The full OpenAPI spec is available at openapi.yaml.
api.openai.com), you can point it at models hosted on Together with two changes: the API key and base URL.
This page is a configuration reference for the Together AI OpenAI compatibility layer. For end-to-end examples of each capability, follow the links to the dedicated capability pages.
Drop-in client setup
To point an OpenAI client at Together, setapi_key to your Together API key and base_url to https://api.together.ai/v1. The examples read the key from the TOGETHER_API_KEY environment variable:
model to any Together model ID. Together model IDs follow the <provider>/<model_name> convention rather than OpenAI’s flat namespace.
Geo-specific inference
To keep inference processing in the United States, set the base URL tohttps://us-api.together.ai/v1. The US endpoint supports select models and charges 1.25× standard serverless rates for input, cached input, and output tokens. See geo-specific inference for supported models and pricing.
Endpoint compatibility matrix
The following OpenAI SDK methods route to Together-native endpoints when the base URL is set tohttps://api.together.ai/v1.
Together-native endpoints not exposed by the OpenAI SDKs (call them with
requests, fetch, or the Together SDK):
- Video generation.
- Image edits and inpainting beyond
images.generate. - Reasoning controls and
reasoning_content. - Logprobs surface.
Drop-in compatibility
These capabilities work without code changes beyond the API key and base URL. Each row maps a Together capability to the OpenAI SDK method that drives it.
Video generation is Together-native and isn’t exposed through the OpenAI SDK.
Known incompatibilities
Model identifiers
Together model IDs are namespaced (openai/gpt-oss-120b, meta-models/Muse-Glimmer-30B, black-forest-labs/FLUX.2-dev). OpenAI model strings like gpt-4o or text-embedding-3-large return a 404. Browse the full list at Available models.
Endpoints not implemented
- Assistants, Threads, and Runs are not implemented. Build the agent loop yourself with function calling.
- The OpenAI-shaped Batch API and Files API are not exposed through
/v1. Together has its own batch API and files API. moderations.createis not implemented and returns a 404. No moderation models are available, so prompt a chat model to classify content instead.
Parameter quirks
logprobsreturns Together’s own shape, which is richer than OpenAI’s.seedis best-effort. Determinism is not guaranteed across replicas, model versions, or load conditions.n(multiple completions per request) is supported on most chat models but not on every model. Loop client-side if a model rejects it.logit_biasis not supported on most models.service_tier,store,metadata, andpredictionare accepted but ignored.reasoning_effortworks on GPT-OSS models ("low","medium","high"). Other reasoning controls (Together’sreasoning={"enabled": ...}toggle,chat_template_kwargs) are not part of OpenAI’s API surface.- Vision models accept
image_urlwith both remote URLs and base64 data URIs. Thedetailfield is accepted but ignored.
Response shape differences
-
usagealways includesprompt_tokens,completion_tokens, andtotal_tokens. Extra token counts vary in location by model, so read both shapes defensively:- Reasoning models (for example
zai-org/GLM-5.2,deepseek-ai/DeepSeek-V4-Pro-0813,Qwen/Qwen3.6-Plus) nest them OpenAI-style: cached prompt tokens underusage.prompt_tokens_details.cached_tokensand reasoning tokens underusage.completion_tokens_details.reasoning_tokens. - Some non-reasoning models return
cached_tokensflat at the top level ofusage, with no*_detailsobjects.
0for all others (with no error message). Fall back across both locations, for example(usage.prompt_tokens_details or {}).get("cached_tokens") or usage.get("cached_tokens", 0). - Reasoning models (for example
-
Reasoning models return the chain of thought in a
reasoningorreasoning_contentfield on the assistant message (not OpenAI’s nestedreasoningobject). The field name depends on the model. Pass it back under the same key when you send a prior turn to the API for preserved thinking or multi-turn tool calling. -
idandsystem_fingerprintare present but use Together’s formats. Don’t parse them as OpenAI IDs. -
images.generatereturnsurlorb64_jsonper theresponse_formatparam, matching OpenAI. Some image models also return Together-specific metadata fields (for exampleseed).
Errors
Together returns OpenAI-shaped error objects ({ "error": { "message", "type", "code" } }), but type and code values are Together’s. Match on HTTP status (400, 401, 404, 429, 500, 503) for portable handling.