Standard chat models return plain text, which is hard to parse if your app needs to read specific fields from the response. Supported models can return JSON that conforms to any schema you supply, so you can read the output directly in code without retries or fragile parsing. Pass the schema in theDocumentation Index
Fetch the complete documentation index at: https://docs.together.ai/llms.txt
Use this file to discover all available pages before exploring further.
response_format key on the chat completions request.
Supported models
For the current list of models that support structured outputs, see the serverless and dedicated endpoint model catalogs.Basic example
Pass a transcript of a voice note to a model and ask it to return a summary in this shape:JSON
response_format key:
JSON
Prompt the model
Always tell the model to respond only in JSON and include a plain-text copy of the schema in the prompt (as a system prompt or a user message). Send this instruction in addition to passing the schema via theresponse_format parameter.
The combination of an explicit “respond in JSON” direction, the schema text in the prompt, and the response_format setting produces consistent, valid JSON every time.
Regex example
Every model that supports JSON mode also supports regex mode. The example below uses regex to constrain a sentiment classification to one of three labels.Structured outputs work with reasoning models too. See Structured outputs with reasoning models on the reasoning page.You can also combine structured outputs with vision models to extract typed data from images. See Structured extraction with vision models on the vision page.
Troubleshooting
If your generated JSON gets cut off, contains stray characters, or fails to parse, the cause is usually one of two things. Token limits: The model can run out of output budget mid-structure. Check themax_tokens you’re sending against the model’s ceiling, and watch for a finish_reason of length in the response. If the model truncates, the JSON is incomplete (unterminated strings, missing closing brackets) regardless of how good your schema is. Either raise max_tokens or simplify the schema.
Malformed example JSON: If your prompt includes an example JSON object, the model follows the example exactly, syntax errors and all. Validate any JSON you embed in prompts before using it. Common symptoms of a bad example: unterminated strings, repeated newlines, repeated keys, or output that stops abruptly with finish_reason: stop.