LLMBase | Docs

Inference

Structured outputs

Request JSON output with json_object or JSON Schema response formats.

Updated


Use response_format when downstream code needs JSON output. LLMBase supports the OpenAI-compatible json_object and json_schema request shapes on models that advertise that feature.

Before sending structured output requests, choose a model whose metadata includes json_mode or structured_outputs in supported_features.

JSON object

Use json_object when your application can validate or repair the final shape itself.

{
  "model": "deepseek/deepseek-v3.2",
  "messages": [
    { "role": "user", "content": "Return three product risks as JSON." }
  ],
  "response_format": { "type": "json_object" }
}

JSON Schema

Use json_schema when missing fields or wrong enum values should be treated as model errors.

{
  "model": "deepseek/deepseek-v3.2",
  "messages": [
    { "role": "user", "content": "Extract the company name and priority." }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "ticket",
      "schema": {
        "type": "object",
        "properties": {
          "company": { "type": "string" },
          "priority": { "type": "string", "enum": ["low", "medium", "high"] }
        },
        "required": ["company", "priority"],
        "additionalProperties": false
      }
    }
  }
}

Structured output is still model generation, not a database constraint. Keep schemas compact, include all required fields, and validate returned JSON in your application before writing to production systems.

Capability checks

Check /v1/models?metadata=true for the live list before routing production traffic:

curl "https://api.llmbase.ai/v1/models?metadata=true" \
  -H "Authorization: Bearer $LLMBASE_API_KEY"

If the selected model cannot satisfy the requested feature set, LLMBase returns 400 with invalid_request_error instead of running an incompatible request.