Chat Completions — OneHub

OpenAI-compatible chat completions. Supports both streaming and non-streaming responses.

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

Chat Completions

POST https://www.onehub.design/v1/chat/completions

Request body

FieldTypeRequiredDescription
modelstringYesModel identifier, e.g. openai/gpt-5-nano
messagesarrayYesArray of message objects with role and content
streambooleanNoSet to true for SSE streaming. Default: false
temperaturenumberNoSampling temperature (0–2). Default: 1
max_tokensnumberNoMaximum tokens to generate. Default: 4096
top_pnumberNoNucleus sampling parameter. Default: 1
stopstring / arrayNoStop sequences (up to 4)
frequency_penaltynumberNoPenalty for repetition (−2 to 2). Default: 0
presence_penaltynumberNoPenalty for new topics (−2 to 2). Default: 0
reasoning_effortstringNoFor OpenAI reasoning models: low, medium, high
toolsarrayNoFunction tools for tool calling
response_formatobjectNo{"type": "json_object"} for JSON mode

Example

curl https://www.onehub.design/v1/chat/completions \
  -H "Authorization: Bearer sk-onehub-xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain quantum computing."}
    ],
    "temperature": 0.7,
    "max_tokens": 500
  }'

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1730000000,
  "model": "anthropic/claude-sonnet-5",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Quantum computing uses qubits..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 18, "completion_tokens": 120, "total_tokens": 138 }
}

Tool calling

OneHub passes through OpenAI-compatible tool definitions, so function calling works with any model that supports it:

{
  "model": "openai/gpt-5",
  "messages": [{ "role": "user", "content": "What is the weather in Paris?" }],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "parameters": { "type": "object", "properties": { "location": { "type": "string" } } }
    }
  }],
  "tool_choice": "auto"
}

Streaming support and formats are covered in Streaming.