{
  "openapi": "3.1.0",
  "info": {
    "title": "Quorum API",
    "version": "1.0.0",
    "summary": "Route a question through a panel of frontier models and get one deliberated answer.",
    "description": "Quorum's HTTP API. `POST /v1/chat/completions` is OpenAI-shaped, so most SDKs work by changing the base URL and the model name — the `model` field selects a Quorum **mode** (a configured panel) rather than a single model. An additive `quorum` block on every response carries what the OpenAI shape has no vocabulary for: which engines actually answered, how many rounds ran, whether they converged, and what it cost.\n\nThis document is written from the handler source, not from memory. Where the API does not do something — token streaming, for one — it is marked here rather than left implied.\n\nThree things that surprise people:\n\n1. **Requests carrying a browser `Origin` header are rejected with 403.** This API is server-to-server. A real key presented from a browser is treated as a leaked key, not a legitimate call.\n2. **`stream: true` returns 400, not a stream.** Provider token streaming is not implemented; failing loudly beats returning a plain body to a client that is waiting for SSE.\n3. **A deliberation is slow by design.** Measured on production 2026-08-20: p50 28.5s, p90 88.2s, p99 229.3s across 3,845 deliberations. Set your client timeout accordingly, and use `POST /v1/estimate` — free — to decide whether a question is worth the wait before spending it.",
    "contact": { "name": "Quorum", "url": "https://www.quorum.dog/help" },
    "license": { "name": "Proprietary", "url": "https://www.quorum.dog/terms.html" }
  },
  "servers": [
    { "url": "https://www.quorum.dog", "description": "Production" }
  ],
  "externalDocs": {
    "description": "The library",
    "url": "https://www.quorum.dog/docs"
  },
  "tags": [
    { "name": "Deliberation", "description": "Convene a panel, or price one first." },
    { "name": "Discovery", "description": "What this key may call." },
    { "name": "Receipts", "description": "What actually happened on a past call." },
    { "name": "Testing", "description": "Measure a mode against a benchmark set. Long-running." }
  ],
  "security": [{ "ApiKeyAuth": [] }],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "tags": ["Deliberation"],
        "summary": "Convene the panel",
        "description": "Runs a real deliberation and bills for it. Seconds, not milliseconds — see the timing note on this document.\n\nSend an `Idempotency-Key` header on anything a retry could duplicate. A repeat of a succeeded key replays the original answer with `quorum.replayed: true`; it is not re-run and not re-billed. A repeat of a key still in flight returns 409.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": { "type": "string" },
            "description": "Deduplicates retries. If omitted, one is derived from org, key, model and messages — so an identical repeat is deduplicated whether you asked for it or not."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ChatCompletionRequest" },
              "examples": {
                "basic": {
                  "summary": "A question worth a panel",
                  "value": {
                    "model": "quorum-standard",
                    "messages": [
                      { "role": "user", "content": "We are choosing between Postgres row-level security and application-layer authorisation for a multi-tenant SaaS. Which, and what breaks either way?" }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The panel answered.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ChatCompletion" } }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/ModelNotFound" },
          "409": {
            "description": "A request with this `Idempotency-Key` is already running. Wait for it rather than retrying.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "413": {
            "description": "The prompt exceeds this key's `max_input_tokens` (8,000 unless raised).",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/v1/estimate": {
      "post": {
        "operationId": "estimate",
        "tags": ["Deliberation"],
        "summary": "Price a question without running it",
        "description": "Classifies the prompt — depth, difficulty, task type — and returns what a real call would cost. Always free: `billed_usd` is `0`.\n\nIt runs the same classifier a real deliberation runs, so the classification is the one that would actually apply, not a second implementation of it. Measured at roughly 0.9 s and about $0.00006 of real cost per call, which is why it is free — but it is still authenticated and still rate-limited, because tiny multiplied by unlimited automated volume is not tiny.\n\nThis is the front half of the escalation pattern: classify everything, deliberate only what earns it. Where that threshold sits is your decision, not ours.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/EstimateRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Classification and projected price.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Estimate" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/ModelNotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "tags": ["Discovery"],
        "summary": "List the modes this key may call",
        "description": "Scoped to what your organisation is actually entitled to, not every mode that exists.\n\nEach entry discloses the provider families the mode is designed to fan out to, before you send it any data. That is the pre-call half of subprocessor transparency; `quorum.engines` on a completion response is the after-the-fact half, and the two can differ when a seat falls back.\n\nRead `pricing.q_surcharge_by_depth` when it is present — it is what most calls are billed at. `q_surcharge_usd` is the flat fallback and ceiling.",
        "responses": {
          "200": {
            "description": "The modes available to this key.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ModelList" } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/v1/receipts/{request_id}": {
      "get": {
        "operationId": "getReceipt",
        "tags": ["Receipts"],
        "summary": "What happened on a past call",
        "description": "Per-seat models, judge scores, whether a seat fell back to a different engine, latency and cost for a completed request.\n\nEvery other endpoint makes Quorum do more; this one makes the *caller* able to do more. An agent that can see judge scores and convergence can escalate, re-ask, or flag for human review — decisions it cannot make from a bare answer string.\n\nScoped to your organisation in the lookup itself: another org's `request_id` returns 404, never a partial leak.",
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "From `quorum.request_id` on a completion response."
          },
          {
            "name": "include_transcript",
            "in": "query",
            "required": false,
            "schema": { "type": "boolean", "default": false },
            "description": "Include the full text each seat produced. Off by default — a full transcript is a labelled multi-model comparison dataset, not something handed over merely because a caller knows a request id."
          }
        ],
        "responses": {
          "200": {
            "description": "The receipt, or an explanation of why there is none.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReceiptResponse" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": {
            "description": "No receipt for this `request_id` under this organisation.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/v1/tests": {
      "post": {
        "operationId": "createTestRun",
        "tags": ["Testing"],
        "summary": "Measure a mode against a benchmark set",
        "description": "Runs a mode over questions drawn from a real benchmark dataset and has a blind multi-judge panel score the results. Billed per question at 25% off standard pricing, for the run as configured.\n\n**This is not a request-response call.** The shared execution engine processes roughly one question per minute per batch, so a 60-question run takes about an hour. You get a `batch_id` and a `status_url` immediately; poll it. That constraint is real and disclosed rather than hidden behind a spinner.\n\nSend `dry_run: true` to get the full price and duration back without starting anything or billing anything.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/TestRunRequest" },
              "examples": {
                "dryRun": {
                  "summary": "Price it first",
                  "value": { "model": "quorum-standard", "buckets": { "light": 10, "medium": 10, "hard": 10 }, "dry_run": true }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Launched, or priced when `dry_run` was set.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TestRunAccepted" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/ModelNotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "get": {
        "operationId": "getTestRun",
        "tags": ["Testing"],
        "summary": "Progress of a test run",
        "parameters": [
          { "name": "batch_id", "in": "query", "required": true, "schema": { "type": "string", "format": "uuid" } }
        ],
        "responses": {
          "200": {
            "description": "Batch progress and, once complete, results.",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "batch": { "type": "object", "additionalProperties": true } } } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "description": "No such batch under this organisation.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/v1/certify": {
      "post": {
        "operationId": "createCertification",
        "tags": ["Testing"],
        "summary": "Certify a mode — fixed shape, $50",
        "description": "A fixed 150-question run — roughly 50 each of light, medium and hard — scored by three judges at two repeats each, ending in a certification verdict. $50 flat.\n\nSame execution engine as `/v1/tests` and the same throughput: about 150 minutes, not instant. Poll `status_url`.\n\nThis is **not** the Marketplace badge. That one requires a published listing and moderation. This certifies a mode your organisation runs privately, with no listing involved.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model"],
                "properties": {
                  "model": { "type": "string", "description": "An `api_model_id` from /v1/models.", "examples": ["quorum-standard"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Certification run launched.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CertificationAccepted" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/ModelNotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/ServerError" }
        }
      },
      "get": {
        "operationId": "getCertification",
        "tags": ["Testing"],
        "summary": "Progress of a certification run",
        "parameters": [
          { "name": "batch_id", "in": "query", "required": true, "schema": { "type": "string", "format": "uuid" } }
        ],
        "responses": {
          "200": {
            "description": "Batch progress, plus a `certification` verdict once complete.",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "batch": { "type": "object", "additionalProperties": true }, "certification": { "type": "object", "additionalProperties": true } } } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "description": "No such batch under this organisation.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer qk_live_…` (or `qk_test_…`). Server-to-server only — a request carrying a browser `Origin` header is rejected with 403 `browser_origin_not_allowed`, because a real key sent from a browser is a leaked key."
      }
    },
    "schemas": {
      "Message": {
        "type": "object",
        "required": ["role", "content"],
        "properties": {
          "role": { "type": "string", "enum": ["system", "user", "assistant"] },
          "content": { "type": "string" }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": ["model", "messages"],
        "properties": {
          "model": {
            "type": "string",
            "description": "An `api_model_id` from /v1/models — a mode, not a single model.",
            "examples": ["quorum-standard"]
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": { "$ref": "#/components/schemas/Message" }
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Only `false` is accepted. `true` returns 400 `stream_not_supported` — provider token streaming is not implemented, and a silent non-stream would break an SDK waiting for SSE."
          },
          "quorum": {
            "type": "object",
            "description": "Optional per-call overrides, within what the mode and your key permit.",
            "additionalProperties": true
          }
        }
      },
      "ChatCompletion": {
        "type": "object",
        "description": "OpenAI's shape, plus an additive `quorum` block. Nothing in the OpenAI-shaped part was renamed.",
        "properties": {
          "id": { "type": "string" },
          "object": { "type": "string", "const": "chat.completion" },
          "created": { "type": "integer", "description": "Unix seconds." },
          "model": { "type": "string" },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": { "type": "integer" },
                "message": { "$ref": "#/components/schemas/Message" },
                "finish_reason": {
                  "type": "string",
                  "enum": ["stop", "cost_cap"],
                  "description": "`cost_cap` means the run stopped at the mode's cost ceiling. The answer is real, but shorter deliberation than the mode would otherwise have run — treat it as a signal, not an error."
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": { "type": "integer" },
              "completion_tokens": { "type": "integer" },
              "total_tokens": { "type": "integer" }
            }
          },
          "quorum": {
            "type": "object",
            "description": "What the OpenAI shape has no field for.",
            "properties": {
              "request_id": { "type": "string", "description": "Pass to /v1/receipts/{request_id}." },
              "mode_key": { "type": "string" },
              "mode_config_hash": { "type": "string", "description": "Short hash of the mode's engine and deliberation config. A change here means the panel itself changed, as opposed to ordinary prompt-to-prompt variance." },
              "rounds": { "type": "integer", "description": "How many deliberation rounds actually ran. Most calls resolve in one; a second round means the panel disagreed enough to warrant it." },
              "seats": { "type": "integer" },
              "converged": { "type": "boolean", "description": "Whether the seats agreed. `false` is information, not failure — it is the signal that the question is genuinely contested." },
              "capped": { "type": "boolean" },
              "surcharge_usd": { "type": "number" },
              "billed_usd": { "type": "number" },
              "latency_ms": { "type": "integer" },
              "engines": { "type": "array", "items": { "type": "string" }, "description": "The provider families that actually answered. May differ from the mode's declared design when a seat fell back." },
              "persisted": { "type": "boolean" },
              "replayed": { "type": "boolean", "description": "Present and `true` only on an idempotent replay: the original answer, not re-run and not re-billed." }
            }
          }
        }
      },
      "EstimateRequest": {
        "type": "object",
        "required": ["model", "messages"],
        "properties": {
          "model": { "type": "string", "examples": ["quorum-standard"] },
          "messages": { "type": "array", "minItems": 1, "items": { "$ref": "#/components/schemas/Message" } }
        }
      },
      "Estimate": {
        "type": "object",
        "properties": {
          "request_id": { "type": "string" },
          "model": { "type": "string" },
          "mode_key": { "type": "string" },
          "depth": { "type": "string", "enum": ["light", "medium", "deep"], "description": "Drives which per-depth surcharge applies." },
          "difficulty_score": { "type": "number", "description": "0–1. Production distribution as of 2026-08-20 (n=3,947): 45% light, 33% medium, 22% deep; mean 0.456." },
          "task_type": { "type": "string" },
          "estimated_price_usd": { "type": "number" },
          "billed_usd": { "type": "number", "const": 0, "description": "Always zero. This endpoint is free." },
          "timing_ms": {
            "type": "object",
            "description": "Returned so you can measure this round trip yourself rather than taking our word for it.",
            "properties": {
              "total": { "type": "integer" },
              "classify": { "type": "integer" }
            }
          }
        }
      },
      "ModelList": {
        "type": "object",
        "properties": {
          "object": { "type": "string", "const": "list" },
          "data": { "type": "array", "items": { "$ref": "#/components/schemas/Model" } }
        }
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "description": "Use this as `model` on other endpoints." },
          "object": { "type": "string", "const": "model" },
          "owned_by": { "type": "string", "const": "quorum" },
          "quorum": {
            "type": "object",
            "properties": {
              "mode_key": { "type": "string" },
              "name": { "type": "string" },
              "description": { "type": ["string", "null"] },
              "price_tier": { "type": ["string", "null"] },
              "pricing": {
                "type": "object",
                "properties": {
                  "q_surcharge_usd": { "type": ["number", "null"], "description": "Flat fallback and ceiling." },
                  "q_surcharge_by_depth": { "type": ["object", "null"], "additionalProperties": { "type": "number" }, "description": "What most calls are actually billed at. Read this in preference to the flat value when present." },
                  "q_surcharge_express_usd": { "type": ["number", "null"] }
                }
              },
              "providers": { "type": "array", "items": { "type": "string" }, "description": "Provider families this mode is designed to use, disclosed before you send data. Real per-call assignment can differ under fallback." }
            }
          }
        }
      },
      "ReceiptResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "receipt_available": { "type": "boolean", "description": "Present and `false` when the request never produced a deliberation — it failed, or was capped before firing. `reason` says which." },
          "reason": { "type": "string" },
          "receipt": { "$ref": "#/components/schemas/Receipt" }
        }
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "request_id": { "type": "string" },
          "mode_key": { "type": "string" },
          "mode_config_hash": { "type": "string" },
          "status": { "type": "string" },
          "billed_usd": { "type": "number", "description": "What this call cost you. BREAKING CHANGE 2026-08-26: this schema and this endpoint also carried a second money field reporting Quorum's own cost of running the call. It was published in error, it is cost-of-goods data, and it has been removed. `billed_usd` is unchanged and is the only per-call money figure the receipt returns; nothing else in the receipt changed." },
          "rounds": { "type": ["integer", "null"] },
          "difficulty_score": { "type": ["number", "null"] },
          "task_type": { "type": ["string", "null"] },
          "hallucination_risk": { "type": ["string", "null"] },
          "minority_insight_likely": { "type": ["boolean", "null"] },
          "best_seat": {
            "type": ["object", "null"],
            "properties": {
              "model_used": { "type": "string" },
              "judge_score": { "type": ["number", "null"] },
              "content": { "type": "string", "description": "Only with `include_transcript=true`." }
            }
          },
          "seats": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model_used": { "type": "string" },
                "round_number": { "type": ["integer", "null"] },
                "judge_score": { "type": ["number", "null"] },
                "is_best_seat": { "type": ["boolean", "null"] },
                "fallback_used": { "type": ["boolean", "null"], "description": "True when the intended engine was unavailable and another took the seat." },
                "original_model": { "type": ["string", "null"], "description": "What was meant to sit there, when `fallback_used`." },
                "latency_ms": { "type": ["integer", "null"] },
                "content": { "type": "string", "description": "Only with `include_transcript=true`." }
              }
            }
          },
          "latency_ms": { "type": ["integer", "null"] },
          "created_at": { "type": "string", "format": "date-time" },
          "completed_at": { "type": ["string", "null"], "format": "date-time" }
        }
      },
      "TestRunRequest": {
        "type": "object",
        "required": ["model", "buckets"],
        "properties": {
          "model": { "type": "string", "examples": ["quorum-standard"] },
          "buckets": {
            "type": "object",
            "description": "Questions per difficulty bucket. Each 1–100; 300 total across all buckets.",
            "properties": {
              "light": { "type": "integer", "minimum": 1, "maximum": 100 },
              "medium": { "type": "integer", "minimum": 1, "maximum": 100 },
              "hard": { "type": "integer", "minimum": 1, "maximum": 100 }
            },
            "additionalProperties": false
          },
          "judges": {
            "type": "array",
            "items": { "type": "string", "enum": ["nova_pro", "mistral_large", "llama4_maverick"] },
            "description": "Defaults to all three. Judging is blind, anonymised and order-randomised."
          },
          "judge_repeats": { "type": "integer", "minimum": 1, "maximum": 3, "default": 1, "description": "Repeat scoring to measure judge consistency." },
          "judging_protocol": { "type": "string", "enum": ["pairwise", "plurality"], "default": "pairwise" },
          "dry_run": { "type": "boolean", "default": false, "description": "Price and duration only. Nothing runs, nothing is billed." }
        }
      },
      "TestRunAccepted": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "dry_run": { "type": "boolean" },
          "batch_id": { "type": "string", "format": "uuid" },
          "mode_key": { "type": "string" },
          "total_questions": { "type": "integer" },
          "per_bucket": { "type": "object", "additionalProperties": true },
          "total_cost_usd": { "type": "number", "description": "On a dry run." },
          "billed_usd": { "type": "number", "description": "On a real run. Charged up front for the run as configured." },
          "estimated_minutes": { "type": "integer" },
          "status_url": { "type": "string" },
          "note": { "type": "string" }
        }
      },
      "CertificationAccepted": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "batch_id": { "type": "string", "format": "uuid" },
          "model": { "type": "string" },
          "mode_key": { "type": "string" },
          "total_questions": { "type": "integer", "const": 150 },
          "billed_usd": { "type": "number", "const": 50 },
          "status_url": { "type": "string" },
          "note": { "type": "string" }
        }
      },
      "Error": {
        "type": "object",
        "description": "OpenAI's error envelope, plus `quorum.request_id` where one exists — so a failure is as traceable as a success.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": { "type": "string" },
              "type": {
                "type": "string",
                "enum": ["invalid_request_error", "authentication_error", "permission_error", "rate_limit_error", "api_error"]
              },
              "code": {
                "type": "string",
                "description": "The stable identifier. Branch on this, not on `message`.",
                "enum": [
                  "invalid_api_key",
                  "revoked_api_key",
                  "org_suspended",
                  "browser_origin_not_allowed",
                  "insufficient_scope",
                  "invalid_model",
                  "invalid_messages",
                  "model_not_found",
                  "stream_not_supported",
                  "context_length_exceeded",
                  "request_in_progress",
                  "missing_request_id",
                  "receipt_not_found",
                  "invalid_buckets",
                  "invalid_bucket",
                  "invalid_bucket_count",
                  "too_many_questions",
                  "invalid_judges",
                  "method_not_allowed",
                  "concurrency_limit_exceeded",
                  "rate_limit_exceeded",
                  "service_unavailable",
                  "internal_error"
                ]
              },
              "param": { "type": ["string", "null"] }
            }
          },
          "quorum": {
            "type": "object",
            "properties": { "request_id": { "type": ["string", "null"] } }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request was malformed. `error.code` says how.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unauthorized": {
        "description": "Missing, invalid or revoked key. Not retryable — fix the key.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Forbidden": {
        "description": "The key is real but not permitted: organisation suspended, key lacks the scope, or the request carried a browser `Origin` header.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "ModelNotFound": {
        "description": "No mode with that `api_model_id` is exposed to this organisation. Call /v1/models to see what is.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "RateLimited": {
        "description": "Rate or concurrency ceiling hit. Defaults are 60 requests/minute per key and 5 concurrent requests per organisation. A `Retry-After` header is sent; back off and retry.",
        "headers": {
          "Retry-After": { "schema": { "type": "integer" }, "description": "Seconds." }
        },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "ServerError": {
        "description": "Our fault. Safe to retry with the same `Idempotency-Key`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unavailable": {
        "description": "A dependency was unreachable and the gate failed closed rather than letting the call through unchecked. Retryable.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    }
  }
}
