Skip to main content
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.
JSON Schema response format for structured outputs

Example Usage

import { ChatFormatJsonSchemaConfig } from "@openrouter/sdk/models";

let value: ChatFormatJsonSchemaConfig = {
  jsonSchema: {
    name: "math_response",
  },
  type: "json_schema",
};

Fields

FieldTypeRequiredDescriptionExample
jsonSchemamodels.ChatJsonSchemaConfig:heavy_check_mark:JSON Schema configuration object{"description": "A mathematical response","name": "math_response","schema": {"properties": {"answer": {"type": "number"}
},
“required”: [
“answer”
],
“type”: “object”
},
“strict”: true<br/>}
type”json_schema”:heavy_check_mark:N/A