Skip to main content
POST
Anthropic Messages

Guide: Anthropic Messages

SDK setup, streaming, thinking, tools, supported betas, limits and errors.

Authorizations

Authorization
string
header
default:<api-key>
required

Bearer authentication header of the form Bearer <api-key>, where <api-key> is your API key.

Headers

anthropic-version
enum<string>

Optional. If sent, must be 2023-06-01.

Available options:
2023-06-01
anthropic-beta
string

Comma-separated beta features. Supported: context-management-2025-06-27, thinking-display-updates-2026-08-18, interleaved-thinking-2025-05-14, fine-grained-tool-streaming-2025-05-14. Any other value is dropped and named in x-gloo-ignored-betas.

Body

application/json

An Anthropic Messages request. Fields are as defined by Anthropic's Messages API. Any other top-level field is dropped and named in x-gloo-ignored-params.

model
string
required

A Claude model: a Gloo model ID such as gloo-anthropic-claude-opus-5.5, or Anthropic's ID such as claude-opus-5-5.

Example:

"gloo-anthropic-claude-opus-5.5"

max_tokens
integer
required

Maximum output tokens, including thinking. Above the model's output limit it is lowered to that limit. Above 21,333 requires stream: true.

Required range: x >= 1
messages
object[]
required

The conversation. Roles are user and assistant. Content is a string or an array of blocks: text, image (base64 or URL source), document (base64, text, content or URL source), search_result, tool_use, tool_result, thinking, redacted_thinking, and server_tool_use / web_search_tool_result when the web search tool is in tools. thinking and redacted_thinking blocks are accepted but not passed to the model; the x-gloo-ignored-params header lists messages.thinking when any were sent.

Minimum array length: 1
system

System prompt: a string or an array of text blocks.

stream
boolean
default:false

Stream the response as Server-Sent Events.

stop_sequences
string[]
temperature
number
top_p
number
top_k
integer
tools
object[]

Your own tools, plus the Anthropic-defined web search (web_search_*), bash (bash_*) and text editor (text_editor_*) tools. Other tool types return 400.

tool_choice
object
thinking
object

Thinking configuration, sent as written, for example {"type": "adaptive", "display": "summarized"}.

output_config
object

Output configuration, sent as written, for example {"effort": "high"}.

cache_control
object

Automatic prompt caching, for example {"type": "ephemeral"}.

context_management
object

Context editing. Requires the context-management-2025-06-27 beta; otherwise dropped.

metadata
object

Only user_id is used, and it is not passed to the model provider as sent.

Response

The model's message. With stream: true, a Server-Sent Events stream of Anthropic's Messages events (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping). A failure after the stream starts ends it with an error event.

An Anthropic message object. model is the model ID you sent.

id
string
type
enum<string>
Available options:
message
role
enum<string>
Available options:
assistant
model
string
content
object[]
stop_reason
string | null
stop_sequence
string | null
usage
object