API Reference

Structured Responses

Getting the model to reply with clean, parseable data — usually JSON — instead of free-form prose.

/v1/chat/completions does not currently accept an OpenAI-style response_format parameter — see the full accepted body in Chat Completions. If you send response_format today it's silently ignored rather than enforced. Until that's added, the reliable way to get structured output is through the prompt itself, below.

Prompting for JSON today

Instruct the model explicitly, in the system message, to return only JSON matching a shape you describe — then parse the response text yourself.

curl https://api.dravenai.lat/v1/chat/completions \
  -H "Authorization: Bearer sk-drv-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model-id",
    "messages": [
      { "role": "system", "content": "Reply with ONLY valid JSON, no markdown fences, matching: {\"city\": string, \"country\": string}." },
      { "role": "user", "content": "Where is the Eiffel Tower?" }
    ],
    "temperature": 0.2
  }'
completion = client.chat.completions.create(
    model="your-model-id",
    messages=[
        {"role": "system", "content": 'Reply with ONLY valid JSON, no markdown fences, matching: {"city": string, "country": string}.'},
        {"role": "user", "content": "Where is the Eiffel Tower?"},
    ],
    temperature=0.2,
)

import json
data = json.loads(completion.choices[0].message.content)
const completion = await client.chat.completions.create({
  model: "your-model-id",
  messages: [
    { role: "system", content: 'Reply with ONLY valid JSON, no markdown fences, matching: {"city": string, "country": string}.' },
    { role: "user", content: "Where is the Eiffel Tower?" },
  ],
  temperature: 0.2,
});

const data = JSON.parse(completion.choices[0].message.content);

Making it robust

A dedicated response_format: { "type": "json_object" } parameter that enforces valid JSON server-side is a natural next step for this API — check back here as the model catalog grows.