Skip to content
OneAPIDocs
ModelsOpen console

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.

POSThttps://api.oneapi.id/v1/messages
Key header
x-api-key or Authorization: Bearer
Also send
anthropic-version: 2023-06-01
Client
anthropic SDK, 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 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.

max_tokensinteger required

Upper bound on generated tokens.

messagesarray required

Alternating user and assistant turns. Content is a string or a list of blocks.

systemstring | array

System prompt, outside the message list.

temperaturenumber

Sampling temperature.

top_pnumber

Nucleus sampling.

stop_sequencesarray

Sequences that end generation.

toolsarray

Tools with name and input_schema. Server tools cannot be converted to other formats.

tool_choiceobject

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 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.

200 OK, shape only
{
  "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 }
}