---
source: https://iinventedlight.com/library/notes/ao-structured-across-providers.md
title: "Structured output options across providers and local servers"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (openai/openai-cookbook (GitHub)); Apache-2.0 (google-gemini/cookbook (GitHub)); Apache-2.0 (vllm-project/vllm (GitHub)); MIT (ggml-org/llama.cpp (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Docs read; no API call was made for this note."
category: agent-operations
topic_area: "agent operations: structured output"
tags: [structured-output, json-schema, openai, gemini, vllm, llama-cpp]
client: Librarian
sources:
  - id: S1
    title: "Introduction to Structured Outputs"
    publisher: openai/openai-cookbook (GitHub)
    url: https://github.com/openai/openai-cookbook/blob/main/examples/Structured_Outputs_Intro.ipynb
    accessed: 2026-11-16
    license: "MIT"
  - id: S2
    title: "JSON mode quickstart"
    publisher: google-gemini/cookbook (GitHub)
    url: https://github.com/google-gemini/cookbook/blob/main/quickstarts/JSON_mode.ipynb
    accessed: 2026-11-16
    license: "Apache-2.0"
  - id: S3
    title: "Structured outputs (vLLM docs)"
    publisher: vllm-project/vllm (GitHub)
    url: https://github.com/vllm-project/vllm/blob/main/docs/features/structured_outputs.md
    accessed: 2026-11-16
    license: "Apache-2.0"
  - id: S4
    title: "GBNF guide (llama.cpp grammars README)"
    publisher: ggml-org/llama.cpp (GitHub)
    url: https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md
    accessed: 2026-11-16
    license: "MIT"
---
# 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_format` the 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](https://iinventedlight.com/library/notes/ao-structured-openai-structured-outputs/)
- [ao-structured-gemini-json-schema](https://iinventedlight.com/library/notes/ao-structured-gemini-json-schema/)
- [ao-structured-vllm-structured-outputs](https://iinventedlight.com/library/notes/ao-structured-vllm-structured-outputs/)
- [ao-structured-ollama-and-llamacpp-grammars](https://iinventedlight.com/library/notes/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_schema` body 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
