SDK Setup — OneHub

OneHub is OpenAI-compatible, so any existing client just needs the base URL changed.

Docs Docs Quick Start Authentication SDK Setup Available Models Rate Limits Chat Completions Streaming List Models Embeddings Image Generation Text to Speech Speech to Text Billing & Wallet Webhooks Errors

SDK Setup

Because OneHub speaks the OpenAI wire format, you keep your existing tooling. Only two things change: the baseURL (or baseURL equivalent) and the API key.

OpenAI Node.js SDK

npm install openai
import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://www.onehub.design/v1",
  apiKey: "sk-onehub-xxx",
});

const completion = await openai.chat.completions.create({
  model: "openai/gpt-5-nano",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(completion.choices[0].message.content);

Python (openai package)

pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://www.onehub.design/v1",
    api_key="sk-onehub-xxx",
)

resp = client.chat.completions.create(
    model="openai/gpt-5-nano",
    messages=[{"role": "user", "content": "Hello!"}],
)

print(resp.choices[0].message.content)

Browser (fetch)

const response = await fetch("https://www.onehub.design/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sk-onehub-xxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "openai/gpt-5-nano",
    messages: [{ role: "user", content: "Hello!" }],
  }),
});

const data = await response.json();
console.log(data.choices[0].message.content);

Notes

  • Never hardcode keys in client-side code. Proxy through your own backend for production.
  • Streaming works with the same SDKs — pass stream: true; see Streaming.