# Structured output · JSON / guided grammar — neuraldeep.ru API

> Раздел машиночитаемой справки. Все разделы: https://neuraldeep.ru/llms.txt · всё одним файлом: https://neuraldeep.ru/llms-full.txt

Base URL: `https://api.neuraldeep.ru/v1`
Auth: `Authorization: Bearer $YOUR_KEY`

vLLM поддерживает guided JSON, regex и grammar (llguidance). Через OpenAI-совместимый `response_format`.

```bash
curl https://api.neuraldeep.ru/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-120b",
    "messages": [{"role":"user","content":"Extract name and age from: Иван, 30 лет"}],
    "response_format": {"type":"json_object"}
  }'
```

```python
from pydantic import BaseModel
from openai import OpenAI

class Person(BaseModel):
    name: str
    age: int

client = OpenAI(api_key="$YOUR_KEY", base_url="https://api.neuraldeep.ru/v1")
r = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=[{"role":"user","content":"Иван, 30 лет"}],
    response_format={"type":"json_schema","json_schema":{
        "name":"Person","schema":Person.model_json_schema(),"strict":True
    }},
)
person = Person.model_validate_json(r.choices[0].message.content)
```

> Для strict JSON — обязательно `strict: true` в schema. vLLM гарантирует соответствие грамматике.
