Skip to main content
Anthropic Messages is a direct endpoint that speaks Anthropic’s own Messages API, for Claude models. Point an official Anthropic SDK, Claude Code or the Claude Agent SDK at Gloo, use your Gloo API key, and your existing Claude code keeps working: the same request body, the same response and streaming events, and the same error types your SDK already handles. Direct endpoints bill the model’s published rate (see the Models page and GET /platform/v2/models). As on the other direct endpoints, nothing here applies guardrails, output moderation, values-alignment (tradition) or routing. Your request goes to the Claude model you name.

When to use it

Anthropic Messages serves Claude models only. For other providers’ models, use Direct Responses or Direct Completions, which also serve Claude.

Set up the SDK

Base URL: https://platform.ai.gloo.com/ai/v2/direct/anthropic The SDK adds /v1/messages to the base URL. Pass your Gloo API key as the SDK’s auth token, which sends it as Authorization: Bearer <key>. Get a key from the API Keys page in Gloo AI Studio.
Use auth_token (authToken in TypeScript). It sends your key as Authorization: Bearer, which is where this endpoint reads it, in every SDK version. SDK versions before Python 2.0 and TypeScript 1.0 send api_key as an x-api-key header instead, which returns 401. You can also set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in the environment and construct the client with no arguments. Either way, leave ANTHROPIC_API_KEY unset: the SDK reads it from the environment and sends it too, as x-api-key.

Claude Code and the Claude Agent SDK

Claude Code and the Claude Agent SDK read the same environment variables. Set them before you start a session and name models by Anthropic’s model IDs:
ANTHROPIC_MODEL sets the model for your session; claude-sonnet-5 and claude-haiku-4-5 work too. ANTHROPIC_DEFAULT_HAIKU_MODEL sets the model Claude Code uses for quick background tasks.

Send a message

The response is an Anthropic message object. Its model field is the model ID you sent, and usage reports input, output and cache tokens as Anthropic defines them. anthropic-version is optional. If you send it, it must be 2023-06-01 (the version the SDKs send) or 2026-10-21. With 2026-10-21, Claude doesn’t accept temperature, top_p or top_k; see What the request can include.

Models

Name a Claude model by its Gloo model ID or by Anthropic’s own model ID. Both of these call Claude Opus 5.5:
  • gloo-anthropic-claude-opus-5.5
  • claude-opus-5-5
Other current choices are Claude Sonnet 5.5 (gloo-anthropic-claude-sonnet-5.5) and Claude Haiku 5.5 (gloo-anthropic-claude-haiku-5.5). See Supported Models for every Claude model and its rates.
  • Claude only. A model from another provider returns 404 with model_not_available. Use Direct Responses for those models.
  • Retired models return an error instead of a replacement. On this endpoint, a retired Claude model ID returns 404 with model_retired, and the message names the model to use instead. Your thinking and effort settings were written for the model you named, so Gloo does not move them to another model for you. (Other direct endpoints serve the replacement; see Model Lifecycle.)

Streaming

Set stream: true, or use the SDK’s streaming helpers. Events are Anthropic’s own (message_start, content_block_delta, message_stop and the rest), passed through as Claude sends them.
  • Errors before the stream starts are real HTTP errors. Nothing is sent until Claude’s first event arrives, so a request that fails before then gets an HTTP status (429, 529 and so on) that your SDK can retry, never an error inside a 200.
  • Errors after the stream starts end the stream with an event: error, as on Anthropic’s API.
  • Use streaming for long outputs. A non-streaming request with max_tokens above 21,333 returns 400, the same limit the SDKs apply. Long non-streaming requests can also time out with 504.

Thinking

Thinking is Claude reasoning through a problem before it answers. Claude returns it as thinking blocks before the text block. On this endpoint you control it with Anthropic’s own parameters, thinking and output_config.effort, which Gloo sends to Claude as you write them.
Thinking is not the same setting as reasoning. The Responses and Chat Completions endpoints use Gloo’s provider-neutral reasoning settings, reasoning_effort and the reasoning object, which work across model families and have their own defaults. Those aren’t read here: a reasoning_effort field is listed in the x-gloo-ignored-params response header. Use thinking and output_config.effort on this endpoint.

Parameters

Defaults, and how to change them

“Thinks adaptively” means Claude decides how much each request needs. You don’t see that thinking unless you set display: "summarized", but it’s billed as output tokens. For other Claude models, see Anthropic’s documentation. Claude Fable models aren’t available on this endpoint: call them with Direct Responses or Direct Completions.

See Claude’s thinking

Set display: "summarized" to get the thinking back, and output_config.effort to set how much Claude puts in:
Claude can decide that a request needs no thinking. The response then has no thinking block, only the answer.

Turn thinking off, or on

