Structured outputs

Carry one JSON Schema across OpenAI, Anthropic, Google, and Responses protocol routes.

2 min readEdit this page

BitRouter normalizes a JSON Schema request and renders it in the outbound provider protocol. Your client can keep its native request shape even when the selected upstream uses another one.

Request formats

Inbound APISchema field
OpenAI Chat Completionsresponse_format.json_schema
OpenAI Responsestext.format
Anthropic Messagesoutput_config.format
Google Generate ContentgenerationConfig.responseSchema

BitRouter promotes these fields into one canonical response-format constraint, then renders the corresponding outbound field after routing.

Example

curl http://127.0.0.1:4356/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai:gpt-5",
    "messages": [{"role": "user", "content": "Return the issue priority."}],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "issue_priority",
        "strict": true,
        "schema": {
          "type": "object",
          "properties": {
            "priority": {"type": "string", "enum": ["low", "medium", "high"]}
          },
          "required": ["priority"],
          "additionalProperties": false
        }
      }
    }
  }'

The same request may route to a Messages or Generate Content upstream without the caller rewriting the schema field.

Capability-aware routing

A schema request adds the structured_outputs capability requirement. Routes that explicitly advertise their capabilities must include it to remain eligible. The public model registry shows which model/provider pairs declare support.

If the selected outbound protocol cannot represent the response format, BitRouter fails the request instead of silently dropping the schema.

What BitRouter guarantees

BitRouter guarantees that it preserves and translates the constraint across supported wire protocols. The upstream model and provider remain responsible for producing schema-conforming output.

JSON Schema support differs by upstream. Use the subset accepted by every provider in a fallback chain, and test the exact models you deploy. A schema accepted by one provider can still be rejected by another before generation.

Protocol mapping

Canonical fieldChat CompletionsResponsesMessagesGenerate Content
Namejson_schema.nametext.format.nameNot representedNot represented
Descriptionjson_schema.descriptiontext.format.descriptionNot representedNot represented
Strictjson_schema.stricttext.format.strictProvider behaviorProvider behavior
Schemajson_schema.schematext.format.schemaformat.schemaresponseSchema

Fields a destination protocol cannot represent are not invented. Keep portable behavior in the schema itself.

How is this guide?

On this page