When you need the model to return JSON that exactly matches a schema, useDocumentation Index
Fetch the complete documentation index at: https://docs.cogito.decart.ai/llms.txt
Use this file to discover all available pages before exploring further.
response_format. Cogito enforces the schema with grammar-constrained decoding — the model literally cannot emit tokens that would break the schema, so you don’t need to ask nicely or add “respond only in JSON” to the system prompt.
JSON schema mode
What “strict” guarantees
Withstrict: true, every property in required is present, every value matches its declared type, and no extra fields are emitted. You can json.loads() without a try/except in production.
json_object mode
For “give me any valid JSON” without a schema:Streaming structured outputs
Both modes work withstream: true. Chunks arrive as token-level deltas and assemble into valid JSON once the stream completes. Don’t JSON.parse partial chunks; only the assembled string is guaranteed valid.
Errors
If the schema is malformed (recursive without a depth limit, mutually exclusive constraints), Cogito returns a 400 withcode: "invalid_response_format" before generation starts. We don’t waste your tokens on impossible schemas.