POST /v1/responses. If your app is built on the Responses API, change the API key, base URL, and model to run it on open-source models hosted by Together. Together doesn’t support stored responses, so send the full conversation with each request.
Set up the client
Install the OpenAI SDK for your language:api_key to your Together API key and base_url to https://api.together.ai/v1, then create a response:
output array starts with a reasoning item, followed by a message item with the answer. The SDKs’ output_text helper returns the answer text. With cURL, read it from the message item’s content[0].text.
input accepts a string or a list of items. For a system prompt, pass instructions or include a system or developer message in the input list.
Supported models
Supported models differ between serverless inference and dedicated model inference:
Other serverless models can accept Responses API requests, but they aren’t supported and may return malformed output.
To send requests to dedicated model inference, set the base URL to
https://api-inference.together.ai/v1 and pass your endpoint string as model.
To use the Responses API with an existing dedicated endpoint or a model that isn’t supported yet, contact sales.
Endpoint support
Stream responses
Setstream to true to receive server-sent events as the model generates them:
response.created and response.in_progress, and ends with response.completed. In between, each output item arrives as response.output_item.added, then its deltas, then response.output_item.done. The delta events depend on the item type:
- Reasoning:
response.reasoning_text.deltaandresponse.reasoning_text.done. - Answer text:
response.content_part.added,response.output_text.delta,response.output_text.done, andresponse.content_part.done. - Function calls:
response.function_call_arguments.deltaandresponse.function_call_arguments.done.
Build multi-turn conversations
Together doesn’t support stored responses, soprevious_response_id and the Conversations API aren’t available. To continue a conversation, append the previous response’s output items to your input, add the next user message, and send the full list:
Call functions
Define each function withtype: "function", a name, a description, and JSON Schema parameters. When the model calls a function, the response has a function_call item with the function name, a JSON-encoded arguments string, and a call_id.
To return the results, append the response’s output items to your input, add a function_call_output item with the matching call_id for each call, and send the full list back:
tool_choice accepts auto, required, none, and a named function ({"type": "function", "name": "get_weather"}). Set parallel_tool_calls to false to get at most one call per turn.
Together doesn’t run tools itself, so your app runs every tool the model calls. Use function tools, custom tools, or the shell, local_shell, and apply_patch tools. Hosted tools (such as file_search, code_interpreter, image_generation, and computer_use_preview) and remote MCP servers return a 400. Together removes a web_search tool from the request, but forcing one with tool_choice returns a 400.
Control reasoning
Setreasoning.effort to none, minimal, low, medium, high, or xhigh:
- Effort levels: Together passes the level to the model’s chat template, so its effect depends on the model. GLM-5.3 reasons at every level, including
none. On GLM-5.2,minimalturns reasoning off,lowandmediumrequest maximum effort, andhighrequests high effort. - Reasoning text: Each
reasoningitem carries the full reasoning text incontent, asreasoning_textparts. reasoning.summary: Together doesn’t generate summaries, sosummaryis always empty.encrypted_content: If you requestinclude: ["reasoning.encrypted_content"],encrypted_contentholds a base64-encoded copy of the reasoning text. It isn’t encrypted.
Get structured outputs
To constrain the answer to a JSON schema, pass the schema intext.format:
Token usage and billing
The response’susage object reports input_tokens, output_tokens, and total_tokens. input_tokens_details.cached_tokens counts the prompt tokens served from Together’s automatic prefix cache. output_tokens_details.reasoning_tokens counts reasoning tokens, which are included in output_tokens.
Together bills Responses API requests the same way as chat completions: per token at each model’s serverless prices, or per GPU-minute on dedicated model inference.
Other differences from OpenAI’s API
store: Together doesn’t store responses, so the response reportsstore: falseeven when you set it totrue.previous_response_idandconversation: Both return a400. Send the full history instead.background: Setting it totruereturns a400.- Images and files: GLM-5.3 and GLM-5.2 don’t accept images, so an
input_imagepart returns a400. The exception is aninput_imagepart that references only afile_id, which Together drops without an error. Aninput_filepart also returns a400.
Errors
Errors use the same JSON format as OpenAI’s API, and the OpenAI SDKs raise their usual exception class for each HTTP status code. For example,responses.retrieve returns a 404 with this body:
type and code values don’t always match OpenAI’s, so branch on the HTTP status code, not on type or code. For the causes and fixes of each status code, see Error codes.
Next steps
Messages API
Call Together models with the Anthropic Messages API.
Together Link
Run Codex and other coding agents on Together models.