Skip to content
OneAPIDocs
ModelsOpen console

API reference

Chat Completions

The OpenAI Chat Completions format. The widest-supported format among existing tools, and the default choice if you are unsure.

POSThttps://api.oneapi.id/v1/chat/completions
Key header
Authorization: Bearer or x-api-key
Streaming
"stream": true, OpenAI chunks
Client
openai SDK, chat.completions

Request

curl https://api.oneapi.id/v1/chat/completions \
  -H "Authorization: Bearer $ONEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5.1",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

Body fields

These fields work with every model, whatever format its provider speaks.

modelstring required

A model ID from Models. Append :online, as in deepseek-v4.1-flash:online, to let the model search the web; see Web search.

messagesarray required

The conversation, oldest first. Roles system, user, assistant and tool.

max_tokensinteger

Upper bound on generated tokens. Send this or max_completion_tokens, not both.

max_completion_tokensinteger

Same limit under its newer name.

temperaturenumber

Sampling temperature.

top_pnumber

Nucleus sampling.

stopstring | array

Sequences that end generation.

toolsarray

Function tools the model may call. Each needs a name and a JSON Schema for its arguments.

tool_choicestring | object

Whether and which tool the model must call.

pluginsarray

OneAPI extension. [{"id": "web"}] turns on web search like :online, with an optional max_results (1–10) per search. Only web is supported. See Web search.

streamboolean

Send Server-Sent Events instead of one JSON body. See Streaming.

stream_optionsobject

Accepted and set by the gateway: the final chunk always carries usage.

reasoning_effortstring

For reasoning models. Refused with unsupported_parameter on models where it cannot be converted.

Other fields

Any other field in this format, such as response_format, logprobs, n or seed, is passed to the provider unchanged when the model is served in this same format. When the gateway has to convert the request for another format, it refuses the field with 400 unsupported_parameter and names it in the message, rather than dropping it.

If you get that error, remove the field or choose another model. The full list of codes is in Errors.

Response

The standard Chat Completions object. The reply is in choices[0].message.content, tool calls in choices[0].message.tool_calls, and the tokens you are billed for in usage.

200 OK, shape only
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "claude-fable-5.1",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello! How can I help?" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 14, "completion_tokens": 8, "total_tokens": 22 }
}