Create a message (Anthropic-compatible)
Send a message to a language model using the Anthropic Messages API format. This endpoint is compatible with the Anthropic Messages API and may be used with the Anthropic JS or Python SDK by setting the base URL to https://api.telnyx.com/v2/ai/anthropic.
The endpoint translates Anthropic-format requests into Telnyx’s inference internals, then translates the response back to the Anthropic message shape. Streaming responses use Anthropic SSE event types (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop).
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Anthropic Messages-compatible request with Telnyx extensions.
The model to use for generating the response, for example zai-org/GLM-5.2 or another model available from the Telnyx models endpoint.
The messages to send to the model, following the Anthropic Messages API format.
The maximum number of tokens to generate in the response.
System prompt. Can be a string or an array of content blocks following the Anthropic API format.
Whether to stream the response as Anthropic-format Server-Sent Events.
Amount of randomness injected into the response. Ranges from 0 to 1.
Nucleus sampling parameter. Use temperature or top_p, but not both.
Top-k sampling parameter. Only sample from the top K options for each subsequent token.
Custom sequences that will cause the model to stop generating.
An object describing metadata about the request.
Definitions of tools that the model may use, following the Anthropic API format.
Controls how the model uses tools, following the Anthropic API format.
Extended thinking configuration for models that support it. Set type to enabled to turn on extended thinking.
If you are using an external inference provider, this field allows you to pass along a reference to your API key. After creating an integration secret for your API key, pass the secret's identifier in this field.
List of MCP (Model Context Protocol) servers to make available to the model.
Configuration for model fallback behavior when the primary model is unavailable.
The billing group ID to associate with this request.
Request timeout in seconds.
Maximum number of retries for the request.
Service tier for the request.
Response
Successful Response
An Anthropic-format message response with type: "message", role, content, stop_reason, stop_sequence, and usage. When stream is true, the response is a text/event-stream of Anthropic SSE events.