Skip to content

Structured outputs ​

response_format: {"type": "json_object"} returns valid JSON; {"type": "json_schema", "json_schema": {"name": ..., "schema": ..., "strict": true}} returns JSON that follows the schema. Both are enforced by a grammar while the model generates, on llama.cpp and vLLM: the model cannot write a token that would break them.

python
person = client.chat.completions.create(
    model="qwen3-14b",
    messages=[{"role": "user", "content": "Give a person named Ada aged 36."}],
    response_format={"type": "json_schema", "json_schema": {
        "name": "person", "strict": True,
        "schema": {"type": "object",
                   "properties": {"name": {"type": "string"}, "age": {"type": "integer"}},
                   "required": ["name", "age"], "additionalProperties": False}}},
)

A schema the engine cannot turn into a grammar is answered 400 invalid_request with the engine's own message. On the reference backend both formats are refused by name.

n (several choices of the same request) and logprobs with top_logprobs are served on the same engines, logprobs in OpenAI's shape (token, logprob, bytes, top_logprobs).

Diffuse Enterprise is commercial software. Diffuse Open is AGPL-3.0.