API reference
Messages
The Anthropic Messages format. Use it when your code or tool is built on the Anthropic SDK, including for models that are not Claude.
https://api.oneapi.id/v1/messages- Key header
x-api-keyorAuthorization: Bearer- Also send
anthropic-version: 2023-06-01- Client
anthropicSDK, base URL without/v1
Request
curl https://api.oneapi.id/v1/messages \
-H "x-api-key: $ONEAPI_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5.1",
"max_tokens": 1024,
"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.
max_tokensinteger requiredUpper bound on generated tokens.
messagesarray requiredAlternating user and assistant turns. Content is a string or a list of blocks.
systemstring | arraySystem prompt, outside the message list.
temperaturenumberSampling temperature.
top_pnumberNucleus sampling.
stop_sequencesarraySequences that end generation.
toolsarrayTools with name and input_schema. Server tools cannot be converted to other formats.
tool_choiceobjectWhether 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 Anthropic stream events. See Streaming.
Other fields
Any other field in this format, such as thinking, metadata or top_k, 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
A message object. Text arrives as text blocks in content, tool calls as tool_use blocks, and billed tokens in usage.
{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "claude-fable-5.1",
"content": [{ "type": "text", "text": "Hello! How can I help?" }],
"stop_reason": "end_turn",
"usage": { "input_tokens": 14, "output_tokens": 8 }
}