v53

latestOpenAPI 3.1.0Apache-2.0raw.githubusercontent.com2026-08-021596144.5 KB
Messages

Create a message

Creates a message using the Anthropic-compatible Messages API. The request follows the Anthropic Messages API format with model, max_tokens, messages, optional system, tools, and streaming support.

Not every provider implements the Messages API. Requests routed to a provider that does not support it return 400 Bad Request with an explanatory error message; use /chat/completions for those providers.

post/messages

Query parameters

provider'ollama' | 'ollama_cloud' | 'groq' | 'llamacpp' | 'openai' | 'cloudflare' | 'cohere' | 'anthropic' | 'deepseek' | 'google' | 'mistral' | 'minimax' | 'moonshot' | 'nvidia' | 'zai'

Specific provider to use (default determined by model)

Request body

modelstring required

The model to use for generating the message.

max_tokensinteger required

The maximum number of tokens to generate before stopping.

streamboolean

Whether to stream the response using server-sent events.

temperaturenumber float

Amount of randomness injected into the response. Ranges from 0.0 to 1.0. Use closer to 0 for analytical / multiple choice, closer to 1 for creative and generative tasks.

top_pnumber float

Use nucleus sampling. Only consider the tokens with top_p probability mass.

top_kinteger

Only sample from the top K options for each subsequent token.

stop_sequencesstring[]

Custom text sequences that will cause the model to stop generating.

Response

Successful response

idstring required

Unique identifier for this message.

type'message' required

Always message.

role'assistant' required

Always assistant.

modelstring required

The model used to generate the message.

stop_reason'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal' required

The reason the model stopped generating.

stop_sequencestring nullable

The stop sequence that caused the model to stop, if any.