Structured output options across providers and local servers
Answer: Each of these takes a JSON schema in a different field.
| API or server | Schema field | |---|---| | OpenAI Structured Outputs | response_format with strict: true, or function definitions with strict: true | | Gemini (Interactions API) | response_format with mime_type application/json and schema | | vLLM | response_format json_schema, or structured_outputs json | | llama-server | json_schema body field, or response_format on /chat/completions |
Gotchas
- OpenAI: unlike JSON mode, Structured Outputs constrains the shape of the JSON, not only its validity.
- Gemini: without
response_formatthe model might wrap the JSON in markdown code blocks. - vLLM: the supported regex syntax depends on the structured output backend.
- llama.cpp: the JSON schema is not injected into the prompt, so describe it explicitly in your prompt.
See also
- ao-structured-openai-structured-outputs
- ao-structured-gemini-json-schema
- ao-structured-vllm-structured-outputs
- ao-structured-ollama-and-llamacpp-grammars
Claims
- id: C1 claim: OpenAI strict mode. source: S1 evidence: "setting the parameter
strict: true"
- id: C2 claim: Gemini may wrap JSON in markdown. source: S2 evidence: "the model might wrap the JSON in markdown code blocks"
- id: C3 claim: vLLM regex depends on backend. source: S3 evidence: "The supported regex syntax depends on the structured output backend."
- id: C4 claim: llama-server json_schema body field. source: S4 evidence: "passed as the
json_schemabody field"
Sources
- [S1] Introduction to Structured Outputs. openai/openai-cookbook (GitHub). https://github.com/openai/openai-cookbook/blob/main/examples/Structured_Outputs_Intro.ipynb . License: MIT. Accessed 2026-11-16.
- [S2] JSON mode quickstart. google-gemini/cookbook (GitHub). https://github.com/google-gemini/cookbook/blob/main/quickstarts/JSON_mode.ipynb . License: Apache-2.0. Accessed 2026-11-16.
- [S3] Structured outputs (vLLM docs). vllm-project/vllm (GitHub). https://github.com/vllm-project/vllm/blob/main/docs/features/structured_outputs.md . License: Apache-2.0. Accessed 2026-11-16.
- [S4] GBNF guide (llama.cpp grammars README). ggml-org/llama.cpp (GitHub). https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md . License: MIT. Accessed 2026-11-16.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: openai/openai-cookbook (GitHub), Introduction to Structured Outputs, MIT (https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE). Copyright (c) 2025 OpenAI; google-gemini/cookbook (GitHub), JSON mode quickstart, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/cookbook/main/LICENSE); vllm-project/vllm (GitHub), Structured outputs (vLLM docs), Apache-2.0 (https://raw.githubusercontent.com/vllm-project/vllm/main/LICENSE); ggml-org/llama.cpp (GitHub), GBNF guide (llama.cpp grammars README), MIT (https://raw.githubusercontent.com/ggml-org/llama.cpp/master/LICENSE). Copyright (c) 2023-2026 The ggml authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: openai/openai-cookbook (GitHub), Introduction to Structured Outputs, MIT (https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE). Copyright (c) 2025 OpenAI; google-gemini/cookbook (GitHub), JSON mode quickstart, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/cookbook/main/LICENSE); vllm-project/vllm (GitHub), Structured outputs (vLLM docs), Apache-2.0 (https://raw.githubusercontent.com/vllm-project/vllm/main/LICENSE); ggml-org/llama.cpp (GitHub), GBNF guide (llama.cpp grammars README), MIT (https://raw.githubusercontent.com/ggml-org/llama.cpp/master/LICENSE). Copyright (c) 2023-2026 The ggml authors.
Cite this
iinventedlight. 2026. "Structured output options across providers and local servers." iinventedlight Library, iil:note:fycfbtb5, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-structured-across-providers/. License: CC-BY-4.0.
@misc{iil_note_fycfbtb5,
author = {{iinventedlight}},
title = {{Structured output options across providers and local servers}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/ao-structured-across-providers/},
note = {Permanent ID iil:note:fycfbtb5. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-structured-across-providers.md.