Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,23 @@ custom stops cannot be combined with output constraints.
For conversational JSON output, the schema and a JSON-only formatting instruction
are included in the system prompt as well as enforced by token masks.

JSON Schema output constraints (`response_format` with `type: "json_schema"` on
Chat Completions and Completions, `text.format` on Responses, and
`output_config.format` on Messages) validate every schema node against a closed
keyword allowlist before grammar compilation. Accepted structural and constraint
keywords are `$ref` (same-document `#` references only), `$defs`, `definitions`,
`type`, `const`, `enum`, `anyOf`, `oneOf`, `allOf`, `properties`,
`patternProperties`, `additionalProperties`, `required`, `minProperties`,
`maxProperties`, `items`, `prefixItems`, `additionalItems`, `minItems`,
`maxItems`, `minLength`, `maxLength`, `pattern`, `format`, `minimum`, `maximum`,
`exclusiveMinimum`, `exclusiveMaximum`, and `multipleOf`. Accepted metadata and
annotation keywords are `$anchor`, `$schema`, `$id`, `id`, `$comment`, `title`,
`description`, `default`, `readOnly`, `writeOnly`, `examples`,
`contentMediaType`, and `contentEncoding`. Any other keyword (such as
`deprecated`, `nullable`, `uniqueItems`, or compiler extensions like
`x-guidance`), external `$ref` targets, and schemas exceeding 262,144 bytes,
depth 64, or 8,192 nodes return HTTP 400.

String stops (`stop`, or `stop_sequences` on Messages) accept at most four
nonempty strings totaling at most 4096 UTF-8 bytes. Token stops
(`stop_token_ids` and `stop_token_sequences`) accept at most sixteen nonempty
Expand Down