API reference
Chat Completions
The OpenAI Chat Completions format. The widest-supported format among existing tools, and the default choice if you are unsure.
https://api.oneapi.id/v1/chat/completions- Key header
Authorization: Bearerorx-api-key- Streaming
"stream": true, OpenAI chunks- Client
openaiSDK,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 requiredA model ID from Models. Append :online, as in deepseek-v4.1-flash:online, to let the model search the web; see Web search.
messagesarray requiredThe conversation, oldest first. Roles system, user, assistant and tool.
max_tokensintegerUpper bound on generated tokens. Send this or max_completion_tokens, not both.
max_completion_tokensintegerSame limit under its newer name.
temperaturenumberSampling temperature.
top_pnumberNucleus sampling.
stopstring | arraySequences that end generation.
toolsarrayFunction tools the model may call. Each needs a name and a JSON Schema for its arguments.
tool_choicestring | objectWhether and which tool the model must call.
pluginsarrayOneAPI 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.
streambooleanSend Server-Sent Events instead of one JSON body. See Streaming.
stream_optionsobjectAccepted and set by the gateway: the final chunk always carries usage.
reasoning_effortstringFor 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.
{
"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 }
}