Messages
Sends a conversation to any chat model in Anthropic's Messages format, whatever format its host speaks.
Point an Anthropic SDK at https://api.runmoth.si without /v1, since the SDK adds it, and send your key as its API key.
Body
modelrequiredA chat model ID from the catalog.
max_tokensrequiredThe longest reply, in tokens, held in full until the call settles. The models that reason first, grok-4.7, deepseek-v4.1-flash and kimi-k3, hold and may bill up to 2,048 output tokens even when this is smaller, though the reply you see stops here.
messagesrequiredThe conversation, with roles user and assistant. Content can be text, images, tool calls and their results, and thinking blocks.
systemstring or arrayThe system prompt.
toolsarrayCustom tools, or the web search tool on models that have it. A model whose capabilities.tools is false refuses a request with tools.
tool_choiceobjectauto, any, none or a named tool. A model whose capabilities.forced_tool_choice is false refuses any and a named tool with 400, so send auto to it.
stop_sequencesarrayText that ends the reply. The GPT, Grok, DeepSeek and Kimi models refuse it.
temperaturenumberFrom 0 to 1, sent where capabilities.sampling_params is true and dropped without an error elsewhere.
top_pnumberFrom 0 to 1, sent where temperature is.
top_kintegerSent only to Claude models whose capabilities.sampling_params is true, and dropped elsewhere.
streambooleanSends the reply as it is written. Chat and streaming shows how to read it.
thinkingobjectSent to Claude models and dropped elsewhere.
A stream in this format reports no charge, so read that call's cost in activity. On models other than Claude, message_start reports 0 input tokens and the real count arrives in the last message_delta.
Errors
400invalid_request_errorThe body isn't valid, holds a document or another block type the API doesn't take, or is longer than the model's context401authentication_errorThe key is missing, revoked or expired402insufficient_creditThe balance or the key's cap can't cover the call's hold403permission_errorThe key may not use this model404not_found_errorThe model isn't a chat model in the catalog429rate_limit_errorToo many calls from the key or the account, or to the model, so wait for retry-after when it is sent529overloaded_errorThe model is paused, or busy or down at its host, so choose another or wait for retry-after when it is sent