Structured Outputs

Ask compatible models to return JSON or schema-constrained output.

Supported patterns

ParameterTypeRequiredDescription
response_formatChatoptionalUse JSON object or JSON schema formats on compatible OpenAI-style models.
text.formatResponsesoptionalUse Responses text format controls for compatible models.
output_configClaudeoptionalUse Claude-compatible output controls only when the upstream supports them.
responseMimeType / responseSchemaGeminioptionalUse Gemini native schema controls for Gemini-compatible models.

JSON schema example

Pass a json_schema in response_format to force the reply to match your shape. Set strict: true so the model adheres exactly to the schema.

{
  "model": "openai/gpt-5.2",
  "messages": [{"role": "user", "content": "Extract the user: Jane, 31, Berlin"}],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "user",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "name": {"type": "string"},
          "age": {"type": "integer"},
          "city": {"type": "string"}
        },
        "required": ["name", "age", "city"],
        "additionalProperties": false
      }
    }
  }
}

Model-dependent features

OneRouter keeps protocol compatibility and forwards model-specific parameters where supported. Features such as tool calling, structured output, reasoning, prompt caching, web search, image input, audio input, video generation, and provider-specific options depend on the selected model and upstream provider. Check the model detail page before relying on a feature in production.