← All notes

vLLM structured outputs: choice, regex, json and grammar

Answer: vLLM supports the generation of structured outputs using xgrammar or guidance as backends. A request can use extra_body={"structured_outputs": {"choice": ["positive", "negative"]}}. A JSON schema request uses response_format with "type": "json_schema".

Migration

Older guided_* fields are replaced by structured_outputs: guided_json -> {"structured_outputs": {"json": ...}} or StructuredOutputsParams(json=...), and so on for guided_regex, guided_choice and guided_grammar.

Details

Outlines

Outlines guarantees structured outputs during generation rather than fixing bad outputs after generation. You pass an output type such as Literal["Yes", "No"], int or a Pydantic model.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: vllm-project/vllm (GitHub), Structured outputs (vLLM docs), Apache-2.0 (https://raw.githubusercontent.com/vllm-project/vllm/main/LICENSE); dottxt-ai/outlines (GitHub), Outlines README, Apache-2.0 (https://raw.githubusercontent.com/dottxt-ai/outlines/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: vllm-project/vllm (GitHub), Structured outputs (vLLM docs), Apache-2.0 (https://raw.githubusercontent.com/vllm-project/vllm/main/LICENSE); dottxt-ai/outlines (GitHub), Outlines README, Apache-2.0 (https://raw.githubusercontent.com/dottxt-ai/outlines/main/LICENSE).

Cite this

Permanent ID: iil:note:gne24ggp

iinventedlight. 2026. "vLLM structured outputs: choice, regex, json and grammar." iinventedlight Library, iil:note:gne24ggp, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-structured-vllm-structured-outputs/. License: CC-BY-4.0.

@misc{iil_note_gne24ggp,
  author = {{iinventedlight}},
  title = {{vLLM structured outputs: choice, regex, json and grammar}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-structured-vllm-structured-outputs/},
  note = {Permanent ID iil:note:gne24ggp. License: CC-BY-4.0.},
}

Markdown

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-vllm-structured-outputs.md.