Learning resourcesReviewed · Together AI

Together AI Messages API guide

This guide shows developers how to use Anthropic's SDKs with Together AI models, but compatibility with Anthropic's API is incomplete. It covers setup, streaming, tool calls and reasoning behavior that can exhaust the output allowance before an answer appears.

Researched 15 Nov 2026

In short.

Together AI's Messages API documentation is a migration guide for developers using Anthropic SDKs, with model restrictions and API differences that require explicit handling. It documents message generation, streaming, token counting and application-run tools for four supported models. Hidden reasoning can consume max_tokens and leave an empty answer without an SDK error. Exact prices, model quality and operational performance are not established, and the examples were not executed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected Messages API documentation page at [https://docs.together.ai/docs/inference/messages-api.md], including setup, supported models, endpoints, streaming, reasoning, tools, caching, billing basis, compatibility warnings and errors. Linked pages, including the documentation index, pricing, model listings and alternative API guides, are excluded. Nothing was executed; documented behavior, performance and costs were not independently verified.

The overview

identity

The resource is Together AI's Messages API documentation at [https://docs.together.ai/docs/inference/messages-api.md]. It explains Together's implementation of POST /v1/messages and how to access Together-hosted models through Anthropic's Python and TypeScript SDKs.

The page is a technical integration guide. Its examples use Together credentials and model identifiers; it does not provide access to Claude models through Together.

assessment

The documented feature set makes this a useful reference for developers adapting an existing Anthropic SDK application to Together. Its strongest contribution is the explanation of compatibility differences, including unsupported methods, reasoning limits, caching semantics and error handling.

A simple text application may need changes mainly to credentials, base URL and model. Applications using server tools, structured outputs, documents or Anthropic-specific SDK methods need a closer feature review. The page does not establish equivalent answer quality, reliability or latency across providers.

users

The guide suits developers maintaining Anthropic SDK integrations, engineers building streaming interfaces and teams implementing tool-calling applications. Python, TypeScript and direct HTTP examples give readers several entry points.

Beginners need enough programming knowledge to install a package, configure an environment variable and inspect response fields. Experienced developers will find the most consequential details in token accounting, tool-loop behavior and differences between SDK compatibility and actual feature support.

capabilities

The page documents messages.create, messages.stream and messages.count_tokens. Streaming delivers incremental text, reasoning and tool-input data. Requests can include custom tools, and responses can request multiple tool calls.

Four models are explicitly supported on both serverless and dedicated inference: GLM-5.2 as zai-org/GLM-5.2, GLM-5.3 as zai-org/GLM-5.3, GLM-5.3 Flash as zai-org/GLM-5.3-Flash and DeepSeek V4.1 Flash as deepseek-ai/DeepSeek-V4.1-Flash-1017. Image blocks are supported only by the two Flash models.

Tool selection accepts auto, any, a named tool or none. Setting tool_choice.disable_parallel_tool_use to true limits the model to one tool call per turn. Tool execution remains the application's responsibility.

Using it

requirements

SDK use requires a Together API key and the Anthropic Python package or @anthropic-ai/sdk TypeScript package. Direct HTTP requests are also documented. Requests specify a Together model identifier, max_tokens and message history.

