{
  "method": "POST",
  "accepts": [
    "application/json"
  ],
  "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
  "embedModel": "@cf/baai/bge-base-en-v1.5",
  "dimensions": 768,
  "gateway": "quasareum-ai",
  "schema": {
    "query": {
      "type": "string",
      "min": 2,
      "max": 2000,
      "required": false,
      "hint": "Single-question shorthand. One of `query` or `messages` must be set."
    },
    "messages": {
      "type": "array",
      "required": false,
      "items": {
        "role": "user|assistant|system",
        "content": "string (1..4000)"
      }
    },
    "topK": {
      "type": "integer",
      "min": 1,
      "max": 10,
      "default": 5
    },
    "agent": {
      "type": "string",
      "max": 120,
      "required": false,
      "hint": "Identify the calling AI for telemetry / rate-limiting."
    }
  },
  "responses": {
    "200": {
      "answer": "string",
      "citations": "array<{ kind, slug, title, score }>",
      "model": "string"
    },
    "400": {
      "ok": false,
      "error": "validation_failed"
    },
    "429": {
      "ok": false,
      "error": "rate_limited",
      "limit": 30,
      "window": "1h"
    },
    "503": {
      "ok": false,
      "error": "ai_unavailable"
    }
  },
  "streaming": {
    "hint": "Send Accept: text/event-stream for token-by-token streaming via Server-Sent Events.",
    "events": [
      "meta (citations + retrieval mode)",
      "data (token chunks from the LLM)",
      "complete (final citationLint)"
    ]
  },
  "example": "curl -X POST https://quasareum.com/api/chat -H 'content-type: application/json' -d '{\"query\":\"What is PerpLog?\",\"agent\":\"claude\"}'",
  "streamExample": "curl --no-buffer -X POST https://quasareum.com/api/chat -H 'content-type: application/json' -H 'accept: text/event-stream' -d '{\"query\":\"What is PerpLog?\"}'"
}