Good to know

  • Thinking is billed as output tokens. It counts in usage.output_tokens and toward max_tokens, whether or not you see it. If you ask for more than the model’s output limit, Gloo lowers max_tokens to that limit and names the value it used in the x-gloo-adjusted-params response header, for example max_tokens=128000.
  • Progress notes between tool calls. With the thinking-display-updates-2026-08-18 beta, display: "updates" returns short progress notes between tool calls instead of a summary.
  • Multi-turn. You can send the assistant’s turns back as the SDK returns them, thinking blocks included. Gloo doesn’t pass earlier thinking or redacted_thinking blocks to the model; each new turn starts its own thinking, and tool loops continue as normal. The x-gloo-ignored-params response header lists messages.thinking when this happens.

Tool use

Define your own tools in tools, exactly as in Anthropic’s API, and send results back in tool_result blocks. tool_choice is passed through. These Anthropic-defined tools are also supported:
Other Anthropic-defined tools, such as web fetch, code execution, computer use and the memory tool, return 400 with tool_not_supported.

Prompt caching

cache_control works as on Anthropic’s API: set it at the top level to cache automatically, or on individual blocks for fine-grained control. Check usage.cache_creation_input_tokens and usage.cache_read_input_tokens to confirm cache hits. See Prompt Caching for how cached tokens are billed, and Prompt caching in the Learning Center for how it works.

What the request can include

Body fields: model, messages, system, max_tokens, stop_sequences, stream, temperature, top_p, top_k, tools, tool_choice, thinking, output_config, cache_control, metadata, and context_management with the context-management-2025-06-27 beta. Gloo passes temperature, top_p and top_k to Claude as you send them. Claude accepts them only with anthropic-version: 2023-06-01 (or no version header), and only on models that still take them, such as Claude Sonnet 4.6, Haiku 4.5 and Opus 4.5 and 4.6. Otherwise Claude returns 400: with 2026-10-21 on every model, and with 2023-06-01 on Claude 5 models and Claude Opus 4.7 and 4.8. Any other top-level field is dropped and named in the x-gloo-ignored-params response header; the request still runs.
  • Content blocks: text, images (base64 or URL), documents (base64, plain text, custom content or URL), search results, tool use and tool results, thinking blocks, and web search blocks when the request includes the web search tool. File ID sources are not supported.
  • Messages take the user and assistant roles. Put instructions in the top-level system field. A message with the system role is passed to Claude as you sent it, and Claude returns 400 where it doesn’t accept one, such as at the start of the conversation.
  • metadata: only user_id is used, and Gloo does not pass your value to the model provider as you sent it.
A block, source or tool type outside these lists returns 400 naming what was refused.

Beta features

Send betas in the anthropic-beta header, or with the SDK’s betas option on client.beta.messages. These are supported: Any other beta is dropped and named in the x-gloo-ignored-betas response header. A request that needs a dropped beta fails with 400.

Not available on this endpoint

Only POST /v1/messages is served. Token counting (/v1/messages/count_tokens) and the models list (/v1/models) return 404 with endpoint_not_available; use GET /platform/v2/models for the model catalog. Message Batches and the Files API are not available.

Limits

  • Request size: up to 10 MB per request. A larger body is refused, usually with 413.
  • Concurrent requests: each organization can have a limited number of Messages requests in flight at once. Past that, you get 429 with rate_limit_error and retry-after: 1. The SDKs retry it for you.
  • Output length: max_tokens above the model’s output limit is lowered to that limit (see Thinking), except on non-streaming requests: there, max_tokens above 21,333 returns 400 rather than being lowered (see Streaming).

Errors

Errors use Anthropic’s error shape, so the SDK raises its usual exception classes (RateLimitError, InternalServerError and so on) and applies its usual retry rules:
error.message is safe to show your users. error.details.code is the value to branch on, and details.developer_message, when present, tells you what to change. The request-id header carries the same request_id; include it when you contact support. ”—” means the error is returned before the request reaches this endpoint, with a short body such as {"error": "The API key is not valid."} (plain text for 413) instead of the shape above. The SDK still raises the class for the status, such as AuthenticationError or PermissionDeniedError. The other statuses mean what they mean across the platform, with Anthropic’s error.type: 402 billing_error (no credit left; add credit in Billing), 403 permission_error or no error.type (the key is not valid, or its organization can’t make this request), and 500 api_error (retry with backoff). See Errors for authentication, payment, rate limiting and server errors, and Error Handling and Retries for retry budgets. Requests on this endpoint are served by Anthropic only, with no failover to another provider, so retry a 529 rather than treating it as final.

Pricing

You pay the Claude model’s published rate for input, output and cache tokens, the same as the other direct endpoints. Web searches are billed per search. See Supported Models for rates.

Next steps

Step-by-step tutorial

Call Claude through Gloo with the Anthropic SDK, step by step.

Endpoint Types

Direct, guarded and grounded endpoints compared.

Direct Responses

One request shape for every model in the catalog.

API Reference

Request and response fields for Anthropic Messages.