Skip to main content
Anthropic Messages is a direct endpoint that speaks Anthropic’s own Messages API. Point an official Anthropic 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 add no platform fee. You pay the model’s published rate (see the Models page and GET /platform/v2/models). Like 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. To call models from other providers with the same code, 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), not api_key. The SDKs send api_key as an x-api-key header, and this endpoint reads your Gloo key from Authorization: Bearer. You can also set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in the environment and construct the client with no arguments.

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.

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 and effort

thinking and output_config are sent to Claude as you write them, so you control reasoning exactly as you would on Anthropic’s API.
  • Adaptive thinking. Claude 5 models, such as Opus 5.5 and Sonnet 5.5, think adaptively. Set the depth with output_config.effort (low, medium, high, xhigh or max).
  • Showing the reasoning. On current Claude models, thinking blocks come back with empty text unless you set display: "summarized", which returns a readable summary of the reasoning. With the thinking-display-updates-2026-08-18 beta, display: "updates" returns short progress notes between tool calls instead.
  • 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 reasoning, and tool loops continue as normal. The x-gloo-ignored-params response header lists messages.thinking when this happens.
  • max_tokens covers thinking. Thinking tokens count toward max_tokens. 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.
See Anthropic’s documentation for which thinking settings each Claude model accepts.

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

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. 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; messages with the system role return 400.
  • 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. If the request needed that beta, Claude rejects it and you get 400 with beta_not_forwarded.

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 32 MB per request. A larger body returns 413 with request_too_large.
  • 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 and effort), 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. 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, with no platform fee, the same as the other direct endpoints. Web searches are billed per search. See Supported Models for rates.

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.