Dedicated inference requires an endpoint string to use as the model value. To use the Messages API with an existing dedicated endpoint or a model that is not yet supported, contact Together sales at [https://www.together.ai/contact-sales]. The page does not state minimum SDK or runtime versions, model context limits or rate-limit values.

mechanism

The SDK sends Anthropic-shaped requests to Together's endpoint. Authentication accepts either x-api-key or Authorization: Bearer; Authorization takes precedence when both are present. Responses retain Anthropic-style message and content-block structures, while response identifiers use Together's format and should be treated as opaque.

Streaming uses server-sent events with Anthropic event names and ends after message_stop, without a [DONE] line. The initial message_start reports the whole prompt, including cached tokens, and zero output tokens. Final usage should be read from message_delta or the SDK helper's final message.

For tools, the model returns tool_use blocks and stop_reason: tool_use. The application executes the requested functions, preserves the assistant response and sends matching tool_result blocks together in a user turn before requesting the next response.

setup

The documented installation commands are pip install anthropic for Python and npm install @anthropic-ai/sdk for TypeScript. Configure the client with TOGETHER_API_KEY and the serverless base URL [https://api.together.ai], then choose a supported Together model string.

For dedicated inference, change the base URL to [https://api-inference.together.ai] and supply the endpoint string as model. This applies to the listed supported models. For an existing dedicated endpoint, contact Together sales at [https://www.together.ai/contact-sales] first to enable Messages API use. The direct HTTP example posts to [https://api.together.ai/v1/messages] with authentication, Content-Type: application/json and anthropic-version: 2023-06-01. That header value is an API version, not a stated SDK version requirement.

example

The introductory example creates an Anthropic client pointed at Together, selects zai-org/GLM-5.3, sets max_tokens to 4096 and sends a user message containing Hello!. It demonstrates request construction and extracting response text; no observed model response is supplied.

The tool example asks for weather in Paris and Tokyo, defines a get_weather function and repeats requests while the response requests tool use. Its temperature is hard-coded to 18 degrees C, so using it for forecasts would require replacing that function with a weather data source. These examples were not executed.

Assessment & evidence

limitations

messages.batches.* is unsupported. models.list is incompatible with Together's model-list response and can raise an SDK error or return an empty list. Other serverless models may accept Messages requests but are unsupported and may produce malformed output. Claude model identifiers return 404.

output_config.format returns 400. PDF document blocks return 400 on every listed model, and image blocks return 400 on GLM-5.2 and GLM-5.3. Requests containing server tools such as web_search, web_fetch or code_execution, or the computer tool, return 400. A web_search tool sent alongside other tools and not forced by tool_choice is removed from the request instead. mcp_servers is ignored.

Most anthropic-beta values enable no additional features. metadata and service_tier do not change the response, and service_tier accepts only auto and standard_only. Gateway failures can use an OpenAI-style error body rather than the usual Anthropic-style body. Overload normally returns 503, which the Python SDK maps to InternalServerError; applications handling overload separately should account for this alongside OverloadedError. Failures after streaming begins arrive as stream error events.

reasoning

thinking.type values enabled and adaptive return reasoning blocks before the answer. Disabled or omitted thinking hides those blocks, but reasoning models can still consume reasoning tokens. The page specifically warns that GLM-5.3 reasons even with thinking disabled and may spend about 1,000 reasoning tokens on a short answer; this is a documentation warning, not a measured result here.

budget_tokens is required with enabled thinking but is not enforced as a separate limit. max_tokens caps reasoning and answer tokens together. Exhausting it can produce an empty text block with stop_reason: max_tokens while the stream ends normally and SDK helpers raise no error. Applications should inspect stop_reason and allow sufficient room for both reasoning and the answer.

output_config.effort is passed to the model's chat template, so its effect depends on the model. Thinking signatures are empty; the page instructs applications to preserve thinking blocks unchanged in multi-turn tool loops. The interleaved-thinking-2025-05-14 beta header permits budget_tokens to exceed max_tokens, without establishing an independent reasoning allowance.

alternatives

For structured outputs, the page points to Together chat completions at [https://docs.together.ai/docs/inference/chat/structured-outputs.md]. For batch processing, it directs readers to [https://docs.together.ai/docs/inference/batch/overview.md]. These are relevant routes when an application needs features absent from the Messages implementation.

The page also links Together's Responses API at [https://docs.together.ai/docs/inference/responses-api.md] and Together Link for coding agents at [https://docs.together.ai/docs/togetherlink.md]. Those linked pages are outside the supplied evidence, so their detailed capabilities, setup and costs were not assessed.

evidence

The evidence consists of the complete Together AI Messages API page at [https://docs.together.ai/docs/inference/messages-api.md]. It includes Python, TypeScript and HTTP examples, supported model and endpoint tables, and explicit descriptions of compatibility differences.

The findings describe documented behavior. No SDK calls, model requests or examples were run. Runtime compatibility, model quality, latency, reliability and actual billing remain unverified. Linked documentation and pricing pages were not included.

Access & freshness

costs

The page states that Messages API requests use the same billing basis as Together chat completions: per token for serverless inference and per GPU-minute for dedicated inference. It links pricing pages but supplies no rates, so exact prices and workload costs are unknown.

Reasoning tokens, including hidden reasoning, count as output tokens. Repeated prompt prefixes are cached automatically, and cache_control has no effect. In usage, input_tokens counts uncached input, cache_read_input_tokens counts cached input and cache_creation_input_tokens is always zero. Cache discounts and actual savings are not established here.

rights

The selected page supplies no redistribution licence for its documentation or code samples and no model-specific licence terms. Its description of hosted models as open source does not establish the permissions or obligations for each model.

Service terms, generated-output rights, data retention, training use and data residency are not established by this page. Those terms need separate confirmation for the intended application.

freshness

The supplied page was captured on 15 November 2026 at 12:32:43.315 UTC. It states no publication or last-updated date and pins no SDK package version.

The supported models, endpoint behavior and restrictions describe that captured text. Subsequent changes and current service availability are unknown.

actions

Before adopting this integration, match the application's required features against the documented restrictions and choose an explicitly supported model. Confirm current prices, model terms and data-handling commitments separately.

In the application's own environment, validate ordinary responses, streaming completion, final usage accounting, tool-result handling and failures. Include a case where reasoning exhausts max_tokens, check stop_reason before using answer text and handle errors by HTTP status where body formats differ. Evaluate answer quality, latency and cost on representative work before relying on the integration.

Evidence for this report

selected-page.txtselected · checked 2026-11-15