POST /v2/ai/anthropic/v1/messages. It accepts the same request body as the
Anthropic Messages API and returns
the same response shape — including streaming via Anthropic SSE event types
(message_start, content_block_start, content_block_delta, content_block_stop,
message_delta, message_stop).
Authentication
The Anthropic SDK sends requests with anx-api-key header by default. Telnyx
uses Authorization: Bearer <TELNYX_API_KEY> instead. Pass the Telnyx key as a
default_headers override and set the SDK’s own api_key to any placeholder
value — the gateway ignores it.
The Anthropic SDK requires
api_key to be set to a non-empty string, even
when you override auth via default_headers. Use any placeholder — the
Telnyx gateway only reads the Authorization: Bearer header.Quickstart
Python
JavaScript / TypeScript
curl
Streaming
The endpoint streams Anthropic-format Server-Sent Events. Use the SDK’s built-in streaming just as you would with the native Anthropic API:Tool Calling
Tool definitions and tool results follow the Anthropic tool use format:Extended Thinking
For models that support extended thinking (e.g. Claude reasoning models), pass thethinking parameter. On older SDK versions that reject unknown kwargs, use
extra_body to forward it into the request JSON:
System Prompts
Thesystem parameter can be a plain string or an array of content blocks,
matching the Anthropic API format:
Models
Anthropic models are available under theanthropic/ prefix. See
Available Models for the full list. Open-source models
hosted on Telnyx (e.g. zai-org/GLM-5.2, moonshotai/Kimi-K2.6) also work
through this endpoint — the request is translated to the OpenAI-compatible
format internally and the response is translated back to the Anthropic shape.
Telnyx Extensions
The endpoint accepts several Telnyx-specific fields alongside the standard Anthropic request body:
These fields pass through as extra body parameters in the SDK: