{
  "components": {
    "schemas": {
      "AddableCandidate": {
        "description": "One local chat model a draft could add as a candidate.",
        "properties": {
          "id": {
            "description": "The model's id.",
            "type": "string"
          },
          "missing": {
            "description": "The enabled facets (wire names) the model does not support; empty when\nit can be added as it is.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "missing"
        ],
        "type": "object"
      },
      "AdminLevel": {
        "anyOf": [
          {
            "const": "off",
            "description": "No admin tools.",
            "type": "string"
          },
          {
            "const": "read_only",
            "description": "Reads lmgw's configuration and state.",
            "type": "string"
          },
          {
            "const": "full",
            "description": "Also changes them.",
            "type": "string"
          }
        ],
        "description": "A level of lmgw's admin tools, written `off`, `read_only` or `full`:\nwhat a device's admin tools may do now (the change feed's\n`hello.self_admin` and `state.self_admin`), the level set on a device\nkey (`KeyRow.self_admin`, and `self_admin` in `key_create` and\n`key_set`), or the gateway's own (`GatewayStatus.self_admin`,\n`SettingsFull.self_admin`).\n\nForward compatible like every enum a client reads: a value a newer\ngateway sends reads as `AdminLevel::Unknown`, as sent, and writes back\nunchanged. The document lists the known values only."
      },
      "AgentBatchShape": {
        "description": "What a `batch` manifest can actually do, for the Run tab.\n\nDerived server-side from the manifest **and the stored config**, because\nboth halves matter and only one of them is in the manifest: the review\ncolumns are the author's, in the author's order, while the values an\neditable field may be set to come from the config field `enum_from` names —\nso widening the taxonomy is a config edit and the table picks it up.\nA client re-deriving this from the manifest text would also lose the column\norder, since a JSON object parses into a sorted map here.",
        "properties": {
          "apply_tools": {
            "description": "The tools Apply reaches, named next to the button so the reviewer knows\nwhat is about to be called.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "apply_tools_are_ceiling": {
            "description": "`apply_tools` is the ceiling the agent's token enforces rather than the\ncalls the step makes — true for a container, whose image decides. The\nRun tab says \"may call\" instead of \"calls\".",
            "type": "boolean"
          },
          "columns": {
            "description": "Review-table columns, in the manifest's order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "decide": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentDecide"
              },
              {
                "type": "null"
              }
            ],
            "description": "The output can classify through a question set (its `decide`); `None`\nwhen it cannot."
          },
          "editable": {
            "description": "Output fields the reviewer may override, with their allowed values.",
            "items": {
              "$ref": "#/components/schemas/AgentReviewField"
            },
            "type": "array"
          },
          "has_apply": {
            "description": "The manifest declares an apply step, so there is something to write.",
            "type": "boolean"
          },
          "has_classify": {
            "description": "The manifest declares a per-item model call, so \"Dry run\" applies.",
            "type": "boolean"
          }
        },
        "required": [
          "columns",
          "editable",
          "has_classify",
          "has_apply",
          "apply_tools",
          "apply_tools_are_ceiling",
          "decide"
        ],
        "type": "object"
      },
      "AgentBudget": {
        "description": "The visible bounds a turn runs under: one pair from Settings → Agents & tools,\nnever a second one invented per agent.",
        "properties": {
          "max_tool_calls": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "timeout_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "max_tool_calls",
          "timeout_seconds"
        ],
        "type": "object"
      },
      "AgentCard": {
        "description": "`GET /api/agents` — one card per catalog entry.",
        "properties": {
          "app": {
            "description": "This agent declares `run.service`, so it serves an app of its own — the card's\n`app` chip, and a link to the App tab.",
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "effective_model": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "error": {
            "description": "Set when the stored manifest could not be read at all — a row written\nby a newer build. The card still lists, saying why, rather than the\nwhole catalog failing.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "description": "The manifest's `run.kind`: `chat`, `batch` or `container`. Empty for a\nrow whose stored manifest could not be read (`error` says why).",
            "type": "string"
          },
          "labels": {
            "description": "The tool labels this agent attaches, in manifest order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "last_run": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentRunSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "model_alias": {
            "description": "The manifest's model alias, template and all — usually\n`{{config.model}}`, in which case `effective_model` says what the\nstored config resolves it to.",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "requires": {
            "items": {
              "$ref": "#/components/schemas/AgentRequirement"
            },
            "type": "array"
          },
          "requires_ok": {
            "description": "Every label resolves and every narrowed tool name is currently listed.",
            "type": "boolean"
          },
          "source": {
            "description": "`builtin`, `imported` or `authored`.",
            "type": "string"
          },
          "threads": {
            "description": "Threads a `chat` agent has opened.",
            "format": "int64",
            "type": "integer"
          },
          "version": {
            "description": "Free text from the manifest, informational.",
            "type": "string"
          },
          "warnings": {
            "description": "Warnings that are not tool gaps.",
            "items": {
              "$ref": "#/components/schemas/AgentWarning"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "version",
          "kind",
          "model_alias",
          "effective_model",
          "labels",
          "enabled",
          "source",
          "requires_ok",
          "requires",
          "warnings",
          "last_run",
          "threads",
          "app",
          "error"
        ],
        "type": "object"
      },
      "AgentDecide": {
        "description": "A batch output that classifies through a Decision lab question set\n(labs-store design §4): the config field holding the set, the set's\nquestion it asks, and how the stored config's set reads.",
        "properties": {
          "enum_from": {
            "description": "The config field the enum comes from without a set (`enum_from`),\nwhich a run with a set does not read.",
            "type": [
              "string",
              "null"
            ]
          },
          "field": {
            "description": "The config field holding the set's id (`QUESTION_SET_FORMAT`).",
            "type": "string"
          },
          "measured": {
            "description": "The threshold was measured on a labelled set run. Only a measured\nthreshold is applied: an answer whose confidence is below it needs\nattention. An unmeasured one is shown, not applied (Decision 10).",
            "type": "boolean"
          },
          "model_field": {
            "description": "The config field the agent's model alias is (`{{config.<field>}}`),\nwhen it is one: a classify needs it or a set, so the Run tab blocks\nClassify while both are empty.",
            "type": [
              "string",
              "null"
            ]
          },
          "problem": {
            "description": "Why the stored config's set cannot classify (gone, no such question,\nnot a choice, no default model); a run refuses with it.",
            "type": [
              "string",
              "null"
            ]
          },
          "question": {
            "description": "The set's question that answers the output field: the output field's\nown name. It must be a `choice` question, whose options are the\nreview's values with the fallback last.",
            "type": "string"
          },
          "set": {
            "description": "The set the stored config names; `None` classifies with the model\ncall, as without `decide`.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "set_name": {
            "description": "That set's name.",
            "type": [
              "string",
              "null"
            ]
          },
          "threshold": {
            "description": "The threshold the set keeps for its question (0 when it has none),\nmeasured or not: see `measured`.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "field",
          "question",
          "enum_from",
          "set",
          "set_name",
          "threshold",
          "measured",
          "model_field",
          "problem"
        ],
        "type": "object"
      },
      "AgentField": {
        "description": "One rendered config field. `ty` is `string | integer | number |\nboolean | array`; `format` is `secret | model_alias | multiline | directory\n| file` or empty, or `QUESTION_SET_FORMAT` on an integer.",
        "properties": {
          "access": {
            "description": "For a `directory` or `file` field: `ro` or `rw`, as the **manifest**\ndeclared it. Empty for every other field — the mode is a\nproperty of the agent, never of the form.",
            "type": "string"
          },
          "default": {},
          "description": {
            "type": "string"
          },
          "enum": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "format": {
            "type": "string"
          },
          "has_value": {
            "description": "For a `secret` field: whether one is stored. Always false otherwise —\nthe value itself is in `config`.",
            "type": "boolean"
          },
          "maximum": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "minimum": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "type",
          "format",
          "title",
          "description",
          "default",
          "enum",
          "minimum",
          "maximum",
          "required",
          "has_value",
          "access"
        ],
        "type": "object"
      },
      "AgentInstallHint": {
        "properties": {
          "kind": {
            "description": "`git`, `image` or `url`.",
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "ref",
          "notes"
        ],
        "type": "object"
      },
      "AgentPortability": {
        "description": "Whether the export of this agent lands on another box.\n\nShown before the download, never enforced: exporting to the same box is the\ncommon case, and the wrong answer is a file that looks complete while naming\nan image only the exporter has.",
        "properties": {
          "notes": {
            "description": "What the receiver would have to do, one sentence each. Empty when\n`portable`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "portable": {
            "description": "Nothing about this agent is local to this machine.",
            "type": "boolean"
          }
        },
        "required": [
          "portable",
          "notes"
        ],
        "type": "object"
      },
      "AgentProvenance": {
        "description": "Where this row's document came from.\n\n`None` on the detail document for a row nobody installed from an image — an\nagent written in the Definition editor has no package and says so by having\nno provenance, rather than by carrying one full of empty strings.\n\n`installed_at` and `pulled_at` are two facts on purpose: the first is when\nthe row was written from the image, the second when the digest was last\nread. `agent_pull` moves only the second.",
        "properties": {
          "digest": {
            "description": "`podman image inspect --format '{{.Digest}}'` at the last read. Absent\nwhen podman could not say — never a placeholder that reads like a digest.",
            "type": "string"
          },
          "image": {
            "description": "The image reference as it was given at install, tag and all.",
            "type": "string"
          },
          "installed_at": {
            "type": "string"
          },
          "manifest_path": {
            "description": "Where in the image the manifest was found (`/lmgw/agent.json`).",
            "type": "string"
          },
          "pulled_at": {
            "type": "string"
          }
        },
        "required": [
          "image",
          "manifest_path",
          "installed_at",
          "pulled_at"
        ],
        "type": "object"
      },
      "AgentRequirement": {
        "description": "One `tools[]` entry measured against what the gateway offers right now.\n\nA gap is a warning, never a refusal: an agent is imported before its server\nis wired, the same way a server is registered before its image is pulled.",
        "properties": {
          "install": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentInstallHint"
              },
              {
                "type": "null"
              }
            ],
            "description": "The manifest's install hint, for prefilling the MCP page. lmgw never\nfetches anything from it."
          },
          "label": {
            "type": "string"
          },
          "missing_tools": {
            "description": "Names in `allowed` the source does not list right now.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "registered": {
            "description": "The label resolves to a registered server or a built-in toolset.",
            "type": "boolean"
          }
        },
        "required": [
          "label",
          "registered",
          "missing_tools",
          "install"
        ],
        "type": "object"
      },
      "AgentReviewField": {
        "description": "One editable output field. An empty `options` means free text: there is no\nenum behind it to offer.",
        "properties": {
          "field": {
            "type": "string"
          },
          "options": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "field",
          "options"
        ],
        "type": "object"
      },
      "AgentRowSet": {
        "description": "The question set that classified a batch row (labs-store design §4),\nstamped on the row as the run read the set: its id, its name and its\n`updated_at`. \"Save as labelled set\" saves a run's rows into the set\nthat classified them; a row the model call classified has none.",
        "properties": {
          "digest": {
            "default": "",
            "description": "A digest of the output question's definition (type, text, options\nwith descriptions, levels) as it was asked. \"Save as labelled set\"\nreports the set changed only when the question's digest differs, not\non any `updated_at` bump (a threshold write). Empty on a row stamped\nwithout one, which reads as unchanged.",
            "type": "string"
          },
          "id": {
            "default": 0,
            "description": "The set's preset id.",
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "default": "",
            "description": "Its name then.",
            "type": "string"
          },
          "updated_at": {
            "default": "",
            "description": "Its `updated_at` then: the version of the set that answered.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "AgentRunCloseBody": {
        "properties": {
          "detail": {
            "type": "string"
          },
          "output": {
            "description": "Any JSON value; carried into the stored result verbatim."
          },
          "status": {
            "description": "Absent defaults to \"done\".",
            "enum": [
              "done",
              "failed",
              "canceled"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "AgentRunEventsBody": {
        "description": "One ledger event object ({row, ...} or {log: \"...\"} or {done: true, ...}) or a JSON array of them. The same events may be sent as application/x-ndjson instead, one object per line; lmgw reads the raw body either way, whatever its Content-Type. A line or entry it cannot parse is skipped and counted in the response's rejected list, and never fails the whole call.",
        "items": {
          "type": "object"
        },
        "type": [
          "object",
          "array"
        ]
      },
      "AgentRunSummary": {
        "description": "One `agent_run` job as the Runs tab lists it.\n\nThe universal job fields plus the run's own `detail`/`result`, whose inner\nshape belongs to the executor rather than to this DTO — the same\nsplit `JobView` already makes for every other job kind.",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "cost_micro": {
            "description": "What those tokens cost, in micro-units of the gateway's currency.\n`None` is \"nobody could price this\", which is also not zero.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "detail": {},
          "done": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "duration_ms": {
            "description": "Wall clock from claim to finish. `None` while it is still going.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "job_id": {
            "format": "int64",
            "type": "integer"
          },
          "model_calls": {
            "description": "The model calls the run made, from its result: calls answered without\nan error. `None` until it has a result. `Some(0)` with no `cost_micro`\nand no tokens is a run that had nothing to price; `Some(0)` can also\ncome with a cost, from calls that failed or were stopped after their\nrows were priced.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "percent": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "phase": {
            "description": "`list`, `classify`, `rerun` or `apply`.",
            "type": "string"
          },
          "stage": {
            "type": "string"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "`queued | running | done | failed | canceled`.",
            "type": "string"
          },
          "tokens": {
            "description": "Prompt + completion tokens the run spent, from its result.\n`None` until it has one — \"not known yet\", which is not zero.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "total": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "job_id",
          "agent_id",
          "phase",
          "status",
          "done",
          "total",
          "percent",
          "stage",
          "detail",
          "tokens",
          "cost_micro",
          "model_calls",
          "duration_ms",
          "error",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "type": "object"
      },
      "AgentRuntime": {
        "description": "What a `container` agent runs under.\n\nEvery limit is here with its default printed next to it on the Run tab:\na container's bounds are shown, never guessed, like a run's tool-call and\nwall-clock budget. `0` means \"no\nlimit\" everywhere except `stop_grace_seconds`, where it means SIGKILL at\nonce — the page says which.",
        "properties": {
          "cpus": {
            "format": "double",
            "type": "number"
          },
          "deadline_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "image": {
            "type": "string"
          },
          "memory_mb": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "output_validated": {
            "description": "The phases whose `output` event is validated against a declared schema.\nA phase absent here is unvalidated, which the Run tab says out loud\nrather than leaving the reader to assume a check that is not happening.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "phases": {
            "description": "Which phases the image implements, in declaration order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "pids": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "podman": {
            "description": "`podman --version` answered on this box.",
            "type": "boolean"
          },
          "podman_note": {
            "description": "Why it did not, when it did not.",
            "type": "string"
          },
          "pull": {
            "description": "`never` | `missing` | `always`.",
            "type": "string"
          },
          "read_only": {
            "type": "boolean"
          },
          "stop_grace_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image",
          "pull",
          "phases",
          "memory_mb",
          "cpus",
          "pids",
          "deadline_seconds",
          "stop_grace_seconds",
          "read_only",
          "output_validated",
          "podman",
          "podman_note"
        ],
        "type": "object"
      },
      "AgentService": {
        "description": "Service mode as the App tab describes it.\n\nEverything a bound here is read from is a manifest field with its value\nprinted: the idle window, the start timeout and the health path are the\nmanifest's, and `0` means what it says everywhere else — never idle-stop,\nand wait as long as the start takes.",
        "properties": {
          "container": {
            "type": "string"
          },
          "health_path": {
            "description": "`run.service.health_path`. Empty = a TCP connect instead of an HTTP GET.",
            "type": "string"
          },
          "host_port": {
            "description": "The host port this start published on — ephemeral, per start. `0` when\nnothing is running.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "idle_seconds": {
            "description": "`0` = never idle-stop, exactly as an MCP server's `idle_seconds` means it.",
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds_now": {
            "description": "How long ago the last proxied request finished. `None` when nothing is\nrunning.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "in_flight": {
            "description": "Requests in flight, which is what the idle sweep skips on.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "log_tail": {
            "description": "The container's own log tail, read while it is running. Empty when\nnothing is up — `podman logs` on a container that is gone has nothing to\nsay.",
            "type": "string"
          },
          "log_tail_lines": {
            "description": "How many lines `log_tail` is at most, printed beside\nit so nobody has to guess whether they are seeing all of it.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "mounts": {
            "description": "The host mounts this agent's container holds, in the manifest's field order and\nonly the ones that are bound.\n\nThe App tab lists them. `host` is filled for an `Admin` reader and left\nout for the container reading its own row, which is told\n`/lmgw/mounts/<field>` and nothing else.",
            "items": {
              "$ref": "#/components/schemas/AgentServiceMount"
            },
            "type": "array"
          },
          "origin": {
            "description": "The origin this agent's UI is served on, as a URL with its slash:\n`http://board.localhost:8001/`. The container's\nown `LMGW_APP_ORIGIN` is the same origin *without* the slash — an\norigin to concatenate onto, rather than an `href`.",
            "type": "string"
          },
          "origin_resolves": {
            "description": "`<id>.<suffix>` resolves on the machine lmgw is running on — the server\nasked the resolver when it rendered this. False is not an error: the\nApp tab prints the `/etc/hosts` line that fixes it, and Chrome and\nFirefox resolve `*.localhost` regardless of what the system says.",
            "type": "boolean"
          },
          "port": {
            "description": "The in-container port the manifest declares.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "provides_mcp": {
            "description": "`run.provides.mcp`, when declared: the path inside the container that\nspeaks MCP, registered as the `agent:<id>` server.",
            "type": [
              "string",
              "null"
            ]
          },
          "running": {
            "description": "The container is up and answering.",
            "type": "boolean"
          },
          "start_timeout_seconds": {
            "description": "`0` = wait as long as the container takes.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "started_at": {
            "description": "When the running container was started.",
            "type": [
              "string",
              "null"
            ]
          },
          "starting": {
            "description": "A start is in flight right now.",
            "type": "boolean"
          }
        },
        "required": [
          "port",
          "health_path",
          "idle_seconds",
          "start_timeout_seconds",
          "provides_mcp",
          "origin",
          "origin_resolves",
          "starting",
          "running",
          "host_port",
          "container",
          "started_at",
          "idle_seconds_now",
          "in_flight",
          "log_tail",
          "log_tail_lines",
          "mounts"
        ],
        "type": "object"
      },
      "AgentServiceMount": {
        "description": "One bound mount as a reader is shown it.",
        "properties": {
          "access": {
            "description": "`ro` | `rw`, as the manifest declared it.",
            "type": "string"
          },
          "field": {
            "description": "The config field that names the slot.",
            "type": "string"
          },
          "host": {
            "description": "The canonical host path — **`Admin` only**. `None` is what the agent's\nown view sees, and it is absent from the JSON rather than empty: a\ncontainer is not told there is a path it is not being given.",
            "type": "string"
          },
          "inside": {
            "description": "`/lmgw/mounts/<field>` — what the container sees, for every reader.",
            "type": "string"
          },
          "kind": {
            "description": "`directory` | `file`, from the field's `format`.",
            "type": "string"
          }
        },
        "required": [
          "field",
          "inside",
          "kind",
          "access"
        ],
        "type": "object"
      },
      "AgentToken": {
        "description": "The agent's credential as the detail page describes it.",
        "properties": {
          "has_value": {
            "description": "A token has been minted. `false` until the first run or the first Copy\ntoken: an agent that is never run never mints a credential.",
            "type": "boolean"
          },
          "name": {
            "description": "`agent:<id>` — the name Logs and the usage page print.",
            "type": "string"
          },
          "scope_note": {
            "description": "The derived scope in words — \"token: any model\", or the aliases it is\nfenced to. Shown next to Copy token so the scope is never invisible.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "has_value",
          "scope_note"
        ],
        "type": "object"
      },
      "AgentWarning": {
        "description": "One warning that is not a tool gap.\n\nBeside `requires`, of the same shape and rendered in the same place. The\nStart gate is `requires_ok` **and** no warning with `blocks_start`.",
        "properties": {
          "blocks_start": {
            "type": "boolean"
          },
          "code": {
            "description": "A stable identifier — `container_without_image`, `podman_unavailable`,\n`image_absent_pull_never`, `local_image_on_import`,\n`secrets_dir_fallback`, `install_image_mismatch`, `dev_url_active`.",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "blocks_start"
        ],
        "type": "object"
      },
      "AliasView": {
        "description": "A model alias plus its resolved upstream name.",
        "properties": {
          "alias": {
            "type": "string"
          },
          "capabilities_override": {
            "description": "An alias's capabilities override for the derived `/v1/models` capability facts: a JSON\nobject with optional keys `capabilities`, `max_output_tokens`, `notes`. `None` = no\noverride."
          },
          "enabled": {
            "type": "boolean"
          },
          "fallback": {
            "description": "The alias's one fallback, as written; `None` = no fallback.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "param_overrides": {
            "$ref": "#/components/schemas/Params"
          },
          "upstream_id": {
            "format": "int64",
            "type": "integer"
          },
          "upstream_model_id": {
            "type": "string"
          },
          "upstream_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "alias",
          "upstream_id",
          "upstream_name",
          "upstream_model_id",
          "param_overrides",
          "enabled",
          "fallback"
        ],
        "type": "object"
      },
      "AlignedWord": {
        "description": "One aligned word.",
        "properties": {
          "char_end": {
            "description": "One past the word's last matched letter or digit in `text`, in the\nsame units as `char_start`: the span is `[char_start, char_end)`.",
            "format": "uint",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "char_start": {
            "description": "Where the word starts in `text`, counted in Unicode scalar values\n(not bytes, not UTF-16 units). The span is matched on letters and\ndigits only, case-insensitively, in order: `Nuova,` and `Nuova` both\ncover the five letters of `Nuova` in the transcript. Absent, with\n`char_end`, for a word that could not be found in the transcript.",
            "format": "uint",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "confidence": {
            "description": "How sure the model is, when it says (several families send `0`\nfor every word, which means \"not computed\", not \"unsure\").",
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "end": {
            "description": "Where the word ends in the clip, in seconds; as `start`.",
            "format": "double",
            "type": "number"
          },
          "end_sample": {
            "description": "`end` in samples; as `start_sample`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "start": {
            "description": "Where the word starts in the clip, in seconds. Taken from the model,\nor computed from `start_sample` and `sample_rate` when it sends only\nsamples.",
            "format": "double",
            "type": "number"
          },
          "start_sample": {
            "description": "`start` in samples of `sample_rate`: as the model answered, or\ncomputed from the seconds when the rate is known. Absent when the\nmodel sends none and the rate is unknown.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "word": {
            "description": "The word as the model reported it, punctuation and all (CrisperWhisper\nkeeps the comma on `Nuova,`, Qwen3's aligner strips it).",
            "type": "string"
          }
        },
        "required": [
          "word",
          "start",
          "end"
        ],
        "type": "object"
      },
      "AnthropicCompaction": {
        "description": "`compaction`: on-demand compaction (the top-level `compaction`), and\nwhich of its types work.",
        "properties": {
          "summarize": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`context_editing.compaction` names `summarize`."
          },
          "supported": {
            "description": "An Anthropic route (lmgw's `context_editing` is present) whose\ncatalog names an on-demand compaction type for the model\n(`context_editing.compaction`): the field goes out as written and\nthe `compaction` block comes back as it came. Unpublished is `false`.",
            "type": "boolean"
          }
        },
        "required": [
          "supported",
          "summarize"
        ],
        "type": "object"
      },
      "AnthropicContextManagement": {
        "description": "`context_management`: whether a request's `context_management` reaches\nthe model, and which of its edit types work.",
        "properties": {
          "clear_thinking_20251015": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`context_management.edits` names `clear_thinking_20251015`."
          },
          "clear_tool_uses_20250919": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`context_management.edits` names `clear_tool_uses_20250919`."
          },
          "compact_20260112": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`context_management.edits` names `compact_20260112`: the edit goes\nout as written and the `compaction` block Anthropic answers with\ncomes back as it came."
          },
          "supported": {
            "description": "An Anthropic route, which sends `context_management` on as written\n(lmgw's `context_editing` is present), whose catalog says the model\ntakes it (`context_editing.supported` is `true`); unpublished is\n`false`.",
            "type": "boolean"
          }
        },
        "required": [
          "supported",
          "clear_thinking_20251015",
          "clear_tool_uses_20250919",
          "compact_20260112"
        ],
        "type": "object"
      },
      "AnthropicCountTokensRequest": {
        "additionalProperties": true,
        "properties": {
          "messages": {
            "items": {
              "properties": {
                "content": {
                  "description": "A string, or an array of blocks: {type:text,text}, {type:image,source:{type:base64,media_type,data} | {type:url,url}}, {type:tool_use,id,name,input} (the id as lmgw gave it: a Gemini model's carries its thought signature and runs to hundreds of characters; echo it exactly, and do not send it to another provider directly), {type:tool_result,tool_use_id,content,is_error}, {type:thinking,thinking,signature} (replayed; unsigned when lmgw itself produced it). Every other block type (redacted_thinking, the provider's own tool blocks, a type newer than lmgw) goes to an Anthropic upstream as written; any other upstream is sent none of it, and x-lmgw-params-ignored names it as content.<type>. A block without a type is refused with 400. A custom tool without input_schema (a server tool) is refused with 400."
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "role",
                "content"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "model": {
            "type": "string"
          },
          "output_config": {
            "additionalProperties": true,
            "type": "object"
          },
          "system": {
            "description": "A string, or an array of {type:text,text} blocks."
          },
          "thinking": {
            "additionalProperties": true,
            "type": "object"
          },
          "tool_choice": {
            "description": "{type:auto|any|none|tool}."
          },
          "tools": {
            "items": {
              "properties": {
                "description": {
                  "type": "string"
                },
                "input_schema": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "input_schema"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "type": "object"
      },
      "AnthropicCountTokensResponse": {
        "properties": {
          "context_management": {
            "additionalProperties": true,
            "description": "Anthropic's own count of the input before the request's context edits ({original_input_tokens}), as it reported it. Only on an Anthropic model's count of a request with context_management.",
            "type": "object"
          },
          "input_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "input_tokens"
        ],
        "type": "object"
      },
      "AnthropicEffort": {
        "description": "`effort`: whether `output_config.effort` reaches the model, and which\nlevels it takes.",
        "properties": {
          "high": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`reasoning.levels` contains `high`."
          },
          "low": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`reasoning.levels` contains `low`."
          },
          "max": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`reasoning.levels` contains `max`."
          },
          "medium": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`reasoning.levels` contains `medium`."
          },
          "supported": {
            "description": "The model has selectable effort levels (`reasoning.kind` is\n`levels`): a request's `output_config.effort` reaches it.",
            "type": "boolean"
          },
          "xhigh": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`reasoning.levels` contains `xhigh`."
          }
        },
        "required": [
          "supported",
          "low",
          "medium",
          "high",
          "xhigh",
          "max"
        ],
        "type": "object"
      },
      "AnthropicError": {
        "properties": {
          "error": {
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "description": "e.g. invalid_request_error, not_found_error, permission_error, overloaded_error, api_error.",
                "type": "string"
              }
            },
            "required": [
              "type",
              "message"
            ],
            "type": "object"
          },
          "type": {
            "enum": [
              "error"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "error"
        ],
        "type": "object"
      },
      "AnthropicMessage": {
        "properties": {
          "content": {
            "items": {
              "additionalProperties": true,
              "description": "{type:text,text} | {type:tool_use,id,name,input}; a leading {type:thinking,thinking} block when the completion carried reasoning (unsigned: produced by lmgw, not by Anthropic); a leading {type:compaction,content,signature,…} block exactly as an Anthropic model answered a compaction (send it back unchanged).",
              "type": "object"
            },
            "type": "array"
          },
          "context_management": {
            "additionalProperties": true,
            "description": "The context management an Anthropic model applied ({applied_edits: [...]}), as Anthropic reported it; a stream carries it on its closing message_delta. Absent from every other model's answer.",
            "type": "object"
          },
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "role": {
            "enum": [
              "assistant"
            ],
            "type": "string"
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "stop_sequence": {
            "type": "null"
          },
          "type": {
            "enum": [
              "message"
            ],
            "type": "string"
          },
          "usage": {
            "properties": {
              "cache_creation_input_tokens": {
                "description": "Present only when the upstream reported cache writes.",
                "type": "integer"
              },
              "cache_read_input_tokens": {
                "description": "Present only when the upstream reported a cache read.",
                "type": "integer"
              },
              "input_tokens": {
                "type": "integer"
              },
              "iterations": {
                "description": "An Anthropic model's per-iteration usage, as it reported it (a compaction entry for a compaction it ran, which the top-level counts leave out). Present only when the upstream reported it.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "output_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens",
              "output_tokens"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "type",
          "role",
          "model",
          "content",
          "stop_reason",
          "stop_sequence",
          "usage"
        ],
        "type": "object"
      },
      "AnthropicMessagesRequest": {
        "additionalProperties": true,
        "properties": {
          "compaction": {
            "additionalProperties": true,
            "description": "Anthropic's on-demand compaction ({type: summarize}; send its beta flag in anthropic-beta). To an Anthropic model it goes as written, and the compaction block Anthropic answers with comes back as it wrote it (stop_reason compaction). Every other model's provider has no equivalent: it is left out and named in x-lmgw-params-ignored. A model's capabilities.context_editing.compaction says which types it takes.",
            "type": "object"
          },
          "context_management": {
            "additionalProperties": true,
            "description": "Anthropic's context management ({edits: [...]}; send its beta flag in anthropic-beta). To an Anthropic model it goes as written, and Anthropic answers for it; a compaction edit (compact_…) included, whose compaction block comes back as Anthropic wrote it. Every other model's provider has no equivalent: it is left out and named in x-lmgw-params-ignored. A model's capabilities.context_editing on GET /v1/models says what it takes.",
            "type": "object"
          },
          "max_tokens": {
            "type": "integer"
          },
          "messages": {
            "items": {
              "properties": {
                "content": {
                  "description": "A string, or an array of blocks: {type:text,text}, {type:image,source:{type:base64,media_type,data} | {type:url,url}}, {type:tool_use,id,name,input} (the id as lmgw gave it: a Gemini model's carries its thought signature and runs to hundreds of characters; echo it exactly, and do not send it to another provider directly), {type:tool_result,tool_use_id,content,is_error}, {type:thinking,thinking,signature} (replayed; unsigned when lmgw itself produced it). Every other block type (redacted_thinking, the provider's own tool blocks, a type newer than lmgw) goes to an Anthropic upstream as written; any other upstream is sent none of it, and x-lmgw-params-ignored names it as content.<type>. A block without a type is refused with 400. A custom tool without input_schema (a server tool) is refused with 400."
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "role",
                "content"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "model": {
            "type": "string"
          },
          "output_config": {
            "description": "lmgw reads output_config.effort as the same reasoning tier x-lmgw-reasoning-effort sets, and output_config.format ({type:json_schema, schema}; the deprecated top-level output_format too) as the structured output every upstream gets in its own spelling. Its refusals are 400 invalid_request_error with the upstream's message. To an OpenAI model the schema goes with strict: true (this format guarantees the schema), so OpenAI's strict-mode rules apply — every property in required, additionalProperties false — and a schema that breaks them comes back as OpenAI's invalid_json_schema refusal, its message kept.",
            "properties": {
              "effort": {
                "type": "string"
              },
              "format": {
                "additionalProperties": true,
                "type": "object"
              }
            },
            "type": "object"
          },
          "stop_sequences": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "stream": {
            "default": false,
            "type": "boolean"
          },
          "system": {
            "description": "A string, or an array of {type:text,text} blocks, joined with blank lines."
          },
          "temperature": {
            "type": "number"
          },
          "thinking": {
            "additionalProperties": true,
            "description": "{type:enabled,budget_tokens} | {type:disabled} | {type:adaptive} (enabled, no budget — \"think as much as judged necessary\") | {type:between_tools} (no up-front thinking: an off that goes to an Anthropic model as written; every other model gets its own off, and x-lmgw-reasoning-ignored names between_tools). Any other type is refused with 400. display goes to an Anthropic model inside adaptive and enabled; beside an off, and to every other model, it is left out and x-lmgw-params-ignored names thinking.display.",
            "type": "object"
          },
          "tool_choice": {
            "description": "{type:auto|any|none|tool} (tool also carries name)."
          },
          "tools": {
            "description": "Custom tools only (input_schema required); a server tool (web_search, computer use, …) is refused with 400.",
            "items": {
              "properties": {
                "description": {
                  "type": "string"
                },
                "input_schema": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "input_schema"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "top_k": {
            "type": "integer"
          },
          "top_p": {
            "type": "number"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "type": "object"
      },
      "AnthropicModel": {
        "properties": {
          "capabilities": {
            "$ref": "#/components/schemas/AnthropicModelCapabilities"
          },
          "context_window": {
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "lifecycle": {
            "description": "Always active: a model lmgw lists is one it serves.",
            "enum": [
              "active"
            ],
            "type": "string"
          },
          "max_input_tokens": {
            "description": "Alias of context_window, under the name the Anthropic SDK types it by.",
            "type": "integer"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "max_tokens": {
            "description": "Alias of max_output_tokens.",
            "type": "integer"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "pricing": {
            "properties": {
              "completion": {
                "type": "string"
              },
              "prompt": {
                "description": "USD per prompt token, as a decimal string; \"0\" for a local model.",
                "type": "string"
              }
            },
            "required": [
              "prompt",
              "completion"
            ],
            "type": "object"
          },
          "type": {
            "enum": [
              "model"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "id",
          "display_name",
          "created_at",
          "lifecycle"
        ],
        "type": "object"
      },
      "AnthropicModelCapabilities": {
        "description": "lmgw's own capabilities object (as on the OpenAI shape, where an absent field means unknown) plus Anthropic's ten capability blocks. In the blocks, supported: true means a /v1/messages request using the feature works on this model through lmgw; false means lmgw does not serve it yet or does not know — Anthropic's schema has no unknown.",
        "properties": {
          "batch": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "Always `false` yet: lmgw serves no `/v1/messages/batches` yet."
          },
          "citations": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "Always `false` yet. A `document` or `search_result` block reaches an\nAnthropic-protocol route as the client wrote it and an answer's\ncitations come back to a Messages client (gateway design §6.1,\n\"Citations\", 2026-11-06), but lmgw does not read the catalog's\n`citations` block yet, so it cannot say per model."
          },
          "code_execution": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "Always `false` yet: the code execution tool is a server tool, which\nthe Messages ingress refuses."
          },
          "compaction": {
            "$ref": "#/components/schemas/AnthropicCompaction"
          },
          "context_editing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextEditingCaps"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic's context management (`context_management` on\n`/v1/messages`: context editing and threshold compaction, and the\ntop-level on-demand `compaction`), under a name of its\nown because the Anthropic-shaped model entry puts Anthropic's\n`context_management` block beside lmgw's object. Present only on an\nAnthropic-protocol route, the one route that sends a request's\n`context_management` on as written; every other route leaves it out\nand names it in `x-lmgw-params-ignored`."
          },
          "context_management": {
            "$ref": "#/components/schemas/AnthropicContextManagement"
          },
          "effort": {
            "$ref": "#/components/schemas/AnthropicEffort"
          },
          "endpoints": {
            "description": "The lmgw routes that accept this model id.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "image_input": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`vision` is `true` and the model is served on `/v1/messages`, whose\ningress takes `image` blocks (base64 and URL sources)."
          },
          "input_modalities": {
            "description": "Subset of `text`, `image`, `audio`, `video`, `file`, `pdf`,\n`embedding`. `pdf` is a catalog's word (Anthropic's `pdf_input`,\nKilo's and OpenRouter's modality).\nAbsent = unknown, never \"none\".",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "languages": {
            "description": "ISO 639-1 codes (a few three-letter ones, `yue`) of the languages a\nlocal audio model works in, whatever its task: speech, recognition,\nalignment. A request's `language` takes them (lmgw sends each in the\nmodel's own spelling). Absent when the model's package names none\nas codes; see `multilingual` for a family that says only that it\ncovers many.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "multilingual": {
            "description": "The model's family says it is multilingual without listing codes\n(\"multilingual\", \"80+ languages\"): it works in more languages than\n`languages` names, which then holds few or none. Absent otherwise;\nabsent along with `languages` means unknown, never \"one language\".",
            "type": [
              "boolean",
              "null"
            ]
          },
          "output_modalities": {
            "description": "The same vocabulary, plus `decisions`: what a decision model answers\nwith (llama.cpp's and OpenRouter's word). A client that checks\nllama.cpp's `architecture.output_modalities` for `decisions` reads\nthis list instead. Absent = unknown.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pdf_input": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "An Anthropic-protocol route (`context_editing` present) to a model\nwhose catalog says `pdf_input` (`input_modalities` holds `pdf`): a\n`document` block reaches it as the client wrote it, base64, URL or\nFiles API source (gateway design §6.1, \"Anthropic blocks lmgw does\nnot model\"). `false` on every other route, which is sent no\n`document` block."
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "server_tools": {
            "$ref": "#/components/schemas/AnthropicServerTools"
          },
          "source": {
            "description": "Where the facts came from: `gguf+config`, `catalog`, `config`, or\n`owner` (an alias's capabilities override).",
            "type": "string"
          },
          "speech": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SpeechCaps"
              },
              {
                "type": "null"
              }
            ],
            "description": "A text-to-speech model's expressive controls — what `instructions`,\ninline tags, `language` and `stream_format` do on it\n(the speech capabilities object). A local audio model's is derived; a\ncloud alias has one only through an alias's capabilities override."
          },
          "structured_output": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StructuredOutputCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "structured_outputs": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`structured_output.json_schema` is `true`: the ingress reads\n`output_config.format` (and the older `output_format`) of type\n`json_schema`."
          },
          "task": {
            "description": "`chat` | `embedding` | `rerank` | `decision` (a decision model,\nanswering on `/v1/systemone`) | `tts` | `asr` | an audio.cpp task\nname | an image task | `realtime` (an OpenAI Realtime model, no lmgw\nroute). Determines `endpoints`.",
            "type": "string"
          },
          "thinking": {
            "$ref": "#/components/schemas/AnthropicThinking"
          },
          "tool_calls": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ToolCallCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "vision": {
            "description": "`input_modalities` contains `image`. Redundant with the list on\npurpose: a client can read this one boolean to decide whether to\nsend images, e.g. whether a session gets a screenshot tool. Absent\nexactly when `input_modalities` is absent.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "task",
          "endpoints",
          "source",
          "batch",
          "citations",
          "code_execution",
          "compaction",
          "context_management",
          "effort",
          "image_input",
          "pdf_input",
          "server_tools",
          "structured_outputs",
          "thinking"
        ],
        "type": "object"
      },
      "AnthropicServerTools": {
        "description": "`server_tools`: Anthropic's server-run tools.",
        "properties": {
          "code_execution": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "The code execution server tool; `false` yet, as `supported`."
          },
          "supported": {
            "description": "Always `false` yet: the Messages ingress refuses every tool without an\n`input_schema` (a server tool) before any upstream sees it.",
            "type": "boolean"
          },
          "web_search": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "The web search server tool; `false` yet, as `supported`."
          }
        },
        "required": [
          "supported",
          "code_execution",
          "web_search"
        ],
        "type": "object"
      },
      "AnthropicStreamEvent": {
        "additionalProperties": true,
        "description": "SSE event: <type>, data: <this object>, one per line of the sequence above.",
        "properties": {
          "type": {
            "enum": [
              "message_start",
              "content_block_start",
              "content_block_delta",
              "content_block_stop",
              "message_delta",
              "message_stop",
              "error"
            ],
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object"
      },
      "AnthropicSupport": {
        "description": "One Anthropic capability: `{\"supported\": bool}`.",
        "properties": {
          "supported": {
            "description": "`true` only when a `/v1/messages` request using this feature works on\nthis model through lmgw; `false` when lmgw does not serve it yet or\ndoes not know.",
            "type": "boolean"
          }
        },
        "required": [
          "supported"
        ],
        "type": "object"
      },
      "AnthropicThinking": {
        "description": "`thinking`.",
        "properties": {
          "supported": {
            "description": "The model reasons: `reasoning.kind` is `toggle` or `levels`, or\n`fixed` with `enabled: true`.",
            "type": "boolean"
          },
          "types": {
            "$ref": "#/components/schemas/AnthropicThinkingTypes",
            "description": "Which `thinking` types work; all `false` when `supported` is."
          }
        },
        "required": [
          "supported",
          "types"
        ],
        "type": "object"
      },
      "AnthropicThinkingTypes": {
        "description": "`thinking.types`: which of Messages' `thinking` types work.",
        "properties": {
          "adaptive": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`{\"type\": \"adaptive\"}` (lmgw's bare \"on\") makes the model think. On\nan Anthropic route, which sends it as thinking type adaptive: the\nmodel's catalog names the type (`reasoning.thinking_types`). Elsewhere:\nits default is on, or \"on\" reaches it (the template's\n`enable_thinking` on a local row)."
          },
          "between_tools": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`{\"type\": \"between_tools\"}` (no up-front thinking) reaches a model\nthat takes it: on an Anthropic route, which sends the type as\nwritten, the model's catalog names it (`reasoning.thinking_types`).\nElsewhere `false`: those routes send their own off instead, and say\nso in `x-lmgw-reasoning-ignored`."
          },
          "disabled": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`{\"type\": \"disabled\"}` switches thinking off\n(`reasoning.can_disable` is `true`; on an Anthropic route, the\ncatalog's `thinking.types.disabled`)."
          },
          "enabled": {
            "$ref": "#/components/schemas/AnthropicSupport",
            "description": "`{\"type\": \"enabled\", \"budget_tokens\": n}`: the budget reaches the\nmodel. On an Anthropic route, which forwards the budget form as\nwritten: the model's catalog names the type\n(`reasoning.thinking_types`). Elsewhere: `reasoning.control` names\n`x-lmgw-reasoning-budget`."
          }
        },
        "required": [
          "adaptive",
          "between_tools",
          "disabled",
          "enabled"
        ],
        "type": "object"
      },
      "ApiError": {
        "description": "Uniform error body for every non-2xx `/api` response.",
        "properties": {
          "code": {
            "description": "Stable machine-readable code, e.g. `not_found`, `invalid_input`.",
            "type": "string"
          },
          "message": {
            "description": "Human-readable description, shown verbatim in the UI.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "ApiKeyRow": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "enabled"
        ],
        "type": "object"
      },
      "AppliedToCurrent": {
        "description": "What a folder patch applied to the folder's current thread (`applied`\nin the patch's answer): the thread and the settings it changed, as the\nthread settings name them (`temperature`, `voice.tts_alias`).",
        "properties": {
          "fields": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "thread_id",
          "fields"
        ],
        "type": "object"
      },
      "ApprovalDecision": {
        "description": "One verdict.",
        "properties": {
          "approval_request_id": {
            "type": "string"
          },
          "approve": {
            "type": "boolean"
          },
          "reason": {
            "description": "Why, for a declined call: the model reads \"The user declined this\ntool call: <reason>\".",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "approval_request_id",
          "approve"
        ],
        "type": "object"
      },
      "ApprovalRequest": {
        "description": "One call that waits for an approval.",
        "properties": {
          "approval_request_id": {
            "description": "The id a decision quotes (`mcpr_…`), unique in the gateway.",
            "type": "string"
          },
          "arguments": {
            "description": "The arguments as the model wrote them: a JSON string.",
            "type": "string"
          },
          "call_id": {
            "description": "The call's id, as its `ready` and `result` frames carry it\n(`mcp_apps::ToolReadyFrame::call_id`). Absent from an lmgw\nbefore 2026-10-09, and from an `ApprovalRequest` read off a bound\nsession's `mcp_approval_request` item (OpenAI's shape has none):\nthere the `lmgw.chat.frame` relaying the `approval` frame has it.",
            "type": "string"
          },
          "name": {
            "description": "The tool's own name: the name the model called, without its\nlabel's `<prefix>__`.",
            "type": "string"
          },
          "server_label": {
            "description": "The thread's label the tool came from.",
            "type": "string"
          }
        },
        "required": [
          "approval_request_id",
          "server_label",
          "name",
          "arguments"
        ],
        "type": "object"
      },
      "ApprovalRequested": {
        "description": "`approval.requested`: a turn in the thread stopped on a call that waits\nfor an approval (client-apps design §6.5). Rendered from the reply's\npending state at delivery; a reply gone by then (deleted, regenerated),\nor a call decided by then (its `approval.decided` follows),\nis not delivered. With `thread_title`, `server_label`, `name` and\n`arguments` a client shows it, or a notification, without a fetch. Also\nthe shape of `Hello::open_approvals`' entries.",
        "properties": {
          "approval_request_id": {
            "type": "string"
          },
          "arguments": {
            "description": "A JSON string.",
            "type": "string"
          },
          "call_id": {
            "description": "The call's id, as the turn's `ready`, `approval` and `result` frames\ncarry it. Absent from an lmgw before 2026-10-09.",
            "type": "string"
          },
          "message_id": {
            "description": "The reply that waits.",
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "The tool's own name, as `chat_approvals::ApprovalRequest`.",
            "type": "string"
          },
          "server_label": {
            "type": "string"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          },
          "thread_title": {
            "description": "The thread's title at delivery (in `hello`, at the head it read).",
            "type": "string"
          }
        },
        "required": [
          "thread_id",
          "thread_title",
          "message_id",
          "approval_request_id",
          "server_label",
          "name",
          "arguments"
        ],
        "type": "object"
      },
      "AsrForm": {
        "description": "The transcription panel's fields (the language is the speech form's).",
        "properties": {
          "details": {
            "default": false,
            "description": "Send to `/v1/audio/transcriptions/details`.",
            "type": "boolean"
          },
          "file_name": {
            "default": "",
            "description": "The upload's file name, as the page held it; the bytes are the\ngroup's input artifact once sent.",
            "type": "string"
          },
          "path": {
            "default": "",
            "description": "A clip on the model server, for the `path` source.",
            "type": "string"
          },
          "source": {
            "default": "upload",
            "description": "`upload` or `path`.",
            "type": "string"
          },
          "stream": {
            "default": false,
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "AttachmentFacts": {
        "additionalProperties": true,
        "description": "What extraction found in an attachment (`AttachmentMeta::meta`): which\nkeys are there depends on the kind. A key a gateway version adds is kept\nbeside these, so a reader never loses it.",
        "properties": {
          "class": {
            "description": "A PDF's class: `text`, `scanned` or `hybrid`.",
            "enum": [
              "text",
              "scanned",
              "hybrid"
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "format": {
            "description": "An office file's or audio clip's format, as sniffed (`docx`, `wav`, ...).",
            "type": [
              "string",
              "null"
            ]
          },
          "media": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MediaFacts"
              },
              {
                "type": "null"
              }
            ],
            "description": "A file an image or audio tool made: the model, its parameters and\ntimes (chat-media-tools design §9)."
          },
          "pages": {
            "description": "A PDF's page count.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "parts": {
            "description": "How many parts an office file has.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "sheets": {
            "description": "A spreadsheet's sheet names.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "textless": {
            "description": "A PDF's pages without a text layer, numbered from 1.",
            "items": {
              "format": "uint32",
              "minimum": 0,
              "type": "integer"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "tokens": {
            "description": "The extracted text's token estimate (text, PDF, office files and\ntranscribed audio).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "transcript_alias": {
            "description": "The speech-to-text alias that wrote an audio clip's transcript.",
            "type": [
              "string",
              "null"
            ]
          },
          "transcript_error": {
            "description": "Why an audio clip's transcription failed, until a retry succeeds.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AttachmentMeta": {
        "description": "One attachment's metadata, never its bytes.",
        "properties": {
          "blockers": {
            "description": "For a draft: why it cannot be sent to the thread's current model.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "call_id": {
            "description": "The tool call that made a `tool` file, or the card action that made\nan `action` file (its `act-<boot>-<n>` id, the one its stream's\nframes carried); absent for an upload.",
            "type": "string"
          },
          "extracted_tokens": {
            "description": "The extracted text's token estimate; `null` when there is none.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "hints": {
            "description": "For a draft: what it becomes on the way, sent all the same (an image\nas a placeholder, a PDF's pages as its text) under a fallback that\ncannot see.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`image`, `pdf`, `text`, `audio`, ... as the upload was classified.",
            "type": "string"
          },
          "meta": {
            "$ref": "#/components/schemas/AttachmentFacts",
            "description": "What extraction found: pages, text-less pages, class, sheets,\ntranscript alias or error, tokens. `{}` for an image."
          },
          "mime": {
            "type": "string"
          },
          "mode": {
            "description": "A text-class PDF's choice, `text` or `images`; `null` when it does\nnot apply or is not chosen yet.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "size": {
            "description": "Size in bytes.",
            "format": "int64",
            "type": "integer"
          },
          "source": {
            "description": "Where the file came from: `upload` (the user sent it), `tool` (an\nimage or audio tool of a turn made it) or `action` (an image card's\naction made it).",
            "enum": [
              "upload",
              "tool",
              "action"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "mime",
          "size",
          "mode",
          "meta",
          "extracted_tokens",
          "source"
        ],
        "type": "object"
      },
      "AudioAlignmentsRequest": {
        "description": "multipart/form-data only — lmgw's own route (for models whose row has task \"align\"), not an OpenAI shape.",
        "properties": {
          "file": {
            "format": "binary",
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "file",
          "model",
          "text"
        ],
        "type": "object"
      },
      "AudioCatalogInstall": {
        "description": "`POST /api/op/audio_catalog` with `action: \"download\"` — the package's\nfiles go through the shared HF download queue (target `audio`), exactly\nlike a wizard download.",
        "properties": {
          "downloads": {
            "items": {
              "$ref": "#/components/schemas/QueuedDownload"
            },
            "type": "array"
          },
          "engine": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EngineDownload"
              },
              {
                "type": "null"
              }
            ],
            "description": "The audio class's image, when it is not on this machine or podman\ncould not say: the download fetches a missing one too, a\nmulti-gigabyte download of its own, and starts nothing\n(`EngineDownload`). `null` when it is here."
          },
          "family": {
            "type": "string"
          },
          "files_queued": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "ok": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "package": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "revision": {
            "description": "The revision the files are fetched at: the commit the catalog pins\n(under `audio.catalog_revision = pinned`), else `main`.",
            "type": "string"
          }
        },
        "required": [
          "downloads",
          "engine",
          "family",
          "files_queued",
          "message",
          "ok",
          "package",
          "repo",
          "revision"
        ],
        "type": "object"
      },
      "AudioCatalogRefreshed": {
        "description": "`audio_catalog` with `action: refresh`: the catalog was fetched anew.",
        "properties": {
          "families": {
            "description": "How many model families the catalog holds.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "fetched_at": {
            "description": "RFC 3339 time of the fetch.",
            "type": "string"
          },
          "message": {
            "description": "The outcome in a sentence.",
            "type": "string"
          },
          "ok": {
            "const": true,
            "description": "Always `true`; a warning does not fail a refresh.",
            "type": "boolean"
          },
          "warnings": {
            "description": "What the refresh could not do (a spec file that did not load, a\npackage repository Hugging Face could not list).",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "ok",
          "families",
          "fetched_at",
          "warnings",
          "message"
        ],
        "type": "object"
      },
      "AudioFamily": {
        "description": "One model family (`model_specs/<family>.json`).",
        "properties": {
          "any_installed": {
            "description": "At least one package fully downloaded.",
            "type": "boolean"
          },
          "builtin_voices": {
            "description": "Voices the family ships, and which it uses by default — enough to\nconfigure a TTS row before its container has ever run.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "capabilities": {
            "additionalProperties": true,
            "description": "Per-task capability tags, as the spec writes them.",
            "type": "object"
          },
          "category": {
            "description": "Free-form spec category (`tts`, `asr`, …) — a badge, not an enum.",
            "type": "string"
          },
          "default_voice": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "docs": {
            "description": "`ui.docs` — paths into the audio.cpp repo, rendered as links.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "family": {
            "type": "string"
          },
          "languages": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "options": {
            "$ref": "#/components/schemas/AudioFamilyOptions",
            "description": "The typed options this family accepts, by group. The dashboard's\ncatalog always has them; the tool's full listing leaves them out for\n`options_summary` (they are long) and a listing narrowed by `family`\nhas them."
          },
          "options_summary": {
            "description": "In the tool's full listing instead of `options`: where to get them. Never\nin the dashboard's catalog.",
            "type": "string"
          },
          "packages": {
            "items": {
              "$ref": "#/components/schemas/AudioPackage"
            },
            "type": "array"
          },
          "served": {
            "description": "An enabled audio model of this family loads one of its packages\n(some package's `served`). A row that points at the family's files\nwithout saying which package is the packages' `serving_unclear`; one\nthat loads nothing of the family is `serving_note`.",
            "type": "boolean"
          },
          "serving_note": {
            "description": "One sentence per enabled row of this family that matches none of its\npackages — an empty or missing root, a `weight_id` that picks no file,\nGGUFs no package ships — joined by \"; \". Empty when there is none.",
            "type": "string"
          },
          "status": {
            "description": "`supported` | `community` | `experimental` | `testing` | `wip` — how\nfinished upstream calls this family. Empty when the spec is older than\nthe field.",
            "type": "string"
          },
          "summary": {
            "description": "One extra line the spec offers beside the description.",
            "type": "string"
          },
          "tags": {
            "description": "`ui.tags` — short labels from the project's own WebUI.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "tasks": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "family",
          "display_name",
          "category",
          "description",
          "tasks",
          "languages",
          "status",
          "tags",
          "docs",
          "summary",
          "builtin_voices",
          "default_voice",
          "capabilities",
          "any_installed",
          "served",
          "serving_note",
          "packages"
        ],
        "type": "object"
      },
      "AudioFamilyOption": {
        "description": "One declared option: name, type, and whatever bounds the spec states.",
        "properties": {
          "default": {
            "description": "The engine's default, as JSON; absent when the spec states none."
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "description": "`string` | `int` | `float` | `bool` | `enum` | `path` | … — the spec's\nown vocabulary, not an enum on this side of the wire.",
            "type": "string"
          },
          "max": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "min": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "values": {
            "description": "Accepted values of an enum option (a named preset already expanded).",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "kind",
          "description",
          "required",
          "default",
          "min",
          "max",
          "values"
        ],
        "type": "object"
      },
      "AudioFamilyOptions": {
        "description": "A family's declared options, split the way they are configured: `load` and\n`session` are the two JSON objects on the model row, `request` is what a\ncall may carry.",
        "properties": {
          "load": {
            "items": {
              "$ref": "#/components/schemas/AudioFamilyOption"
            },
            "type": "array"
          },
          "request": {
            "items": {
              "$ref": "#/components/schemas/AudioFamilyOption"
            },
            "type": "array"
          },
          "session": {
            "items": {
              "$ref": "#/components/schemas/AudioFamilyOption"
            },
            "type": "array"
          }
        },
        "required": [
          "request",
          "load",
          "session"
        ],
        "type": "object"
      },
      "AudioInputMode": {
        "anyOf": [
          {
            "const": "off",
            "description": "The chat model reads the transcript.",
            "type": "string"
          },
          {
            "const": "on",
            "description": "A chat model that takes audio hears the turn; the transcript is\nmade beside it.",
            "type": "string"
          }
        ],
        "description": "Whether a voice turn may reach the chat model as audio."
      },
      "AudioInputShown": {
        "description": "`audio_input`: the setting, the level it came from, and the verdict.",
        "properties": {
          "blocked": {
            "$ref": "#/components/schemas/AudioInputVerdict",
            "description": "The verdict a GPU block would bring: its fallback's, or the refusal\nwhen there is none. Absent unless no block is live now and one would\nhand the turn elsewhere."
          },
          "lead": {
            "description": "What handed the turn to `model` when the resolve swapped (\"under the\nGPU hold\"). Absent when nothing did.",
            "type": "string"
          },
          "model": {
            "description": "The model the turn goes to: the thread's, or the fallback a block hands\nit to.",
            "type": "string"
          },
          "path": {
            "$ref": "#/components/schemas/InputPath",
            "description": "`audio` when the model hears the turn, `transcript` otherwise."
          },
          "source": {
            "$ref": "#/components/schemas/VoiceSource",
            "description": "The level `value` came from."
          },
          "value": {
            "$ref": "#/components/schemas/AudioInputMode",
            "description": "The setting in effect."
          },
          "why": {
            "description": "Why the transcript, in the page's words; `null` on the audio path.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "value",
          "source",
          "path",
          "model",
          "why"
        ],
        "type": "object"
      },
      "AudioInputVerdict": {
        "description": "Where a voice turn's words go: as audio, or as the transcript and why.",
        "properties": {
          "blocked": {
            "$ref": "#/components/schemas/AudioInputVerdict",
            "description": "The verdict a GPU block would bring: its fallback's, or the refusal\nwhen there is none. Absent unless no block is live now and one would\nhand the turn elsewhere."
          },
          "lead": {
            "description": "What handed the turn to `model` when the resolve swapped (\"under the\nGPU hold\"). Absent when nothing did.",
            "type": "string"
          },
          "model": {
            "description": "The model the turn goes to: the thread's, or the fallback a block hands\nit to.",
            "type": "string"
          },
          "path": {
            "$ref": "#/components/schemas/InputPath",
            "description": "`audio` when the model hears the turn, `transcript` otherwise."
          },
          "why": {
            "description": "Why the transcript, in the page's words; `null` on the audio path.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "path",
          "model",
          "why"
        ],
        "type": "object"
      },
      "AudioLabForm": {
        "description": "The whole form a kept group stores: which task's panel was shown, every\npanel's fields and the speech settings, so a re-opened group puts the\npage back as it was when it asked. The model is the plan's.",
        "properties": {
          "asr": {
            "$ref": "#/components/schemas/AsrForm",
            "default": {
              "details": false,
              "file_name": "",
              "path": "",
              "source": "upload",
              "stream": false
            }
          },
          "generic": {
            "default": false,
            "description": "The OpenAI-shaped task was sent through `/v1/tasks/run` instead.",
            "type": "boolean"
          },
          "settings": {
            "$ref": "#/components/schemas/AudioSettings2Input",
            "default": {
              "pcm": {
                "bits": "16",
                "channels": "1",
                "rate": "24000"
              },
              "speech": {
                "input": "",
                "instructions": "",
                "language": "",
                "max_tokens": "",
                "model": "",
                "options": "",
                "reference_text": "",
                "response_format": "",
                "seed": "",
                "speed": "",
                "stream": false,
                "voice": "",
                "voice_ref": ""
              }
            }
          },
          "task": {
            "default": "",
            "description": "The task picker's id (`tts`, `asr`, `vc`, ...).",
            "type": "string"
          },
          "tasks": {
            "$ref": "#/components/schemas/TaskForm",
            "default": {
              "flags": {},
              "json": "",
              "stream": false,
              "values": {}
            }
          },
          "timeline_rate": {
            "default": "",
            "description": "The timeline rate field, for spans in samples.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "AudioLabModel": {
        "description": "One enabled audio model, as the lab's pickers need it.",
        "properties": {
          "alias": {
            "description": "The alias to send as `model`: the audio prefix and the model id.",
            "type": "string"
          },
          "family": {
            "description": "The engine family the model runs in (audio.cpp's own name for it).",
            "type": "string"
          },
          "mode": {
            "description": "`offline` or `streaming`; only a streaming model can stream speech.",
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "task": {
            "description": "What the model does: `tts`, `asr`, `align` or another audio.cpp task.\nDecides which panel the lab offers.",
            "type": "string"
          }
        },
        "required": [
          "alias",
          "model_id",
          "family",
          "task",
          "mode"
        ],
        "type": "object"
      },
      "AudioLabUploadRequest": {
        "description": "multipart/form-data. The body size is not limited.",
        "properties": {
          "file": {
            "description": "A clip; send as many file parts as there are clips. A part's file name names the clip: letters, digits, space, '.', '_' and '-', not starting with '.' (anything else is a 400). A clip with the name of a stored one replaces it.",
            "format": "binary",
            "type": "string"
          },
          "transcript": {
            "description": "What the clip says. Applied only when the upload holds exactly one file; blank is ignored.",
            "type": "string"
          }
        },
        "required": [
          "file"
        ],
        "type": "object"
      },
      "AudioModel": {
        "description": "An audio model row (JSON-map fields stay dynamic).",
        "properties": {
          "backend": {
            "description": "`cpu` runs this row on the CPU (no VRAM, served under the GPU hold);\n`None` inherits the class's backend.",
            "type": [
              "string",
              "null"
            ]
          },
          "busy_timeout_ms": {
            "description": "Per-model `busy_timeout_ms` and the ceiling a request's own value is\nclamped to, in ms; `None` inherits the class.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "config_id": {
            "description": "Named config/weights asset ids, for a model directory holding several.",
            "type": [
              "string",
              "null"
            ]
          },
          "default_request_options": {
            "additionalProperties": true,
            "description": "Request-option defaults applied to every call to this model.",
            "type": "object"
          },
          "default_voice_preset": {},
          "enabled": {
            "type": "boolean"
          },
          "extra_run_args": {
            "description": "Per-model `podman run` args override; `None` inherits the audio\nclass settings' `extra_run_args`.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The model or alias that answers whenever this one cannot (the GPU\nhold, VRAM outside lmgw, background traffic deferred, a disabled\nrow), as written. `None` = no fallback.",
            "type": [
              "string",
              "null"
            ]
          },
          "family": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Per-model container image override;\n`None` inherits the audio class settings' image.",
            "type": [
              "string",
              "null"
            ]
          },
          "lazy": {
            "description": "Per-model override of the class's `lazy_load`; `None` inherits.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "load_options": {
            "additionalProperties": true,
            "type": "object"
          },
          "mode": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "model_spec_override": {
            "description": "A `<family>.json` model spec (or a directory of them) under the audio models\ndir that replaces the container image's own catalog for this row.",
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "type": "string"
          },
          "residency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LearnedResidency"
              },
              {
                "type": "null"
              }
            ],
            "description": "What this model's container was measured to hold on the GPU once it\nhad served a request. Learned by the gateway,\nnever by the editor; `audio_model_set`'s `clear: \"residency\"` resets\nit. `None` = not learned, charged at the on-disk size."
          },
          "session_options": {
            "additionalProperties": true,
            "type": "object"
          },
          "task": {
            "type": "string"
          },
          "threads": {
            "description": "Per-row thread count; `None` inherits (this machine's physical cores\nfor a row switched to the CPU itself, else the class's — for a row\nthat inherits a class backend of `cpu` too).",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "voice_presets": {
            "additionalProperties": true,
            "type": "object"
          },
          "warm_start": {
            "description": "Start this model's own container at app launch.",
            "type": "boolean"
          },
          "weight_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "model_id",
          "family",
          "path",
          "task",
          "mode",
          "lazy",
          "busy_timeout_ms",
          "backend",
          "threads",
          "load_options",
          "session_options",
          "default_request_options",
          "model_spec_override",
          "config_id",
          "weight_id",
          "voice_presets",
          "default_voice_preset",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback",
          "residency"
        ],
        "type": "object"
      },
      "AudioModelDetail": {
        "description": "An audio.cpp model read back.",
        "properties": {
          "backend": {
            "description": "`cpu` when the row is switched to the CPU; null inherits the class.",
            "type": [
              "string",
              "null"
            ]
          },
          "busy_timeout_ms": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "config_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_request_options": {
            "additionalProperties": true,
            "type": "object"
          },
          "default_voice_preset": true,
          "effective_extra_run_args": {
            "description": "The `podman run` args in effect, one entry per argument.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "effective_image": {
            "description": "The image the container starts from (the row's, else the class's).",
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "extra_run_args": {
            "description": "`podman run` args override, one entry per argument; null inherits.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The one fallback (openai egress design §14.2), as written; `null` =\nnone.",
            "type": [
              "string",
              "null"
            ]
          },
          "family": {
            "description": "The audio.cpp model-loader family.",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Container image override; null inherits the audio class's.",
            "type": [
              "string",
              "null"
            ]
          },
          "lazy": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "load_options": {
            "additionalProperties": true,
            "type": "object"
          },
          "mode": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "model_spec_override": {
            "type": [
              "string",
              "null"
            ]
          },
          "next_step": {
            "description": "How to prove the model works.",
            "type": "string"
          },
          "path": {
            "description": "The model directory, relative to the audio models dir.",
            "type": "string"
          },
          "path_present": {
            "description": "Whether that path exists.",
            "type": "boolean"
          },
          "problems": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "public_name": {
            "description": "The name clients call it by, with the audio prefix.",
            "type": "string"
          },
          "residency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LearnedResidency"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the container was measured to hold on the GPU."
          },
          "residency_charged_bytes": {
            "description": "The learned residency admission charges, when it belongs to the\ncurrent configuration.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "residency_note": {
            "description": "What the row is charged on the GPU, in a sentence.",
            "type": "string"
          },
          "running": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AudioRunning"
              },
              {
                "type": "null"
              }
            ],
            "description": "The container's state, when one is running."
          },
          "runs_on": {
            "description": "`gpu` or `cpu`.",
            "type": "string"
          },
          "server_json": {
            "description": "The `server.json` entry this row renders to."
          },
          "session_options": {
            "additionalProperties": true,
            "type": "object"
          },
          "task": {
            "type": "string"
          },
          "threads": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "threads_in_effect": {
            "format": "int64",
            "type": "integer"
          },
          "threads_source": {
            "description": "`row`, `class`, `cores` or `logical_cpus`.",
            "type": "string"
          },
          "voice_presets": {
            "additionalProperties": true,
            "type": "object"
          },
          "warm_start": {
            "type": "boolean"
          },
          "weight_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "model_id",
          "public_name",
          "family",
          "path",
          "path_present",
          "task",
          "mode",
          "lazy",
          "busy_timeout_ms",
          "backend",
          "threads",
          "default_request_options",
          "model_spec_override",
          "config_id",
          "weight_id",
          "load_options",
          "session_options",
          "voice_presets",
          "default_voice_preset",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback",
          "residency",
          "effective_image",
          "effective_extra_run_args",
          "runs_on",
          "threads_in_effect",
          "threads_source",
          "server_json",
          "running",
          "residency_note",
          "residency_charged_bytes",
          "problems",
          "next_step"
        ],
        "type": "object"
      },
      "AudioModelView": {
        "properties": {
          "deferrals_24h": {
            "description": "`LocalModelView::deferrals_24h`, for this row's `public_name`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "model": {
            "$ref": "#/components/schemas/AudioModel"
          },
          "public_name": {
            "type": "string"
          },
          "residency_charged_bytes": {
            "description": "The learned residency admission charges this row: `model.residency`'s\nfigure while it belongs to the row's current configuration, `None`\notherwise (not learned, or learned for a previous configuration — the\non-disk size is charged then).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "residency_note": {
            "description": "What the row is charged on the GPU and why, in one sentence: its learned residency, or the\non-disk size it is charged\nat instead — not learned yet, learned for a previous configuration, or\nnot learnable on this host (and why).",
            "type": "string"
          },
          "runs_on": {
            "description": "Where the row runs as configured now: `gpu` | `cpu` (its own\n`backend`, else the class's). A running container keeps the placement\nit was started with until it stops.",
            "type": "string"
          },
          "threads_in_effect": {
            "description": "The thread count its `server.json` renders.",
            "format": "int64",
            "type": "integer"
          },
          "threads_source": {
            "description": "Where that count comes from: `row` | `class` | `cores` (this\nmachine's physical cores, for a row switched to the CPU that names\nnone) | `logical_cpus` (the same, where the core topology could not\nbe read and the figure is the logical CPU count).",
            "type": "string"
          }
        },
        "required": [
          "public_name",
          "model",
          "residency_note",
          "residency_charged_bytes",
          "runs_on",
          "threads_in_effect",
          "threads_source",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "AudioPackage": {
        "description": "One installable package (a file set of a family) plus everything the UI\nneeds to show its state and to prefill the audio-model editor from it.",
        "properties": {
          "availability_note": {
            "description": "What is known about whether the repo publishes this package's files,\nwhen it is not simply \"all of them\": the missing ones with the date of\nthe listing, or why the repo could not be listed. Empty otherwise.",
            "type": "string"
          },
          "description": {
            "description": "What this package is, when the spec says so (a size, a trade).",
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "download_ids": {
            "description": "Tracked download rows for this package's files — the UI joins them\nagainst `GET /api/hf/downloads` for live progress.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "downloaded_from": {
            "description": "Which commit the downloaded files came from, as a sentence — the\ncommit and the revision the download asked for, or \"unknown\" for files\ndownloaded before lmgw recorded it. Empty when nothing is downloaded.",
            "type": "string"
          },
          "file_count": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "format": {
            "description": "`gguf` / `safetensors`.",
            "type": "string"
          },
          "gated": {
            "description": "The repo needs an accepted licence and a token: downloading it without\none fails with 401s, so the UI says so before the click.",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "incomplete": {
            "description": "Downloaded once and short of `missing_files` now, with nothing on\nits way: a download (\"complete install\") fetches those — and, while\na pin is followed, the package's installed files from another commit\nthan the pin, so the package is one commit again.",
            "type": "boolean"
          },
          "installed": {
            "description": "Every file downloaded — the package can be served.",
            "type": "boolean"
          },
          "missing_files": {
            "description": "Spec files the package lacks on this machine, once any of it was\ndownloaded: no finished download, or the file is gone from disk. A\nspec that grew after the package was installed (a new built-in\nvoice) shows up here.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "partial": {
            "description": "Some (not all) files tracked/downloaded.",
            "type": "boolean"
          },
          "pin_followed": {
            "description": "Whether a download takes `pinned_commit`: true under\n`audio.catalog_revision = pinned`, false under `latest`, which takes\n`main` even though the spec pins one. False when nothing is pinned.",
            "type": "boolean"
          },
          "pinned_commit": {
            "description": "The commit the spec pins the package to — its `revision` when that is\na full commit hash; empty when it pins none.",
            "type": "string"
          },
          "precision": {
            "description": "`q8_0`, `f16`, … — empty when the spec names none.",
            "type": "string"
          },
          "recommended": {
            "description": "audio.cpp's recommended package for the family.",
            "type": "boolean"
          },
          "repo": {
            "description": "Hugging Face repo the files come from; empty = no download source in\nthe spec, so the package cannot be installed from here.",
            "type": "string"
          },
          "revision": {
            "description": "The revision the spec names for the package's repo (`main`, or a\ncommit), as written; empty when it names none.",
            "type": "string"
          },
          "served": {
            "description": "An enabled audio model loads this package's weights: the weights file\nlmgw takes the row to load (the GGUFs under its root, narrowed by its\n`weight_id`) belongs to this package and no other — or, for a package\nwithout GGUFs, the package is downloaded and the only one under the\nrow's root. Implies the weights are on disk.",
            "type": "boolean"
          },
          "served_by": {
            "description": "The `model_id`s of the rows that serve it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "serving_unclear": {
            "description": "Non-empty when a row points at this package's files without telling\nit apart from another package (its root holds several and no\n`weight_id` picks one): what it is and how to settle it, one sentence\nper such row.",
            "type": "string"
          },
          "size": {
            "description": "Human size of the downloaded files, empty until they are on disk.",
            "type": "string"
          },
          "suggested_mode": {
            "type": "string"
          },
          "suggested_model_id": {
            "type": "string"
          },
          "suggested_path": {
            "type": "string"
          },
          "suggested_task": {
            "type": "string"
          },
          "unavailable_reason": {
            "description": "Why this package cannot be installed from here, in upstream's words —\na licence that forbids redistribution, a GGUF build not published yet.\nEmpty when it can.",
            "type": "string"
          },
          "unpublished_files": {
            "description": "Spec files the repo does not publish, as of the refresh that listed\nit at the revision a download takes (the pin, when followed): the spec\nis ahead of the weights, and a download would be refused.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "display_name",
          "format",
          "precision",
          "file_count",
          "size",
          "recommended",
          "installed",
          "partial",
          "missing_files",
          "incomplete",
          "description",
          "repo",
          "gated",
          "unavailable_reason",
          "revision",
          "pinned_commit",
          "pin_followed",
          "downloaded_from",
          "unpublished_files",
          "availability_note",
          "served",
          "served_by",
          "serving_unclear",
          "download_ids",
          "suggested_model_id",
          "suggested_path",
          "suggested_task",
          "suggested_mode"
        ],
        "type": "object"
      },
      "AudioRoute": {
        "description": "The route a kept audio group's one cell asks: its plan's variant.",
        "oneOf": [
          {
            "const": "speech",
            "description": "`/v1/audio/speech`, through `/audio-lab/api/speech`.",
            "type": "string"
          },
          {
            "const": "transcription",
            "description": "`/v1/audio/transcriptions`, through `/audio-lab/api/transcriptions`.",
            "type": "string"
          },
          {
            "const": "transcription_details",
            "description": "`/v1/audio/transcriptions/details` (`?details=1`).",
            "type": "string"
          },
          {
            "const": "alignment",
            "description": "`/v1/audio/alignments`, through `/audio-lab/api/alignments`.",
            "type": "string"
          },
          {
            "const": "task_run",
            "description": "`/v1/tasks/run`, through `/audio-lab/api/tasks/run`.",
            "type": "string"
          },
          {
            "const": "task_stream",
            "description": "`/v1/tasks/stream` (`?stream=1`).",
            "type": "string"
          }
        ]
      },
      "AudioRunning": {
        "description": "A running audio container.",
        "properties": {
          "in_flight": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "state",
          "in_flight"
        ],
        "type": "object"
      },
      "AudioSettings": {
        "description": "The audio class settings: the same fields as the chat/aux class settings,\nplus the engine fields that flow into every audio model's own\n`server.json`.",
        "properties": {
          "backend": {
            "type": "string"
          },
          "busy_timeout_ms": {
            "description": "How long a request waits for a model that is already running before it\nfails with `503 server_busy`, in ms. **0 = wait forever.**",
            "format": "int64",
            "type": "integer"
          },
          "catalog_revision": {
            "description": "What an audio catalog download takes: `pinned` (the commit the spec\npins, `main` where it pins none — the default) or `latest` (`main`).",
            "type": "string"
          },
          "device": {
            "format": "int64",
            "type": "integer"
          },
          "extra_run_args": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "idle_unload_ms": {
            "description": "Unload the resident model after this long without a load or run,\nfreeing its VRAM while the container stays up. **0 = never.**",
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "type": "string"
          },
          "lazy_load": {
            "type": "boolean"
          },
          "max_request_body_mb": {
            "description": "Largest request body audiocpp_server buffers, in MiB. **0 = leave the\nkey out**, so the engine's own 2 GiB default applies.",
            "format": "int64",
            "type": "integer"
          },
          "min_free_memory_mb": {
            "description": "Free memory (host and GPU) a model load must leave behind, in MiB.\n**0 = no guard.**",
            "format": "int64",
            "type": "integer"
          },
          "models_dir": {
            "type": "string"
          },
          "public_prefix": {
            "type": "string"
          },
          "request_timeout_seconds": {
            "description": "Per-request ceiling for the class, in seconds. 0 = the maximum possible — no deadline of\nlmgw's own.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "threads": {
            "format": "int64",
            "type": "integer"
          },
          "voice_dir": {
            "description": "Shared voice library as the container sees it (`/models/voices` by\ndefault — the Audio lab's own clips). Empty = no library.",
            "type": "string"
          },
          "voice_transcribe_alias": {
            "description": "The speech-to-text model that writes voice-library clip transcripts\n(its configured fallback answers as for any request). Empty = none:\nnothing is transcribed automatically.",
            "type": "string"
          }
        },
        "required": [
          "image",
          "models_dir",
          "backend",
          "device",
          "threads",
          "lazy_load",
          "busy_timeout_ms",
          "idle_unload_ms",
          "min_free_memory_mb",
          "max_request_body_mb",
          "voice_dir",
          "extra_run_args",
          "public_prefix",
          "request_timeout_seconds",
          "voice_transcribe_alias",
          "catalog_revision"
        ],
        "type": "object"
      },
      "AudioSettings2": {
        "description": "The `audio_settings` preset (labs-store design §5): the speech panel's\nfields and the PCM format a stream is assembled with.",
        "properties": {
          "pcm": {
            "$ref": "#/components/schemas/PcmFormat"
          },
          "speech": {
            "$ref": "#/components/schemas/SpeechForm"
          }
        },
        "required": [
          "speech",
          "pcm"
        ],
        "type": "object"
      },
      "AudioSettings2Input": {
        "description": "The `audio_settings` preset (labs-store design §5): the speech panel's\nfields and the PCM format a stream is assembled with.",
        "properties": {
          "pcm": {
            "$ref": "#/components/schemas/PcmFormatInput",
            "default": {
              "bits": "16",
              "channels": "1",
              "rate": "24000"
            }
          },
          "speech": {
            "$ref": "#/components/schemas/SpeechFormInput",
            "default": {
              "input": "",
              "instructions": "",
              "language": "",
              "max_tokens": "",
              "model": "",
              "options": "",
              "reference_text": "",
              "response_format": "",
              "seed": "",
              "speed": "",
              "stream": false,
              "voice": "",
              "voice_ref": ""
            }
          }
        },
        "type": "object"
      },
      "AudioSettingsPatch": {
        "additionalProperties": false,
        "properties": {
          "backend": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "busy_timeout_ms": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "catalog_revision": {
            "default": null,
            "description": "`pinned` | `latest`. Set by the save, not by `apply`: it is not part\nof the class's container definition.",
            "type": [
              "string",
              "null"
            ]
          },
          "device": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "extra_run_args": {
            "default": null,
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "idle_unload_ms": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "image": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "lazy_load": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "max_request_body_mb": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "min_free_memory_mb": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "models_dir": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "public_prefix": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "request_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "threads": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "voice_dir": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "voice_transcribe_alias": {
            "default": null,
            "description": "Checked by the save (a local `asr` row, or empty), not by `apply`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AudioSpeechRequest": {
        "additionalProperties": true,
        "description": "OpenAI's TTS shape plus audio.cpp's own request options, forwarded with model rewritten to the upstream's own id; a row's configured voice presets apply on top. input may carry inline tags ([laughs], or a stage direction such as (sighs)): rendered by a model whose capabilities.speech.inline_tags says so, stripped everywhere else — never read out. An input of nothing but tags is 400 empty_input, refused before any model is started.",
        "properties": {
          "input": {
            "description": "The text. A local model whose engine refuses a character its package lacks (Supertonic) is sent an equivalent it has in its place, or nothing; the x-lmgw-speech response header names each one. An input left with nothing to say (a lone emoji) is 400 empty_input, refused before any model is started.",
            "type": "string"
          },
          "instructions": {
            "description": "A speaking style, or the description a voice-design model builds its voice from (required there: 400 instructions_required without one, unless the row has a default). Dropped for a model that reads none: capabilities.speech.instructions says which, and the x-lmgw-speech response header says when.",
            "type": "string"
          },
          "language": {
            "description": "An ISO 639-1 code or BCP-47 tag; a local model gets it in its own vocabulary.",
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          },
          "speed": {
            "type": "number"
          },
          "stream_format": {
            "description": "Streams PCM16 (with response_format pcm) as speech.audio.delta events (sse) or as raw chunked PCM (audio). A local model streams only when its row runs in streaming mode; an offline row is 400 streaming_unsupported before anything starts (capabilities.speech.streaming says which). The x-lmgw-sample-rate response header states the PCM's rate.",
            "enum": [
              "sse",
              "audio"
            ],
            "type": "string"
          },
          "voice": {
            "description": "A row's own voice preset id, when it defines any (GET /v1/audio/voices). A voice-library clip with no transcript, for a model that cannot clone one without, is 400 voice_needs_transcript before anything starts (lmgw.needs_transcript in the voice list); send reference_text, or transcribe the clip in the dashboard's Audio lab. A local model whose audio.cpp image lacks eSpeak NG is 400 audio_image_lacks_espeak.",
            "type": "string"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "type": "object"
      },
      "AudioTiming": {
        "description": "The engine's own account of one inference. Each figure is absent when the\nengine leaves it out.",
        "properties": {
          "audio_duration_ms": {
            "description": "Milliseconds of audio the engine processed.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "rtf": {
            "description": "Real-time factor: `wall_ms` over `audio_duration_ms`; below 1 is\nfaster than real time.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "wall_ms": {
            "description": "Wall-clock milliseconds of the inference.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AudioTranscription": {
        "additionalProperties": true,
        "properties": {
          "text": {
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "AudioTranscriptionDetails": {
        "additionalProperties": true,
        "description": "The same transcription, plus the detail arrays the plain route leaves out.",
        "properties": {
          "segments": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "speaker_turns": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "text": {
            "type": "string"
          },
          "words": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "AudioTranscriptionsRequest": {
        "description": "multipart/form-data (also accepted as application/json with the same fields but no upload: instead of file, audio names a clip by its path on the model server's own filesystem, e.g. /models/clip.wav, and the body is relayed with model rewritten; the multipart form is what real clients send).",
        "properties": {
          "file": {
            "format": "binary",
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          },
          "temperature": {
            "type": "number"
          }
        },
        "required": [
          "file",
          "model"
        ],
        "type": "object"
      },
      "AudioVoices": {
        "additionalProperties": true,
        "description": "lmgw's own route. A local audio model is answered from lmgw's catalog without starting it (?probe=engine asks its own server, starting it); a remote one is asked.",
        "properties": {
          "lmgw": {
            "description": "Only on a local audio model answered from lmgw's catalog (x-lmgw-voices-source: config).",
            "properties": {
              "default": {
                "description": "What speaks when a request names no voice.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "engine_asked": {
                "type": "boolean"
              },
              "entries": {
                "items": {
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "preset",
                        "library",
                        "native",
                        "embedding"
                      ],
                      "type": "string"
                    },
                    "send": {
                      "description": "Where lmgw puts the name in the engine's request; clients always send it as `voice`.",
                      "enum": [
                        "voice",
                        "options.voice_id"
                      ],
                      "type": "string"
                    },
                    "transcript": {
                      "description": "A library clip's transcript is recorded.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "send"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "held": {
                "description": "The GPU hold (or a benchmark run) holds the card and the model has no fallback: the list stands, its speech is refused (503 gpu_hold) until the hold is released.",
                "type": "boolean"
              },
              "missing": {
                "description": "Voices the spec names whose file the package lacks.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "needs_transcript": {
                "description": "The model cannot clone a library clip without its transcript: speech with an entry whose `transcript` is false is refused (400 voice_needs_transcript) until it has one (the dashboard's Audio lab, Transcribe).",
                "type": "boolean"
              },
              "source": {
                "enum": [
                  "config"
                ],
                "type": "string"
              }
            },
            "required": [
              "source",
              "engine_asked",
              "held",
              "entries",
              "default",
              "missing",
              "needs_transcript"
            ],
            "type": "object"
          },
          "voices": {
            "description": "Every name the model answers to as `voice`, sorted; for a probe of the engine or of a remote upstream, as that source sent it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "voices"
        ],
        "type": "object"
      },
      "AuxModel": {
        "description": "An aux container model row — embedders, rerankers and decision models\nalike.",
        "properties": {
          "args": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "backend": {
            "description": "`cpu` runs the row on the CPU (no VRAM charged, served under the GPU\nhold); null runs it on the GPU.",
            "type": [
              "string",
              "null"
            ]
          },
          "batch_size": {
            "description": "`--batch-size`; null takes llama-server's default.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "ctx_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "extra_run_args": {
            "description": "Per-model `podman run` args override; `None` inherits the aux\nclass settings' `extra_run_args`.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The model or alias that answers whenever this one cannot (the GPU\nhold, VRAM outside lmgw, background traffic deferred, a disabled\nrow), as written. `None` = no fallback.",
            "type": [
              "string",
              "null"
            ]
          },
          "gguf_path": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Per-model container image override;\n`None` inherits the aux class settings' image.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "description": "`embed` | `rerank` | `decision`.",
            "type": "string"
          },
          "mmproj_path": {
            "description": "A projector (`--mmproj`), relative to the aux models dir.",
            "type": [
              "string",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "pooling": {
            "type": [
              "string",
              "null"
            ]
          },
          "threads": {
            "description": "`--threads`; null renders none on the GPU, and on the CPU this\nmachine's physical cores (the logical CPU count where the core\ntopology cannot be read) unless the row's extra args name a count.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "ubatch_size": {
            "description": "`--ubatch-size`; null takes llama-server's default.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "warm_start": {
            "description": "Start this model's own container at app launch.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "gguf_path",
          "kind",
          "pooling",
          "ctx_size",
          "ubatch_size",
          "batch_size",
          "mmproj_path",
          "backend",
          "threads",
          "args",
          "idle_seconds",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback"
        ],
        "type": "object"
      },
      "AuxModelDetail": {
        "description": "An aux (embedding, rerank or decision) model read back.",
        "properties": {
          "backend": {
            "description": "`cpu` runs the row on the CPU; null runs it on the GPU.",
            "type": [
              "string",
              "null"
            ]
          },
          "batch_size": {
            "description": "`--batch-size`; null takes llama-server's default.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "command_line": {
            "description": "The `podman run …` command line this model renders to.",
            "type": "string"
          },
          "ctx_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "downloaded_from": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DownloadedFrom"
              },
              {
                "type": "null"
              }
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoint": {
            "description": "The route that serves it: `/v1/embeddings`, `/v1/rerank` or\n`/v1/systemone`.",
            "type": "string"
          },
          "extra_args": {
            "description": "One entry per llama-server option (round-trips with the patch field).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "extra_run_args": {
            "description": "`podman run` args override, one entry per argument; null inherits.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The one fallback (openai egress design §14.2), as written; `null` =\nnone.",
            "type": [
              "string",
              "null"
            ]
          },
          "fit_note": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FitNote"
              },
              {
                "type": "null"
              }
            ],
            "description": "The note of a context fitted to the graphics card (find-a-model\ndesign D26): Get it's or \"Fit again\"'s; `None` when the row's\ncontext isn't a fit's shorter one."
          },
          "gguf_path": {
            "type": "string"
          },
          "gguf_present": {
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Container image override; null inherits the aux class's.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "description": "`embed`, `rerank` or `decision`.",
            "type": "string"
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the GGUF header states; null when it states none."
          },
          "mmproj_path": {
            "description": "A projector (`--mmproj`), relative to the aux models dir.",
            "type": [
              "string",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "pooling": {
            "type": [
              "string",
              "null"
            ]
          },
          "problems": {
            "description": "Static findings; empty is not proof it loads.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "public_name": {
            "description": "The name clients call it by, with the aux prefix.",
            "type": "string"
          },
          "source": {
            "description": "`hf` or `manual`.",
            "type": "string"
          },
          "threads": {
            "description": "`--threads`; null renders none on the GPU, and on the CPU this\nmachine's physical cores (the logical CPU count where the core\ntopology cannot be read) unless the row's extra args name a count.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "threads_in_effect": {
            "description": "The thread count its container starts with: `threads`, else a count\nthe extra args name, else on the CPU this machine's cores. Null when\nnothing names one (a GPU row: llama-server picks) or the args' value\nis not a number.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "threads_source": {
            "$ref": "#/components/schemas/AuxThreadsSource",
            "description": "Where `threads_in_effect` comes from."
          },
          "ubatch_size": {
            "description": "`--ubatch-size`; null takes llama-server's default.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "warm_start": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "public_name",
          "kind",
          "endpoint",
          "pooling",
          "ctx_size",
          "ubatch_size",
          "batch_size",
          "mmproj_path",
          "backend",
          "threads",
          "threads_in_effect",
          "threads_source",
          "gguf_path",
          "gguf_present",
          "licence",
          "source",
          "downloaded_from",
          "extra_args",
          "idle_seconds",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback",
          "command_line",
          "problems",
          "fit_note"
        ],
        "type": "object"
      },
      "AuxModelView": {
        "properties": {
          "deferrals_24h": {
            "description": "`LocalModelView::deferrals_24h`, for this row's `public_name`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the row's GGUF header states; null when it states none\nor the file cannot be read."
          },
          "model": {
            "$ref": "#/components/schemas/AuxModel"
          },
          "public_name": {
            "type": "string"
          },
          "threads_in_effect": {
            "description": "The thread count its container starts with: the row's `threads`, else\na count its extra args name, else on the CPU this machine's cores.\nNull when nothing names one (a GPU row: llama-server picks) or the\nargs' value is not a number.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "threads_source": {
            "$ref": "#/components/schemas/AuxThreadsSource",
            "description": "Where `threads_in_effect` comes from."
          }
        },
        "required": [
          "public_name",
          "model",
          "licence",
          "threads_in_effect",
          "threads_source",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "AuxRouterSettings": {
        "description": "The aux class settings: the chat/aux class fields, flat beside the prefix\nof the decision rows (decision-models design §3.10). Dereferences to the\nclass fields.",
        "properties": {
          "decision_prefix": {
            "description": "Namespace of the decision rows (`decide` → `decide/<model id>`);\nembedders and rerankers are under `public_prefix`. Empty = bare ids.",
            "type": "string"
          },
          "extra_run_args": {
            "description": "Class default; a model's own `extra_run_args` overrides it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "image": {
            "description": "Class default; a model's own `image` overrides it.",
            "type": "string"
          },
          "models_dir": {
            "type": "string"
          },
          "public_prefix": {
            "type": "string"
          },
          "request_timeout_seconds": {
            "description": "Per-request ceiling for the class, in seconds: how long lmgw waits for\nan answer to start, and how long a streamed answer may then go\nwithout an event before lmgw ends it with an error. **0 = the maximum\npossible** — no deadline of lmgw's own. One per class since the four\nstopped sharing a single 600 s constant.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image",
          "models_dir",
          "extra_run_args",
          "public_prefix",
          "request_timeout_seconds",
          "decision_prefix"
        ],
        "type": "object"
      },
      "AuxRouterSettingsPatch": {
        "additionalProperties": false,
        "description": "The aux class's patch: the class fields and the decision rows' prefix\n(decision-models design §3.10). Its own type rather than a flattened\n`RouterSettingsPatch`, because a patch denies unknown fields and serde\ncannot do that through a flatten.",
        "properties": {
          "decision_prefix": {
            "default": null,
            "description": "The prefix decision rows are exposed under (`decide`); `\"\"` = bare ids.",
            "type": [
              "string",
              "null"
            ]
          },
          "extra_run_args": {
            "default": null,
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "image": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "models_dir": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "public_prefix": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "request_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AuxThreadsSource": {
        "description": "Where an aux row's thread count comes from.",
        "oneOf": [
          {
            "const": "row",
            "description": "The row's own `threads`.",
            "type": "string"
          },
          {
            "const": "args",
            "description": "A `--threads`/`-t` in the row's extra args, rendered as written.",
            "type": "string"
          },
          {
            "const": "cores",
            "description": "This machine's physical cores: a row on the CPU that names no count.",
            "type": "string"
          },
          {
            "const": "logical_cpus",
            "description": "`Cores` where the core topology could not be read: the\nlogical CPU count stands in.",
            "type": "string"
          },
          {
            "const": "llama_server",
            "description": "No count: a GPU row that names none renders no `--threads`, and\nllama-server picks.",
            "type": "string"
          }
        ]
      },
      "BaseUrl": {
        "properties": {
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "label"
        ],
        "type": "object"
      },
      "BatchColumn": {
        "description": "One column of the file.",
        "properties": {
          "json": {
            "description": "Every non-empty value is a JSON object or array (in JSONL, written as\none or as a string holding one): the state's JSON mode fits it.",
            "type": "boolean"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "json"
        ],
        "type": "object"
      },
      "BatchFormat": {
        "description": "The uploaded file's format.",
        "oneOf": [
          {
            "const": "csv",
            "description": "RFC 4180 with a header row.",
            "type": "string"
          },
          {
            "const": "jsonl",
            "description": "One JSON object per line; its columns are its top-level keys.",
            "type": "string"
          }
        ]
      },
      "BatchFromAgentSkip": {
        "description": "Why a row of the apply job is no item.",
        "oneOf": [
          {
            "const": "never_asked",
            "description": "The model was never asked about it (no id, or its fetch failed): it\nhas no state to ask again.",
            "type": "string"
          },
          {
            "const": "call_failed",
            "description": "Its call failed and its output is still the fallback the failure\ngave it: no answer, and no label of the owner's.",
            "type": "string"
          }
        ]
      },
      "BatchFromAgentSkipped": {
        "description": "A row of the apply job that is no item.",
        "properties": {
          "id": {
            "description": "The row's id.",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/BatchFromAgentSkip"
          },
          "reason": {
            "description": "Why it is no item, with the row's error.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "reason"
        ],
        "type": "object"
      },
      "BatchMapping": {
        "description": "Which columns a set run reads. A column is named by its header; a\ncolumn whose header is empty cannot be mapped (give it a name in the\nfile).",
        "properties": {
          "key": {
            "description": "The column holding each item's own key (a ticket number, a row id):\nkept per item and carried into both exports, so an answer can be\nmatched back to its source row. Absent, none; an empty value is no\nkey.",
            "type": [
              "string",
              "null"
            ]
          },
          "labels": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Per question id, the column holding its expected answer: an option's\nname (`choice`); yes, no, true, false, 1 or 0 (`noul`); a level's\nexact text or its index, as the whole column reads\n(`score_labels`). An empty value is no label.",
            "type": "object"
          },
          "score_labels": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ScoreLabels"
            },
            "description": "Per `score` question id, how its label column reads. A question not\nnamed here reads as its column does: as level texts when every\nnon-empty value is a level's exact text, as indices when every one is\nan index in range. When both fit and disagree (a scale written \"1\" to\n\"5\" and values \"1\" to \"4\"), or the column mixes the two, the input is\nrefused until this says which.",
            "type": "object"
          },
          "state": {
            "description": "The column holding each item's state. Required.",
            "type": "string"
          },
          "state_mode": {
            "$ref": "#/components/schemas/StateMode",
            "description": "How that column's values are sent: as text, or as JSON (each value\nmust parse)."
          }
        },
        "required": [
          "state",
          "state_mode",
          "key",
          "labels",
          "score_labels"
        ],
        "type": "object"
      },
      "BatchMappingInput": {
        "description": "Which columns a set run reads. A column is named by its header; a\ncolumn whose header is empty cannot be mapped (give it a name in the\nfile).",
        "properties": {
          "key": {
            "default": null,
            "description": "The column holding each item's own key (a ticket number, a row id):\nkept per item and carried into both exports, so an answer can be\nmatched back to its source row. Absent, none; an empty value is no\nkey.",
            "type": [
              "string",
              "null"
            ]
          },
          "labels": {
            "additionalProperties": {
              "type": "string"
            },
            "default": {},
            "description": "Per question id, the column holding its expected answer: an option's\nname (`choice`); yes, no, true, false, 1 or 0 (`noul`); a level's\nexact text or its index, as the whole column reads\n(`score_labels`). An empty value is no label.",
            "type": "object"
          },
          "score_labels": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ScoreLabels"
            },
            "default": {},
            "description": "Per `score` question id, how its label column reads. A question not\nnamed here reads as its column does: as level texts when every\nnon-empty value is a level's exact text, as indices when every one is\nan index in range. When both fit and disagree (a scale written \"1\" to\n\"5\" and values \"1\" to \"4\"), or the column mixes the two, the input is\nrefused until this says which.",
            "type": "object"
          },
          "state": {
            "default": "",
            "description": "The column holding each item's state. Required.",
            "type": "string"
          },
          "state_mode": {
            "$ref": "#/components/schemas/StateMode",
            "default": "text",
            "description": "How that column's values are sent: as text, or as JSON (each value\nmust parse)."
          }
        },
        "type": "object"
      },
      "BatchProblem": {
        "description": "What stops a file from being run: a line that does not read, a column\nthat is not there, a state or a label that is no answer.",
        "properties": {
          "column": {
            "description": "The column at fault.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/BatchProblemKind"
          },
          "line": {
            "description": "The line the row starts on, from 1 (the header is line 1 of a CSV);\n`null` for the mapping.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "message": {
            "description": "The whole problem in a sentence, row and value included.",
            "type": "string"
          },
          "question": {
            "description": "The question it is about (a label, a `labels` or `score_labels`\nentry); `null` for the file, the state and the state or key column.",
            "type": [
              "string",
              "null"
            ]
          },
          "row": {
            "description": "The item's number, from 1; `null` for the file or the mapping.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "value": {
            "description": "The value at fault, as read.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "question",
          "row",
          "line",
          "column",
          "value",
          "message"
        ],
        "type": "object"
      },
      "BatchProblemKind": {
        "description": "What kind of problem a `BatchProblem` is, for a client that acts on one\nwithout reading its message.",
        "oneOf": [
          {
            "const": "file",
            "description": "The file itself: a line that does not read, a header, no rows.",
            "type": "string"
          },
          {
            "const": "mapping",
            "description": "The mapping: a column it names that is empty, missing or named twice,\nor a `labels` or `score_labels` entry naming no question it can take.",
            "type": "string"
          },
          {
            "const": "state",
            "description": "A row's state: empty, or no JSON in JSON mode.",
            "type": "string"
          },
          {
            "const": "label",
            "description": "A row's label that is no answer of its question.",
            "type": "string"
          },
          {
            "const": "score_labels_needed",
            "description": "A `score` question's label column reads both as level texts and as\nindices with different meanings, or mixes the two: the mapping's\n`score_labels` for `question` has to say which.",
            "type": "string"
          }
        ]
      },
      "BatchStatus": {
        "description": "Where a set run is.",
        "oneOf": [
          {
            "const": "running",
            "description": "Its job is answering items now.",
            "type": "string"
          },
          {
            "const": "done",
            "description": "Every item has a run.",
            "type": "string"
          },
          {
            "const": "canceled",
            "description": "Cancelled with items left; Resume runs the rest.",
            "type": "string"
          },
          {
            "const": "interrupted",
            "description": "Its job ended with items left: a restart of the gateway, a failure\n(`job_error` says which: lmgw refusing before the model was asked,\nsuch as the GPU hold, ends the job too), or a job row since pruned.\nResume runs the rest.",
            "type": "string"
          },
          {
            "const": "not_started",
            "description": "No job ran it yet.",
            "type": "string"
          }
        ]
      },
      "BatchView": {
        "description": "A set run.",
        "properties": {
          "cancel_requested": {
            "description": "A Cancel already went to the job that runs it now: the next Cancel\naborts the calls in flight (their answers are not kept). False when\nno job runs it.",
            "type": "boolean"
          },
          "concurrency": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "done": {
            "description": "Items with a run, whatever it answered: the progress.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "failed": {
            "description": "Of those, the runs the route did not answer with a 2xx.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "job_error": {
            "description": "That job's error when it failed (`interrupted by shutdown` after a\nrestart).",
            "type": [
              "string",
              "null"
            ]
          },
          "job_id": {
            "description": "The last job that ran it (no longer listed once pruned): the live\none while it runs.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "lab": {
            "$ref": "#/components/schemas/LabKind"
          },
          "labelled": {
            "description": "Items with at least one expected answer.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "mapping": {
            "$ref": "#/components/schemas/BatchMapping"
          },
          "model": {
            "type": "string"
          },
          "preset_id": {
            "description": "The saved set it ran; `null` for an unsaved set, or one deleted\nsince.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "preset_name": {
            "description": "The saved set's name, when it is still there.",
            "type": [
              "string",
              "null"
            ]
          },
          "set": {
            "$ref": "#/components/schemas/QuestionSet",
            "description": "The set as run: later edits of the saved set do not change it."
          },
          "source_name": {
            "description": "The uploaded file's name.",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/BatchStatus"
          },
          "total": {
            "description": "Items in all.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "unreadable": {
            "description": "Of those, the 2xx runs that do not read as an answer to every\nquestion of the set (the metrics count them per question as\n`unreadable`).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "lab",
          "preset_id",
          "preset_name",
          "set",
          "model",
          "source_name",
          "mapping",
          "concurrency",
          "status",
          "total",
          "done",
          "failed",
          "unreadable",
          "labelled",
          "job_id",
          "job_error",
          "cancel_requested",
          "created_at"
        ],
        "type": "object"
      },
      "BenchBlocked": {
        "properties": {
          "message": {
            "description": "The sentence to show.",
            "type": "string"
          },
          "reason": {
            "$ref": "#/components/schemas/BlockedReason"
          },
          "run_id": {
            "description": "The running run, for the `run_going` reason.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "reason",
          "message",
          "run_id"
        ],
        "type": "object"
      },
      "BenchComparison": {
        "description": "A run against another: the previous comparable run for `bench_run`.",
        "properties": {
          "base_created_at": {
            "type": "string"
          },
          "base_run_id": {
            "format": "int64",
            "type": "integer"
          },
          "comparable": {
            "description": "Same model file, settings hash, suite version and GPU.",
            "type": "boolean"
          },
          "improvements": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "metrics": {
            "items": {
              "$ref": "#/components/schemas/MetricDelta"
            },
            "type": "array"
          },
          "not_comparable": {
            "description": "Why not, when not.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "probes": {
            "items": {
              "$ref": "#/components/schemas/ProbeChange"
            },
            "type": "array"
          },
          "regressions": {
            "description": "Metrics and probes flagged each way (`not_same_point` and\n`missing` count for neither).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "threshold_pct": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "base_run_id",
          "base_created_at",
          "comparable",
          "not_comparable",
          "threshold_pct",
          "metrics",
          "probes",
          "regressions",
          "improvements"
        ],
        "type": "object"
      },
      "BenchOverrides": {
        "description": "What a run changes about the row's container, and only about the\nbench container. `None` (and `false`, `0`) is \"as the row says\".",
        "properties": {
          "batch_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cache_type_k": {
            "type": [
              "string",
              "null"
            ]
          },
          "cache_type_v": {
            "type": [
              "string",
              "null"
            ]
          },
          "ctx_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "flash_attn": {
            "description": "`auto` / `on` / `off`.",
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "description": "Another image, e.g. an Engines page build (comparing two builds is two runs\nof one row with two images).",
            "type": [
              "string",
              "null"
            ]
          },
          "kv_unified": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "n_gpu_layers": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "no_draft": {
            "description": "Run without the row's speculative drafter.",
            "type": "boolean"
          },
          "parallel": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "rung": {
            "description": "A ladder row's rung, 0 = base.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "ubatch_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "rung",
          "image",
          "ctx_size",
          "parallel",
          "ubatch_size",
          "batch_size",
          "cache_type_k",
          "cache_type_v",
          "flash_attn",
          "kv_unified",
          "n_gpu_layers",
          "no_draft"
        ],
        "type": "object"
      },
      "BenchRun": {
        "description": "One stored run, whole: every column, the JSON ones typed.",
        "properties": {
          "build": {
            "$ref": "#/components/schemas/BuildIdentity"
          },
          "command_line": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "gpu": {
            "$ref": "#/components/schemas/GpuIdentity"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "image_ref": {
            "type": "string"
          },
          "job_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "model": {
            "$ref": "#/components/schemas/ModelIdentity"
          },
          "notes": {
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/SuiteParams"
          },
          "probes": {
            "$ref": "#/components/schemas/ProbeReport"
          },
          "results": {
            "$ref": "#/components/schemas/RunResults"
          },
          "settings": {
            "$ref": "#/components/schemas/BenchSettings"
          },
          "settings_hash": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/BenchStatus"
          },
          "status_reason": {
            "description": "Why it ended the way it did, in one word where there is one\n(`hold`, `canceled`, `shutdown`).",
            "type": [
              "string",
              "null"
            ]
          },
          "suite_version": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "timeline": {
            "$ref": "#/components/schemas/Timeline"
          },
          "unreadable": {
            "description": "The JSON columns that did not decode, each as \"<column>: <why>\". Each reads as its empty\ndefault here, so the run\nis comparable with nothing ):\nread as empty, it would compare as \"measured nothing\".",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "job_id",
          "created_at",
          "finished_at",
          "status",
          "status_reason",
          "error",
          "model",
          "image_ref",
          "image_id",
          "build",
          "settings",
          "settings_hash",
          "command_line",
          "gpu",
          "suite_version",
          "params",
          "results",
          "probes",
          "timeline",
          "notes"
        ],
        "type": "object"
      },
      "BenchRunSummary": {
        "description": "One row of the runs table.",
        "properties": {
          "build_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "commit": {
            "type": [
              "string",
              "null"
            ]
          },
          "complete": {
            "description": "Every selected phase finished without an error.",
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "engine_slug": {
            "description": "`dev.lmgw.slug`, `org.opencontainers.image.version`, the commit and\n`/props` `build_info` — whichever the build has.",
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "gpu_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "headline": {
            "$ref": "#/components/schemas/Headline"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image_ref": {
            "type": "string"
          },
          "improvements": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "job_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "phases": {
            "items": {
              "$ref": "#/components/schemas/Phase"
            },
            "type": "array"
          },
          "previous_id": {
            "description": "The previous comparable run, when there is one.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "probes_judged": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "probes_passed": {
            "description": "Probes that passed, and probes that gave a verdict (`pass`, `fail`,\n`error` — not `info` or `skipped`).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "quant": {
            "type": [
              "string",
              "null"
            ]
          },
          "regressions": {
            "description": "Against it, at the answer's `threshold_pct`.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "repetitions": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "rung": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/BenchStatus"
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "suite_version": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "throttled": {
            "type": "boolean"
          },
          "unreadable": {
            "description": "The stored columns that did not decode. Such a\nrun is listed with what could be read, and compared with nothing.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "job_id",
          "created_at",
          "finished_at",
          "status",
          "status_reason",
          "error",
          "complete",
          "model_id",
          "quant",
          "rung",
          "image_ref",
          "engine_slug",
          "version",
          "commit",
          "build_info",
          "gpu_name",
          "throttled",
          "suite_version",
          "repetitions",
          "phases",
          "headline",
          "probes_passed",
          "probes_judged",
          "notes",
          "previous_id",
          "regressions",
          "improvements"
        ],
        "type": "object"
      },
      "BenchSettings": {
        "description": "The `settings` of a run: what the bench container runs,\nafter the overrides.\n\n**The settings hash covers `params`, `args` and `extra_run_args` only**: the image is the build\nidentity and may differ between\ncomparable runs (that is the point of comparing builds), the weights file\nis the model identity, and `overrides` only says how these values came\nabout — the same effective flags reached with or without an override are\nthe same settings.",
        "properties": {
          "args": {
            "description": "The row's freeform llama-server flags (minus the drafter's, with\n`no_draft`).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "extra_run_args": {
            "description": "`podman run` flags (GPU devices, …): the row's, or its class's.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "gguf_path": {
            "description": "The weights file, relative to the chat models dir (the rung's own for\na ladder rung).",
            "type": "string"
          },
          "image": {
            "description": "The resolved image the run starts (override, row, or class default).",
            "type": "string"
          },
          "overrides": {
            "$ref": "#/components/schemas/BenchOverrides"
          },
          "params": {
            "description": "The effective `LlamaParams`, as the row stores them."
          },
          "rung": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image",
          "gguf_path",
          "rung",
          "params",
          "args",
          "extra_run_args",
          "overrides"
        ],
        "type": "object"
      },
      "BenchStatus": {
        "description": "How a run ended.",
        "oneOf": [
          {
            "enum": [
              "running",
              "done",
              "failed",
              "canceled"
            ],
            "type": "string"
          },
          {
            "const": "aborted",
            "description": "Ended by something other than a cancel request — the GPU hold\nswitching on (`status_reason: \"hold\"`).",
            "type": "string"
          },
          {
            "const": "interrupted",
            "description": "Found `running` at boot: lmgw went away mid-run.",
            "type": "string"
          }
        ]
      },
      "BenchStop": {
        "description": "One container a start stops — what the confirmation lists.",
        "properties": {
          "busy": {
            "description": "Serving lmgw requests right now, or still starting: the run waits for\nit to drain rather than cutting it off. A client generating on the\ncontainer's own port is only seen at start time (`/slots`).",
            "type": "boolean"
          },
          "class": {
            "description": "`chat` | `aux` | `audio` | `image`.",
            "type": "string"
          },
          "container_name": {
            "type": "string"
          },
          "in_flight": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "model_id": {
            "type": "string"
          },
          "state": {
            "description": "The registry's state: `starting` | `ready` | `stopping`.",
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id",
          "container_name",
          "state",
          "busy",
          "in_flight"
        ],
        "type": "object"
      },
      "BesideTerms": {
        "description": "What else is on the card, for the beside measure.",
        "properties": {
          "outside_bytes": {
            "description": "Other programs' use; `None` when it couldn't be told (the note says\nwhy), and then the measure is the card less lmgw's models alone.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "residents_bytes": {
            "description": "lmgw's own models on the card now.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "outside_bytes",
          "residents_bytes"
        ],
        "type": "object"
      },
      "BlockedReason": {
        "description": "Why a run cannot start now.",
        "oneOf": [
          {
            "enum": [
              "row_disabled"
            ],
            "type": "string"
          },
          {
            "const": "hold",
            "description": "The GPU hold is on: a benchmark is lmgw using VRAM.",
            "type": "string"
          },
          {
            "const": "run_going",
            "description": "Another run holds the card; `run_id` names it.",
            "type": "string"
          },
          {
            "const": "row_missing",
            "description": "No chat row has this id.",
            "type": "string"
          },
          {
            "const": "not_chat",
            "description": "The id names an aux, audio or image row.",
            "type": "string"
          },
          {
            "const": "rung_out_of_range",
            "description": "`rung` is past the row's top rung.",
            "type": "string"
          },
          {
            "const": "image_missing",
            "description": "The image is not on this machine: `podman run` would pull it and the\nload phase would time the download.",
            "type": "string"
          },
          {
            "const": "no_weights",
            "description": "The chat models dir is not configured, or the weights are not in it.",
            "type": "string"
          },
          {
            "const": "booting",
            "description": "lmgw has just started and has not yet adopted the containers a\nprevious lmgw left running: the drain could not see them yet.",
            "type": "string"
          },
          {
            "const": "invalid_image",
            "description": "The `image` override is not an image reference: it starts with `-`\n(podman would read it as a flag) or holds whitespace.",
            "type": "string"
          }
        ]
      },
      "Build": {
        "description": "One `builds` row: the editable definition plus its identity.",
        "properties": {
          "arch": {
            "description": "Compute capabilities / GPU targets (`[\"89\"]`, `[\"86\", \"89\"]`,\n`[\"gfx1100\"]`). `None` = auto-detect from the host GPUs.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "backend": {
            "$ref": "#/components/schemas/GpuBackend"
          },
          "build_args": {
            "description": "Extra `--build-arg` lines, one `KEY=VALUE` per line.",
            "type": "string"
          },
          "ccache": {
            "type": "boolean"
          },
          "ccache_max_size": {
            "description": "`CCACHE_MAXSIZE`, e.g. `10G`, `500M`; `0` is ccache's \"no limit\".",
            "type": "string"
          },
          "cpus": {
            "description": "`--cpuset-cpus` (`0-15`, `0,2,4`). `None` = all cores. Needs podman to\nhave the `cpuset` cgroup controller (rootless: delegated to\n`user@.service`); without it a save and a run refuse, naming the fix.\nCPUs the host does not have online are refused the same way.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "cuda_version": {
            "description": "`None` = the preset's default for the engine.",
            "type": [
              "string",
              "null"
            ]
          },
          "dockerfile": {
            "description": "Repo-relative Dockerfile path. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          },
          "edits": {
            "description": "`None` = the preset's edits for the resolved Dockerfile; `Some` = this\nexplicit, customized list (which may be empty: no edits at all).",
            "items": {
              "$ref": "#/components/schemas/BuildEdit"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "engine": {
            "$ref": "#/components/schemas/Engine"
          },
          "extras": {
            "description": "Merged on top of `git_ref`, in order.",
            "items": {
              "$ref": "#/components/schemas/BuildExtra"
            },
            "type": "array"
          },
          "forge": {
            "$ref": "#/components/schemas/Forge"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "keep_layers": {
            "description": "Keep podman's layer cache (`--layers=true`). Off by default: no\nmulti-GiB intermediates are left behind.",
            "type": "boolean"
          },
          "keep_runs": {
            "description": "How many previous runs' immutable tags to keep. `None` = keep all.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "ref": {
            "description": "Branch, tag or commit to build on.",
            "type": "string"
          },
          "repo_url": {
            "description": "A preset or any git URL (`https://`, `http://`, `ssh://`,\n`git@host:path`, `file://`).",
            "type": "string"
          },
          "slug": {
            "description": "Becomes the tag. Tag charset, bounded so the longest immutable tag\nfits 128 characters, and immutable once the build has a run.",
            "type": "string"
          },
          "target": {
            "description": "Final build stage. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "engine",
          "repo_url",
          "forge",
          "ref",
          "extras",
          "backend",
          "cuda_version",
          "arch",
          "dockerfile",
          "target",
          "edits",
          "ccache",
          "ccache_max_size",
          "cpus",
          "build_args",
          "keep_layers",
          "keep_runs",
          "notes",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "BuildEdit": {
        "description": "One Dockerfile edit: a literal find/replace of\n**every** occurrence, applied to a copy of the Dockerfile, never to the\ncheckout, in list order (a later edit sees what the earlier ones wrote).\nEach one is logged as applied or not matched; a `required` edit that does\nnot match fails the run.\n\n`find` and `replace` may carry `{{ccache_id}}`, `{{npm_cache_id}}`,\n`{{ccache_max_size}}`, `{{ccache_shared_mount}}`/`{{ccache_seed}}` and\n`{{npm_shared_mount}}`/`{{npm_seed}}`, filled in per run, so an edit list\nstays the same when only a cache id or the size changes. The last two\npairs render empty for a plain build; with extras they mount the shared\nccache/npm cache read-only and seed the build's own from it. `name` and\n`role` are for the log and the ccache switch; neither changes the image,\nso neither is hashed.",
        "properties": {
          "find": {
            "type": "string"
          },
          "name": {
            "description": "Short label for the log and the editor (`ccache-mount`). May be empty.",
            "type": "string"
          },
          "replace": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "role": {
            "$ref": "#/components/schemas/EditRole"
          }
        },
        "required": [
          "role",
          "find",
          "replace",
          "required"
        ],
        "type": "object"
      },
      "BuildEditInput": {
        "description": "One Dockerfile edit: a literal find/replace of\n**every** occurrence, applied to a copy of the Dockerfile, never to the\ncheckout, in list order (a later edit sees what the earlier ones wrote).\nEach one is logged as applied or not matched; a `required` edit that does\nnot match fails the run.\n\n`find` and `replace` may carry `{{ccache_id}}`, `{{npm_cache_id}}`,\n`{{ccache_max_size}}`, `{{ccache_shared_mount}}`/`{{ccache_seed}}` and\n`{{npm_shared_mount}}`/`{{npm_seed}}`, filled in per run, so an edit list\nstays the same when only a cache id or the size changes. The last two\npairs render empty for a plain build; with extras they mount the shared\nccache/npm cache read-only and seed the build's own from it. `name` and\n`role` are for the log and the ccache switch; neither changes the image,\nso neither is hashed.",
        "properties": {
          "find": {
            "default": "",
            "type": "string"
          },
          "name": {
            "description": "Short label for the log and the editor (`ccache-mount`). May be empty.",
            "type": "string"
          },
          "replace": {
            "default": "",
            "type": "string"
          },
          "required": {
            "default": false,
            "type": "boolean"
          },
          "role": {
            "$ref": "#/components/schemas/EditRole",
            "default": "other"
          }
        },
        "type": "object"
      },
      "BuildExtra": {
        "description": "One entry of a build's ordered extras list: something merged on top\nof the base ref, in order.\n\nWith no `pin`, a run follows the head. A pin is a full commit SHA and\nbuilds exactly that commit.",
        "oneOf": [
          {
            "description": "A PR (GitHub) or MR (GitLab) of the build's own `repo_url`.",
            "properties": {
              "kind": {
                "const": "pr",
                "type": "string"
              },
              "number": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "pin": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "number"
            ],
            "type": "object"
          },
          {
            "description": "A branch, tag or commit of another remote: a fork branch, an upstream\nllama.cpp PR on top of ik via `refs/pull/N/head`, …",
            "properties": {
              "kind": {
                "const": "ref",
                "type": "string"
              },
              "pin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ref": {
                "type": "string"
              },
              "remote_url": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "remote_url",
              "ref"
            ],
            "type": "object"
          }
        ]
      },
      "BuildIdentity": {
        "description": "The build the run measured, filled in by the benchmark runner from the image and its labels,\nplus `/props` `build_info` where the engine reports it.",
        "properties": {
          "build_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "commit": {
            "description": "`dev.lmgw.base`, else `org.opencontainers.image.revision`.",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_slug": {
            "description": "`dev.lmgw.slug`.",
            "type": [
              "string",
              "null"
            ]
          },
          "git_ref": {
            "description": "`dev.lmgw.ref`.",
            "type": [
              "string",
              "null"
            ]
          },
          "image_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "image_ref": {
            "type": "string"
          },
          "labels": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Every label, verbatim.",
            "type": "object"
          },
          "repo": {
            "description": "`dev.lmgw.repo`.",
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "description": "`org.opencontainers.image.version`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "image_ref",
          "image_id",
          "engine_slug",
          "repo",
          "commit",
          "git_ref",
          "version",
          "build_info",
          "labels"
        ],
        "type": "object"
      },
      "BuildRun": {
        "description": "One `build_runs` row: append-only, and kept when its\nbuild is deleted (`build_id` becomes `None`).",
        "properties": {
          "base_sha": {
            "type": [
              "string",
              "null"
            ]
          },
          "build_id": {
            "description": "`None` once the build has been deleted.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cfg_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "engine": {
            "$ref": "#/components/schemas/Engine"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image_id": {
            "description": "Full image ID (no `sha256:`).",
            "type": [
              "string",
              "null"
            ]
          },
          "image_present": {
            "description": "Whether `image_id` is on this machine now, read from one podman image\nlisting per answer. `image_id` is history (which image the run made)\nand stays after the image is deleted; this says whether the image can\nstill be tagged, verified or deleted. `None` when the run made no image,\nand when podman could not be asked: unknown is not \"deleted\". Filled by\nthe `builds` and `build_get` ops, never stored.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "inputs": {
            "$ref": "#/components/schemas/BuildRunInputs"
          },
          "job_id": {
            "description": "The background job that executed it (`JobKind::BuildRun`). Not a\nforeign key: job rows are pruned by the jobs retention settings, runs\nare not.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "log_path": {
            "description": "The full, never-truncated build log.",
            "type": [
              "string",
              "null"
            ]
          },
          "promoted": {
            "description": "lmgw last moved the build's moving tag to this run's image. At most\none run per build carries it. podman is the source of truth: a tag\nmoved by hand is not reflected here.",
            "type": "boolean"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "slug": {
            "description": "Snapshot of the build's slug and engine, so a run stays readable after\nits build is gone.",
            "type": "string"
          },
          "started_at": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/BuildRunStatus"
          },
          "tags": {
            "description": "Every tag this run put on its image (immutable, and the moving tag\nwhen promoted).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "trigger": {
            "$ref": "#/components/schemas/BuildTrigger"
          },
          "verify": {
            "description": "The verify checks' results, shaped by the executor."
          }
        },
        "required": [
          "id",
          "build_id",
          "job_id",
          "slug",
          "engine",
          "trigger",
          "status",
          "inputs",
          "base_sha",
          "cfg_hash",
          "image_id",
          "image_present",
          "tags",
          "promoted",
          "size_bytes",
          "verify",
          "error",
          "log_path",
          "started_at",
          "finished_at"
        ],
        "type": "object"
      },
      "BuildRunInputs": {
        "description": "A run's `inputs` column: the full snapshot.",
        "properties": {
          "cfg_hash": {
            "description": "Full sha256 hex of the image-affecting inputs; the immutable tag\ncarries its first 6 characters. `None` until resolved.",
            "type": [
              "string",
              "null"
            ]
          },
          "config": {
            "$ref": "#/components/schemas/BuildSpec",
            "description": "The build definition exactly as it was when the run started — a run\noutlives edits to its build, and the build itself."
          },
          "resolved": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResolvedInputs"
              },
              {
                "type": "null"
              }
            ],
            "description": "`None` until the run has resolved its refs (phase 1)."
          }
        },
        "required": [
          "config",
          "resolved",
          "cfg_hash"
        ],
        "type": "object"
      },
      "BuildRunStatus": {
        "description": "Where a build run is, or how it ended.",
        "oneOf": [
          {
            "enum": [
              "canceled"
            ],
            "type": "string"
          },
          {
            "const": "running",
            "description": "Still going — including waiting for the machine-wide build lock, which\nthe job detail names.",
            "type": "string"
          },
          {
            "const": "succeeded",
            "description": "Built, verified and promoted: the moving tag points at its image.",
            "type": "string"
          },
          {
            "const": "unverified",
            "description": "Built, but not GPU-verified (GPU hold, or a CUDA OOM while probing).\nNot promoted; **Verify now** can finish the job later.",
            "type": "string"
          },
          {
            "const": "broken",
            "description": "Built, and a verify check failed. Not promoted.",
            "type": "string"
          },
          {
            "const": "failed",
            "description": "Did not produce an image.",
            "type": "string"
          },
          {
            "const": "up_to_date",
            "description": "The immutable tag for these exact inputs already existed and was\nverified; nothing was built.",
            "type": "string"
          }
        ]
      },
      "BuildSetAction": {
        "description": "`build_set`'s `action`.",
        "enum": [
          "create",
          "update",
          "delete",
          "duplicate"
        ],
        "type": "string"
      },
      "BuildSpec": {
        "description": "Every editable field of a build — the `builds` row minus its id and\ntimestamps. What the editor sends, what `duplicate` copies, and what a run\nsnapshots into its `inputs` as \"the config as built\".\n\n`None` on the optional fields means **auto**, resolved by the run from the\nengine preset and the host, and the resolved value is recorded on the run:\n`cuda_version` → the preset default, `arch` → the host GPUs' compute\ncapabilities, `dockerfile`/`target` → the preset's candidates, `edits` →\nthe preset's edits for the resolved Dockerfile.",
        "properties": {
          "arch": {
            "description": "Compute capabilities / GPU targets (`[\"89\"]`, `[\"86\", \"89\"]`,\n`[\"gfx1100\"]`). `None` = auto-detect from the host GPUs.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "backend": {
            "$ref": "#/components/schemas/GpuBackend"
          },
          "build_args": {
            "description": "Extra `--build-arg` lines, one `KEY=VALUE` per line.",
            "type": "string"
          },
          "ccache": {
            "type": "boolean"
          },
          "ccache_max_size": {
            "description": "`CCACHE_MAXSIZE`, e.g. `10G`, `500M`; `0` is ccache's \"no limit\".",
            "type": "string"
          },
          "cpus": {
            "description": "`--cpuset-cpus` (`0-15`, `0,2,4`). `None` = all cores. Needs podman to\nhave the `cpuset` cgroup controller (rootless: delegated to\n`user@.service`); without it a save and a run refuse, naming the fix.\nCPUs the host does not have online are refused the same way.",
            "type": [
              "string",
              "null"
            ]
          },
          "cuda_version": {
            "description": "`None` = the preset's default for the engine.",
            "type": [
              "string",
              "null"
            ]
          },
          "dockerfile": {
            "description": "Repo-relative Dockerfile path. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          },
          "edits": {
            "description": "`None` = the preset's edits for the resolved Dockerfile; `Some` = this\nexplicit, customized list (which may be empty: no edits at all).",
            "items": {
              "$ref": "#/components/schemas/BuildEdit"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "engine": {
            "$ref": "#/components/schemas/Engine"
          },
          "extras": {
            "description": "Merged on top of `git_ref`, in order.",
            "items": {
              "$ref": "#/components/schemas/BuildExtra"
            },
            "type": "array"
          },
          "forge": {
            "$ref": "#/components/schemas/Forge"
          },
          "keep_layers": {
            "description": "Keep podman's layer cache (`--layers=true`). Off by default: no\nmulti-GiB intermediates are left behind.",
            "type": "boolean"
          },
          "keep_runs": {
            "description": "How many previous runs' immutable tags to keep. `None` = keep all.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "ref": {
            "description": "Branch, tag or commit to build on.",
            "type": "string"
          },
          "repo_url": {
            "description": "A preset or any git URL (`https://`, `http://`, `ssh://`,\n`git@host:path`, `file://`).",
            "type": "string"
          },
          "slug": {
            "description": "Becomes the tag. Tag charset, bounded so the longest immutable tag\nfits 128 characters, and immutable once the build has a run.",
            "type": "string"
          },
          "target": {
            "description": "Final build stage. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "slug",
          "name",
          "engine",
          "repo_url",
          "forge",
          "ref",
          "extras",
          "backend",
          "cuda_version",
          "arch",
          "dockerfile",
          "target",
          "edits",
          "ccache",
          "ccache_max_size",
          "cpus",
          "build_args",
          "keep_layers",
          "keep_runs",
          "notes"
        ],
        "type": "object"
      },
      "BuildSpecInput": {
        "description": "Every editable field of a build — the `builds` row minus its id and\ntimestamps. What the editor sends, what `duplicate` copies, and what a run\nsnapshots into its `inputs` as \"the config as built\".\n\n`None` on the optional fields means **auto**, resolved by the run from the\nengine preset and the host, and the resolved value is recorded on the run:\n`cuda_version` → the preset default, `arch` → the host GPUs' compute\ncapabilities, `dockerfile`/`target` → the preset's candidates, `edits` →\nthe preset's edits for the resolved Dockerfile.",
        "properties": {
          "arch": {
            "default": null,
            "description": "Compute capabilities / GPU targets (`[\"89\"]`, `[\"86\", \"89\"]`,\n`[\"gfx1100\"]`). `None` = auto-detect from the host GPUs.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "backend": {
            "$ref": "#/components/schemas/GpuBackend",
            "default": "cuda"
          },
          "build_args": {
            "default": "",
            "description": "Extra `--build-arg` lines, one `KEY=VALUE` per line.",
            "type": "string"
          },
          "ccache": {
            "default": true,
            "type": "boolean"
          },
          "ccache_max_size": {
            "default": "10G",
            "description": "`CCACHE_MAXSIZE`, e.g. `10G`, `500M`; `0` is ccache's \"no limit\".",
            "type": "string"
          },
          "cpus": {
            "default": null,
            "description": "`--cpuset-cpus` (`0-15`, `0,2,4`). `None` = all cores. Needs podman to\nhave the `cpuset` cgroup controller (rootless: delegated to\n`user@.service`); without it a save and a run refuse, naming the fix.\nCPUs the host does not have online are refused the same way.",
            "type": [
              "string",
              "null"
            ]
          },
          "cuda_version": {
            "default": null,
            "description": "`None` = the preset's default for the engine.",
            "type": [
              "string",
              "null"
            ]
          },
          "dockerfile": {
            "default": null,
            "description": "Repo-relative Dockerfile path. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          },
          "edits": {
            "default": null,
            "description": "`None` = the preset's edits for the resolved Dockerfile; `Some` = this\nexplicit, customized list (which may be empty: no edits at all).",
            "items": {
              "$ref": "#/components/schemas/BuildEditInput"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "engine": {
            "$ref": "#/components/schemas/Engine",
            "default": "llama"
          },
          "extras": {
            "default": [],
            "description": "Merged on top of `git_ref`, in order.",
            "items": {
              "$ref": "#/components/schemas/BuildExtra"
            },
            "type": "array"
          },
          "forge": {
            "$ref": "#/components/schemas/Forge",
            "default": "plain"
          },
          "keep_layers": {
            "default": false,
            "description": "Keep podman's layer cache (`--layers=true`). Off by default: no\nmulti-GiB intermediates are left behind.",
            "type": "boolean"
          },
          "keep_runs": {
            "default": null,
            "description": "How many previous runs' immutable tags to keep. `None` = keep all.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "default": "",
            "type": "string"
          },
          "notes": {
            "default": "",
            "type": "string"
          },
          "ref": {
            "default": "",
            "description": "Branch, tag or commit to build on.",
            "type": "string"
          },
          "repo_url": {
            "default": "",
            "description": "A preset or any git URL (`https://`, `http://`, `ssh://`,\n`git@host:path`, `file://`).",
            "type": "string"
          },
          "slug": {
            "default": "",
            "description": "Becomes the tag. Tag charset, bounded so the longest immutable tag\nfits 128 characters, and immutable once the build has a run.",
            "type": "string"
          },
          "target": {
            "default": null,
            "description": "Final build stage. `None` = the preset's candidates.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "BuildTrigger": {
        "description": "What started a run.",
        "oneOf": [
          {
            "const": "manual",
            "description": "A click on the Engines page (or the `/api` op behind it).",
            "type": "string"
          },
          {
            "const": "mcp",
            "description": "`lmgw__build_run`.",
            "type": "string"
          },
          {
            "const": "schedule",
            "description": "A scheduled run.",
            "type": "string"
          }
        ]
      },
      "BuildUpdateEntry": {
        "description": "One build's slot in a `build_updates_check` response.",
        "properties": {
          "build_id": {
            "format": "int64",
            "type": "integer"
          },
          "update": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UpdateStatus"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "build_id",
          "update"
        ],
        "type": "object"
      },
      "BuildView": {
        "description": "One row of the Builds tab: a build plus what it is doing and\nwhat is using it right now. `current_run` is the promoted run — its\nimage holds the moving tag; `last_run` is simply the most recent one,\nwhich may be a failed or unverified attempt after `current_run`.",
        "properties": {
          "build": {
            "$ref": "#/components/schemas/Build"
          },
          "current_run": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuildRun"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_run": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuildRun"
              },
              {
                "type": "null"
              }
            ]
          },
          "live_job_id": {
            "description": "The `JobRow.id` of this build's run while one is live.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "moving_tag": {
            "description": "The build's moving tag **on the answering instance**: `<engine repo>:<slug>`\nin production, `localhost/lmgw-dev-<engine repo>:<slug>` on a dev\ninstance (which tags into a namespace of its own). Computed by the\nserver, the same way its runs tag, so it is right for a build that\nhas never run too — prefer it to computing the tag client-side.",
            "type": "string"
          },
          "update": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UpdateStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "used_by": {
            "items": {
              "$ref": "#/components/schemas/ImageUse"
            },
            "type": "array"
          }
        },
        "required": [
          "build",
          "last_run",
          "current_run",
          "live_job_id",
          "used_by",
          "update",
          "moving_tag"
        ],
        "type": "object"
      },
      "CancelKind": {
        "description": "What cancelling a running image job does (design §5.4).",
        "oneOf": [
          {
            "const": "native",
            "description": "The image server's own cancel: the job is dropped, the model stays.",
            "type": "string"
          },
          {
            "const": "restart",
            "description": "The image server cannot stop a running picture, and this call is the\nmodel's only request: lmgw stops its container, and the next picture\nloads it again.",
            "type": "string"
          },
          {
            "const": "abandon",
            "description": "The image server cannot stop a running picture, and another request\nuses the model: the call stops waiting, the picture finishes in the\nbackground and is thrown away.",
            "type": "string"
          }
        ]
      },
      "CandidateAliasPreview": {
        "description": "`candidate_alias_set action=preview`: the alias editor's live answer to\n\"what would saving this draft mean right now\". It runs the validation and\nderivation of a save over the draft and writes nothing.\n\nNo single refusal aborts the answer: a draft is the normal state of an\neditor nobody has saved yet, so the first problem is `error` (and `ok` is\n`false`) while the derivation goes on with the most useful stand-in it has.\nEvery key is always there.",
        "properties": {
          "addable": {
            "description": "Every enabled local chat model not yet a candidate, and which of the\nenabled facets it would lack if added: the \"add candidate\" list's\nfilter.",
            "items": {
              "$ref": "#/components/schemas/AddableCandidate"
            },
            "type": "array"
          },
          "advisories": {
            "description": "Worth flagging, but not an error.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "common_facets": {
            "description": "Facets every candidate currently supports.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "context_length": {
            "description": "Minimum across `routable_candidates`; `null` if any of them is unknown or nothing\nis routable.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled_facets": {
            "description": "The facets the draft would have enabled (wire facet names).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "error": {
            "description": "The first refusal a save of this draft would make, if any.",
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_usable": {
            "description": "The alias fallback resolves and is not local.",
            "type": "boolean"
          },
          "max_output_tokens": {
            "description": "Same rule as `context_length`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "ok": {
            "description": "`false` when `error` is set.",
            "type": "boolean"
          },
          "problems": {
            "description": "What is wrong with a candidate or the fallback, in prose.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "routable_candidates": {
            "description": "Candidates the gate may route to right now, in list order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "unsupported_by": {
            "additionalProperties": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "description": "Facet wire name -> candidate ids that do not support it.",
            "type": "object"
          }
        },
        "required": [
          "ok",
          "enabled_facets",
          "common_facets",
          "unsupported_by",
          "routable_candidates",
          "problems",
          "advisories",
          "fallback_usable",
          "context_length",
          "max_output_tokens",
          "addable",
          "error"
        ],
        "type": "object"
      },
      "CandidateAliasSaved": {
        "description": "`candidate_alias_set`'s answer to `create`, `update` (also `enable` and\n`disable`) and `delete`: the saved row's id, and for a write that leaves a\nrow a fresh derivation of what it means right now (the shape the editor\nand `lmgw__models` read), so a caller never needs a second call to see\nwhether the alias it just saved is usable.\n\nThe derived keys are absent for `delete`, and for a `create` or `update`\nwhose row was deleted by a concurrent call between the write and the read:\nthe write itself succeeded, so that answer is `{ok, id, message}`.",
        "properties": {
          "advisories": {
            "description": "Worth flagging, but not an error: a candidate with `--cache-ram 0`, a\nfallback that lacks an enabled facet.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "common_facets": {
            "description": "Facets every candidate currently supports: the ceiling a save may enable.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "context_length": {
            "description": "Minimum across `routable_candidates`; `null` if any of them is unknown or nothing\nis routable. Absent where the derived keys are.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled_facets": {
            "description": "The stored enabled facet set (wire facet names).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "fallback_notes": {
            "description": "What the save says about the fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "fallback_usable": {
            "description": "The alias fallback resolves and is not local.",
            "type": "boolean"
          },
          "id": {
            "description": "The row's id.",
            "format": "int64",
            "type": "integer"
          },
          "max_output_tokens": {
            "description": "Same rule as `context_length`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "message": {
            "description": "What was done, for a person to read.",
            "type": "string"
          },
          "ok": {
            "description": "Always `true`; a refusal is an error answer instead.",
            "type": "boolean"
          },
          "problems": {
            "description": "What is wrong with a candidate or the fallback, in prose.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "routable_candidates": {
            "description": "Candidates the gate may route to right now, in list order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "ok",
          "id",
          "message"
        ],
        "type": "object"
      },
      "CandidateAliasStatus": {
        "description": "One entry of `GatewayStatus.candidate_aliases` (`GET /api/status`,\n`lmgw__status`): what an alias is, whom it starts and what is wrong with\nit, from the same derivation the alias editor reads.",
        "properties": {
          "alternates": {
            "description": "The other candidates, in preference order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "deferrals_24h": {
            "description": "How many `gpu_deferred` refusals the alias logged in the last 24 hours.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "enabled_facets": {
            "description": "The stored enabled facet set (wire facet names).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "mode": {
            "description": "`background` | `owner`: whose traffic the alias serves.",
            "type": "string"
          },
          "name": {
            "description": "The alias, as clients name it in `model`.",
            "type": "string"
          },
          "primary": {
            "description": "The candidate the alias starts; `null` only for a row that saved with\nan empty list.",
            "type": [
              "string",
              "null"
            ]
          },
          "problems": {
            "description": "What is wrong with a candidate or the fallback, in prose.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "mode",
          "primary",
          "alternates",
          "enabled_facets",
          "problems",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "CandidateAliasView": {
        "description": "A candidate alias: its stored fields plus what lmgw computes from the live snapshot\n(never stored, recomputed on every read).",
        "properties": {
          "advisories": {
            "description": "A candidate with `--cache-ram 0`: not an error, but worth\nflagging.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "alias": {
            "type": "string"
          },
          "background": {
            "type": "boolean"
          },
          "candidates": {
            "description": "Local chat model ids, first = primary, rest = alternates in\npreference order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "capabilities_disabled": {
            "description": "The explicit \"turn this common facet off\" list (wire facet names).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "common_facets": {
            "description": "Facets every candidate currently supports — the ceiling a save may\nenable.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "context_length": {
            "description": "Minimum across `routable_candidates` (a ladder candidate at its top rung);\nabsent if any of them is unknown or nothing is routable.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "deferrals_24h": {
            "description": "How many `gpu_deferred` refusals this alias logged in the last 24\nhours. `Some(0)` is a real\nzero; `None` only ever means a frame cached from before this field\nexisted (`#[serde(default)]`), never \"unknown\".",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "enabled_facets": {
            "description": "The stored enabled facet set (`capabilities_enabled` as last saved —\nsee that field's own doc comment for why this is never recomputed\noutside a save).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "fallback": {
            "description": "The alias's one fallback, as written; `null` = none.",
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_usable": {
            "description": "The alias fallback resolves to a model that can stand in (not a\ncandidate alias).",
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "max_output_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "notes": {
            "type": "string"
          },
          "problems": {
            "description": "What is wrong with a candidate or the fallback, in prose.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "routable_candidates": {
            "description": "Candidates the gate may actually route to right now, in list order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "unsupported_by": {
            "additionalProperties": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "description": "Facet wire name -> candidate ids that do not support it (the editor's\n\"not supported by: <ids>\").",
            "type": "object"
          }
        },
        "required": [
          "id",
          "alias",
          "candidates",
          "background",
          "fallback",
          "capabilities_disabled",
          "enabled",
          "notes",
          "enabled_facets",
          "common_facets",
          "unsupported_by",
          "routable_candidates",
          "problems",
          "advisories",
          "fallback_usable",
          "context_length",
          "max_output_tokens",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "CardFile": {
        "description": "The other measure's file, when the two picks differ (D120).",
        "properties": {
          "bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "file": {
            "type": "string"
          },
          "fit": {
            "$ref": "#/components/schemas/FileFit"
          },
          "quant": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "file",
          "quant",
          "bytes",
          "fit"
        ],
        "type": "object"
      },
      "CardKind": {
        "description": "The kind of row a card's model becomes (D126, D29).",
        "oneOf": [
          {
            "enum": [
              "chat",
              "embed",
              "rerank"
            ],
            "type": "string"
          },
          {
            "const": "decision",
            "description": "A decision model: known only from its header (`decision.type`), so\nno search answer says it yet.",
            "type": "string"
          }
        ]
      },
      "CardMeasure": {
        "description": "The card a fit was measured against (design §3.1, §9.2), from one ledger\nread.",
        "properties": {
          "admission": {
            "description": "Admission is on and refuses a model that doesn't fit.",
            "type": "boolean"
          },
          "budget": {
            "description": "The capacity is the declared budget, not the devices' total.",
            "type": "boolean"
          },
          "capacity_bytes": {
            "description": "What lmgw may use: the declared GPU memory budget, else the devices'\ntotal.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "headroom_bytes": {
            "description": "The headroom setting, added to every footprint.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "hold": {
            "description": "The GPU hold is on: local models are paused (D10). The marks don't\nchange for it.",
            "type": "boolean"
          },
          "outside_bytes": {
            "description": "What other programs hold on the card now: the devices' used memory\nless lmgw's charges. `None` without a device reading, or when one of\nlmgw's models on the card has no figure.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "residents": {
            "description": "lmgw's own models on the card now, with what admission keeps free for\nthem.",
            "items": {
              "$ref": "#/components/schemas/CardResident"
            },
            "type": "array"
          }
        },
        "required": [
          "capacity_bytes",
          "headroom_bytes",
          "budget",
          "admission",
          "hold",
          "outside_bytes",
          "residents"
        ],
        "type": "object"
      },
      "CardResident": {
        "description": "One of lmgw's models on the card now, as the beside measure charges it.",
        "properties": {
          "bytes": {
            "description": "Its charge plus what admission keeps free for it (an image\npipeline's measured peak, an audio model's pending load).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "class": {
            "description": "`chat | aux | audio | image`.",
            "type": "string"
          },
          "model": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model",
          "bytes"
        ],
        "type": "object"
      },
      "ChainRow": {
        "properties": {
          "awaiting_approval": {
            "type": "boolean"
          },
          "chain_id": {
            "type": "string"
          },
          "first_at": {
            "type": "string"
          },
          "head_id": {
            "description": "What a client passes as `previous_response_id` to continue.",
            "type": "string"
          },
          "input_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "last_at": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "output_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "responses": {
            "format": "int64",
            "type": "integer"
          },
          "size": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "chain_id",
          "head_id",
          "model",
          "status",
          "responses",
          "first_at",
          "last_at",
          "input_tokens",
          "output_tokens",
          "size",
          "awaiting_approval"
        ],
        "type": "object"
      },
      "ChatCompletion": {
        "properties": {
          "choices": {
            "items": {
              "properties": {
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "logprobs": {
                  "description": "Always null: lmgw relays no log probabilities yet. Present because OpenAI's schema requires the field.",
                  "type": "null"
                },
                "message": {
                  "properties": {
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_content": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "assistant"
                      ],
                      "type": "string"
                    },
                    "tool_calls": {
                      "items": {
                        "additionalProperties": true,
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "index",
                "message",
                "finish_reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "created": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "chat.completion"
            ],
            "type": "string"
          },
          "usage": {
            "properties": {
              "completion_tokens": {
                "type": "integer"
              },
              "completion_tokens_details": {
                "description": "Present only when the upstream reported reasoning tokens.",
                "properties": {
                  "reasoning_tokens": {
                    "type": "integer"
                  }
                },
                "required": [
                  "reasoning_tokens"
                ],
                "type": "object"
              },
              "prompt_tokens": {
                "type": "integer"
              },
              "prompt_tokens_details": {
                "description": "Present only when the upstream reported prompt-cache counts, and each field only when reported: cached_tokens read from the cache, cache_write_tokens written to it. Both are part of prompt_tokens.",
                "properties": {
                  "cache_write_tokens": {
                    "type": "integer"
                  },
                  "cached_tokens": {
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices",
          "usage"
        ],
        "type": "object"
      },
      "ChatCompletionChunk": {
        "description": "One frame: `data: <this object>`, repeated, ending with the literal `data: [DONE]`.",
        "properties": {
          "choices": {
            "items": {
              "properties": {
                "delta": {
                  "properties": {
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_content": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "assistant"
                      ],
                      "type": "string"
                    },
                    "tool_calls": {
                      "items": {
                        "additionalProperties": true,
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "index": {
                  "type": "integer"
                }
              },
              "required": [
                "index",
                "delta",
                "finish_reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "created": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "chat.completion.chunk"
            ],
            "type": "string"
          },
          "usage": {
            "description": "Only with stream_options.include_usage: null on every frame but the last, whose choices is [] and which carries the request's usage.",
            "properties": {
              "completion_tokens": {
                "type": "integer"
              },
              "completion_tokens_details": {
                "description": "Present only when the upstream reported reasoning tokens.",
                "properties": {
                  "reasoning_tokens": {
                    "type": "integer"
                  }
                },
                "required": [
                  "reasoning_tokens"
                ],
                "type": "object"
              },
              "prompt_tokens": {
                "type": "integer"
              },
              "prompt_tokens_details": {
                "description": "Present only when the upstream reported prompt-cache counts, and each field only when reported: cached_tokens read from the cache, cache_write_tokens written to it. Both are part of prompt_tokens.",
                "properties": {
                  "cache_write_tokens": {
                    "type": "integer"
                  },
                  "cached_tokens": {
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ],
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "type": "object"
      },
      "ChatCompletionRequest": {
        "additionalProperties": true,
        "properties": {
          "chat_template_kwargs": {
            "additionalProperties": true,
            "description": "Only enable_thinking is read (llama-server's own template toggle, distinct from the protocol-neutral reasoning controls above); every key is forwarded verbatim.",
            "type": "object"
          },
          "frequency_penalty": {
            "type": "number"
          },
          "json_schema": {
            "additionalProperties": true,
            "description": "llama.cpp's own top-level schema; without a response_format, or next to a {type:text} one, it is read as response_format {type:json_schema} and sent in that spelling. Next to a grammar it is 400 bad_request, as llama-server refuses the pair.",
            "type": "object"
          },
          "max_completion_tokens": {
            "description": "Wins over max_tokens when both are sent.",
            "type": "integer"
          },
          "max_tokens": {
            "type": "integer"
          },
          "messages": {
            "items": {
              "additionalProperties": true,
              "properties": {
                "content": {
                  "description": "A string, or an array of parts: {type:text,text}, {type:image_url,image_url:{url}} (a plain URL or a data: URI), {type:input_audio,input_audio:{data,format}} (data: URI, or raw base64 with format required). A tool message keeps only its text, as OpenAI defines it; any other part is dropped with a WARN naming it."
                },
                "name": {
                  "description": "role: tool only. Forwarded as the tool result's name.",
                  "type": "string"
                },
                "reasoning_content": {
                  "description": "role: assistant only. Replayed as the leading reasoning part (also accepted spelled 'reasoning', as OpenRouter spells it; DeepSeek and llama.cpp use reasoning_content).",
                  "type": "string"
                },
                "role": {
                  "description": "system and developer are both treated as a system message; tool and function are both treated as a tool-result message.",
                  "enum": [
                    "system",
                    "developer",
                    "user",
                    "assistant",
                    "tool",
                    "function"
                  ],
                  "type": "string"
                },
                "tool_call_id": {
                  "description": "role: tool only.",
                  "type": "string"
                },
                "tool_calls": {
                  "description": "role: assistant only: [{id, type:function, function:{name, arguments: <JSON string>}}]. Send each id back as lmgw gave it: a Gemini model's call id carries the model's thought signature, which Gemini 3 refuses a replayed call without. Such ids run to hundreds of characters; echo them exactly, and do not send them to another provider directly (lmgw strips the signature there).",
                  "items": {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "required": [
                "role"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "model": {
            "description": "An alias, a local model id, a candidate alias, or 'prefix/…' to pass through to an exposed upstream.",
            "type": "string"
          },
          "presence_penalty": {
            "type": "number"
          },
          "reasoning": {
            "additionalProperties": true,
            "description": "lmgw extension, OpenRouter's shape: {effort, max_tokens, enabled, exclude}. Read for the reasoning tier and forwarded verbatim.",
            "type": "object"
          },
          "reasoning_budget_tokens": {
            "description": "lmgw extension: a thinking-token budget (also x-lmgw-reasoning-budget). Forwarded verbatim alongside thinking_budget_tokens — whichever spelling a llama-server version reads.",
            "type": "integer"
          },
          "reasoning_effort": {
            "description": "lmgw extension: an effort level, or 'none' for off — one spelling of the reasoning control (also x-lmgw-reasoning-effort, and reasoning.effort below); the header wins when both are sent.",
            "type": "string"
          },
          "response_format": {
            "additionalProperties": true,
            "description": "{type:text} | {type:json_object} | {type:json_schema, json_schema:{name, description, schema, strict}} — translated for every upstream: Anthropic output_config.format (json_schema only; json_object is refused with response_format_unsupported), Gemini responseMimeType + responseJsonSchema. A type the model's capabilities.structured_output flag says false is refused before any upstream call (400 response_format_unsupported, param response_format); a schema the upstream rejects is 400 invalid_json_schema with its message. Another type goes verbatim to OpenAI-compatible upstreams. Keys lmgw does not model, on the object and on json_schema, reach OpenAI-compatible and llama.cpp upstreams as sent.",
            "type": "object"
          },
          "seed": {
            "type": "integer"
          },
          "service_tier": {
            "description": "OpenAI's processing tier (auto, default, flex, priority, fast, scale, ultrafast), forwarded as sent; on an OpenAI platform row lmgw sends auto when it is unset, and prices the answer at the tier the answer reports. A request by a caller with a budget (its key's, or the gateway's) on a cloud model with no price on file for what it is billed in is refused before the send: 403 budget_unpriced, naming the model and the missing price. A flex request needs a flex price: no other tier's price bounds a flex answer's spend, which is cheaper.",
            "type": "string"
          },
          "stop": {
            "description": "A string, or an array of strings."
          },
          "stream": {
            "default": false,
            "type": "boolean"
          },
          "stream_options": {
            "description": "With stream: true, include_usage ends the stream with a chunk whose choices is [] and that carries usage; every other chunk then has usage: null. Without it no chunk carries usage. Not forwarded: lmgw asks the upstream for usage itself, for its request log.",
            "properties": {
              "include_usage": {
                "default": false,
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "temperature": {
            "type": "number"
          },
          "thinking_budget_tokens": {
            "description": "Same as reasoning_budget_tokens; both are read and both stay in the forwarded body.",
            "type": "integer"
          },
          "tool_choice": {
            "description": "\"auto\" | \"none\" | \"required\" | {type:function,function:{name}}."
          },
          "tools": {
            "items": {
              "properties": {
                "function": {
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "parameters": {
                      "additionalProperties": true,
                      "type": "object"
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object"
                },
                "type": {
                  "enum": [
                    "function"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "type",
                "function"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "top_k": {
            "description": "Not part of the OpenAI API, but accepted; llama.cpp supports it.",
            "type": "integer"
          },
          "top_p": {
            "type": "number"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "type": "object"
      },
      "ChatCompletionStreamError": {
        "description": "The frame a stream carries instead of a chunk when the upstream fails after the first byte was sent.",
        "properties": {
          "error": {
            "properties": {
              "code": {
                "enum": [
                  "upstream"
                ],
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "type": {
                "enum": [
                  "api_error"
                ],
                "type": "string"
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "ChatKnowledgeBase": {
        "description": "One knowledge base, as the Chat shows it.",
        "properties": {
          "embed_resolvable": {
            "description": "Whether a model on the gateway still resolves to the base's pinned\nembedding model; without one a search is by keyword only.",
            "type": "boolean"
          },
          "files": {
            "description": "Its files, in any state.",
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "Unique across the bases.",
            "type": "string"
          },
          "ready": {
            "description": "The files ingested and searchable.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "files",
          "ready",
          "embed_resolvable"
        ],
        "type": "object"
      },
      "ChatKnowledgeFile": {
        "description": "The file a `ChatKnowledgeSource` shows.",
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "What the bytes were sniffed as.",
            "type": "string"
          },
          "name": {
            "description": "The name it was uploaded under (a label, never a path).",
            "type": "string"
          },
          "pages": {
            "description": "Pages, slides or sheets, when the file has them.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "description": "`pending`, `ingesting`, `ready` or `failed`.",
            "enum": [
              "pending",
              "ingesting",
              "ready",
              "failed"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "status",
          "pages"
        ],
        "type": "object"
      },
      "ChatTestPassed": {
        "description": "A chat model that loaded and answered, with the comparison of its running\nbuild against the gateway's static derivation.",
        "properties": {
          "answer": {
            "$ref": "#/components/schemas/DecideAnswer",
            "description": "For `decide`: the model's answer to the probe's `choice` question, as\nit gave it. The test does not judge the choice, only that the route\nanswered with one of the options and probabilities that sum to 1\n(decision-models design §3.7)."
          },
          "class": {
            "description": "`aux` for an aux model's pass, `chat` where this is the first part of\na chat model's.",
            "enum": [
              "chat",
              "aux"
            ],
            "type": "string"
          },
          "dimensions": {
            "description": "For `embed`: the embedding's length.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "disagreements": {
            "description": "Where the running build and the static derivation disagree; empty\nwhen they agree or `/props` could not be read.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "input_tokens": {
            "description": "For `decide`: the input tokens the server reported for the question.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "latency_ms": {
            "description": "How long the load and the probe took, in milliseconds.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "loaded": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "note": {
            "description": "Why `props` could not be read, when it could not.",
            "type": "string"
          },
          "ok": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "probe": {
            "description": "What was sent: `generate` (one token), `embed`, `rerank` or `decide`\n(one System One `choice` question on `/v1/systemone`).",
            "type": "string"
          },
          "props": {
            "description": "llama-server's own `/props` answer, verbatim; null when it could not\nbe read."
          },
          "scored": {
            "description": "For `rerank`: how many documents came back scored.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "static": {
            "$ref": "#/components/schemas/StaticCaps",
            "description": "The capabilities the gateway derived statically, the part `/props`\nalso states an opinion on."
          }
        },
        "required": [
          "ok",
          "loaded",
          "model_id",
          "class",
          "probe",
          "latency_ms",
          "props",
          "static",
          "disagreements"
        ],
        "type": "object"
      },
      "ChatTool": {
        "description": "One tool a thread may tick.",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The exposed name (`docs__query`): what a thread's `allowed_tools`\nand `require_approval` name.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "description"
        ],
        "type": "object"
      },
      "ChatToolSource": {
        "description": "One toolset a thread may attach.",
        "properties": {
          "description": {
            "description": "A toolset's purpose in one line; empty for a server.",
            "type": "string"
          },
          "kind": {
            "description": "`builtin` (one of lmgw's own toolsets), `server` (a registered MCP\nserver) or `agent` (a service agent's tools).",
            "enum": [
              "builtin",
              "server",
              "agent"
            ],
            "type": "string"
          },
          "name": {
            "description": "A server's configured name; a toolset's label.",
            "type": "string"
          },
          "reason": {
            "description": "Why it offers nothing now, when it does not.",
            "type": [
              "string",
              "null"
            ]
          },
          "server_label": {
            "description": "What a thread's `mcp_tools` entry names: a toolset's own label, a\nserver's tool prefix, else its name.",
            "type": "string"
          },
          "status": {
            "description": "A server's connection now: `ready`, `connecting`, `error` or\n`stopped`. A built-in toolset is `ready` when it offers tools and\n`unavailable` when it offers none (`reason` says why).",
            "enum": [
              "ready",
              "connecting",
              "error",
              "stopped",
              "unavailable"
            ],
            "type": "string"
          },
          "tool_count": {
            "description": "The tools of it the caller may tick now: a built-in toolset's\n`tools`; a server's tools as last listed, the owner's\nswitched-off ones and those outside the caller's tool scope left out\n(`0` before it was first listed).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "tools": {
            "description": "A built-in toolset's tools. Empty for a server:\n`GET /chat/api/tools/{label}` lists those, connecting it.",
            "items": {
              "$ref": "#/components/schemas/ChatTool"
            },
            "type": "array"
          }
        },
        "required": [
          "server_label",
          "kind",
          "name",
          "description",
          "status",
          "tool_count",
          "reason",
          "tools"
        ],
        "type": "object"
      },
      "CheckMergeStep": {
        "description": "One extra's row in a `build_check_merge` report.",
        "properties": {
          "files": {
            "description": "Conflicted paths — set only when `outcome` is `conflict`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "label": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "outcome": {
            "$ref": "#/components/schemas/MergeOutcome"
          },
          "sha": {
            "type": "string"
          }
        },
        "required": [
          "label",
          "outcome",
          "sha",
          "files",
          "note"
        ],
        "type": "object"
      },
      "ChoiceAnswer": {
        "properties": {
          "choice": {
            "description": "The most probable option.",
            "type": "string"
          },
          "confidence": {
            "description": "How certain the model is, derived from the probabilities.",
            "format": "double",
            "type": "number"
          },
          "probabilities": {
            "additionalProperties": {
              "format": "double",
              "type": "number"
            },
            "description": "Every option with its probability; they sum to 1.",
            "type": "object"
          }
        },
        "required": [
          "choice",
          "probabilities",
          "confidence"
        ],
        "type": "object"
      },
      "ChoiceQuestion": {
        "properties": {
          "criteria": {
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Each option with its description, or `null` when it needs none, in\nthe order the options are offered. TypeSafe takes up to 255; llama.cpp\nnames its own per-type limit when a request crosses it.",
            "type": "object"
          },
          "instructions": {
            "description": "The question: a string, an object or an array."
          }
        },
        "required": [
          "instructions",
          "criteria"
        ],
        "type": "object"
      },
      "ChunkRow": {
        "description": "One chunk. `payload` is a **verbatim** slice of the source document and is\nrendered as such — never as markdown, since it carries its own fences.",
        "properties": {
          "corpus_id": {
            "format": "int64",
            "type": "integer"
          },
          "derived_summary": {
            "type": "string"
          },
          "derived_title": {
            "description": "LLM-derived — a label, never payload.",
            "type": "string"
          },
          "document_id": {
            "format": "int64",
            "type": "integer"
          },
          "heading_path": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "payload": {
            "type": "string"
          },
          "span_end": {
            "format": "int64",
            "type": "integer"
          },
          "span_start": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "document_id",
          "corpus_id",
          "heading_path",
          "span_start",
          "span_end",
          "payload",
          "derived_title",
          "derived_summary"
        ],
        "type": "object"
      },
      "ChunkSpan": {
        "description": "Where a chunk sits in its file, without its text.",
        "properties": {
          "heading_path": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "page": {
            "description": "1-based page, slide or sheet, when the file has them.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "seq": {
            "description": "The chunk's position in the file.",
            "format": "int64",
            "type": "integer"
          },
          "span_end": {
            "format": "int64",
            "type": "integer"
          },
          "span_start": {
            "description": "Byte range in the file's extracted text.",
            "format": "int64",
            "type": "integer"
          },
          "tokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "seq",
          "page",
          "heading_path",
          "span_start",
          "span_end",
          "tokens"
        ],
        "type": "object"
      },
      "ClimbStatus": {
        "description": "A climb in progress, and why — \"climbing to 3/3 — prompt 41,210 + 8,192 >\n30,000\".",
        "properties": {
          "of": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "reason": {
            "description": "Why — the numbers of the request that did not fit.",
            "type": "string"
          },
          "seconds": {
            "description": "Since the mark, in whole seconds.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "stage": {
            "description": "What it is doing right now, in words.",
            "type": "string"
          },
          "to": {
            "description": "The rung it climbs to, 1-based.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "to",
          "of",
          "reason",
          "stage",
          "seconds"
        ],
        "type": "object"
      },
      "Clip": {
        "description": "One reference clip of the voice library.",
        "properties": {
          "name": {
            "description": "The file name, extension included.",
            "type": "string"
          },
          "server_path": {
            "description": "The clip's path inside the model container: what goes into `voice_ref`\nor `audio`.",
            "type": "string"
          },
          "size": {
            "description": "Bytes.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "transcript": {
            "description": "What the clip says (its line in the library's `prompt_text` index);\nempty while it has none. A cloning model that needs a reference text\nreads it from here when a request names the clip as `voice`.",
            "type": "string"
          },
          "voice": {
            "description": "What a request's `voice` names once the audio class's voice directory is\nthis library: the file name without its extension.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "size",
          "server_path",
          "voice",
          "transcript"
        ],
        "type": "object"
      },
      "ClipFailed": {
        "description": "A clip an upload could not transcribe; the upload itself stands.",
        "properties": {
          "clip": {
            "description": "The clip's file name.",
            "type": "string"
          },
          "transcribe_error": {
            "type": "string"
          }
        },
        "required": [
          "clip",
          "transcribe_error"
        ],
        "type": "object"
      },
      "ClipTranscription": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ClipWritten"
          },
          {
            "$ref": "#/components/schemas/ClipFailed"
          }
        ],
        "description": "One clip of an upload, transcribed or not."
      },
      "ClipWritten": {
        "description": "A clip an upload transcribed.",
        "properties": {
          "answered_by": {
            "description": "The fallback alias that answered in place of the one asked, else `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "by": {
            "description": "Who wrote it, in a sentence.",
            "type": "string"
          },
          "clip": {
            "description": "The clip's file name.",
            "type": "string"
          },
          "fallback_reason": {
            "description": "Why the fallback answered (`hold`, `external_vram`, ...), else `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "transcript_source": {
            "description": "`asr:<model>`: the model the transcript came from. When a fallback\nanswered, that model's name.",
            "type": "string"
          }
        },
        "required": [
          "clip",
          "transcript_source",
          "answered_by",
          "fallback_reason",
          "by"
        ],
        "type": "object"
      },
      "CompletionRequest": {
        "additionalProperties": true,
        "description": "Forwarded to an OpenAI-protocol upstream verbatim (a llama.cpp row's response_format excepted, see there): this route refuses anything else (an Anthropic or Gemini alias gets 400 rather than a request its upstream cannot answer).",
        "properties": {
          "max_completion_tokens": {
            "type": "integer"
          },
          "max_tokens": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "n_predict": {
            "description": "llama.cpp spelling of max_tokens; folded into it for local models with a guard or a ladder.",
            "type": "integer"
          },
          "prompt": {
            "description": "A string, an array of strings, an array of token ids, or a mix of both."
          },
          "response_format": {
            "additionalProperties": true,
            "description": "As on /v1/chat/completions. llama.cpp's own /v1/completions reads no response_format, so for a llama.cpp row it is sent as the top-level json_schema that route reads; a type with no such spelling is 400 response_format_unsupported, and a JSON type next to a grammar 400 bad_request, with nothing sent.",
            "type": "object"
          },
          "stream": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "type": "object"
      },
      "ConcurrentPoint": {
        "description": "One concurrent point: *N* streams released together.",
        "properties": {
          "aggregate_tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "Σ `predicted_n` / (last stream's end − first stream's first token)."
          },
          "draft": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DraftStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "energy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Energy"
              },
              {
                "type": "null"
              }
            ],
            "description": "Over the aggregate's window; tokens are Σ `predicted_n`."
          },
          "energy_unmeasured": {
            "description": "Why `energy` is `None` although the card reports power: a window\nshorter than the GPU sampler resolves (two of its ticks, 200 ms at\nthe 100 ms tick), whose figure would have been the\nticks' average power times its length rather than a measurement.\n`None` otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "per_stream_tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "The median of the streams' `predicted_per_second`, per repetition."
          },
          "streams": {
            "description": "*N*.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "streams",
          "aggregate_tok_s",
          "per_stream_tok_s",
          "draft",
          "energy",
          "energy_unmeasured"
        ],
        "type": "object"
      },
      "ConfiguredAs": {
        "description": "A configured row already serving the planned GGUF, and how it differs\nfrom the plan.",
        "properties": {
          "apply": {
            "additionalProperties": true,
            "description": "The patch for the class's set op that brings the row in line with the\nplan; absent when it is in sync.",
            "type": "object"
          },
          "change": {
            "description": "Each field the plan would change on the row.",
            "items": {
              "$ref": "#/components/schemas/PlanChange"
            },
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "description": "The row's id in its class's table.",
            "format": "int64",
            "type": "integer"
          },
          "in_sync": {
            "description": "Nothing the plan proposes differs from the row.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "unset": {
            "description": "Chat rows: settings the row's files cannot support, which `apply`\nclears. Absent on aux rows.",
            "items": {
              "$ref": "#/components/schemas/PlanUnset"
            },
            "type": "array"
          }
        },
        "required": [
          "model_id",
          "id",
          "enabled",
          "in_sync",
          "change"
        ],
        "type": "object"
      },
      "ConnectModel": {
        "description": "`source` is `alias | local`.",
        "properties": {
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "source"
        ],
        "type": "object"
      },
      "ContainerAdvisories": {
        "description": "A model that starts but misbehaves under some input.",
        "properties": {
          "advisories": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "class": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id",
          "advisories"
        ],
        "type": "object"
      },
      "ContainerBusy": {
        "description": "A model whose container is still serving requests.",
        "properties": {
          "class": {
            "type": "string"
          },
          "in_flight": {
            "description": "How many requests it is serving.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "model_id": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id",
          "in_flight"
        ],
        "type": "object"
      },
      "ContainerFailure": {
        "description": "A model an action failed on.",
        "properties": {
          "class": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id",
          "error"
        ],
        "type": "object"
      },
      "ContainerImage": {
        "description": "One local or external image of the three engines.",
        "properties": {
          "backend": {
            "description": "The `dev.lmgw.backend` label, when present — a free string because\nan external image (a `build.sh` tag, a registry pull) may not carry\nit at all.",
            "type": [
              "string",
              "null"
            ]
          },
          "created": {
            "type": "string"
          },
          "engine": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Engine"
              },
              {
                "type": "null"
              }
            ],
            "description": "`None` when the image can't be matched to an engine."
          },
          "external": {
            "description": "No `dev.lmgw.run` label — a `build.sh` image or a registry pull.",
            "type": "boolean"
          },
          "id": {
            "description": "Full image ID (no `sha256:`).",
            "type": "string"
          },
          "provenance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ImageProvenance"
              },
              {
                "type": "null"
              }
            ],
            "description": "`None` for an external image lmgw did not build."
          },
          "registry_update": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RegistryUpdate"
              },
              {
                "type": "null"
              }
            ],
            "description": "The registry update check for an image a class\ndefault or model override uses under a registry name (not\n`localhost/`). `None` for every other image, and before the first\ncheck."
          },
          "run_status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuildRunStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "The run this image came from, when it is one lmgw built."
          },
          "size": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "used_by": {
            "items": {
              "$ref": "#/components/schemas/ImageUse"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "tags",
          "engine",
          "backend",
          "size",
          "created",
          "provenance",
          "external",
          "used_by",
          "run_status",
          "registry_update"
        ],
        "type": "object"
      },
      "ContainerModel": {
        "description": "A model named by class and id.",
        "properties": {
          "class": {
            "description": "`chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "model_id": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id"
        ],
        "type": "object"
      },
      "ContainerPort": {
        "description": "A model and the port its container is up on.",
        "properties": {
          "class": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "port": {
            "description": "The loopback port the container is published on.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "class",
          "model_id",
          "port"
        ],
        "type": "object"
      },
      "ContainerProblems": {
        "description": "A model with problems found by the static checks.",
        "properties": {
          "class": {
            "type": "string"
          },
          "issues": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "model_id": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "model_id",
          "issues"
        ],
        "type": "object"
      },
      "ContextEditingCaps": {
        "additionalProperties": false,
        "description": "The `context_editing` object of a model on an Anthropic route: what\nits provider's catalog says about Anthropic's context management\n(`capabilities.context_management` on Anthropic's own `/v1/models`).",
        "properties": {
          "compaction": {
            "description": "The top-level `compaction.type` values (on-demand compaction) the\nprovider says the model takes (`summarize`, …), sorted: its catalog's\n`capabilities.compaction`. lmgw sends the field on as written, and\nthe `compaction` block Anthropic answers with comes back as it came.\nOmitted when the provider names none.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "edits": {
            "description": "The `context_management.edits[].type` values the provider says the\nmodel takes, all of which lmgw sends on (`clear_thinking_20251015`,\n`clear_tool_uses_20250919`, `compact_20260112`, …), sorted. A\ncompaction edit's `compaction` answer block comes back as Anthropic\nsent it. Omitted when the provider names none.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supported": {
            "description": "The provider says whether the model takes `context_management` at\nall. Absent when its catalog says nothing.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ContextExcerpt": {
        "description": "One retrieved excerpt, as a user message stores it.",
        "properties": {
          "chunk_id": {
            "type": "string"
          },
          "file": {
            "description": "The file's name when it was retrieved.",
            "type": "string"
          },
          "file_id": {
            "format": "int64",
            "type": "integer"
          },
          "file_sha": {
            "description": "The sha256 of the file version the chunk was cut from; empty for a\ncontext stored before it was kept.",
            "type": "string"
          },
          "heading_path": {
            "type": "string"
          },
          "kb": {
            "description": "The base's name when it was retrieved.",
            "type": "string"
          },
          "kb_id": {
            "format": "int64",
            "type": "integer"
          },
          "page": {
            "description": "1-based PDF page; `null` for other files.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "score": {
            "format": "float",
            "type": "number"
          },
          "span_end": {
            "format": "int64",
            "type": "integer"
          },
          "span_start": {
            "description": "Byte range in the file's extracted text.",
            "format": "int64",
            "type": "integer"
          },
          "text": {
            "description": "The chunk's text, verbatim.",
            "type": "string"
          },
          "tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "kb_id",
          "kb",
          "file_id",
          "file",
          "page",
          "chunk_id",
          "heading_path",
          "text",
          "score",
          "tokens",
          "span_start",
          "span_end",
          "file_sha"
        ],
        "type": "object"
      },
      "ContinueState": {
        "description": "Whether a thread's last reply can be continued, and why not.",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ok",
          "reason"
        ],
        "type": "object"
      },
      "CorpusSource": {
        "properties": {
          "corpus_id": {
            "format": "int64",
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "fence": {
            "description": "Domains a fetch may touch; empty = the root's own host.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`llms_txt | markdown | rustdoc_json | html`.",
            "type": "string"
          },
          "root": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "corpus_id",
          "root",
          "kind",
          "fence",
          "created_at"
        ],
        "type": "object"
      },
      "CorpusStatusView": {
        "description": "The corpus status badges (embedding and evaluation state). Neither blocks a query.",
        "properties": {
          "embed_model_resolvable": {
            "description": "Whether a model on this gateway still resolves to the corpus's pinned\nembedding identity. `false` with `embed_status` `re_embed_required`\nmeans the corpus cannot be queried until it is re-embedded; `true`\nmeans it is mid re-embed and still answers.",
            "type": "boolean"
          },
          "embed_status": {
            "type": "string"
          },
          "eval_status": {
            "type": "string"
          },
          "flags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "embed_status",
          "embed_model_resolvable",
          "eval_status",
          "flags",
          "warnings"
        ],
        "type": "object"
      },
      "CorpusView": {
        "description": "One corpus as the list and the detail view both show it.",
        "properties": {
          "chunk_count": {
            "format": "int64",
            "type": "integer"
          },
          "corpus_id": {
            "description": "The client-facing `library@version`, as `docs__resolve` reports it.",
            "type": "string"
          },
          "crawl_date": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "embed_dims": {
            "format": "int64",
            "type": "integer"
          },
          "embed_identity": {
            "description": "`upstream/model@dims`, the pinned identity in one string.",
            "type": "string"
          },
          "embed_model": {
            "type": "string"
          },
          "embed_status": {
            "description": "`ok | re_embed_required` — the same flag `docs__resolve` reports.",
            "type": "string"
          },
          "embed_upstream": {
            "type": "string"
          },
          "eval_at": {
            "description": "When it was measured; absent when no instant was recorded.",
            "type": "string"
          },
          "eval_best": {
            "description": "The best hit@k ever measured; absent = never evaluated.",
            "format": "double",
            "type": "number"
          },
          "eval_k": {
            "description": "The depth `eval_score` was measured at; absent when no depth was\nrecorded (never evaluated, or a score stored without one).",
            "format": "int64",
            "type": "integer"
          },
          "eval_regression": {
            "type": "boolean"
          },
          "eval_score": {
            "description": "Latest measured hit@k; absent = never evaluated, which is not zero.",
            "format": "double",
            "type": "number"
          },
          "eval_status": {
            "description": "`ok | regression | unmeasured`.",
            "type": "string"
          },
          "flags": {
            "description": "Machine-readable badges; `warnings` is one sentence per flag.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "ingest_model": {
            "type": "string"
          },
          "ingest_prompt_version": {
            "type": "string"
          },
          "library": {
            "type": "string"
          },
          "resident_bytes": {
            "description": "What serving this corpus costs once resident: the visible price of\nthe exact-KNN scan.",
            "format": "int64",
            "type": "integer"
          },
          "source_kind": {
            "type": "string"
          },
          "sources": {
            "items": {
              "$ref": "#/components/schemas/CorpusSource"
            },
            "type": "array"
          },
          "status": {
            "description": "`ready | ingesting | failed | re_embed_required` — free-form, a chip.",
            "type": "string"
          },
          "unembedded_chunks": {
            "description": "Chunks with no vector yet; non-zero means the KNN stage sees only part\nof the corpus.",
            "format": "int64",
            "type": "integer"
          },
          "updated_at": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "corpus_id",
          "library",
          "version",
          "status",
          "chunk_count",
          "unembedded_chunks",
          "resident_bytes",
          "embed_upstream",
          "embed_model",
          "embed_dims",
          "embed_identity",
          "ingest_model",
          "ingest_prompt_version",
          "crawl_date",
          "source_kind",
          "eval_regression",
          "embed_status",
          "eval_status",
          "flags",
          "warnings",
          "sources",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CountSource": {
        "description": "Where a ubatch or batch in effect comes from.",
        "oneOf": [
          {
            "const": "row",
            "description": "The row's own field.",
            "type": "string"
          },
          {
            "const": "args",
            "description": "A flag in the row's extra args.",
            "type": "string"
          },
          {
            "const": "batch",
            "description": "The batch: llama.cpp lowers the ubatch to it.",
            "type": "string"
          },
          {
            "const": "ubatch",
            "description": "The ubatch: embedding mode (a non-causal type, a causal type with a\nhead) lowers the batch to it.",
            "type": "string"
          },
          {
            "const": "llama_cpp_default",
            "description": "llama.cpp's default (ubatch 512, batch 2048).",
            "type": "string"
          }
        ]
      },
      "CountTokensRequest": {
        "description": "Routed by model exactly like the chat endpoints, so counting a cold local model's tokens starts its container. The key's alias scope applies: a refused count answers 403 key_scope and is logged; a successful count is not logged. No budget applies, neither the key's nor the gateway's: a count costs nothing.",
        "properties": {
          "input": {
            "type": "string"
          },
          "model": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "type": "object"
      },
      "CountTokensResponse": {
        "properties": {
          "model": {
            "type": "string"
          },
          "tokens": {
            "type": "integer"
          }
        },
        "required": [
          "model",
          "tokens"
        ],
        "type": "object"
      },
      "CurrentReason": {
        "description": "Why `current` answered with a new thread.",
        "oneOf": [
          {
            "const": "first",
            "description": "The folder had no current thread (for a device key: none it can\nreach).",
            "type": "string"
          },
          {
            "const": "gone",
            "description": "Its current thread can no longer be continued in the folder. Only\nthe dashboard and admin keys are given this reason.",
            "type": "string"
          },
          {
            "const": "idle",
            "description": "Its current thread had no message for the folder's idle minutes.",
            "type": "string"
          },
          {
            "const": "requested",
            "description": "The caller asked for a new thread (`new: true`).",
            "type": "string"
          }
        ]
      },
      "CurvePoint": {
        "description": "One point of the threshold curve: what a cut at `threshold` keeps.",
        "properties": {
          "accuracy": {
            "description": "`correct` over `labelled`; `null` when none is labelled.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "correct": {
            "description": "Of those, the ones answered correctly.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "coverage": {
            "description": "`covered` over every answered item.",
            "format": "double",
            "type": "number"
          },
          "covered": {
            "description": "Answered items at or above it.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "labelled": {
            "description": "Labelled items among `covered`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "threshold": {
            "description": "A confidence (certainty for `noul`) some answer has.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "threshold",
          "covered",
          "coverage",
          "labelled",
          "correct",
          "accuracy"
        ],
        "type": "object"
      },
      "DecideAnswer": {
        "description": "The probe's `choice` answer, with the options in the order the model\ngave them. A JSON object would lose that order on the way through an op\n(the op's JSON is a sorted map), so the options are a list.",
        "properties": {
          "choice": {
            "description": "The most probable option.",
            "type": "string"
          },
          "confidence": {
            "description": "How certain the model is, derived from the probabilities.",
            "format": "double",
            "type": "number"
          },
          "probabilities": {
            "description": "Every option with its probability, in the order llama.cpp answered\nthem; they sum to 1.",
            "items": {
              "$ref": "#/components/schemas/OptionProbability"
            },
            "type": "array"
          }
        },
        "required": [
          "choice",
          "probabilities",
          "confidence"
        ],
        "type": "object"
      },
      "DecisionBackend": {
        "description": "Where a local decision row computes.",
        "enum": [
          "cpu",
          "gpu"
        ],
        "type": "string"
      },
      "DecisionEstimate": {
        "description": "One limit with the form's estimate against it.",
        "properties": {
          "limit": {
            "$ref": "#/components/schemas/DecisionLimit"
          },
          "over": {
            "description": "The estimate is past the limit. A warning: Ask is not blocked.",
            "type": "boolean"
          },
          "tokens": {
            "description": "The state plus the largest question, or the largest option span.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "limit",
          "tokens",
          "over"
        ],
        "type": "object"
      },
      "DecisionFacts": {
        "description": "A local decision row's facts: its row, its GGUF header and its running\nserver.",
        "properties": {
          "backend": {
            "$ref": "#/components/schemas/DecisionBackend"
          },
          "batch": {
            "description": "The batch in effect.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "batch_source": {
            "$ref": "#/components/schemas/CountSource"
          },
          "ctx_size": {
            "description": "The row's `ctx_size`; `null` takes llama-server's default.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "decision_type": {
            "description": "The header's `decision.type` (`laya`, `kev`, ...).",
            "type": [
              "string",
              "null"
            ]
          },
          "header_error": {
            "description": "Why the header could not be read; the header's fields are `null`\nthen.",
            "type": [
              "string",
              "null"
            ]
          },
          "max_head_tokens": {
            "description": "The header's `decision.max_head_tokens`: past it llama.cpp truncates a\nquestion and its options.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "n_ctx_slot": {
            "description": "One slot's context as the running server's `/props` says; `null`\nuntil a container has run.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "shape": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DecisionShape"
              },
              {
                "type": "null"
              }
            ]
          },
          "threads_in_effect": {
            "description": "The thread count its container runs with; `null` when llama-server\npicks.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "threads_source": {
            "$ref": "#/components/schemas/AuxThreadsSource"
          },
          "ubatch": {
            "description": "The ubatch in effect: the row's, its args', llama.cpp's default, never\nabove the batch.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "ubatch_source": {
            "$ref": "#/components/schemas/CountSource"
          }
        },
        "required": [
          "header_error",
          "decision_type",
          "max_head_tokens",
          "shape",
          "ctx_size",
          "n_ctx_slot",
          "ubatch",
          "ubatch_source",
          "batch",
          "batch_source",
          "backend",
          "threads_in_effect",
          "threads_source"
        ],
        "type": "object"
      },
      "DecisionFallbackPrice": {
        "description": "The price of the alias that answers for a held local row: `alias` and\nwhat `DecisionPrice` says of a model, for its own primary route.",
        "properties": {
          "alias": {
            "type": "string"
          },
          "local": {
            "description": "Served on this machine: free.",
            "type": "boolean"
          },
          "rows": {
            "description": "The rows that price it, per unit, as `DecisionPrice::rows`.",
            "items": {
              "$ref": "#/components/schemas/PriceRowView"
            },
            "type": "array"
          },
          "unresolved": {
            "description": "Why its route did not resolve; `rows` is empty then.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "alias",
          "local",
          "rows",
          "unresolved"
        ],
        "type": "object"
      },
      "DecisionForm": {
        "description": "The Decision lab's whole form, as the page holds it and the store keeps\nit (`lab_groups.form`). Every list is a `Vec`, so storing it keeps its\norder.",
        "properties": {
          "images": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/DecisionImageInput"
            },
            "type": "array"
          },
          "questions": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/QuestionDraftInput"
            },
            "type": "array"
          },
          "state": {
            "default": "",
            "description": "As typed; JSON mode keeps its text verbatim.",
            "type": "string"
          },
          "state_mode": {
            "$ref": "#/components/schemas/StateMode",
            "default": "text"
          }
        },
        "type": "object"
      },
      "DecisionImageInput": {
        "description": "One image the form sends.",
        "oneOf": [
          {
            "description": "A new image, as the page read it.",
            "properties": {
              "name": {
                "type": "string"
              },
              "source": {
                "const": "data_url",
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "source",
              "name",
              "url"
            ],
            "type": "object"
          },
          {
            "description": "An image the store keeps already (a re-opened form): its artifact id.\nNothing is uploaded again.",
            "properties": {
              "id": {
                "format": "int64",
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "source": {
                "const": "artifact",
                "type": "string"
              }
            },
            "required": [
              "source",
              "id",
              "name"
            ],
            "type": "object"
          }
        ]
      },
      "DecisionLabModel": {
        "description": "One model that answers `/v1/systemone`: a local `decide/*` row, or a\ncloud alias or catalog entry of task `decision`.",
        "properties": {
          "context_length": {
            "description": "From its capabilities: the context it is planned against, or the\ncatalog's.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "facts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DecisionFacts"
              },
              {
                "type": "null"
              }
            ],
            "description": "What its row and its GGUF header say; `null` for a cloud model."
          },
          "fallback": {
            "description": "The model or alias that answers for it while it is held, when that\none can (its configured fallback, the first hop of its chain).",
            "type": [
              "string",
              "null"
            ]
          },
          "held": {
            "description": "The GPU hold (or a benchmark's lease) pauses it now: a GPU row while\nthe hold is on. A CPU row and a cloud model never are.",
            "type": "boolean"
          },
          "input_modalities": {
            "description": "From its capabilities; `null` when unknown.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "limits": {
            "description": "What must fit in how many tokens (§2.2's table): one or two limits.",
            "items": {
              "$ref": "#/components/schemas/DecisionLimit"
            },
            "type": "array"
          },
          "local": {
            "description": "A local aux row of kind decision.",
            "type": "boolean"
          },
          "model_id": {
            "description": "The row's id, for a local model.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The public name a request asks for.",
            "type": "string"
          },
          "notes": {
            "description": "What `GET /v1/models` notes about it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "owner": {
            "description": "Who serves it, as `GET /v1/models` says (`lmgw` for a local row, the\nupstream's name for a cloud model).",
            "type": "string"
          },
          "price": {
            "$ref": "#/components/schemas/DecisionPrice",
            "description": "What prices a request to it, as the gateway prices one."
          },
          "reads_images": {
            "description": "It reads images: its running server's `vision`, else an `image` among\nits input modalities.",
            "type": "boolean"
          },
          "state": {
            "description": "Its container's state (`starting`, `ready`, `stopping`); `null` when\nno container runs, and for a cloud model.",
            "type": [
              "string",
              "null"
            ]
          },
          "warnings": {
            "description": "What its container's start found.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "owner",
          "local",
          "model_id",
          "input_modalities",
          "context_length",
          "notes",
          "state",
          "warnings",
          "held",
          "fallback",
          "reads_images",
          "facts",
          "limits",
          "price"
        ],
        "type": "object"
      },
      "DecisionLimit": {
        "description": "One limit a request meets on a model.",
        "properties": {
          "applies_to": {
            "$ref": "#/components/schemas/DecisionMeasure"
          },
          "of": {
            "description": "What the number is and where it comes from (\"the ubatch in effect,\nset on the row\").",
            "type": "string"
          },
          "rule": {
            "description": "The rule in one sentence, with what llama.cpp answers past it.",
            "type": "string"
          },
          "tokens": {
            "description": "The limit in tokens; `null` when it is not known.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "applies_to",
          "tokens",
          "of",
          "rule"
        ],
        "type": "object"
      },
      "DecisionMeasure": {
        "description": "What a limit bounds.",
        "oneOf": [
          {
            "const": "state_and_question",
            "description": "The state and one question (with its options and the template): the\ngauge's estimate is the state plus the largest question.",
            "type": "string"
          },
          {
            "const": "option_span",
            "description": "The span from the first option marker to the end of the prompt: the\nestimate is the largest option list.",
            "type": "string"
          }
        ]
      },
      "DecisionPrice": {
        "description": "What prices a request to a decision model: the rows the gateway's own\nprice lookup selects for its primary route (`Snapshot::sheet_for`), the\nroute a request takes when no fallback answers. A fallback that answers\nis priced by its own rows.",
        "properties": {
          "fallback": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DecisionFallbackPrice"
              },
              {
                "type": "null"
              }
            ],
            "description": "While a local row is held and its `fallback` can answer, the\nprice of the alias that answers every request instead (the rows the\ngateway then records it at). Absent otherwise."
          },
          "local": {
            "description": "Served on this machine: free whatever rows exist (Usage records the\ncompute it takes, not a price).",
            "type": "boolean"
          },
          "rows": {
            "description": "Per unit, the row that prices it, each unit resolved on its own: the\nalias's manual row, else the alias's catalog row, else the upstream\nmodel's manual row, else its catalog row; a row without a usable rate\nis no row. Empty for a local model, and for a cloud model no row\ncovers, whose cost Usage records as unknown.",
            "items": {
              "$ref": "#/components/schemas/PriceRowView"
            },
            "type": "array"
          },
          "unresolved": {
            "description": "Why its route did not resolve (a candidate alias picks its model per\nrequest); `rows` is empty then.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "local",
          "rows",
          "unresolved"
        ],
        "type": "object"
      },
      "DecisionQuestionKind": {
        "description": "A question's type and its type's fields.",
        "oneOf": [
          {
            "description": "Pick one of the options, in the order offered.",
            "properties": {
              "options": {
                "items": {
                  "$ref": "#/components/schemas/OptionDraft"
                },
                "type": "array"
              },
              "type": {
                "const": "choice",
                "type": "string"
              }
            },
            "required": [
              "type",
              "options"
            ],
            "type": "object"
          },
          {
            "description": "Rate on 2 to 10 levels, lowest first.",
            "properties": {
              "levels": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": {
                "const": "score",
                "type": "string"
              }
            },
            "required": [
              "type",
              "levels"
            ],
            "type": "object"
          },
          {
            "description": "Yes or no; `yes` and `no` say what each means, both blank sends no\n`criteria`.",
            "properties": {
              "no": {
                "type": "string"
              },
              "type": {
                "const": "noul",
                "type": "string"
              },
              "yes": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "yes",
              "no"
            ],
            "type": "object"
          }
        ]
      },
      "DecisionQuestionKindInput": {
        "description": "A question's type and its type's fields.",
        "oneOf": [
          {
            "description": "Pick one of the options, in the order offered.",
            "properties": {
              "options": {
                "items": {
                  "$ref": "#/components/schemas/OptionDraftInput"
                },
                "type": "array"
              },
              "type": {
                "const": "choice",
                "type": "string"
              }
            },
            "required": [
              "type",
              "options"
            ],
            "type": "object"
          },
          {
            "description": "Rate on 2 to 10 levels, lowest first.",
            "properties": {
              "levels": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": {
                "const": "score",
                "type": "string"
              }
            },
            "required": [
              "type",
              "levels"
            ],
            "type": "object"
          },
          {
            "description": "Yes or no; `yes` and `no` say what each means, both blank sends no\n`criteria`.",
            "properties": {
              "no": {
                "type": "string"
              },
              "type": {
                "const": "noul",
                "type": "string"
              },
              "yes": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "yes",
              "no"
            ],
            "type": "object"
          }
        ]
      },
      "DecisionShape": {
        "description": "A decision model's header shape (decision-models design §3.4).",
        "oneOf": [
          {
            "const": "non_causal",
            "description": "`attention.causal = false` (Laya, Julia-1): the whole prompt in one\nubatch.",
            "type": "string"
          },
          {
            "const": "causal_head",
            "description": "Causal with a decision head (Kev, Clef): embedding mode.",
            "type": "string"
          },
          {
            "const": "label_logits",
            "description": "Causal, answering from label logits (lev, OpenJev): a normal context.",
            "type": "string"
          }
        ]
      },
      "DecodePoint": {
        "description": "One decode point: `n_predict: G`, `ignore_eos`, `cache_prompt: true`.",
        "properties": {
          "depth": {
            "description": "*D*: the prompt length the generation starts from.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "distinct_token_ratio": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Stat"
              },
              {
                "type": "null"
              }
            ],
            "description": "Distinct token ids over generated ones, per repetition: near 1 for\nprose, low for a degenerate loop that `ignore_eos` ran into — and a\nloop is what a drafter predicts perfectly, so a draft acceptance\nnext to a low ratio flatters it. Only where the\nengine streams token ids (official llama.cpp, not ik)."
          },
          "draft": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DraftStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "energy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Energy"
              },
              {
                "type": "null"
              }
            ],
            "description": "Over first token → last token of each repetition, so the priming\nprefill stays out; tokens are those generated after the first."
          },
          "energy_unmeasured": {
            "description": "Why `energy` is `None` although the card reports power: a window\nshorter than the GPU sampler resolves (two of its ticks, 200 ms at\nthe 100 ms tick), whose figure would have been the\nticks' average power times its length rather than a measurement.\n`None` otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "evaluated_tokens": {
            "$ref": "#/components/schemas/Stat",
            "description": "`timings.prompt_n`: the first repetition primes the cache (≈ *D*), the\nlater ones reuse it (a handful)."
          },
          "generated": {
            "$ref": "#/components/schemas/Stat",
            "description": "`timings.predicted_n`."
          },
          "tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "Server-side `timings.predicted_per_second`."
          }
        },
        "required": [
          "depth",
          "tok_s",
          "generated",
          "evaluated_tokens",
          "draft",
          "distinct_token_ratio",
          "energy",
          "energy_unmeasured"
        ],
        "type": "object"
      },
      "DeviceCaError": {
        "description": "Why lmgw's device CA cannot be used.",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/DeviceCaErrorKind",
            "description": "What kind of failure it is."
          },
          "message": {
            "description": "The reason in a sentence, naming the file, the mode found or the\nSecret Service's answer.",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "message"
        ],
        "type": "object"
      },
      "DeviceCaErrorKind": {
        "description": "The kind of `DeviceCaError`.",
        "oneOf": [
          {
            "const": "missing",
            "description": "No CA exists, and the call needed one.",
            "type": "string"
          },
          {
            "const": "locked",
            "description": "The wallet's unlock prompt was declined.",
            "type": "string"
          },
          {
            "const": "unreadable",
            "description": "A file cannot be read, does not parse, or the key does not open or\ndoes not match the certificate.",
            "type": "string"
          },
          {
            "const": "bad_mode",
            "description": "The key file is readable by group or others, not owned by lmgw's\nuser, or a symbolic link.",
            "type": "string"
          },
          {
            "const": "no_secret_service",
            "description": "The key is wrapped and no Secret Service answers this start.",
            "type": "string"
          },
          {
            "const": "wrap_key_missing",
            "description": "The key is wrapped and the Secret Service holds no wrapping key for\nthis data directory.",
            "type": "string"
          },
          {
            "const": "secret_service",
            "description": "The Secret Service answered with an error.",
            "type": "string"
          }
        ]
      },
      "DeviceCaKeyMode": {
        "description": "How `tls/ca.key` keeps the CA's key (device link design D2).",
        "oneOf": [
          {
            "const": "wrapped",
            "description": "Encrypted (AES-256-GCM) under a key held in the session's Secret\nService.",
            "type": "string"
          },
          {
            "const": "plain",
            "description": "Plain PKCS#8, readable by its owner only: a start without a Secret\nService (headless). The next start that reaches one wraps it.",
            "type": "string"
          }
        ]
      },
      "DeviceCaState": {
        "description": "Whether lmgw's device CA exists and signs.",
        "oneOf": [
          {
            "const": "missing",
            "description": "None exists: it is created when the device listener is first turned\non.",
            "type": "string"
          },
          {
            "const": "stored",
            "description": "On disk and not loaded since this start (the device listener has not\nrun): `fp`, `created` and `key_mode` are read from the files, the key\nitself is not opened.",
            "type": "string"
          },
          {
            "const": "ready",
            "description": "Loaded: its key is open and signs.",
            "type": "string"
          },
          {
            "const": "error",
            "description": "It cannot be used; `error` says why.",
            "type": "string"
          }
        ]
      },
      "DeviceCaStatus": {
        "description": "lmgw's device CA (device link design §2.1), as the status shows it.",
        "properties": {
          "cert_file": {
            "description": "The certificate's path (`tls/ca.crt` in the data directory), PEM,\nreadable by anyone: what `curl --cacert` takes.",
            "type": "string"
          },
          "certificate_pem": {
            "description": "The CA certificate, PEM: what `curl --cacert` takes and the Devices\ncard copies. Public like the file (`0644`) and the pin; `null` while\nthe CA is missing or its certificate cannot be read.",
            "type": [
              "string",
              "null"
            ]
          },
          "created": {
            "description": "The CA's creation day (its `notBefore`), RFC 3339 UTC; `null` with\n`fp`.",
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DeviceCaError"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the CA cannot be used, with state `error`."
          },
          "fp": {
            "description": "`sha256:` and the lowercase hex SHA-256 of the CA certificate's\nSubjectPublicKeyInfo: the pairing link's `fp`. `null` while the CA is\nmissing or its certificate cannot be read.",
            "type": [
              "string",
              "null"
            ]
          },
          "key_file": {
            "description": "The key file's path (`tls/ca.key` in the data directory).",
            "type": "string"
          },
          "key_mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DeviceCaKeyMode"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the key file keeps the key; `null` while the CA is missing or the\nkey file cannot be read."
          },
          "state": {
            "$ref": "#/components/schemas/DeviceCaState",
            "description": "Whether the CA exists and signs."
          }
        },
        "required": [
          "state",
          "fp",
          "created",
          "key_mode",
          "error",
          "key_file",
          "cert_file",
          "certificate_pem"
        ],
        "type": "object"
      },
      "DeviceLeafSlot": {
        "description": "Which connections a server certificate serves.",
        "oneOf": [
          {
            "const": "loopback",
            "description": "Every connection to a loopback address (`127.0.0.0/8`, `::1`).",
            "type": "string"
          },
          {
            "const": "interface",
            "description": "Connections to one address of this machine's interfaces.",
            "type": "string"
          },
          {
            "const": "shared",
            "description": "Connections to an address no interface lists: the URL-list hosts\nalone.",
            "type": "string"
          }
        ]
      },
      "DeviceLeafStatus": {
        "description": "One server certificate the device listener presents (device link design\n§2.2).",
        "properties": {
          "address": {
            "description": "The local address it serves, for `interface`; `null` for `loopback`\nand `shared`.",
            "type": [
              "string",
              "null"
            ]
          },
          "issued": {
            "description": "When it was issued, RFC 3339 UTC.",
            "type": "string"
          },
          "names": {
            "description": "The names it carries (its subjectAltNames): its address, or the\nloopback addresses and `localhost`, and every host of every device's\nURL list.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "renew_after": {
            "description": "From when the next connection it would serve gets a new one: half its\nvalidity.",
            "type": "string"
          },
          "slot": {
            "$ref": "#/components/schemas/DeviceLeafSlot",
            "description": "Which connections it serves."
          },
          "valid_until": {
            "description": "Its `notAfter`, RFC 3339 UTC.",
            "type": "string"
          }
        },
        "required": [
          "slot",
          "address",
          "issued",
          "valid_until",
          "renew_after",
          "names"
        ],
        "type": "object"
      },
      "DeviceListenerState": {
        "description": "Whether the device listener serves.",
        "oneOf": [
          {
            "const": "off",
            "description": "`devices.listener` is off, or the gateway is not serving.",
            "type": "string"
          },
          {
            "const": "listening",
            "description": "It serves on `urls`.",
            "type": "string"
          },
          {
            "const": "error",
            "description": "It is on and does not serve; `error` says why. The plain listener\nserves on.",
            "type": "string"
          }
        ]
      },
      "DeviceListenerStatus": {
        "description": "The device listener (device link design §4.1, §9.2), as the status\nshows it: whether it serves, where, or why not, and what it holds open.",
        "properties": {
          "connections": {
            "description": "Its open connections now, TLS handshakes included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "error": {
            "description": "Why it does not serve, with state `error`: a bind error naming the\naddress and the settings, the device CA's reason, or a port it cannot\nderive.",
            "type": [
              "string",
              "null"
            ]
          },
          "evicted": {
            "description": "Such connections it closed since it started to make room for a newer\none, one of those two bounds reached (the oldest goes).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "listen": {
            "description": "The scope it serves, or tried to: `loopback`, `all` or an address\n(`devices.listen`); `null` while off.",
            "type": [
              "string",
              "null"
            ]
          },
          "port": {
            "description": "The port it serves, or tried to (`devices.port`, or the HTTP port's\nnumber plus one); `null` while off.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "requests": {
            "description": "The requests in flight on it now (an open Chat feed is one).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "sessions": {
            "description": "The realtime sessions and turns running on it now.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "state": {
            "$ref": "#/components/schemas/DeviceListenerState",
            "description": "Whether it serves."
          },
          "unauthenticated": {
            "description": "Its connections that have not authenticated, now: handshakes in\nprogress, connections without a certificate, and connections whose\ncertificate opens no working device. What `devices.unauthenticated_max`\nand `devices.unauthenticated_per_peer` bound.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "urls": {
            "description": "What it is bound to, as `https://` base URLs: two for `loopback`\n(one when the machine has no IPv6), one otherwise. Empty unless\n`listening`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "state",
          "listen",
          "port",
          "urls",
          "error",
          "connections",
          "requests",
          "sessions",
          "unauthenticated",
          "evicted"
        ],
        "type": "object"
      },
      "DevicePaired": {
        "description": "A device's pairing link minted: `POST /api/op/key_create` with `kind:\ndevice` (the row and its first pairing token) and `device_token` (a new\ntoken for the same row; device link design §3.2, §5.2). The token goes to\nthe owner once, inside the link.",
        "properties": {
          "fp": {
            "description": "`sha256:` and the hex SHA-256 of the device CA's SubjectPublicKeyInfo:\nthe link's `fp`, which the device's enrolment pins.",
            "type": "string"
          },
          "id": {
            "description": "The device row's `api_keys.id`; a new token keeps it.",
            "format": "int64",
            "type": "integer"
          },
          "link": {
            "description": "`lmgw-pair:?v=2&name=…&url=…[&url=…]&fp=sha256:…&token=lmgw-enrol-…`:\ncarries the one-time pairing token to the device. Secret while its\ntoken lives: shown once, never logged.",
            "type": "string",
            "x-lmgw-secret": true
          },
          "local_only": {
            "description": "Paired as \"this computer\": the device reaches lmgw on a loopback\naddress only.",
            "type": "boolean"
          },
          "message": {
            "description": "What was done, for a person to read: what the device does next, and\nwhether the device listener reaches it from where it is.",
            "type": "string"
          },
          "name": {
            "description": "`device:<name>`.",
            "type": "string"
          },
          "ok": {
            "description": "Always `true`; a refusal is an error answer instead.",
            "type": "boolean"
          },
          "token_expires_at": {
            "description": "When the pairing token lapses (RFC 3339, UTC): `devices.token_minutes`\nafter it was minted.",
            "type": "string"
          },
          "urls": {
            "description": "The device's lmgw URLs: `https` base URLs of the device listener, in\nthe owner's order, as the link carries them and enrolment answers\nthem.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "ok",
          "id",
          "name",
          "link",
          "urls",
          "local_only",
          "token_expires_at",
          "fp",
          "message"
        ],
        "type": "object"
      },
      "DevicePairingState": {
        "description": "Where a device's pairing stands.",
        "oneOf": [
          {
            "const": "waiting",
            "description": "No key: waiting for its device to enrol with a token (or for a new\ntoken, when its last one ended).",
            "type": "string"
          },
          {
            "const": "enrolled",
            "description": "A key enrolled and waiting for the owner's confirmation: its every\nrequest is refused 403 `device_unconfirmed` until then. A key kept\nbeside it (`kept_code`) is served until the confirmation ends it.",
            "type": "string"
          },
          {
            "const": "confirmed",
            "description": "Enrolled and confirmed: the device is served.",
            "type": "string"
          },
          {
            "const": "v1",
            "description": "Paired with a link from before TLS: its bearer key no longer works,\nand it needs a new token.",
            "type": "string"
          }
        ]
      },
      "DevicePairingStatus": {
        "description": "Pairing in `GET /api/status` (device link design §3.3, §9.2): the tokens\nalive, and the failed enrolments of the last hour.",
        "properties": {
          "counted_since": {
            "description": "Since when failures are counted: the counts live in memory and start\nat zero with each start of lmgw (RFC 3339 UTC).",
            "type": "string"
          },
          "failures_last_hour": {
            "description": "Failed enrolments (an unknown, used, lapsed or ended token) in the\nlast hour, from every address.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "last_failure_at": {
            "description": "When it was, RFC 3339 UTC.",
            "type": [
              "string",
              "null"
            ]
          },
          "last_failure_from": {
            "description": "The address of the last failure (an IPv6 address by its /64), `null`\nwhen none was counted.",
            "type": [
              "string",
              "null"
            ]
          },
          "tokens_alive": {
            "description": "The pairing tokens alive now (minted, not lapsed, not ended; a used\none stays alive for its same-key repeat): while any is, a device\nlistener handshake may come without a client certificate, for\nenrolment alone.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "tokens_alive",
          "failures_last_hour",
          "last_failure_from",
          "last_failure_at",
          "counted_since"
        ],
        "type": "object"
      },
      "DevicePairingView": {
        "description": "A device row's pairing (device link design §3.6, §9.3), as the Keys\nlist shows it.",
        "properties": {
          "cert_not_after": {
            "description": "The certificate of the key that works now: its `notAfter`, and from\nwhen the card and the device say it lapses (two thirds of its\nvalidity), RFC 3339 UTC.",
            "type": [
              "string",
              "null"
            ]
          },
          "cert_notice_after": {
            "type": [
              "string",
              "null"
            ]
          },
          "client": {
            "description": "The client its last enrolment named (the enrolment's `client`, free\ntext, never trusted for anything): the waiting key's while one waits,\nthe key that works now's otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "confirm_code": {
            "description": "The confirmation code, `7F3A-91C2`, of the key that waits for the\nowner's confirmation in state `enrolled`, of the confirmed key\notherwise: what the device shows, and what the owner compares and\nsends with `device_confirm`.",
            "type": [
              "string",
              "null"
            ]
          },
          "confirmed_at": {
            "description": "When the owner confirmed the key that works now (RFC 3339 UTC); with\na key waiting, the kept key's confirmation.",
            "type": [
              "string",
              "null"
            ]
          },
          "contested_at": {
            "description": "When a used token of its came back with another key, and from where:\nif the device did not pair, someone else holds a certificate for the\nrow (unconfirmed until the owner confirms it), so delete it.",
            "type": [
              "string",
              "null"
            ]
          },
          "contested_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "device_name": {
            "description": "The name the device's user gave the device, as its last enrolment\nsaid it (the enrolment's `device_name`, free text, never trusted for\nanything; *added 2026-10-23*): the waiting key's while one waits, the\nkey that works now's otherwise. Not the name the owner gave the link.",
            "type": [
              "string",
              "null"
            ]
          },
          "enrolled_at": {
            "description": "When its last enrolment was (RFC 3339 UTC): the waiting key's while\none waits (state `enrolled`), the key that works now's otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "enrolled_from": {
            "description": "From where its last enrolment came (the peer address): the waiting\nkey's while one waits, the key that works now's otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "kept_client": {
            "description": "With a key waiting beside the kept one: the kept key's `client`.",
            "type": [
              "string",
              "null"
            ]
          },
          "kept_code": {
            "description": "With a new key waiting beside the device's confirmed one (a re-pair\nthat kept the current key): the kept key's code. The kept key is\nserved until the waiting one is confirmed, which ends it.",
            "type": [
              "string",
              "null"
            ]
          },
          "kept_device_name": {
            "description": "With a key waiting beside the kept one: the kept key's `device_name`\n(*added 2026-10-23*), which `device_name` no longer shows then.",
            "type": [
              "string",
              "null"
            ]
          },
          "local_only": {
            "description": "Paired as \"this computer\".",
            "type": "boolean"
          },
          "state": {
            "$ref": "#/components/schemas/DevicePairingState",
            "description": "Where its pairing stands."
          },
          "token": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PairingTokenView"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its latest pairing token, if it was ever given one.",
            "x-lmgw-secret": true
          },
          "urls": {
            "description": "Its lmgw URLs, `https`, in the owner's order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "state",
          "token",
          "enrolled_at",
          "enrolled_from",
          "client",
          "device_name",
          "confirm_code",
          "kept_code",
          "kept_device_name",
          "kept_client",
          "confirmed_at",
          "contested_at",
          "contested_from",
          "cert_not_after",
          "cert_notice_after",
          "urls",
          "local_only"
        ],
        "type": "object"
      },
      "DeviceUrl": {
        "description": "One URL proposed for another device.",
        "properties": {
          "interface": {
            "description": "The interface the address is on (`eth0`, `wg0`); empty for a\nlistener set to one address.",
            "type": "string"
          },
          "url": {
            "description": "`https://<address>:<device port>`.",
            "type": "string"
          },
          "wireguard": {
            "description": "The interface is a point-to-point link (WireGuard, Tailscale), not\na LAN's.",
            "type": "boolean"
          }
        },
        "required": [
          "url",
          "interface",
          "wireguard"
        ],
        "type": "object"
      },
      "DevicesSettings": {
        "description": "Settings → Network & access → Devices (`devices.*` in\n`GET /api/settings-full`, device link design §9.1).",
        "properties": {
          "client_cert_days": {
            "description": "A device certificate's validity, in days (1 to 3650); the card and\nthe device show a notice from two thirds of it. Applies to the next\ncertificate issued.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "enrol_refuse_per_min": {
            "description": "Failed enrolments per address (an IPv6 address by its /64) per\nminute before the address is answered 429 (1 to 100000); applies at\nonce.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "handshake_timeout_s": {
            "description": "A TLS handshake's bound, in seconds (1 to 300); applies to the next\nconnection.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "header_timeout_s": {
            "description": "A request head's bound, and an idle kept-alive connection's wait for\nthe next one, in seconds (1 to 3600); applies to the next connection.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "listen": {
            "description": "Where the device listener binds: `loopback` (`127.0.0.1` and `[::1]`,\nwhile every paired device is this computer), `all` (`[::]`, every\naddress) or one IP address.",
            "type": "string"
          },
          "listener": {
            "description": "Whether the device listener runs: the TLS listener paired devices\nconnect to. Off until the first pairing turns it on.",
            "type": "boolean"
          },
          "port": {
            "description": "The device listener's port; `null` = the HTTP port's number plus one,\nwritten as a number the first time the listener starts.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "port_effective": {
            "description": "The port the device listener binds: `port`, else the HTTP port's\nnumber plus one; `null` when `port` is `null` and the HTTP port is\n65535 (no port above it), so the setting must name one.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "server_cert_days": {
            "description": "A server certificate's validity, in days (1 to 3650); a server\ncertificate is re-issued from half of it, unnoticed by devices.\nApplies to the next certificate issued.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "token_minutes": {
            "description": "A pairing token's lifetime, in minutes (1 to 1440); applies to the\nnext token.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "transfer_expiry_days": {
            "description": "How long a transfer offer between devices lasts, in days (1 to\n3650); its bytes are deleted when it expires undelivered. Applies to\nthe next offer.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "unauthenticated_max": {
            "description": "The device listener's connections that have not authenticated yet\n(handshakes in progress, connections without a certificate or with\none that opens no working device), at most, from every peer together\n(1 to 4096); a new one past it closes the oldest. Applies to the next\nconnection.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "unauthenticated_per_peer": {
            "description": "The same, from one peer: an IPv4 address, an IPv6 address by its /64\n(1 to 4096); a new one past it closes that peer's oldest. Applies to\nthe next connection.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "unauthenticated_timeout_s": {
            "description": "A whole connection without a client certificate, in seconds (1 to\n300); applies to the next connection.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "listener",
          "listen",
          "port",
          "port_effective",
          "token_minutes",
          "client_cert_days",
          "server_cert_days",
          "handshake_timeout_s",
          "header_timeout_s",
          "unauthenticated_timeout_s",
          "enrol_refuse_per_min",
          "unauthenticated_max",
          "unauthenticated_per_peer",
          "transfer_expiry_days"
        ],
        "type": "object"
      },
      "DevicesSettingsPatch": {
        "additionalProperties": false,
        "description": "The sparse patch both saves take under `devices`.",
        "properties": {
          "client_cert_days": {
            "default": null,
            "description": "A device certificate's validity in days, 1 to 3650; the notice comes\nat two thirds of it. Applies to the next certificate issued.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "enrol_refuse_per_min": {
            "default": null,
            "description": "Failed enrolments per address (an IPv6 address by its /64) per\nminute before a 429, 1 to 100000. Applies at once.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "handshake_timeout_s": {
            "default": null,
            "description": "A TLS handshake's bound in seconds, 1 to 300. Applies to the next\nconnection.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "header_timeout_s": {
            "default": null,
            "description": "A request head's bound, and an idle kept-alive connection's, in\nseconds, 1 to 3600. Applies to the next connection.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "listen": {
            "default": null,
            "description": "Where it binds: `loopback` (127.0.0.1 and [::1]), `all` ([::], every\naddress) or one IP address. Applies at once, moving it and ending its\nconnections.",
            "type": [
              "string",
              "null"
            ]
          },
          "listener": {
            "default": null,
            "description": "The device listener: on or off. Applies at once: on binds it (making\nlmgw's device CA on its first start), off closes it and ends its\nconnections — its feeds, realtime sessions and calls — never the\nplain listener's.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "port": {
            "default": null,
            "description": "Its port, 1 to 65535. Applies at once, moving it and ending its\nconnections. Unset, it is the HTTP port's number plus one, written\nhere the first time the listener is turned on.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "server_cert_days": {
            "default": null,
            "description": "A server certificate's validity in days, 1 to 3650; it is re-issued\nfrom half of it. Applies to the next certificate issued.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "token_minutes": {
            "default": null,
            "description": "A pairing token's lifetime in minutes, 1 to 1440. Applies to the next\ntoken.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "transfer_expiry_days": {
            "default": null,
            "description": "How long a transfer offer between devices lasts, in days, 1 to 3650;\nits bytes are deleted when it expires undelivered. Applies to the\nnext offer.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "unauthenticated_max": {
            "default": null,
            "description": "The device listener's connections that have not authenticated yet\n(handshakes in progress included), at most, from every peer\ntogether, 1 to 4096; a new one past it closes the oldest. Applies to\nthe next connection.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "unauthenticated_per_peer": {
            "default": null,
            "description": "The same, from one address (an IPv6 address by its /64), 1 to 4096;\na new one past it closes that address's oldest. Applies to the next\nconnection.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "unauthenticated_timeout_s": {
            "default": null,
            "description": "A whole connection without a client certificate, in seconds, 1 to\n300. Applies to the next connection.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "DevicesStatus": {
        "description": "`devices` in `GET /api/status` (device link design §9.2): lmgw's device\nCA and the server certificates issued from it.",
        "properties": {
          "ca": {
            "$ref": "#/components/schemas/DeviceCaStatus",
            "description": "lmgw's device CA: whether it exists and is loaded, its pin and how\nits key is kept, or why it cannot be used."
          },
          "leaves": {
            "description": "The server certificates issued since this start, one per local\naddress that served a device connection (one for every loopback\naddress); empty until the device listener serves.",
            "items": {
              "$ref": "#/components/schemas/DeviceLeafStatus"
            },
            "type": "array"
          },
          "listener": {
            "$ref": "#/components/schemas/DeviceListenerStatus",
            "description": "The device listener: off, where it listens, or why it does not."
          },
          "pairing": {
            "$ref": "#/components/schemas/DevicePairingStatus",
            "description": "Pairing: the tokens alive and the failed enrolments counted."
          }
        },
        "required": [
          "ca",
          "leaves",
          "listener",
          "pairing"
        ],
        "type": "object"
      },
      "DictatedVoice": {
        "additionalProperties": false,
        "description": "How a dictated message says it was dictated (`voice` of a send): the\nfacts of the transcribe answer, nothing a reply carries. Unknown fields\nare refused.",
        "properties": {
          "asr": {
            "description": "The speech-to-text alias that was asked.",
            "type": [
              "string",
              "null"
            ]
          },
          "asr_answered_by": {
            "description": "The alias that answered in its place, when a fallback did.",
            "type": [
              "string",
              "null"
            ]
          },
          "asr_ms": {
            "description": "How long the transcription took.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "audio_ms": {
            "description": "The recording's length.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "via": {
            "description": "Must be `dictation`: a realtime turn is written by the bound session\nand cannot be sent.",
            "type": "string"
          }
        },
        "required": [
          "via"
        ],
        "type": "object"
      },
      "DiskInfo": {
        "description": "`container_images`' `disk` field:\n`podman system df` totals plus orphaned build leftovers, shown for\ninformation only — nothing is pruned from here.",
        "properties": {
          "buildah_orphans": {
            "description": "`/var/tmp/buildahNNN` dirs and `Storage` containers not yet cleaned\nup.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "images_total": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "reclaimable": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "images_total",
          "reclaimable",
          "buildah_orphans"
        ],
        "type": "object"
      },
      "DiskRoom": {
        "description": "The models directory's free space against what the files need (D125):\na warning, never a block.",
        "properties": {
          "free_bytes": {
            "description": "The free bytes of the filesystem the models directory is on, read\nwith `statvfs` now; `None` when it couldn't be read.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "needs_bytes": {
            "description": "The bytes still to download: every queued file's listed size less\nwhat its kept `.part` already holds. A file already on disk counts\nnothing.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "notes": {
            "description": "What the check leaves out, each a sentence.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "sentence": {
            "description": "\"Needs 15.6 GiB on the disk, 8.5 GiB is free\", when short; else none.",
            "type": [
              "string",
              "null"
            ]
          },
          "short": {
            "description": "The files need more than is free.",
            "type": "boolean"
          }
        },
        "required": [
          "needs_bytes",
          "free_bytes",
          "short",
          "sentence",
          "notes"
        ],
        "type": "object"
      },
      "DocRequestRow": {
        "description": "One `docs__request` filing. `status` is `pending | fulfilled | dismissed`;\nonly the first two are settable by hand — `fulfilled` is what an ingest\njob's auto-fulfil writes.",
        "properties": {
          "client_name": {
            "description": "MCP client name from `initialize`, when it gave one.",
            "type": [
              "string",
              "null"
            ]
          },
          "count": {
            "format": "int64",
            "type": "integer"
          },
          "first_requested_at": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "last_requested_at": {
            "type": "string"
          },
          "library": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "version": {
            "description": "Empty when the requester pinned no version.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "library",
          "version",
          "reason",
          "client_name",
          "count",
          "first_requested_at",
          "last_requested_at",
          "status"
        ],
        "type": "object"
      },
      "DocsSearchDefaults": {
        "description": "The stage defaults (`Settings.docs_search`) — where a request that\noverrides nothing starts. None of these is a cap: every one is a\nper-request parameter the playground and `docs__query` can override.",
        "properties": {
          "budget_tokens": {
            "description": "`0` means *no budget* — every one of `limit` chunks comes back.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "eval_k": {
            "description": "Depth an eval run measures hit@k at when the request names no `k`.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "fts_weights": {
            "$ref": "#/components/schemas/FtsWeightsView",
            "description": "BM25 column weights — a stage default like any other, and one the\nplayground exposes, so it has to round-trip through a save."
          },
          "k_fts": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "k_rerank": {
            "description": "`0` disables the rerank stage.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "k_vec": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "rrf_k": {
            "format": "float",
            "type": "number"
          }
        },
        "required": [
          "k_fts",
          "k_vec",
          "rrf_k",
          "fts_weights",
          "k_rerank",
          "limit",
          "budget_tokens",
          "eval_k"
        ],
        "type": "object"
      },
      "DocsSearchPatch": {
        "additionalProperties": false,
        "description": "The Docs search stage defaults. Every field is optional so the Docs tab can\nmove one knob without restating the rest.",
        "properties": {
          "budget_tokens": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "eval_k": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "fts_weights": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FtsWeightsPatch"
              },
              {
                "type": "null"
              }
            ]
          },
          "k_fts": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "k_rerank": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "k_vec": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "limit": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "rrf_k": {
            "default": null,
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "DocumentRow": {
        "properties": {
          "content_hash": {
            "description": "Gates incremental re-ingest: unchanged pages never re-run the model.",
            "type": "string"
          },
          "fetched_at": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "source_id": {
            "format": "int64",
            "type": "integer"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "source_id",
          "url",
          "content_hash",
          "fetched_at"
        ],
        "type": "object"
      },
      "DownloadEstimate": {
        "description": "A download's size and the time it takes on this connection (D23).",
        "properties": {
          "engine_bytes": {
            "description": "The engine image's layers still to fetch; `None` when it is on this\nmachine already or its size isn't known (`notes` says which).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "files_bytes": {
            "description": "The files: the weights (every part) and their companions.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "rate_bytes_per_sec": {
            "description": "Bytes per second; `None` with nothing measured.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "rate_from": {
            "$ref": "#/components/schemas/RateSource"
          },
          "secs": {
            "description": "The whole download's seconds at that rate, rounded up.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "sentence": {
            "description": "\"about 4 minutes on your connection\".",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "files_bytes",
          "engine_bytes",
          "rate_bytes_per_sec",
          "rate_from",
          "secs",
          "sentence",
          "notes"
        ],
        "type": "object"
      },
      "DownloadRow": {
        "properties": {
          "dest_path": {
            "type": "string"
          },
          "downloaded_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "file": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "job_id": {
            "description": "Id of the `hf_download` job currently transferring this file, if any —\nwhat \"Cancel\" acts on. `None` means nothing is running for this row.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kept_bytes": {
            "description": "The bytes a failed, cut or paused transfer left in its `.part`, which\nRetry or Resume goes on from (find-a-model design D135). `None` while\na transfer runs, and when nothing is kept.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "percent": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "received_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "repo": {
            "type": "string"
          },
          "requested_revision": {
            "description": "The revision the download asks for: `main`, or the commit an audio\ncatalog entry pins. `None` on a row from before it was recorded (a\n`main` download).",
            "type": [
              "string",
              "null"
            ]
          },
          "resolved_commit": {
            "description": "The commit the file on disk came from (the hub's `X-Repo-Commit`).\n`None` when unknown — every row downloaded before it was recorded.",
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "`queued | downloading | done | failed | update_available` — a row that\nclaims queued/downloading with no live progress is *interrupted*\n(derived, never stored).",
            "type": "string"
          },
          "target": {
            "description": "`chat | aux | audio | image`.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "repo",
          "file",
          "dest_path",
          "target",
          "status",
          "error",
          "size",
          "downloaded_at",
          "received_bytes",
          "percent",
          "job_id",
          "requested_revision",
          "resolved_commit",
          "kept_bytes"
        ],
        "type": "object"
      },
      "DownloadedFrom": {
        "description": "Where a downloaded weights file came from.",
        "properties": {
          "download_id": {
            "description": "The download's id.",
            "format": "int64",
            "type": "integer"
          },
          "file": {
            "description": "The file within it.",
            "type": "string"
          },
          "repo": {
            "description": "The Hugging Face repository.",
            "type": "string"
          }
        },
        "required": [
          "repo",
          "file",
          "download_id"
        ],
        "type": "object"
      },
      "DraftStats": {
        "description": "Speculative decoding's draft statistics, summed over a point's requests. Present only when the\nserver reported them.",
        "properties": {
          "acceptance": {
            "description": "`accepted / drafted`, `None` when nothing was drafted.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "accepted": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "drafted": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "drafted",
          "accepted",
          "acceptance"
        ],
        "type": "object"
      },
      "EditApplied": {
        "description": "One Dockerfile edit's result in a resolved preview: the run log's\n\"applied (N matches)\" / \"not matched\", as data.",
        "properties": {
          "applied": {
            "description": "Occurrences replaced; `0` = not matched (a run fails on that when the\nedit is `required`).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "index": {
            "description": "Position in the edit list, from 0 (an edit's `name` may be empty).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "role": {
            "$ref": "#/components/schemas/EditRole"
          }
        },
        "required": [
          "index",
          "name",
          "role",
          "required",
          "applied"
        ],
        "type": "object"
      },
      "EditRole": {
        "description": "What a Dockerfile edit is for. The role is what lets the build's\nown switches reach an edit that was customized: `ccache` off drops every\n`ccache` and `cache` edit, whether it came\nfrom the preset or was typed by hand.",
        "oneOf": [
          {
            "const": "ccache",
            "description": "Compiler-cache wiring: the `ccache` package, the cache mount, the\ncompiler launchers, the stats line.",
            "type": "string"
          },
          {
            "const": "cache",
            "description": "Another build cache mount (the web UI's npm cache). Optional, and a\ncache like ccache: off with it.",
            "type": "string"
          },
          {
            "const": "build_info",
            "description": "Build number / commit / date injection, so `--version` names what was\nbuilt even though `.git` is not in the build context.",
            "type": "string"
          },
          {
            "const": "qualify",
            "description": "`docker.io/` in front of a bare base image, so it resolves without a\nshort-name alias.",
            "type": "string"
          },
          {
            "const": "base_image",
            "description": "A different base-image variant (sd.cpp's `-cudnn-` dropped).",
            "type": "string"
          },
          {
            "const": "other",
            "description": "Anything else — what a hand-written edit is unless it says otherwise.",
            "type": "string"
          }
        ]
      },
      "EmbeddingsRequest": {
        "properties": {
          "dimensions": {
            "description": "Forwarded (Gemini: outputDimensionality). A route that answers with another length — llama-server has no such parameter — is refused with 400 rather than served full-length vectors.",
            "minimum": 1,
            "type": "integer"
          },
          "encoding_format": {
            "description": "Encoded by the gateway, whatever the upstream: base64 is the little-endian float32 bytes, as OpenAI serves it.",
            "enum": [
              "float",
              "base64"
            ],
            "type": "string"
          },
          "input": {
            "description": "A string, or an array of strings. Token-id arrays are refused with 400: an alias can route to a model with another tokenizer."
          },
          "model": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "type": "object"
      },
      "EmbeddingsResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "embedding": {
                  "description": "Floats, or a base64 string when encoding_format was base64.",
                  "oneOf": [
                    {
                      "items": {
                        "type": "number"
                      },
                      "type": "array"
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "object": {
                  "enum": [
                    "embedding"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "object",
                "index",
                "embedding"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "list"
            ],
            "type": "string"
          },
          "usage": {
            "properties": {
              "prompt_tokens": {
                "description": "What the model reported; 0 when it reported nothing.",
                "minimum": 0,
                "type": "integer"
              },
              "total_tokens": {
                "description": "The same number: embedding generates nothing.",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "total_tokens"
            ],
            "type": "object"
          }
        },
        "required": [
          "object",
          "model",
          "data",
          "usage"
        ],
        "type": "object"
      },
      "Energy": {
        "description": "The energy of a measured window: a point's, summed over its repetitions.",
        "properties": {
          "avg_w": {
            "format": "double",
            "type": "number"
          },
          "joules": {
            "description": "The whole card, idle draw included.",
            "format": "double",
            "type": "number"
          },
          "seconds": {
            "description": "Length of the measured windows, summed.",
            "format": "double",
            "type": "number"
          },
          "source": {
            "$ref": "#/components/schemas/EnergySource"
          },
          "tokens": {
            "description": "The tokens those windows produced (prefill: prompt tokens; decode:\ngenerated tokens).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "tokens_per_joule": {
            "description": "`tokens / joules`; `None` when the windows measured 0 J.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "tokens_per_joule_each": {
            "$ref": "#/components/schemas/Stat",
            "description": "Tokens per joule of each window on its own (one per repetition, or\nper request for prefill): the spread the comparison reads as this\nfigure's noise. A half-second decode window right after an idle\nmoment is measured while the card's clocks ramp up — live, decode at\ndepth 64 read 2.47 and 3.01 tok/J in two runs of identical settings.\nWindows the counter did not move over are left out."
          }
        },
        "required": [
          "joules",
          "seconds",
          "avg_w",
          "tokens",
          "tokens_per_joule",
          "tokens_per_joule_each",
          "source"
        ],
        "type": "object"
      },
      "EnergySource": {
        "description": "Where a joule figure came from.",
        "oneOf": [
          {
            "const": "counter",
            "description": "The driver's total-energy counter, read at both ends of the window\n(NVML `nvmlDeviceGetTotalEnergyConsumption`).",
            "type": "string"
          },
          {
            "const": "integrated",
            "description": "Power samples integrated over the window (trapezoids), because the\ncounter is not available.",
            "type": "string"
          }
        ]
      },
      "EnergySummary": {
        "description": "The run's VRAM and energy picture.",
        "properties": {
          "baseline_vram_bytes": {
            "description": "Device VRAM used before the bench container started.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "idle_power_w": {
            "description": "Mean power over the baseline window, so a view can show net energy.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "peak_power_w": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "peak_vram_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EnergySource"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the run's joules were measured; `None` when the GPU reports no\npower at all (then `unavailable` says why)."
          },
          "total_joules": {
            "description": "First sample to last.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "unavailable": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "source",
          "unavailable",
          "baseline_vram_bytes",
          "idle_power_w",
          "peak_vram_bytes",
          "peak_power_w",
          "total_joules"
        ],
        "type": "object"
      },
      "Engine": {
        "description": "Which of the three engines lmgw runs a build produces. ik_llama.cpp is\n`Llama` with its own repo preset, not an engine of its own: its images run\nin the same classes.",
        "oneOf": [
          {
            "const": "llama",
            "description": "llama.cpp and ik_llama.cpp — `llama-server`.",
            "type": "string"
          },
          {
            "const": "audio",
            "description": "audio.cpp — `audiocpp_server`.",
            "type": "string"
          },
          {
            "const": "sdcpp",
            "description": "stable-diffusion.cpp — `sd-server`.",
            "type": "string"
          }
        ]
      },
      "EngineDownload": {
        "description": "What a model download did about the image the models of its class run\nin (machine-check design §5, D16): that image was not on this machine,\nso the download fetches it too — through the `image_pull` job a start\nof the model would use, keyed by the reference, so a start or an\nEngines-page pull of the same image joins it. Nothing is started: the\nfirst request then only loads the model.",
        "properties": {
          "image": {
            "description": "The image reference, as the class's Image setting names it.",
            "type": "string"
          },
          "job_id": {
            "description": "The `image_pull` job fetching it: started now, or the one already\npulling it. Its bytes are on the jobs feed (`done`/`total`, and\n`size_note` in its detail when the size is not known), and\n`container_image_pull_status` reads how it ended. `null` unless\n`state` is `downloading`; `note` says why.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "note": {
            "description": "Why nothing is downloading: why it could not begin (an image built\non this machine is never pulled — \"run its build again on the\nEngines page\" — and a reference no registry can give is refused),\nor why podman could not say whether the image is here.",
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/EngineFetch",
            "description": "What became of it: downloading, refused, or not known whether it\nis needed."
          }
        },
        "required": [
          "image",
          "state",
          "job_id",
          "note"
        ],
        "type": "object"
      },
      "EngineFetch": {
        "description": "What became of a model download's fetch of its class's image\n(`EngineDownload::state`).",
        "oneOf": [
          {
            "const": "downloading",
            "description": "The image is missing and its `image_pull` job runs (`job_id`).",
            "type": "string"
          },
          {
            "const": "refused",
            "description": "The image is missing and its download could not begin (`note`).",
            "type": "string"
          },
          {
            "const": "not_known",
            "description": "Podman failed to say whether the image is on this machine, or did\nnot answer in time (`note`): nothing was fetched, and the model's\nfirst start looks again.",
            "type": "string"
          }
        ]
      },
      "EnrolledDevice": {
        "description": "`Enrolment::device`.",
        "properties": {
          "id": {
            "description": "The device row's `api_keys.id`; re-pairing keeps it.",
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "The device's name as lmgw gave it, without `device:`.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "ErrorKindSeries": {
        "properties": {
          "counts": {
            "description": "Aligned with `buckets`.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "kind": {
            "type": "string"
          },
          "refusal": {
            "description": "True when this kind is lmgw refusing, rather than an upstream or a\nclient failing — the two belong in different colours.",
            "type": "boolean"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "kind",
          "refusal",
          "total",
          "counts"
        ],
        "type": "object"
      },
      "EvalRunRow": {
        "description": "One measured run. `params` is the stage parameter set it was measured under —\ntwo runs under different parameters are not comparable, so the numbers\nnever travel without them.",
        "properties": {
          "corpus_id": {
            "format": "int64",
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "hit_at_k": {
            "format": "double",
            "type": "number"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "k": {
            "format": "int64",
            "type": "integer"
          },
          "mrr": {
            "format": "double",
            "type": "number"
          },
          "orphaned_queries": {
            "description": "Queries whose every expected chunk is gone — they score zero for a\nreason that is not \"retrieval got worse\".",
            "format": "int64",
            "type": "integer"
          },
          "params": {
            "description": "The stage parameters it was measured under; absent when the stored text\ndoes not parse."
          },
          "queries": {
            "format": "int64",
            "type": "integer"
          },
          "regression": {
            "type": "boolean"
          },
          "report": {
            "description": "Full per-query breakdown; absent on the same terms as `params`."
          }
        },
        "required": [
          "id",
          "corpus_id",
          "k",
          "queries",
          "hit_at_k",
          "mrr",
          "orphaned_queries",
          "regression",
          "created_at"
        ],
        "type": "object"
      },
      "Example": {
        "additionalProperties": false,
        "description": "One static example exchange: what the user says, and how the model\nreplies. Both sides are non-empty.",
        "properties": {
          "reply": {
            "type": "string"
          },
          "user": {
            "type": "string"
          }
        },
        "required": [
          "user",
          "reply"
        ],
        "type": "object"
      },
      "ExportAttachment": {
        "description": "An attachment as the export carries it: its metadata, position and bytes.",
        "properties": {
          "blockers": {
            "description": "For a draft: why it cannot be sent to the thread's current model.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "call_id": {
            "description": "The tool call that made a `tool` file, or the card action that made\nan `action` file (its `act-<boot>-<n>` id, the one its stream's\nframes carried); absent for an upload.",
            "type": "string"
          },
          "created_at": {
            "description": "When it was uploaded.",
            "type": "string"
          },
          "data": {
            "description": "The file's bytes, base64 (standard alphabet, padded).",
            "type": "string"
          },
          "extracted": {
            "description": "The text extracted from it (a PDF's pages, an office file, an audio\nfile's transcript); `null` when there is none.",
            "type": [
              "string",
              "null"
            ]
          },
          "extracted_tokens": {
            "description": "The extracted text's token estimate; `null` when there is none.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "hints": {
            "description": "For a draft: what it becomes on the way, sent all the same (an image\nas a placeholder, a PDF's pages as its text) under a fallback that\ncannot see.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`image`, `pdf`, `text`, `audio`, ... as the upload was classified.",
            "type": "string"
          },
          "meta": {
            "$ref": "#/components/schemas/AttachmentFacts",
            "description": "What extraction found: pages, text-less pages, class, sheets,\ntranscript alias or error, tokens. `{}` for an image."
          },
          "mime": {
            "type": "string"
          },
          "mode": {
            "description": "A text-class PDF's choice, `text` or `images`; `null` when it does\nnot apply or is not chosen yet.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "ord": {
            "description": "Its position among its message's files.",
            "format": "int64",
            "type": "integer"
          },
          "size": {
            "description": "Size in bytes.",
            "format": "int64",
            "type": "integer"
          },
          "source": {
            "description": "Where the file came from: `upload` (the user sent it), `tool` (an\nimage or audio tool of a turn made it) or `action` (an image card's\naction made it).",
            "enum": [
              "upload",
              "tool",
              "action"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "mime",
          "size",
          "mode",
          "meta",
          "extracted_tokens",
          "source",
          "ord",
          "created_at",
          "extracted",
          "data"
        ],
        "type": "object"
      },
      "ExportMessage": {
        "description": "A message as the export carries it: the columns of a stored message with\nits `ir_messages` parsed, and the files sent with it.",
        "properties": {
          "answered_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/ExportAttachment"
            },
            "type": "array"
          },
          "completion_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "content": {
            "type": "string"
          },
          "context": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessageContext"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "images_note": {
            "type": "string"
          },
          "ir_messages": {
            "description": "An agentic turn's tool calls and results as the JSON value the\nrecord holds; `null` for a plain turn. When the record does not\nparse, its raw text and `ir_messages_unparsed: true`."
          },
          "ir_messages_unparsed": {
            "description": "Set (to `true`) only when `ir_messages` is the raw text of a record\nthat did not parse.",
            "type": "boolean"
          },
          "kb_refs": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "description": "A user message's origin: where its client said the user wrote it.",
            "type": [
              "string",
              "null"
            ]
          },
          "prompt_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning": {
            "type": "string"
          },
          "role": {
            "description": "`user`, `assistant` or `tool`.",
            "type": "string"
          },
          "task": {
            "$ref": "#/components/schemas/MessageTask"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          },
          "voice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessageVoice"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "thread_id",
          "role",
          "content",
          "reasoning",
          "prompt_tokens",
          "completion_tokens",
          "ir_messages",
          "kb_refs",
          "context",
          "model",
          "answered_by",
          "voice",
          "origin",
          "created_at",
          "attachments"
        ],
        "type": "object"
      },
      "ExportRef": {
        "description": "A folder or personality profile named in an export.",
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "ExportThread": {
        "description": "A thread as the export carries it: the columns of the thread list's row\n(`ThreadRow`) except the two derived from other rows, `last_message_at`\nand `purge_at`.",
        "properties": {
          "agent_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "archived_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "folder_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "description": "Negative for a temporary thread.",
            "format": "int64",
            "type": "integer"
          },
          "kb_budget_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "kb_mode": {
            "$ref": "#/components/schemas/KbMode"
          },
          "kind": {
            "description": "`chat` or `admin`.",
            "type": "string"
          },
          "max_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "items": {
              "$ref": "#/components/schemas/ThreadMcp"
            },
            "type": "array"
          },
          "media_defaults": {
            "$ref": "#/components/schemas/MediaDefaults",
            "description": "The image and audio tools' default models of its own."
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "type": "string"
          },
          "pinned": {
            "type": "boolean"
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "system_prompt": {
            "type": "string"
          },
          "temperature": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "temporary": {
            "description": "The thread was held in memory only (a temporary chat).",
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "voice": {
            "$ref": "#/components/schemas/ThreadVoice"
          }
        },
        "required": [
          "id",
          "title",
          "model_alias",
          "system_prompt",
          "temperature",
          "max_tokens",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "frequency_penalty",
          "seed",
          "stop",
          "kind",
          "mcp_tools",
          "reasoning_enabled",
          "reasoning_effort",
          "reasoning_budget",
          "agent_id",
          "pinned",
          "archived_at",
          "folder_id",
          "profile_id",
          "kb_ids",
          "kb_mode",
          "kb_budget_tokens",
          "voice",
          "media_defaults",
          "created_at",
          "updated_at",
          "temporary"
        ],
        "type": "object"
      },
      "ExtraChange": {
        "description": "One unpinned extra's change since the last verified run.",
        "properties": {
          "change": {
            "description": "The badge's own wording: `\"pushed\"`, `\"closed unmerged\"`, or one\nof the two \"merged upstream\" readings (see `reasons` of the update status).",
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "label",
          "change"
        ],
        "type": "object"
      },
      "Fallback": {
        "description": "The fallback that answers for a blocked model, and whether it is a local\nmodel: a local one may be a fallback too, and answers where it may run\n(a row on the CPU under the hold).",
        "properties": {
          "alias": {
            "type": "string"
          },
          "local": {
            "type": "boolean"
          }
        },
        "required": [
          "alias",
          "local"
        ],
        "type": "object"
      },
      "FallbackUnusable": {
        "description": "A named hold fallback that cannot answer: `why` is the clause the hold's\nrefusal names it with (\"does not resolve\", \"is itself a candidate alias\").",
        "properties": {
          "alias": {
            "type": "string"
          },
          "why": {
            "type": "string"
          }
        },
        "required": [
          "alias",
          "why"
        ],
        "type": "object"
      },
      "FeedHold": {
        "description": "The GPU hold: whether local models are paused. A held model answers with\nits own fallback, where one is set (each thread's model says which). The\n`hold` event and part of `Hello`.",
        "properties": {
          "active": {
            "description": "The owner's GPU hold is on: models on the graphics card are paused.",
            "type": "boolean"
          },
          "benchmark": {
            "description": "A benchmark run holds the graphics card: every local model waits\nuntil it ends, one on the CPU too, or answers with its fallback\n(chat-plane design D6).",
            "type": "boolean"
          }
        },
        "required": [
          "active",
          "benchmark"
        ],
        "type": "object"
      },
      "FeedPrincipal": {
        "description": "Who the feed is for: its kind and the name it is known by, without the\nkind's prefix. A paired device is kind `device`, named as it was paired\n(\"desktop\", not \"device:desktop\"); the gateway's administrator has the\nother kind: the dashboard (named `dashboard`) or an admin key (named as\nthe key without its prefix).",
        "properties": {
          "kind": {
            "enum": [
              "device",
              "owner"
            ],
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "name"
        ],
        "type": "object"
      },
      "FileFit": {
        "description": "One file's fit on the card, by one measure (design §3.1, §9.2).",
        "properties": {
          "beside": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BesideTerms"
              },
              {
                "type": "null"
              }
            ],
            "description": "What else is on the card, for the beside measure."
          },
          "bits_per_weight": {
            "description": "Bits per weight over the repeating layers (D7), every part of a split\nfile's.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "capacity_bytes": {
            "description": "The room this measure leaves: the card, less what is beside it for\nthe beside measure. The headroom comes off it as well.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "ctx": {
            "description": "The largest context that fits, at most the trained one (D6); `None`\nwhen nothing fits, without a card, or for a mark by size.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "headroom_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "mark": {
            "$ref": "#/components/schemas/FitMark"
          },
          "measure": {
            "$ref": "#/components/schemas/FitMeasure"
          },
          "notes": {
            "description": "What the reader should also know, each a sentence: the hold, admission\noff, a term that couldn't be sized, why the header wasn't read.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "parameters": {
            "description": "The model's parameters from the header's descriptors (D7, D131).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "terms": {
            "$ref": "#/components/schemas/FitTerms"
          },
          "trained_ctx": {
            "description": "The model's trained context, from its header.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "uses_bytes": {
            "description": "The footprint at `ctx` (at one token when nothing fits; the files'\nbytes for a mark by size), without the headroom.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "mark",
          "measure",
          "ctx",
          "trained_ctx",
          "uses_bytes",
          "capacity_bytes",
          "headroom_bytes",
          "terms",
          "beside",
          "bits_per_weight",
          "parameters",
          "notes"
        ],
        "type": "object"
      },
      "FilePick": {
        "description": "The file a repo's list recommends, by one measure (design §3.2).",
        "properties": {
          "file": {
            "description": "The recommended file; `None` when no file qualifies.",
            "type": [
              "string",
              "null"
            ]
          },
          "full_context": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FullContextFile"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the pick fits only a shorter conversation and a smaller file of\nat least 4 bits per weight keeps the whole one."
          },
          "measure": {
            "$ref": "#/components/schemas/FitMeasure"
          },
          "rule": {
            "$ref": "#/components/schemas/PickRule"
          },
          "why": {
            "description": "The \"Why this file\" line.",
            "type": "string"
          }
        },
        "required": [
          "file",
          "rule",
          "measure",
          "why",
          "full_context"
        ],
        "type": "object"
      },
      "FindAnswer": {
        "description": "What a `model_find` answer is (§4.5).",
        "oneOf": [
          {
            "const": "card",
            "description": "A card: a model with a file that fits by its size.",
            "type": "string"
          },
          {
            "const": "no_match",
            "description": "Nothing on the hub matches.",
            "type": "string"
          },
          {
            "const": "no_runnable_file",
            "description": "A match exists, but no GGUF of it does.",
            "type": "string"
          },
          {
            "const": "loose_only",
            "description": "Only repos that match some of the words: `did_you_mean`.",
            "type": "string"
          },
          {
            "const": "all_gated",
            "description": "Every upload that could be used is gated and couldn't be read.",
            "type": "string"
          },
          {
            "const": "nothing_fits",
            "description": "No file of the top author's models fits: the card says so, for the\none closest to fitting.",
            "type": "string"
          },
          {
            "const": "no_file_in_band",
            "description": "The model has GGUF files, but none of 4 to 8 bits per weight, the\nfiles lmgw picks by itself (D71): the sentence says what they are.",
            "type": "string"
          },
          {
            "const": "other_kind",
            "description": "The top match is a kind of model Find a model doesn't set up yet\n(pictures, speech): the sentence points to where it is added.",
            "type": "string"
          },
          {
            "const": "unreachable",
            "description": "Hugging Face couldn't be reached.",
            "type": "string"
          },
          {
            "const": "rate_limited",
            "description": "Hugging Face's rate limit is used up: `hub_budget.reset_s` says when\nit resets.",
            "type": "string"
          },
          {
            "const": "not_hugging_face",
            "description": "An address on another host: answered locally, nothing sent (D124).",
            "type": "string"
          },
          {
            "const": "not_a_model",
            "description": "A Hugging Face page that isn't a model's (an account's, a dataset's,\na Space's): answered locally, nothing sent.",
            "type": "string"
          },
          {
            "const": "more",
            "description": "A later page of the search (`cursor`): only the lists.",
            "type": "string"
          }
        ]
      },
      "FitChange": {
        "description": "One parameter \"Fit again\" changes.",
        "properties": {
          "from": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "key": {
            "description": "`ctx_size`, `ubatch_size` or `batch_size`.",
            "type": "string"
          },
          "to": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "from",
          "to"
        ],
        "type": "object"
      },
      "FitChangeInput": {
        "description": "One parameter \"Fit again\" changes.",
        "properties": {
          "from": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "key": {
            "default": "",
            "description": "`ctx_size`, `ubatch_size` or `batch_size`.",
            "type": "string"
          },
          "to": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FitMark": {
        "description": "A file's mark (design §3.3).",
        "oneOf": [
          {
            "const": "fits",
            "description": "Fits with the model's whole trained context (`ctx` is it).",
            "type": "string"
          },
          {
            "const": "fits_shorter",
            "description": "Fits a shorter conversation: `ctx` is the largest that fits.",
            "type": "string"
          },
          {
            "const": "does_not_fit",
            "description": "Doesn't fit, not even at one token.",
            "type": "string"
          },
          {
            "const": "fits_by_size",
            "description": "The header wasn't read (or couldn't be), and the file's bytes plus\nthe headroom fit: \"fits by size · not checked\" (D8).",
            "type": "string"
          },
          {
            "const": "does_not_fit_by_size",
            "description": "The header wasn't read (or couldn't be), and the file's bytes alone\nare more than the room (D8).",
            "type": "string"
          },
          {
            "const": "unknown",
            "description": "Neither the header's fit nor the file's size is known: the listing\ngives no size, or a split file's part is missing. Never a fit.",
            "type": "string"
          },
          {
            "const": "no_card",
            "description": "Nothing to measure against: no GPU telemetry and no declared budget\n(D9).",
            "type": "string"
          }
        ]
      },
      "FitMeasure": {
        "description": "Which of the two measures of \"fits\" a `FileFit` was taken against\n(design D5, D120).",
        "oneOf": [
          {
            "const": "whole_card",
            "description": "The whole card as admission measures it, with nothing else on it:\nadmission unloads lmgw's other models when this one is asked for.",
            "type": "string"
          },
          {
            "const": "beside",
            "description": "The card less what other programs hold on it now and less lmgw's own\nmodels on it now.",
            "type": "string"
          }
        ]
      },
      "FitNote": {
        "description": "The note a row keeps when its context was fitted to the card rather\nthan planned at the trained one (D26): what Get it (WP5) writes on the\nrow it creates, and what the model editor's \"Fit again\" renews.",
        "properties": {
          "at": {
            "description": "When, as the server's UTC time (`YYYY-MM-DD HH:MM:SS`).",
            "type": "string"
          },
          "capacity_bytes": {
            "description": "That measure's room, before the headroom, and the headroom.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "ctx": {
            "description": "The context the row got.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "headroom_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "measure": {
            "$ref": "#/components/schemas/FitMeasure",
            "description": "The measure it was fitted to."
          },
          "trained_ctx": {
            "description": "The model's trained context, which the plan proposed.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "ctx",
          "trained_ctx",
          "measure",
          "capacity_bytes",
          "headroom_bytes",
          "at"
        ],
        "type": "object"
      },
      "FitTerms": {
        "description": "What a footprint is made of, at the fit's context.",
        "properties": {
          "compute_bytes": {
            "description": "Working memory: the compute buffers.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "kv_cache_bytes": {
            "description": "The conversation's memory: the KV cache and any recurrent state.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "weights_bytes": {
            "description": "The weights on the card, the projector and the drafter included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "weights_bytes",
          "kv_cache_bytes",
          "compute_bytes"
        ],
        "type": "object"
      },
      "Folder": {
        "description": "A Chat folder as `GET /chat/api/folders` lists it, with its thread\ncounts as the caller may see them.",
        "properties": {
          "archive_days": {
            "description": "Days without activity before one of its threads is archived; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "defaults": {
            "$ref": "#/components/schemas/ThreadDefaults"
          },
          "devices_hidden": {
            "description": "Set when a device deleted this folder while it held threads that\ndevice could not see: the folder stays for them, hidden from every\ndevice, until it is shown to devices again from the dashboard. Always\n`false` for a device key, which never sees such a folder.",
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "Folder names need not be unique.",
            "type": "string"
          },
          "ongoing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FolderOngoing"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` for a folder that is not one ongoing conversation."
          },
          "purge_days": {
            "description": "Days after archiving before one of its threads is deleted; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "sort": {
            "description": "The folder's place in the list.",
            "format": "int64",
            "type": "integer"
          },
          "threads_active": {
            "format": "int64",
            "type": "integer"
          },
          "threads_archived": {
            "format": "int64",
            "type": "integer"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "sort",
          "defaults",
          "ongoing",
          "archive_days",
          "purge_days",
          "devices_hidden",
          "created_at",
          "updated_at",
          "threads_active",
          "threads_archived"
        ],
        "type": "object"
      },
      "FolderChanged": {
        "description": "`folder.created` / `folder.updated` for a folder that exists at\ndelivery: the folder as `GET /chat/api/folders` lists it now (its counts\nas the reader may see them), with `by` beside its fields.",
        "properties": {
          "archive_days": {
            "description": "Days without activity before one of its threads is archived; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "by": {
            "description": "Who made the change; `null` for the gateway's own.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "defaults": {
            "$ref": "#/components/schemas/ThreadDefaults"
          },
          "devices_hidden": {
            "description": "Set when a device deleted this folder while it held threads that\ndevice could not see: the folder stays for them, hidden from every\ndevice, until it is shown to devices again from the dashboard. Always\n`false` for a device key, which never sees such a folder.",
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "Folder names need not be unique.",
            "type": "string"
          },
          "ongoing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FolderOngoing"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` for a folder that is not one ongoing conversation."
          },
          "purge_days": {
            "description": "Days after archiving before one of its threads is deleted; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "sort": {
            "description": "The folder's place in the list.",
            "format": "int64",
            "type": "integer"
          },
          "threads_active": {
            "format": "int64",
            "type": "integer"
          },
          "threads_archived": {
            "format": "int64",
            "type": "integer"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "sort",
          "defaults",
          "ongoing",
          "archive_days",
          "purge_days",
          "devices_hidden",
          "created_at",
          "updated_at",
          "threads_active",
          "threads_archived",
          "by"
        ],
        "type": "object"
      },
      "FolderGone": {
        "description": "`folder.deleted`, and `folder.created` / `folder.updated` for a folder\nthat is gone by the time the event is delivered.",
        "properties": {
          "by": {
            "type": [
              "string",
              "null"
            ]
          },
          "deleted": {
            "type": "boolean"
          },
          "folder_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "folder_id",
          "deleted",
          "by"
        ],
        "type": "object"
      },
      "FolderOngoing": {
        "description": "The `ongoing` field of a folder: `null` for a folder that is not an\nongoing conversation.",
        "properties": {
          "current_thread_id": {
            "description": "The thread the conversation continues in; `null` until the first\n`current` call, after its thread was deleted, moved out of the\nfolder or archived by hand, and, for a device key, while the thread\nis out of the key's reach.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "idle_minutes": {
            "description": "Minutes without a message after which the next `current` call starts\na new thread. `0`: a new thread only when a client asks for one.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "idle_minutes",
          "current_thread_id"
        ],
        "type": "object"
      },
      "FolderRef": {
        "description": "A folder named by its id and name.",
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "Forge": {
        "description": "Where a build's repository lives, which decides how PR extras are found.",
        "oneOf": [
          {
            "const": "github",
            "description": "PRs are `refs/pull/<n>/head`, details from the GitHub REST API.",
            "type": "string"
          },
          {
            "const": "gitlab",
            "description": "MRs are `refs/merge-requests/<n>/head`, details from `/api/v4`.",
            "type": "string"
          },
          {
            "const": "plain",
            "description": "No PR list and no forge API: refs from other remotes only.",
            "type": "string"
          }
        ]
      },
      "ForgePr": {
        "description": "One PR (GitHub) or MR (GitLab) as the extras picker shows it.",
        "properties": {
          "author": {
            "type": "string"
          },
          "base_sha": {
            "type": "string"
          },
          "draft": {
            "type": "boolean"
          },
          "head_sha": {
            "type": "string"
          },
          "merge_commit_sha": {
            "description": "The commit the merge put on its target branch — the merge, squash or\nrebase commit (GitHub `merge_commit_sha`; GitLab `merge_commit_sha`,\nelse `squash_commit_sha`). Empty when the forge gives none (an open\nPR, an old GitLab). A build skips a merged PR as \"merged upstream\"\nonly when its base contains this commit (or the PR's head).",
            "type": "string"
          },
          "merged_at": {
            "description": "Set once the forge reports it merged.",
            "type": [
              "string",
              "null"
            ]
          },
          "number": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "state": {
            "description": "The forge's own spelling (`open` | `closed`).",
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "number",
          "title",
          "author",
          "updated_at",
          "draft",
          "state",
          "head_sha",
          "base_sha",
          "merged_at",
          "url",
          "merge_commit_sha"
        ],
        "type": "object"
      },
      "FtsWeightsPatch": {
        "additionalProperties": false,
        "description": "The four BM25 column weights, each optional like every other stage default.",
        "properties": {
          "derived_summary": {
            "default": null,
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "derived_title": {
            "default": null,
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "heading_path": {
            "default": null,
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "payload": {
            "default": null,
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FtsWeightsView": {
        "description": "BM25 column weights, in `chunk_fts` column order.",
        "properties": {
          "derived_summary": {
            "format": "float",
            "type": "number"
          },
          "derived_title": {
            "format": "float",
            "type": "number"
          },
          "heading_path": {
            "format": "float",
            "type": "number"
          },
          "payload": {
            "format": "float",
            "type": "number"
          }
        },
        "required": [
          "payload",
          "heading_path",
          "derived_title",
          "derived_summary"
        ],
        "type": "object"
      },
      "FullContextFile": {
        "description": "The smaller file that keeps the whole context, named in the fold when the\npick fits only a shorter one (D7).",
        "properties": {
          "bits_per_weight": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "file": {
            "type": "string"
          },
          "quant": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentence": {
            "description": "\"Q4_K_S remembers all 262 144 tokens, at 4.6 bits per weight.\"",
            "type": "string"
          },
          "trained_ctx": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "file",
          "quant",
          "trained_ctx",
          "bits_per_weight",
          "sentence"
        ],
        "type": "object"
      },
      "FusedHitView": {
        "properties": {
          "chunk_id": {
            "type": "string"
          },
          "fts_rank": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "knn_rank": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "rrf_score": {
            "format": "float",
            "type": "number"
          }
        },
        "required": [
          "chunk_id",
          "rrf_score",
          "fts_rank",
          "knn_rank"
        ],
        "type": "object"
      },
      "GetWaiting": {
        "description": "One file of a get that waits (WP7, D108).",
        "properties": {
          "file": {
            "description": "The file's path in the repo.",
            "type": "string"
          },
          "note": {
            "description": "The download row's own note, as the Downloads page shows it; `None`\nwhen it has none (`not_started`).",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/WaitReason"
          }
        },
        "required": [
          "file",
          "reason",
          "note"
        ],
        "type": "object"
      },
      "GgufFile": {
        "properties": {
          "path": {
            "description": "Relative to models_dir — exactly what the path fields take.",
            "type": "string"
          },
          "role_guess": {
            "description": "`weights | mmproj | drafter` (filename guess).",
            "type": "string"
          },
          "size": {
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "used_by": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "path",
          "size_bytes",
          "size",
          "used_by",
          "role_guess"
        ],
        "type": "object"
      },
      "GoldenCandidateRow": {
        "description": "One generated query awaiting a decision. It is **not** a golden query: an\neval never scores it, and only an accept turns it into one.",
        "properties": {
          "corpus_id": {
            "format": "int64",
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "decided_at": {
            "description": "Empty while it is still pending.",
            "type": "string"
          },
          "expected_chunk_ids": {
            "description": "The chunk it was written from — attached by code, never named by the\nmodel.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "golden_query_id": {
            "description": "The golden query it became, when it was accepted.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "model": {
            "description": "The model that wrote it — the corpus's pinned ingest model.",
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "rationale": {
            "description": "The model's sentence about why that chunk answers it.",
            "type": "string"
          },
          "status": {
            "description": "`pending | accepted | rejected`.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "corpus_id",
          "query",
          "expected_chunk_ids",
          "rationale",
          "model",
          "status",
          "golden_query_id",
          "created_at",
          "decided_at"
        ],
        "type": "object"
      },
      "GoldenQueryRow": {
        "properties": {
          "corpus_id": {
            "format": "int64",
            "type": "integer"
          },
          "expected_chunk_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "origin": {
            "description": "`manual | synthetic`.",
            "type": "string"
          },
          "query": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "corpus_id",
          "query",
          "expected_chunk_ids",
          "origin"
        ],
        "type": "object"
      },
      "GpuBackend": {
        "description": "The GPU backend a build targets, labelled **GPU backend** on the Engines\npage. Picks the preset's Dockerfile candidate.",
        "enum": [
          "cuda",
          "vulkan",
          "rocm",
          "cpu"
        ],
        "type": "string"
      },
      "GpuIdentity": {
        "description": "The GPU the run used, as far as the sampler sees it. Sums and maxima over the visible\ndevices.",
        "properties": {
          "clock_events": {
            "description": "The OR of every sample's clock-event reasons.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "devices": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "driver": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The first device's name (a comparison key).",
            "type": [
              "string",
              "null"
            ]
          },
          "power_limit_w": {
            "description": "The enforced power limit.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "telemetry": {
            "description": "The GPU probe's own label (`NVML (driver …)`, or why there is none).",
            "type": "string"
          },
          "temp_end_c": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "temp_max_c": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "temp_start_c": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "throttled": {
            "description": "Whether any of those is a throttling reason: NVML's software power cap\n(`0x4`), hardware slowdown (`0x8`), software or hardware thermal\nslowdown (`0x20`, `0x40`) or power-brake slowdown (`0x80`). Idle, the\napplications-clocks setting, sync boost and the display clock are\nstates, not throttling. A run that throttled reports the throttled\nnumbers.",
            "type": "boolean"
          },
          "vram_total_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "driver",
          "devices",
          "vram_total_bytes",
          "power_limit_w",
          "temp_start_c",
          "temp_end_c",
          "temp_max_c",
          "clock_events",
          "throttled",
          "telemetry"
        ],
        "type": "object"
      },
      "GroupApplied": {
        "description": "A group, `apply`: every running member recreated, and the static checks\nover every enabled model in scope.",
        "properties": {
          "advisories": {
            "items": {
              "$ref": "#/components/schemas/ContainerAdvisories"
            },
            "type": "array"
          },
          "busy": {
            "items": {
              "$ref": "#/components/schemas/ContainerBusy"
            },
            "type": "array"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ContainerFailure"
            },
            "type": "array"
          },
          "held": {
            "description": "Stopped and not started again because the GPU hold is on.",
            "items": {
              "$ref": "#/components/schemas/ContainerModel"
            },
            "type": "array"
          },
          "message": {
            "type": "string"
          },
          "models_enabled": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "models_with_advisories": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "models_with_problems": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "note": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "problems": {
            "items": {
              "$ref": "#/components/schemas/ContainerProblems"
            },
            "type": "array"
          },
          "recreated": {
            "items": {
              "$ref": "#/components/schemas/ContainerPort"
            },
            "type": "array"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "target",
          "held",
          "models_enabled",
          "models_with_problems",
          "problems",
          "models_with_advisories",
          "advisories",
          "recreated",
          "busy",
          "errors",
          "message",
          "note"
        ],
        "type": "object"
      },
      "GroupRestarted": {
        "description": "A group, `restart`.",
        "properties": {
          "busy": {
            "items": {
              "$ref": "#/components/schemas/ContainerBusy"
            },
            "type": "array"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ContainerFailure"
            },
            "type": "array"
          },
          "held": {
            "description": "Left running untouched because the GPU hold would not let them start\nagain.",
            "items": {
              "$ref": "#/components/schemas/ContainerModel"
            },
            "type": "array"
          },
          "message": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "restarted": {
            "items": {
              "$ref": "#/components/schemas/ContainerPort"
            },
            "type": "array"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "target",
          "restarted",
          "busy",
          "held",
          "errors",
          "message"
        ],
        "type": "object"
      },
      "GroupStarted": {
        "description": "A group, `start`: only the models flagged warm_start are started.",
        "properties": {
          "already_running": {
            "items": {
              "$ref": "#/components/schemas/ContainerModel"
            },
            "type": "array"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ContainerFailure"
            },
            "type": "array"
          },
          "held": {
            "description": "Left alone because the GPU hold is on.",
            "items": {
              "$ref": "#/components/schemas/ContainerModel"
            },
            "type": "array"
          },
          "note": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "started": {
            "items": {
              "$ref": "#/components/schemas/ContainerPort"
            },
            "type": "array"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "target",
          "started",
          "already_running",
          "held",
          "errors",
          "note"
        ],
        "type": "object"
      },
      "GroupStatus": {
        "description": "A group, `status`.",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "runtime": {
            "description": "The containers of the group.",
            "items": {
              "$ref": "#/components/schemas/RuntimeStatus"
            },
            "type": "array"
          },
          "target": {
            "description": "The group asked about: `all`, `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "vram": {
            "$ref": "#/components/schemas/VramStatus",
            "description": "The GPU ledger, whole even when one group was asked about."
          }
        },
        "required": [
          "ok",
          "target",
          "runtime",
          "vram"
        ],
        "type": "object"
      },
      "GroupStopped": {
        "description": "A group, `stop`.",
        "properties": {
          "busy": {
            "description": "Still serving requests and left running; `override` forces them.",
            "items": {
              "$ref": "#/components/schemas/ContainerBusy"
            },
            "type": "array"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ContainerFailure"
            },
            "type": "array"
          },
          "message": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "stopped": {
            "items": {
              "$ref": "#/components/schemas/ContainerModel"
            },
            "type": "array"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "target",
          "stopped",
          "busy",
          "errors",
          "message"
        ],
        "type": "object"
      },
      "Headline": {
        "description": "The headline numbers of one run, each `None` when the run did not\nmeasure it.",
        "properties": {
          "aggregate_streams": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "aggregate_tok_s": {
            "description": "Aggregate tok/s at *N_slots* streams.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "decode_deep_depth": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "decode_deep_tok_s": {
            "description": "Decode tok/s at the deepest point, *D_max*.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "decode_tok_s": {
            "description": "Decode tok/s at depth 64.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "decode_tokens_per_joule": {
            "description": "Decode tokens per joule at depth 64.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "load_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "load_vram_bytes": {
            "description": "VRAM the load took (after load minus the baseline).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "prefill_tok_s": {
            "description": "Prefill tok/s at 2048 tokens, or the nearest measured length.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "prefill_tokens": {
            "description": "The length it was measured at.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "stall_ms": {
            "description": "The mixed phase's median stall.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "ttft_ms": {
            "description": "TTFT at that same length.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "prefill_tok_s",
          "prefill_tokens",
          "ttft_ms",
          "decode_tok_s",
          "decode_deep_tok_s",
          "decode_deep_depth",
          "aggregate_tok_s",
          "aggregate_streams",
          "decode_tokens_per_joule",
          "load_ms",
          "load_vram_bytes",
          "stall_ms"
        ],
        "type": "object"
      },
      "HeatCell": {
        "properties": {
          "dow": {
            "format": "int64",
            "type": "integer"
          },
          "hour": {
            "format": "int64",
            "type": "integer"
          },
          "requests": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "dow",
          "hour",
          "requests"
        ],
        "type": "object"
      },
      "HelloCert": {
        "description": "`Hello::cert`: the device certificate's dates, RFC 3339 UTC.",
        "properties": {
          "not_after": {
            "description": "When the certificate lapses.",
            "type": "string"
          },
          "notice_after": {
            "description": "From when the device says \"this certificate lapses on `<not_after>`;\npair it again before then\" (two thirds of its validity).",
            "type": "string"
          }
        },
        "required": [
          "not_after",
          "notice_after"
        ],
        "type": "object"
      },
      "HfCompanion": {
        "description": "A file `hf_add` queued beside the weights.",
        "properties": {
          "file": {
            "description": "Path inside the repo.",
            "type": "string"
          },
          "role": {
            "description": "`mmproj | drafter`.",
            "type": "string"
          }
        },
        "required": [
          "file",
          "role"
        ],
        "type": "object"
      },
      "HfUpdatesChecked": {
        "description": "`POST /api/op/hf_set` with `action: check_updates`: the tracked downloads of\none class compared with the hub.",
        "properties": {
          "errors": {
            "description": "One sentence per file the hub could not be asked about.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "ok": {
            "description": "`false` when a file could not be compared (`errors` is not empty); the\nanswer is still a success, for the files that could.",
            "type": "boolean"
          },
          "updates_available": {
            "description": "How many finished downloads now differ from the hub's copy; each is\nflagged `update_available`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "ok",
          "updates_available",
          "errors"
        ],
        "type": "object"
      },
      "HoldSettingsDto": {
        "description": "The GPU hold settings. `active` is\nreported here but never settable through `SettingsFullPatch` — it is\ntoggled only through the `hold_set` op, because engaging it has the side\neffect of stopping containers.",
        "properties": {
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "active"
        ],
        "type": "object"
      },
      "HostCpu": {
        "description": "This machine's CPUs (reported as `host_cpu`).",
        "properties": {
          "logical_cpus": {
            "description": "Online logical CPUs, SMT siblings included.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "physical_cores": {
            "description": "Physical cores, or the logical count when the topology is unreadable\n(`source`).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "source": {
            "description": "`topology` (counted from the kernel's CPU topology) | `logical` (the\ntopology could not be read, so the logical count stands in).",
            "type": "string"
          }
        },
        "required": [
          "physical_cores",
          "logical_cpus",
          "source"
        ],
        "type": "object"
      },
      "HostSettings": {
        "description": "Settings → MCP (`mcp.*` in `GET /api/settings-full`): the host link's\nlimits, each explicit on the link's WebSocket (§5.1), and the MCP Tasks\npoll interval.",
        "properties": {
          "host_max_frame_mb": {
            "description": "The largest frame, in MiB; `0` = bounded by `host_max_message_mb`.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "host_max_message_mb": {
            "description": "The largest message a device may send, in MiB; `0` = no bound of its\nown (a frame is then bounded by `host_max_frame_mb`). Not `0`\ntogether with `host_max_frame_mb`. A full-desktop screenshot is the\nexpected large message.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "host_ping_interval_s": {
            "description": "Seconds between the link's pings; a ping with no pong for a whole\ninterval closes the link. `0` = no pings, and no bound on a device\nthat stopped answering.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "task_poll_interval_s": {
            "description": "Seconds between two `tasks/get` of an MCP task whose server suggests\nno `pollInterval` of its own (MCP Tasks design §5.2); a server's\nstatus notifications act at once. At least `1`.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "host_max_message_mb",
          "host_max_frame_mb",
          "host_ping_interval_s",
          "task_poll_interval_s"
        ],
        "type": "object"
      },
      "HostedCallCount": {
        "description": "One hosted call type and its count (`UnpricedHostedTool::calls`).",
        "properties": {
          "calls": {
            "format": "int64",
            "type": "integer"
          },
          "item_type": {
            "description": "The output item type: `web_search_call`, `file_search_call`,\n`code_interpreter_call`, `image_generation_call` or `shell_call`.",
            "type": "string"
          }
        },
        "required": [
          "item_type",
          "calls"
        ],
        "type": "object"
      },
      "HubBudget": {
        "description": "The hub's rate limit after this answer (§4.5), from its `RateLimit` and\n`RateLimit-Policy` headers. lmgw keeps no counter of its own.",
        "properties": {
          "allowance": {
            "description": "What the hub allows, from the last policy it sent, with or without\nthe token (\"Without an account it allows 500 requests every 5\nminutes; a Hugging Face token in Settings raises that.\"): the end of\n`sentence`, alone, for a page that says the wait itself. `None`\nwithout a policy.",
            "type": [
              "string",
              "null"
            ]
          },
          "calls": {
            "description": "The requests this answer made.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "near": {
            "description": "Fewer requests are left than this answer made: the next search may\nmeet the limit.",
            "type": "boolean"
          },
          "quota": {
            "description": "Requests the window allows.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "remaining": {
            "description": "Requests left in the window.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "reset_s": {
            "description": "Seconds until the window resets.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "sentence": {
            "description": "What the person reads when `near` or limited.",
            "type": [
              "string",
              "null"
            ]
          },
          "window_s": {
            "description": "The window's length in seconds.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "remaining",
          "reset_s",
          "quota",
          "window_s",
          "calls",
          "near",
          "sentence",
          "allowance"
        ],
        "type": "object"
      },
      "ImageAsset": {
        "properties": {
          "image_upscale": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "ImageCapabilities": {
        "description": "One sd-server's own answer about the pipeline it loaded.\n\nEvery field defaults, because this is the one payload in the class that\ncomes from a moving container tag: a build that stops reporting a number\nmust leave the rest readable rather than fail the frame.",
        "properties": {
          "current_mode": {
            "type": "string"
          },
          "defaults_by_mode": {
            "additionalProperties": true,
            "description": "The request defaults per mode, as the server serializes its own\nrequest struct (`img_gen` → `{width, height, sample_params, …}`).",
            "type": "object"
          },
          "features": {
            "$ref": "#/components/schemas/ImageFeatures"
          },
          "limits": {
            "$ref": "#/components/schemas/ImageLimits"
          },
          "loras": {
            "items": {
              "$ref": "#/components/schemas/ImageAsset"
            },
            "type": "array"
          },
          "output_formats": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "preview_modes": {
            "description": "The preview modes the build offers (`none`, `proj`, `tae`, `vae`);\nempty for a build without previews.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "samplers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "schedulers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supported_modes": {
            "description": "`[\"img_gen\"]`, `[\"img_gen\",\"vid_gen\"]` — what the loaded pipeline can\nactually do, as opposed to what the row claims.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "upscale": {
            "description": "The build can upscale with a model under its upscalers directory.",
            "type": "boolean"
          },
          "upscalers": {
            "items": {
              "$ref": "#/components/schemas/ImageAsset"
            },
            "type": "array"
          }
        },
        "required": [
          "supported_modes",
          "current_mode",
          "limits",
          "features",
          "samplers",
          "schedulers",
          "output_formats",
          "loras",
          "upscalers",
          "preview_modes",
          "upscale",
          "defaults_by_mode"
        ],
        "type": "object"
      },
      "ImageEditsRequest": {
        "description": "Refused unless the resolved model's row has its edit pipeline enabled.",
        "properties": {
          "image": {
            "description": "One or more image files. lmgw relays every multipart field named image verbatim, with no cardinality check of its own.",
            "items": {
              "format": "binary",
              "type": "string"
            },
            "type": "array"
          },
          "mask": {
            "format": "binary",
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "n": {
            "type": "integer"
          },
          "prompt": {
            "type": "string"
          },
          "size": {
            "type": "string"
          }
        },
        "required": [
          "image",
          "model",
          "prompt"
        ],
        "type": "object"
      },
      "ImageFeatures": {
        "description": "Which optional inputs the loaded pipeline admits to accepting. Not an edit\ngate — the row's `edit` column is.",
        "properties": {
          "cache": {
            "type": "boolean"
          },
          "cancel_generating": {
            "type": "boolean"
          },
          "cancel_queued": {
            "type": "boolean"
          },
          "control_image": {
            "type": "boolean"
          },
          "hires": {
            "type": "boolean"
          },
          "init_image": {
            "type": "boolean"
          },
          "ip_adapter_image": {
            "type": "boolean"
          },
          "lora": {
            "type": "boolean"
          },
          "mask_image": {
            "type": "boolean"
          },
          "preview": {
            "description": "The job API draws previews of a running generation.",
            "type": "boolean"
          },
          "ref_images": {
            "type": "boolean"
          },
          "vae_tiling": {
            "type": "boolean"
          }
        },
        "required": [
          "init_image",
          "mask_image",
          "ref_images",
          "control_image",
          "ip_adapter_image",
          "lora",
          "hires",
          "vae_tiling",
          "cache",
          "cancel_queued",
          "cancel_generating",
          "preview"
        ],
        "type": "object"
      },
      "ImageGenForm": {
        "description": "Everything the lab's two panels collect, as typed. Numbers travel as the\nstrings the inputs hold: an empty field means \"say nothing about this\", not\nzero, and a malformed one has to be reportable as a message rather than\nsilently become a default.",
        "properties": {
          "cfg_scale": {
            "type": "string"
          },
          "height": {
            "type": "string"
          },
          "loras": {
            "items": {
              "$ref": "#/components/schemas/ImageLoraRow"
            },
            "type": "array"
          },
          "model": {
            "description": "The public alias — `image/<id>` for a local row, the alias for a cloud\none. Rewritten to the concrete upstream id by the route itself.",
            "type": "string"
          },
          "n": {
            "type": "string"
          },
          "negative_prompt": {
            "type": "string"
          },
          "output_compression": {
            "type": "string"
          },
          "output_format": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "sampler": {
            "type": "string"
          },
          "scheduler": {
            "type": "string"
          },
          "seed": {
            "description": "Blank says nothing (sd-server's own default is a fixed 42); `-1` is its\nspelling for \"random each run\".",
            "type": "string"
          },
          "steps": {
            "type": "string"
          },
          "width": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "prompt",
          "negative_prompt",
          "width",
          "height",
          "n",
          "steps",
          "cfg_scale",
          "seed",
          "sampler",
          "scheduler",
          "output_format",
          "output_compression",
          "loras"
        ],
        "type": "object"
      },
      "ImageGenFormInput": {
        "description": "Everything the lab's two panels collect, as typed. Numbers travel as the\nstrings the inputs hold: an empty field means \"say nothing about this\", not\nzero, and a malformed one has to be reportable as a message rather than\nsilently become a default.",
        "properties": {
          "cfg_scale": {
            "default": "",
            "type": "string"
          },
          "height": {
            "default": "",
            "type": "string"
          },
          "loras": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/ImageLoraRowInput"
            },
            "type": "array"
          },
          "model": {
            "default": "",
            "description": "The public alias — `image/<id>` for a local row, the alias for a cloud\none. Rewritten to the concrete upstream id by the route itself.",
            "type": "string"
          },
          "n": {
            "default": "",
            "type": "string"
          },
          "negative_prompt": {
            "default": "",
            "type": "string"
          },
          "output_compression": {
            "default": "",
            "type": "string"
          },
          "output_format": {
            "default": "",
            "type": "string"
          },
          "prompt": {
            "default": "",
            "type": "string"
          },
          "sampler": {
            "default": "",
            "type": "string"
          },
          "scheduler": {
            "default": "",
            "type": "string"
          },
          "seed": {
            "default": "",
            "description": "Blank says nothing (sd-server's own default is a fixed 42); `-1` is its\nspelling for \"random each run\".",
            "type": "string"
          },
          "steps": {
            "default": "",
            "type": "string"
          },
          "width": {
            "default": "",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ImageGenerationsRequest": {
        "additionalProperties": true,
        "description": "Other keys are forwarded for a cloud image upstream.",
        "properties": {
          "model": {
            "type": "string"
          },
          "n": {
            "type": "integer"
          },
          "output_compression": {
            "type": "integer"
          },
          "output_format": {
            "type": "string"
          },
          "prompt": {
            "description": "May carry a trailing <sd_cpp_extra_args>{…}</sd_cpp_extra_args> block of raw sd.cpp CLI arguments; the dashboard's Image lab builds this block and is the reference for its contents.",
            "type": "string"
          },
          "size": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "type": "object"
      },
      "ImageGenerationsResponse": {
        "description": "The upstream's answer, relayed as it sends it: each image carries what response_format asked for, plus whatever else the upstream adds (revised_prompt).",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "items": {
              "anyOf": [
                {
                  "required": [
                    "b64_json"
                  ]
                },
                {
                  "required": [
                    "url"
                  ]
                }
              ],
              "description": "One image: b64_json, or url when the request asked for response_format url (an upstream's default, dall-e's, for instance).",
              "properties": {
                "b64_json": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "created",
          "data"
        ],
        "type": "object"
      },
      "ImageLabEditRequest": {
        "description": "multipart/form-data. The body size is not limited.",
        "properties": {
          "form": {
            "contentMediaType": "application/json",
            "contentSchema": {
              "$ref": "#/components/schemas/ImageLabForm"
            },
            "description": "The form as a JSON string: the ImageGenForm the generate route takes as its body, with optionally `image` and `mask` naming kept pictures ({id, name}, an artifact the lab store keeps) in place of an upload.",
            "type": "string"
          },
          "image": {
            "description": "The picture to edit; stands in for the form's `image` ref. One of the two is required.",
            "format": "binary",
            "type": "string"
          },
          "mask": {
            "description": "An optional mask.",
            "format": "binary",
            "type": "string"
          }
        },
        "required": [
          "form"
        ],
        "type": "object"
      },
      "ImageLabForm": {
        "description": "A group's form: the page's form, and for an edit its picture and mask as\nkept files. Also what an edit's `form` part takes, so a re-opened edit\nnames its kept picture instead of uploading it again; an `image` or\n`mask` part of the upload stands in for the ref.",
        "properties": {
          "cfg_scale": {
            "default": "",
            "type": "string"
          },
          "height": {
            "default": "",
            "type": "string"
          },
          "image": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LabFileRef"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "An edit's picture, kept; `null` for a generation."
          },
          "loras": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/ImageLoraRowInput"
            },
            "type": "array"
          },
          "mask": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LabFileRef"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "An edit's mask, kept; `null` without one."
          },
          "model": {
            "default": "",
            "description": "The public alias — `image/<id>` for a local row, the alias for a cloud\none. Rewritten to the concrete upstream id by the route itself.",
            "type": "string"
          },
          "n": {
            "default": "",
            "type": "string"
          },
          "negative_prompt": {
            "default": "",
            "type": "string"
          },
          "output_compression": {
            "default": "",
            "type": "string"
          },
          "output_format": {
            "default": "",
            "type": "string"
          },
          "prompt": {
            "default": "",
            "type": "string"
          },
          "sampler": {
            "default": "",
            "type": "string"
          },
          "scheduler": {
            "default": "",
            "type": "string"
          },
          "seed": {
            "default": "",
            "description": "Blank says nothing (sd-server's own default is a fixed 42); `-1` is its\nspelling for \"random each run\".",
            "type": "string"
          },
          "steps": {
            "default": "",
            "type": "string"
          },
          "width": {
            "default": "",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ImageLabModel": {
        "description": "One model the Image lab can generate with: a local `image/<id>` row, or a\ncloud alias whose upstream catalog says it draws. `C` is the shape of the\nprobed capabilities: the gateway fills in its own, a reader (and the API\ndocument) uses `ImageCapabilities`.",
        "properties": {
          "args": {
            "additionalProperties": true,
            "description": "The flags a local row's container is started with (`width`, `height`,\n`steps`, `cfg_scale`, `sampling_method` are the form's defaults when\nset); `null` for a cloud alias.",
            "type": [
              "object",
              "null"
            ]
          },
          "edit": {
            "description": "Whether it serves `/v1/images/edits`.",
            "type": "boolean"
          },
          "endpoints": {
            "description": "The `/v1` routes the model serves.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "image_capabilities": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ImageCapabilities"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the running container reported about its loaded pipeline: the\nsamplers, schedulers, size bounds and LoRAs on disk. `null` until a\ncontainer has been probed."
          },
          "local": {
            "description": "A local row of this gateway, not a cloud alias.",
            "type": "boolean"
          },
          "model_id": {
            "description": "The local row's model id; `null` for a cloud alias.",
            "type": [
              "string",
              "null"
            ]
          },
          "modes": {
            "description": "A local row's pipelines (`img_gen`, `vid_gen`, ...), as the operator\ndeclared them; `null` for a cloud alias.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "name": {
            "description": "The alias to send as `model`.",
            "type": "string"
          },
          "notes": {
            "description": "What the gateway noticed about the model, one sentence each.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "owner": {
            "description": "The upstream that serves it (`local` for the gateway's own rows).",
            "type": "string"
          },
          "state": {
            "description": "A local row's container state (`starting`, `ready`, `stopping`);\n`null` when it has none running, and for a cloud alias.",
            "type": [
              "string",
              "null"
            ]
          },
          "task": {
            "description": "The model's task, as `GET /v1/models` reports it.",
            "type": "string"
          },
          "warnings": {
            "description": "Non-fatal problems the running container's start found.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "owner",
          "local",
          "model_id",
          "task",
          "endpoints",
          "edit",
          "modes",
          "args",
          "notes",
          "state",
          "warnings",
          "image_capabilities"
        ],
        "type": "object"
      },
      "ImageLimits": {
        "description": "Bounds the server enforces on a request — **the server's real numbers**;\nlmgw never substitutes one of its own, so a `None` is shown as unknown\nrather than filled in.",
        "properties": {
          "max_batch_count": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_height": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_queue_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_upscale_height": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_upscale_width": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_width": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "min_height": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "min_width": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "min_width",
          "max_width",
          "min_height",
          "max_height",
          "max_batch_count",
          "max_queue_size",
          "max_upscale_width",
          "max_upscale_height"
        ],
        "type": "object"
      },
      "ImageLoraRow": {
        "description": "One row of the optional LoRA table. `<lora:…>` prompt tags are refused by\nevery sd.cpp family, so a LoRA is this structured field or nothing.",
        "properties": {
          "multiplier": {
            "description": "Blank leaves the server's own multiplier in place.",
            "type": "string"
          },
          "path": {
            "description": "A name from the probed `loras` list, or a path the server can resolve\nunder its `--lora-model-dir`.",
            "type": "string"
          }
        },
        "required": [
          "path",
          "multiplier"
        ],
        "type": "object"
      },
      "ImageLoraRowInput": {
        "description": "One row of the optional LoRA table. `<lora:…>` prompt tags are refused by\nevery sd.cpp family, so a LoRA is this structured field or nothing.",
        "properties": {
          "multiplier": {
            "default": "",
            "description": "Blank leaves the server's own multiplier in place.",
            "type": "string"
          },
          "path": {
            "default": "",
            "description": "A name from the probed `loras` list, or a path the server can resolve\nunder its `--lora-model-dir`.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ImageModel": {
        "description": "An image model row — one stable-diffusion.cpp pipeline.\n\nThe two JSON-map fields stay dynamic on purpose, exactly as the server\ntypes them: sd.cpp adds a model family and its flag every few weeks, and\nthe keys are validated against the container image's own `--help` rather\nthan against any enum on either side of this wire.",
        "properties": {
          "args": {
            "additionalProperties": true,
            "description": "Runtime + default-generation flags, same key convention. A `true`\nrenders as a bare switch.",
            "type": "object"
          },
          "capabilities_override": {
            "description": "An alias's capabilities override for the derived `/v1/models` capability facts."
          },
          "edit": {
            "description": "The pipeline takes reference images and may serve `/v1/images/edits`.",
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "extra_run_args": {
            "description": "Per-model `podman run` args override; `None` inherits the class's.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The model or alias that answers whenever this one cannot (the GPU\nhold, VRAM outside lmgw, background traffic deferred, a disabled\nrow), as written. `None` = no fallback.",
            "type": [
              "string",
              "null"
            ]
          },
          "files": {
            "additionalProperties": true,
            "description": "Flag key → path relative to the image models dir. Exactly one of\n`model` / `diffusion_model` is present on a valid row.",
            "type": "object"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "description": "Seconds idle before the container is stopped; `0` never reaps.",
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Per-model container image override; `None` inherits the image class\nsettings' image.",
            "type": [
              "string",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "modes": {
            "description": "`img_gen` / `vid_gen`; empty means the default (`img_gen`).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "peak_extra_bytes": {
            "description": "The learned transient peak: what one generation was measured to need\nabove this pipeline's idle residency. Written by\nthe gateway, not by the editor — a `files` or `args` change resets it\nto `None`, because a different pipeline has a different peak.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "peak_learned_at": {
            "description": "When that figure was observed; `None` whenever the peak is.",
            "type": [
              "string",
              "null"
            ]
          },
          "preview_mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PreviewMode"
              },
              {
                "type": "null"
              }
            ],
            "description": "How a running generation's preview is drawn (design §5.2); `None`\nis the default: a quick sketch where the build offers it, else off."
          },
          "prompt_style": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PromptStyle"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the chat model writes this row's prompts (chat-media-tools\ndesign §3.4); `None` derives it from the matching recipe."
          },
          "warm_start": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "files",
          "args",
          "modes",
          "edit",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "idle_seconds",
          "fallback",
          "peak_extra_bytes",
          "peak_learned_at",
          "prompt_style",
          "preview_mode"
        ],
        "type": "object"
      },
      "ImageModelDetail": {
        "description": "An image-generation pipeline read back.",
        "properties": {
          "args": {
            "additionalProperties": true,
            "description": "Runtime and default-generation flags.",
            "type": "object"
          },
          "capabilities_override": true,
          "command_line": {
            "type": "string"
          },
          "edit": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoints": {
            "description": "The routes that serve it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "extra_run_args": {
            "description": "`podman run` args override, one entry per argument; null inherits.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The one fallback (openai egress design §14.2), as written; `null` =\nnone.",
            "type": [
              "string",
              "null"
            ]
          },
          "files": {
            "additionalProperties": true,
            "description": "Flag key to path under the image models dir.",
            "type": "object"
          },
          "files_present": {
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "For each key of `files`, whether the file (or directory) exists.",
            "type": "object"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "type": [
              "string",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "modes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "peak": {
            "description": "`peak_extra_bytes` in a sentence.",
            "type": "string"
          },
          "peak_extra_bytes": {
            "description": "Bytes one generation was measured to need above idle residency;\nnull until one has run.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "peak_learned_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "problems": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "public_name": {
            "description": "The name clients call it by, with the image prefix.",
            "type": "string"
          },
          "warm_start": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "public_name",
          "files",
          "files_present",
          "args",
          "modes",
          "edit",
          "endpoints",
          "enabled",
          "image",
          "extra_run_args",
          "warm_start",
          "idle_seconds",
          "fallback",
          "capabilities_override",
          "peak_extra_bytes",
          "peak_learned_at",
          "peak",
          "command_line",
          "problems"
        ],
        "type": "object"
      },
      "ImageModelView": {
        "properties": {
          "deferrals_24h": {
            "description": "`LocalModelView::deferrals_24h`, for this row's `public_name`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "derived_prompt_style": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PromptStyle"
              },
              {
                "type": "null"
              }
            ],
            "description": "The prompt style the shipped recipe matching this row's weights\ngives it (chat-media-tools design §3.4): what applies while the\nrow's own `prompt_style` is unset. `null` when no recipe matches."
          },
          "model": {
            "$ref": "#/components/schemas/ImageModel"
          },
          "public_name": {
            "type": "string"
          }
        },
        "required": [
          "public_name",
          "model",
          "derived_prompt_style",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "ImageProvenance": {
        "description": "An image's build provenance: read\nfrom the `dev.lmgw.*` OCI labels, so an image stays self-describing even\nafter its `builds`/`build_runs` rows are gone.",
        "properties": {
          "base": {
            "description": "Base SHA the run built from (`dev.lmgw.base`).",
            "type": "string"
          },
          "build_id": {
            "format": "int64",
            "type": "integer"
          },
          "build_name": {
            "description": "The build's name as it is now — its slug when it has no name — read\nfrom the builds table, so \"follows <build>\" needs no second call.\n`None` once the build is deleted (the labels outlive it).",
            "type": [
              "string",
              "null"
            ]
          },
          "extras": {
            "description": "The extras merged in, each with its resolved SHA (`dev.lmgw.extras`,\nstored on the image as JSON) — the same\nshape a run's `inputs.resolved` carries.",
            "items": {
              "$ref": "#/components/schemas/ResolvedExtra"
            },
            "type": "array"
          },
          "git_ref": {
            "type": "string"
          },
          "instance": {
            "description": "The lmgw instance that built it (`dev.lmgw.instance`: one per data\ndir, so a dev instance's images are told from production's). Empty\non an image built before the label existed.",
            "type": "string"
          },
          "other_instance": {
            "description": "Built by another lmgw instance than the one answering. Its build and\nrun ids are that instance's, so `build_id` and `run_id` are 0 and\n`build_name` is `None` — the provenance is the labels' alone.",
            "type": "boolean"
          },
          "repo": {
            "type": "string"
          },
          "run_id": {
            "format": "int64",
            "type": "integer"
          },
          "slug": {
            "type": "string"
          }
        },
        "required": [
          "build_id",
          "build_name",
          "run_id",
          "slug",
          "repo",
          "git_ref",
          "base",
          "extras",
          "instance",
          "other_instance"
        ],
        "type": "object"
      },
      "ImagePullJobDetail": {
        "description": "`JobRow.detail` for `kind = \"image_pull\"`: podman's latest output line,\nand the bytes downloaded so far (machine-check design §5). The job's\nown `done`/`total` are the same bytes.",
        "properties": {
          "done_bytes": {
            "description": "Compressed layer bytes downloaded so far, as Podman's API reports\nthem; 0 while nothing was reported, and on the `podman pull` command's\npath, which reports none.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "image": {
            "type": "string"
          },
          "last_line": {
            "type": "string"
          },
          "old_id": {
            "description": "The image ID the reference named before the pull; `None` when it was\nnot on this machine.",
            "type": [
              "string",
              "null"
            ]
          },
          "size_note": {
            "description": "Why the size is not known, when it is not: \"size not known — …\".",
            "type": [
              "string",
              "null"
            ]
          },
          "total_bytes": {
            "description": "The whole download: the compressed size of the layers the registry's\nmanifest lists for this machine, less those Podman found it already\nhad. `None` when it is not known; `size_note` then says why.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "image",
          "old_id",
          "last_line",
          "done_bytes",
          "total_bytes",
          "size_note"
        ],
        "type": "object"
      },
      "ImagePullResult": {
        "description": "The result of a finished `image_pull` job (stored on its job row). A pull\nreplaces no running container: `used_by` is who still runs (or names) the\nold image, for the page's \"Recreate N running containers\" offer.",
        "properties": {
          "image": {
            "type": "string"
          },
          "log": {
            "description": "podman's output, line by line: the `podman pull` command's whole\noutput, or through Podman's API each blob's changes (not its byte\ncounts) and a closing line of what came down.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "new_digests": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "new_id": {
            "type": "string"
          },
          "old_digests": {
            "description": "`sha256:…` digests podman recorded for the reference before and after.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "old_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated": {
            "description": "The reference now names a different image than before.",
            "type": "boolean"
          },
          "used_by": {
            "items": {
              "$ref": "#/components/schemas/ImageUse"
            },
            "type": "array"
          }
        },
        "required": [
          "image",
          "old_id",
          "new_id",
          "old_digests",
          "new_digests",
          "updated",
          "used_by",
          "log"
        ],
        "type": "object"
      },
      "ImageRecipe": {
        "description": "One shipped family.",
        "properties": {
          "args": {
            "additionalProperties": true,
            "description": "Runtime + default-generation flags for the prefilled row, already in\n`ImageModel.args` shape.",
            "type": "object"
          },
          "components": {
            "items": {
              "$ref": "#/components/schemas/ImageRecipeComponent"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "edit": {
            "type": "boolean"
          },
          "installed": {
            "description": "Every component is already on disk.",
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "modes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "partial": {
            "description": "Some but not all components are on disk or downloading.",
            "type": "boolean"
          },
          "served": {
            "description": "An image model row already names this recipe's primary file.",
            "type": "boolean"
          },
          "suggested_model_id": {
            "description": "Suggested `model_id` for the prefilled row.",
            "type": "string"
          },
          "total_bytes": {
            "description": "Bytes of the default file set, on disk.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "total_size": {
            "type": "string"
          },
          "vram_note": {
            "description": "Measured VRAM where a spike measured it, and the word \"unmeasured\"\nwhere none did — never a number derived from the file sizes.",
            "type": "string"
          }
        },
        "required": [
          "key",
          "display_name",
          "description",
          "components",
          "args",
          "modes",
          "edit",
          "vram_note",
          "total_bytes",
          "total_size",
          "installed",
          "partial",
          "served",
          "suggested_model_id"
        ],
        "type": "object"
      },
      "ImageRecipeAlternative": {
        "description": "A different file for the same component — the quantizations the repo ships.",
        "properties": {
          "file": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "present": {
            "description": "This alternative is the file already on disk.",
            "type": "boolean"
          },
          "size": {
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "file",
          "size_bytes",
          "size",
          "label",
          "present"
        ],
        "type": "object"
      },
      "ImageRecipeComponent": {
        "description": "One file of a pipeline, under the `files` key it fills.",
        "properties": {
          "alternatives": {
            "items": {
              "$ref": "#/components/schemas/ImageRecipeAlternative"
            },
            "type": "array"
          },
          "dest_path": {
            "description": "Path relative to the image models dir once downloaded — what the row's\n`files` value is.",
            "type": "string"
          },
          "done": {
            "description": "A tracked download for it finished.",
            "type": "boolean"
          },
          "download_id": {
            "description": "Tracked download row id, when there is one — join against\n`GET /api/hf/downloads` for live progress.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "downloading": {
            "description": "A tracked download exists for it and has not finished.",
            "type": "boolean"
          },
          "file": {
            "type": "string"
          },
          "gated": {
            "description": "The hub refuses this repo without a token that accepted the licence.",
            "type": "boolean"
          },
          "note": {
            "type": "string"
          },
          "present": {
            "description": "The file is on disk under the image models dir.",
            "type": "boolean"
          },
          "repo": {
            "type": "string"
          },
          "role": {
            "description": "The `files` key — `diffusion_model` / `model` / `vae` / `clip_l` /\n`clip_g` / `t5xxl` / `llm` / `llm_vision`.",
            "type": "string"
          },
          "shared_with": {
            "description": "Display names of the other recipes that name this exact file. A\ncomponent is shared on purpose (the second recipe to want it finds it\non disk), but it also means one recipe's download shows up under every\nneighbour — this is what lets a card say whose download it is watching.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "size": {
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "role",
          "repo",
          "file",
          "dest_path",
          "size_bytes",
          "size",
          "gated",
          "note",
          "present",
          "downloading",
          "done",
          "download_id",
          "shared_with",
          "alternatives"
        ],
        "type": "object"
      },
      "ImageRecipeRow": {
        "description": "The prefilled row an \"add from recipe\" hands to the editor — the field\nnames `POST /api/op/image_model_set` (and `lmgw__image_model_set`) take.",
        "properties": {
          "action": {
            "type": "string"
          },
          "args": {
            "additionalProperties": true,
            "type": "object"
          },
          "edit": {
            "type": "boolean"
          },
          "files": {
            "additionalProperties": true,
            "type": "object"
          },
          "model_id": {
            "type": "string"
          },
          "modes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "action",
          "model_id",
          "files",
          "args",
          "modes",
          "edit"
        ],
        "type": "object"
      },
      "ImageSettings": {
        "description": "The image class settings: the same fields as the chat/aux class settings\nand no engine ones. sd-server has no config file, so everything\nper-process is a flag in some row's `args`.",
        "properties": {
          "extra_run_args": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "image": {
            "type": "string"
          },
          "models_dir": {
            "type": "string"
          },
          "public_prefix": {
            "type": "string"
          },
          "request_timeout_seconds": {
            "description": "Per-request ceiling for the class, in seconds. 0 = the maximum possible — no deadline of\nlmgw's own.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image",
          "models_dir",
          "extra_run_args",
          "public_prefix",
          "request_timeout_seconds"
        ],
        "type": "object"
      },
      "ImageSettingsPatch": {
        "additionalProperties": false,
        "description": "The image class's patch. Shaped like `RouterSettingsPatch` — the four\nfields are the same four — but kept separate rather than reusing it,\nbecause the two types are not the same settings struct and a shared patch\nwould make `image.backend` a compile error away from existing.",
        "properties": {
          "extra_run_args": {
            "default": null,
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "image": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "models_dir": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "public_prefix": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "request_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ImageTestPassed": {
        "description": "An image pipeline that drew its probe image.",
        "properties": {
          "bytes": {
            "description": "The first image's size in bytes.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "class": {
            "const": "image",
            "description": "Always `image`.",
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "latency_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "loaded": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "n": {
            "description": "How many images came back.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "note": {
            "type": "string"
          },
          "ok": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "output_format": {
            "description": "What the server said it encoded; null when it says nothing."
          },
          "probe": {
            "const": "image_generation",
            "description": "Always `image_generation`.",
            "type": "string"
          },
          "public_name": {
            "type": "string"
          },
          "seed": {
            "format": "int64",
            "type": "integer"
          },
          "size": {
            "description": "The probe's size, e.g. `256x256`.",
            "type": "string"
          },
          "steps": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "ok",
          "loaded",
          "model_id",
          "class",
          "public_name",
          "probe",
          "endpoint",
          "latency_ms",
          "size",
          "steps",
          "seed",
          "n",
          "output_format",
          "bytes",
          "note"
        ],
        "type": "object"
      },
      "ImageUpscalerEntry": {
        "description": "One shipped upscaler.",
        "properties": {
          "description": {
            "type": "string"
          },
          "dest_path": {
            "description": "Where it lands, relative to the image models dir: `upscalers/<file>`.",
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "done": {
            "type": "boolean"
          },
          "download_id": {
            "format": "int64",
            "type": "integer"
          },
          "downloading": {
            "type": "boolean"
          },
          "file": {
            "type": "string"
          },
          "gated": {
            "type": "boolean"
          },
          "key": {
            "description": "What `image_upscaler_add` takes.",
            "type": "string"
          },
          "licence": {
            "description": "The licence the repo states.",
            "type": "string"
          },
          "present": {
            "type": "boolean"
          },
          "repo": {
            "type": "string"
          },
          "scale": {
            "description": "How many times larger a side gets per run.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "size": {
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "key",
          "display_name",
          "description",
          "repo",
          "file",
          "dest_path",
          "size_bytes",
          "size",
          "gated",
          "licence",
          "scale",
          "present",
          "downloading",
          "done"
        ],
        "type": "object"
      },
      "ImageUpscalerFile": {
        "description": "One upscaler file on disk.",
        "properties": {
          "file": {
            "type": "string"
          },
          "name": {
            "description": "The name sd-server and the tools call it by: the file stem.",
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "name",
          "file",
          "size_bytes"
        ],
        "type": "object"
      },
      "ImageUpscalers": {
        "description": "The upscaler side of the image recipes (chat-media-tools design §9):\nsd-server's `POST /sdcpp/v1/upscale` runs an ESRGAN model it finds at\nthe top level of `<image models_dir>/upscalers`, one directory every\nimage row reads.",
        "properties": {
          "dir": {
            "description": "The directory, relative to the image models dir.",
            "type": "string"
          },
          "on_disk": {
            "description": "The upscalers on disk, by the name `image__upscale` and the card's\nUpscale take (the file stem), whichever way they got there.",
            "items": {
              "$ref": "#/components/schemas/ImageUpscalerFile"
            },
            "type": "array"
          },
          "shipped": {
            "description": "The models lmgw ships an entry for.",
            "items": {
              "$ref": "#/components/schemas/ImageUpscalerEntry"
            },
            "type": "array"
          }
        },
        "required": [
          "shipped",
          "on_disk",
          "dir"
        ],
        "type": "object"
      },
      "ImageUse": {
        "description": "One user of an image.",
        "properties": {
          "class": {
            "description": "The lmgw class (`chat` | `aux` | `audio` | `image`).",
            "type": "string"
          },
          "container": {
            "description": "Set for `running_container` and `stopped_container`: its name.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/ImageUseKind"
          },
          "model_id": {
            "description": "Which model row: set for `model_override`, and for a\n`running_container` or `stopped_container` that is one of lmgw's model\ncontainers (read from its labels, else matched by its name) — with\n`class`, what the `container` op's `apply` recreates. `None` for a\ncontainer that is no model's (an agent's, or anything else on the\nmachine).",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "class",
          "model_id",
          "container"
        ],
        "type": "object"
      },
      "ImageUseKind": {
        "description": "How something is using an image: what\n`container_image_delete` refuses to delete out from under, and what\nthe promote success panel offers to recreate.",
        "oneOf": [
          {
            "enum": [
              "class_default",
              "model_override",
              "running_container"
            ],
            "type": "string"
          },
          {
            "const": "stopped_container",
            "description": "A container that exists but is not running — exited, created, or a\nbuildah working container (`podman ps -a --external`). It keeps its\nimage from being removed all the same.",
            "type": "string"
          }
        ]
      },
      "ImportedCorpus": {
        "properties": {
          "chunks": {
            "format": "int64",
            "type": "integer"
          },
          "corpus_id": {
            "type": "string"
          },
          "documents": {
            "format": "int64",
            "type": "integer"
          },
          "embed_alias": {
            "description": "The name on *this* gateway that routes there, when one does.",
            "type": [
              "string",
              "null"
            ]
          },
          "embed_model": {
            "description": "The embedding identity the corpus is pinned to.",
            "type": "string"
          },
          "replaced": {
            "type": "boolean"
          }
        },
        "required": [
          "corpus_id",
          "embed_model",
          "embed_alias",
          "chunks",
          "documents",
          "replaced"
        ],
        "type": "object"
      },
      "InputPath": {
        "anyOf": [
          {
            "const": "audio",
            "description": "The model heard the turn's audio.",
            "type": "string"
          },
          {
            "const": "transcript",
            "description": "The model read the speech-to-text transcript.",
            "type": "string"
          }
        ],
        "description": "How a voice turn's words reached the chat model."
      },
      "ItemState": {
        "description": "How an item came out.",
        "oneOf": [
          {
            "enum": [
              "ok",
              "problem"
            ],
            "type": "string"
          },
          {
            "const": "info",
            "description": "Worth knowing; never changes the verdict.",
            "type": "string"
          },
          {
            "const": "not_checked",
            "description": "Not checked, because an item before it is not ok: the sentence says\nwhich.",
            "type": "string"
          }
        ]
      },
      "JobRow": {
        "description": "One background job. `done`/`total` are in the kind's own unit (bytes for\n`hf_download`, documents for an ingest, …) and `stage` names what is\nhappening; `total` is absent when the total genuinely isn't known yet.",
        "properties": {
          "created_at": {
            "type": "string"
          },
          "detail": {
            "description": "Kind-specific payload; the generic feed does not interpret it."
          },
          "done": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "key": {
            "description": "Dedup key scoped to the kind (`hf:<download row id>`).",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "description": "`hf_download | ingest | re_embed | eval_run | golden_gen`.",
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "percent": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "stage": {
            "type": "string"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "`queued | running | done | failed | canceled`.",
            "type": "string"
          },
          "total": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "key",
          "label",
          "status",
          "done",
          "total",
          "percent",
          "stage",
          "detail",
          "error",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "type": "object"
      },
      "JsonRpcError": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "id": {},
          "jsonrpc": {
            "enum": [
              "2.0"
            ],
            "type": "string"
          }
        },
        "required": [
          "jsonrpc",
          "error"
        ],
        "type": "object"
      },
      "JsonRpcRequest": {
        "properties": {
          "id": {
            "description": "Absent on a notification (e.g. notifications/initialized); string or number otherwise."
          },
          "jsonrpc": {
            "enum": [
              "2.0"
            ],
            "type": "string"
          },
          "method": {
            "description": "e.g. initialize, ping, tools/list, tools/call, resources/list, resources/templates/list, resources/read, notifications/initialized.",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "type": "object"
          }
        },
        "required": [
          "jsonrpc",
          "method"
        ],
        "type": "object"
      },
      "JsonRpcResponse": {
        "properties": {
          "id": {},
          "jsonrpc": {
            "enum": [
              "2.0"
            ],
            "type": "string"
          },
          "result": {
            "additionalProperties": true,
            "type": "object"
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "result"
        ],
        "type": "object"
      },
      "KbMode": {
        "anyOf": [
          {
            "const": "auto",
            "description": "Search before every turn and send the excerpts with the user's\nmessage.",
            "type": "string"
          },
          {
            "const": "tool",
            "description": "Give the model the knowledge search tools; it searches when it\ndecides to.",
            "type": "string"
          }
        ],
        "description": "How a thread's knowledge bases reach the model."
      },
      "KeptImage": {
        "description": "A tag that was left in place, and why: one a `keep_runs` prune kept, or one a `build_set`\ndelete with `delete_images` did not remove (in use, a name from outside\nthe build, a dev instance).",
        "properties": {
          "reason": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "required": [
          "tag",
          "reason"
        ],
        "type": "object"
      },
      "KeyCreated": {
        "description": "`POST /api/op/key_create` for a client or an owner key: the new row, and\nits key in the clear.\n\nA device key answers `DevicePaired` instead. The wrapper\n`KeyCreateAnswer` is the document's description of the one op; a reader\nknows the `kind` it sent and reads that kind's type.",
        "properties": {
          "id": {
            "description": "The new key's `api_keys.id`.",
            "format": "int64",
            "type": "integer"
          },
          "key": {
            "description": "The key. Secret. A client key's is shown here and nowhere else (only\nits hash is stored); an owner key's stays readable with `key_reveal`.",
            "type": "string",
            "x-lmgw-secret": true
          },
          "message": {
            "description": "What was done, for a person to read.",
            "type": "string"
          },
          "name": {
            "description": "The key's name; an owner key's carries the `owner:` prefix the server\nwrites.",
            "type": "string"
          },
          "ok": {
            "description": "Always `true`; a refusal is an error answer instead.",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "id",
          "name",
          "key",
          "message"
        ],
        "type": "object"
      },
      "KeyMap": {
        "anyOf": [
          {
            "additionalProperties": true,
            "type": "object"
          },
          {
            "type": "string"
          }
        ],
        "description": "A `files` or `args` map as a patch carries it, the image class's map\ncounterpart of the list-valued run arguments.\n\nTwo spellings for one map, and both are load-bearing. `/api/op` and the\ndashboard send a real JSON object, because that is what the row stores.\nThe MCP plane cannot: its schemas are flat scalars on purpose (a tool\nwhose arguments need hand-built JSON is a tool a small local model cannot\ncall reliably), which is the same reason `capabilities_override` accepts a\nJSON *string* there. So a text block of `key = value` lines — the syntax\nprinted by `sd-server --help` — is accepted wherever the object is."
      },
      "KeyRow": {
        "description": "One key on the Keys & policy table. `GET /api/usage/keys`",
        "properties": {
          "app_id": {
            "description": "Devices only: the app id its last enrolment declared\n(`dev.example.storyplayer`), what other devices of the same app\noffer files to; `null` without one, and on every other kind.",
            "type": [
              "string",
              "null"
            ]
          },
          "budget_micro": {
            "format": "int64",
            "type": "integer"
          },
          "budget_period": {
            "type": "string"
          },
          "concurrency_limit": {
            "format": "int64",
            "type": "integer"
          },
          "device_tools": {
            "description": "Client and device keys: the device-hosted labels whose tools the key\nreaches (`[\"kai\"]`), whatever its tool scope's mode, which then\nfilters those tools as any server's. A label no device hosts now is\nkept and reaches nothing until one does: compare it with the device\nrows' `hosts_label`. Empty for every other kind.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "hosts_label": {
            "description": "Devices only: the label it may host MCP tools under; `null` without\na hosting grant.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`key` | `internal` | `agent` | `owner` | `device` — an internal\nidentity is budgetable but can never authenticate anything; an owner\nkey holds every capability; a device is a paired client app.",
            "type": "string"
          },
          "last_seen_at": {
            "description": "Devices only: when one of its long-lived connections (the Chat\nfeed, a voice session, its tool link) last opened or closed,\nRFC 3339 UTC.",
            "type": [
              "string",
              "null"
            ]
          },
          "last_used": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "online": {
            "description": "Devices only: which of its connections are open now — `feed`,\n`voice`, `tools`, in that order. Empty means offline.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "open_links": {
            "description": "Devices only: how many connections of each kind in `online` are\nopen, in the same order. More than one of a kind is a client that\nopened another before its last one closed.",
            "items": {
              "$ref": "#/components/schemas/OpenLinks"
            },
            "type": "array"
          },
          "pairing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DevicePairingView"
              },
              {
                "type": "null"
              }
            ],
            "description": "Devices only: its pairing over the device link (device link design\n§3, §9.3) — its token, its enrolment and the code to confirm, a\ncontested token, its certificate's dates and its URLs. `null` for\nevery other kind."
          },
          "reaches": {
            "description": "Devices with a hosting grant only: every principal that reaches the\nhosted label's tools (client-apps design §5.6, L16 as changed\n2026-10-15) — `owner`, the device itself, each key and device whose\n`device_tools` grants the label, and each agent whose manifest names\nit — as a sentence each (\"owner\", \"device 'desktop' (hosts it)\", \"key\n'ci'\", \"agent 'board'\"). Empty without a grant.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "requests": {
            "format": "int64",
            "type": "integer"
          },
          "rpm_limit": {
            "format": "int64",
            "type": "integer"
          },
          "scope_mode": {
            "type": "string"
          },
          "scope_patterns": {
            "type": "string"
          },
          "self_admin": {
            "$ref": "#/components/schemas/AdminLevel",
            "description": "Devices only: the device's level of lmgw's admin tools — `off`,\n`read_only` (it reads lmgw's configuration and state) or `full` (it\nalso changes it, and may register programs that run on the gateway's\nmachine). Above `off` it sees and uses the Chat threads and folders\nthat carry the self-admin toolset (`lmgw`); at `full` it may also\nattach the toolset and change such threads and folders. The\nself-admin level in Settings caps what the tools may do. Admin Chat\nstays hidden from every device. `off` for every other kind."
          },
          "spent_micro": {
            "description": "Spend so far in the current budget period: what the budget counts.\nThat includes the budget floor of three kinds of unpriced request,\neach a lower bound, so the figure can be above what the priced rows\nadd up to: one unpriced only for a hosted-tool fee priced nowhere\n(the known part of its cost), an OpenAI answer at a tier above\nStandard with no price for it (the standard price), and a stream cut\nbefore the upstream reported usage (a local count of its text).",
            "format": "int64",
            "type": "integer"
          },
          "spent_unknown_requests": {
            "description": "What that figure does **not** cover — the same obligation every other\nmoney total on this plane carries. Without it the per-key meter would be\nthe one number on the page that cannot state its own remainder. Every\nunpriced request is counted here, those whose floor `spent_micro`\nincludes too: their whole cost is still unknown.",
            "format": "int64",
            "type": "integer"
          },
          "spent_unknown_tokens": {
            "description": "The tokens of those unpriced requests, counted as\n`spent_unknown_requests` counts them.",
            "format": "int64",
            "type": "integer"
          },
          "tool_scope_mode": {
            "description": "`all` | `allow` | `deny` over exposed MCP tool names — which tools the\nkey sees on `/mcp` and may attach in a `/v1/responses` run. Only a\nclient key's is read: an agent's tools are its manifest's, and an owner\nkey is not scoped.",
            "type": "string"
          },
          "tool_scope_patterns": {
            "type": "string"
          },
          "tpm_limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "enabled",
          "kind",
          "scope_mode",
          "scope_patterns",
          "tool_scope_mode",
          "tool_scope_patterns",
          "device_tools",
          "budget_micro",
          "budget_period",
          "rpm_limit",
          "tpm_limit",
          "concurrency_limit",
          "expires_at",
          "note",
          "spent_micro",
          "spent_unknown_requests",
          "spent_unknown_tokens",
          "requests",
          "last_used",
          "last_seen_at",
          "hosts_label",
          "reaches",
          "self_admin",
          "online",
          "open_links",
          "pairing",
          "app_id"
        ],
        "type": "object"
      },
      "KnowledgeBase": {
        "description": "A knowledge base as every route shows it.",
        "properties": {
          "chunk_overlap": {
            "format": "int64",
            "type": "integer"
          },
          "chunk_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "counts": {
            "$ref": "#/components/schemas/KnowledgeCounts"
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "embed_alias": {
            "description": "The embedding model alias the base was created with.",
            "type": "string"
          },
          "embed_context": {
            "description": "The embedding model's context in tokens, when the gateway knows it.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "embed_dims": {
            "description": "The vector length of the pinned model.",
            "format": "int64",
            "type": "integer"
          },
          "embed_identity": {
            "description": "`upstream/model (Nd)`: the pin as one line.",
            "type": "string"
          },
          "embed_input_limit": {
            "description": "What one embedding input may hold, `min(context, ubatch)` for a local\nmodel; `chunk_tokens` (heading path included) is checked against it.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "embed_input_limit_source": {
            "description": "One sentence: where `embed_input_limit` comes from.",
            "type": "string"
          },
          "embed_model": {
            "description": "The embedding model the base is pinned to.",
            "type": "string"
          },
          "embed_resolvable": {
            "description": "Whether a model on this gateway still resolves to the pin. When not,\nsearches fall back to keywords and new files cannot be embedded.",
            "type": "boolean"
          },
          "embed_tokenizer": {
            "description": "What counts the tokens: `model`, `tiktoken` or `tiktoken_guess`.",
            "type": "string"
          },
          "embed_upstream": {
            "description": "The upstream the alias resolved to when the base was pinned.",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "job": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/JobRow"
              },
              {
                "type": "null"
              }
            ],
            "description": "The live job on the base, or the last one that ran."
          },
          "mcp_visible": {
            "description": "Whether the `kb__*` tools on `/mcp` may search this base.",
            "type": "boolean"
          },
          "name": {
            "description": "Unique across the bases.",
            "type": "string"
          },
          "notes": {
            "description": "One sentence each: what a person should know about the base now.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "rerank_alias": {
            "description": "Empty: no rerank stage.",
            "type": "string"
          },
          "resident_bytes": {
            "description": "What the base's vectors cost resident in memory: embedded chunks x\ndimensions x 2.",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "`ready` or `re_embed_required` (the vectors no longer match the pinned\nmodel; Resume fills them in).",
            "enum": [
              "ready",
              "re_embed_required"
            ],
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "vectors_rev": {
            "description": "Moves on every chunk write.",
            "format": "int64",
            "type": "integer"
          },
          "vision_alias": {
            "description": "Empty: text-less PDF pages are skipped and counted.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "embed_alias",
          "embed_upstream",
          "embed_model",
          "embed_dims",
          "rerank_alias",
          "vision_alias",
          "chunk_tokens",
          "chunk_overlap",
          "mcp_visible",
          "status",
          "vectors_rev",
          "created_at",
          "updated_at",
          "embed_identity",
          "counts",
          "resident_bytes",
          "embed_context",
          "embed_input_limit",
          "embed_input_limit_source",
          "embed_tokenizer",
          "embed_resolvable",
          "job",
          "notes"
        ],
        "type": "object"
      },
      "KnowledgeCounts": {
        "description": "A base's file and chunk counts.",
        "properties": {
          "bytes": {
            "description": "The files' size in bytes.",
            "format": "int64",
            "type": "integer"
          },
          "chunks": {
            "format": "int64",
            "type": "integer"
          },
          "embedded": {
            "description": "Chunks that have a vector; `chunks - embedded` are waiting for one.",
            "format": "int64",
            "type": "integer"
          },
          "failed": {
            "format": "int64",
            "type": "integer"
          },
          "files": {
            "format": "int64",
            "type": "integer"
          },
          "ingesting": {
            "format": "int64",
            "type": "integer"
          },
          "pending": {
            "format": "int64",
            "type": "integer"
          },
          "ready": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "files",
          "ready",
          "pending",
          "ingesting",
          "failed",
          "chunks",
          "embedded",
          "bytes"
        ],
        "type": "object"
      },
      "KnowledgeExcerpt": {
        "description": "One retrieved excerpt.",
        "properties": {
          "chunk_id": {
            "type": "string"
          },
          "file": {
            "description": "The file's name.",
            "type": "string"
          },
          "file_id": {
            "format": "int64",
            "type": "integer"
          },
          "file_sha": {
            "description": "The sha256 of the file version the chunk was cut from.",
            "type": "string"
          },
          "heading_path": {
            "type": "string"
          },
          "kb": {
            "description": "The base's name.",
            "type": "string"
          },
          "kb_id": {
            "format": "int64",
            "type": "integer"
          },
          "page": {
            "description": "1-based PDF page; `null` for other files.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "rerank_skipped": {
            "description": "Present (and true) when the rerank stage ran but did not score this\nexcerpt (its query + chunk pair was over the reranker's input limit):\n`score` is its fused score and it ranks behind the reranked ones.",
            "type": "boolean"
          },
          "score": {
            "description": "The final order's score: the reranker's when it ran, the fused\n(reciprocal-rank) score otherwise.",
            "format": "float",
            "type": "number"
          },
          "span_end": {
            "format": "int64",
            "type": "integer"
          },
          "span_start": {
            "description": "Byte range in the file's extracted text.",
            "format": "int64",
            "type": "integer"
          },
          "text": {
            "description": "The chunk's text, verbatim.",
            "type": "string"
          },
          "tokens": {
            "description": "Counted over heading path and text.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "kb_id",
          "kb",
          "file_id",
          "file",
          "page",
          "chunk_id",
          "heading_path",
          "text",
          "score",
          "tokens",
          "span_start",
          "span_end",
          "file_sha"
        ],
        "type": "object"
      },
      "KnowledgeFile": {
        "description": "One file of a base.",
        "properties": {
          "added_at": {
            "type": "string"
          },
          "chunk_count": {
            "format": "int64",
            "type": "integer"
          },
          "error": {
            "description": "Why the last ingest failed.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "ingested_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "kb_id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "What the bytes were sniffed as.",
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "name": {
            "description": "The name it was uploaded under (a label, never a path).",
            "type": "string"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "pages": {
            "description": "Pages, slides or sheets, when the file has them.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "size": {
            "format": "int64",
            "type": "integer"
          },
          "skipped_pages": {
            "description": "Text-less PDF pages that were skipped (no vision model on the base).",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "`pending`, `ingesting`, `ready` or `failed`.",
            "enum": [
              "pending",
              "ingesting",
              "ready",
              "failed"
            ],
            "type": "string"
          },
          "sub": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kb_id",
          "name",
          "kind",
          "sub",
          "mime",
          "size",
          "sha256",
          "status",
          "error",
          "pages",
          "skipped_pages",
          "notes",
          "chunk_count",
          "added_at",
          "ingested_at"
        ],
        "type": "object"
      },
      "KnowledgeUploadRequest": {
        "description": "multipart/form-data with one part per file.",
        "properties": {
          "file": {
            "description": "One file; send as many parts as there are files. The part's field name does not matter, its file name names the file.",
            "format": "binary",
            "type": "string"
          }
        },
        "type": "object"
      },
      "LabArtifactRole": {
        "description": "Whether an artifact is a group's input or a run's output.",
        "oneOf": [
          {
            "const": "input",
            "description": "Sent with the group's requests (an image a decision model reads),\nshared by its cells.",
            "type": "string"
          },
          {
            "const": "output",
            "description": "What a run produced (a generated image, a speech clip).",
            "type": "string"
          }
        ]
      },
      "LabArtifactView": {
        "description": "One artifact: media bytes kept as a file named by their sha256.",
        "properties": {
          "created_at": {
            "type": "string"
          },
          "data_url_head": {
            "description": "An input that came as a data URL: its head as typed, everything\nbefore the comma (`data:image/x-receipt;name=a.png;base64`). A request\nsends it as `<head>,<base64 of the bytes>`; `null` for bytes that came\nas bytes.",
            "type": [
              "string",
              "null"
            ]
          },
          "href": {
            "description": "Where the bytes are: `/labs/api/artifacts/{id}` from the API, the\nfile's path inside the zip in an export.",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "mime": {
            "description": "The media type, sniffed from the bytes.",
            "type": "string"
          },
          "name": {
            "description": "The upload's name, or the one lmgw gave an output.",
            "type": "string"
          },
          "ord": {
            "description": "Its place among the group's inputs or the run's outputs.",
            "format": "int64",
            "type": "integer"
          },
          "role": {
            "$ref": "#/components/schemas/LabArtifactRole"
          },
          "run_id": {
            "description": "The run that produced it; `null` for a group's input.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "sha256": {
            "description": "The sha256 of the bytes, which names the file.",
            "type": "string"
          },
          "size": {
            "description": "The file's size in bytes.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "run_id",
          "role",
          "ord",
          "name",
          "mime",
          "size",
          "sha256",
          "data_url_head",
          "href",
          "created_at"
        ],
        "type": "object"
      },
      "LabBatchItem": {
        "description": "What makes a group an item of a set run (labs-store design §3.1).",
        "properties": {
          "batch_id": {
            "description": "The set run.",
            "format": "int64",
            "type": "integer"
          },
          "expected": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "The expected answers, per question id, as the store keeps a label:\nthe option's name (`choice`), the level's index (`score`), `yes` or\n`no` (`noul`). Empty when the item is not labelled.",
            "type": "object"
          },
          "item_ix": {
            "description": "The item's place in the run's file, from 0.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "key": {
            "description": "The item's own key, from the mapping's `key` column; `null` without\none.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "batch_id",
          "item_ix",
          "key",
          "expected"
        ],
        "type": "object"
      },
      "LabCell": {
        "description": "One cell of a group's plan: the model it asks and the variant of the\nform it sends. The cells run in plan order, one run each.",
        "properties": {
          "model": {
            "description": "The public name asked.",
            "type": "string"
          },
          "variant": {
            "description": "The lab's name for what was sent: the Decision lab's `as_written`,\n`no_descriptions` or `reversed`.",
            "type": "string"
          }
        },
        "required": [
          "model",
          "variant"
        ],
        "type": "object"
      },
      "LabError": {
        "description": "How this plane answers a failure: `{\"error\": \"...\"}`, plus the `code` of\na refusal that has one.",
        "properties": {
          "code": {
            "description": "A machine-readable word, on the refusals that have one (for example\n`dev_shared_models_dir`).",
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "LabExportFormat": {
        "description": "The file format of an export.",
        "oneOf": [
          {
            "const": "jsonl",
            "description": "Lossless: one `lmgw.lab.v1` line per group; a zip with the files when\nthe scope has artifacts.",
            "type": "string"
          },
          {
            "const": "csv",
            "description": "The lab's flat table.",
            "type": "string"
          },
          {
            "const": "files",
            "description": "The Image and Audio labs' files under readable names: one group's\none file as it is, else a zip of the files and a `manifest.jsonl`\n(`LabFilesManifestLine`). The Decision lab makes no files (a 400).",
            "type": "string"
          }
        ]
      },
      "LabFileKind": {
        "description": "What a file of the export is.",
        "oneOf": [
          {
            "const": "output",
            "description": "A run's output as the store keeps it: a picture, a speech file, a\ntask's audio.",
            "type": "string"
          },
          {
            "const": "wav",
            "description": "A run's streamed or raw PCM speech, kept as it arrived and written as\na WAV with the PCM format the form held (the gateway's\n`x-lmgw-sample-rate` wins over its rate).",
            "type": "string"
          },
          {
            "const": "transcript",
            "description": "A transcription's or a task's text answer, as UTF-8 text.",
            "type": "string"
          }
        ]
      },
      "LabFileRef": {
        "description": "A file the store keeps, as a form names it: the artifact's id and the\nname it came with. A re-opened form sends it back, so a re-ask uploads\nnothing again.",
        "properties": {
          "id": {
            "description": "The artifact (`/labs/api/artifacts/{id}`).",
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "The upload's file name.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "LabFilesInput": {
        "description": "One input of the group a file's run read: an upload to transcribe, an\nedit's picture. Named here, not carried in the zip: it is the owner's own\nfile, and the JSONL export carries it.",
        "properties": {
          "artifact_id": {
            "description": "The input artifact.",
            "format": "int64",
            "type": "integer"
          },
          "mime": {
            "type": "string"
          },
          "name": {
            "description": "The upload's name.",
            "type": "string"
          },
          "sha256": {
            "type": "string"
          }
        },
        "required": [
          "artifact_id",
          "name",
          "mime",
          "sha256"
        ],
        "type": "object"
      },
      "LabFilesManifestLine": {
        "description": "One line of a files zip's manifest: a file, and the run it came from.",
        "properties": {
          "answered_by": {
            "description": "Which model answered: a fallback's alias when one did.",
            "type": "string"
          },
          "artifact_id": {
            "description": "The kept artifact the file is (or, for a WAV, was made from); `null`\nfor a transcript.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "description": "When the run was answered.",
            "type": "string"
          },
          "endpoint": {
            "description": "The `/v1` route the run asked.",
            "type": "string"
          },
          "file": {
            "description": "The file's path inside the zip:\n`<group id>-<model>-<voice or task>-<first words>.<ext>`.",
            "type": "string"
          },
          "format": {
            "description": "Always `lmgw.lab.files.v1`.",
            "type": "string"
          },
          "group_id": {
            "format": "int64",
            "type": "integer"
          },
          "inputs": {
            "description": "The group's inputs the run read, which the zip does not carry.",
            "items": {
              "$ref": "#/components/schemas/LabFilesInput"
            },
            "type": "array"
          },
          "kind": {
            "$ref": "#/components/schemas/LabFileKind"
          },
          "lab": {
            "$ref": "#/components/schemas/LabKind"
          },
          "mime": {
            "description": "The file's media type.",
            "type": "string"
          },
          "missing": {
            "description": "The artifact's file was not in the data dir when the export was\nwritten: the zip does not carry it, and `MISSING.txt` names it.",
            "type": "boolean"
          },
          "model": {
            "description": "The model asked.",
            "type": "string"
          },
          "parameters": {
            "description": "The request as sent: its JSON, or for an upload the multipart\nsummary (`LabMultipartSummary`); a request that is no JSON as its\ntext."
          },
          "run_id": {
            "description": "The run; `null` for a run the store could not keep.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "sha256": {
            "description": "That artifact's sha256, which names its file in the data dir.",
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "description": "The file's size in the zip, in bytes; for a missing file, the kept\nartifact's.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "task": {
            "description": "The Audio lab's task (`tts`, `asr`, ...), the Image lab's\n`generate` or `edit`.",
            "type": "string"
          },
          "text": {
            "description": "The text the run was given: what was spoken, the prompt; `null`\nwhen it was given none.",
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "description": "The voice a speech run asked; `null` for anything else.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "format",
          "file",
          "kind",
          "lab",
          "group_id",
          "run_id",
          "created_at",
          "endpoint",
          "model",
          "answered_by",
          "task",
          "voice",
          "text",
          "parameters",
          "mime",
          "size",
          "artifact_id",
          "sha256",
          "missing",
          "inputs"
        ],
        "type": "object"
      },
      "LabGroupView": {
        "description": "What one click in a lab produced, or one item of a set run.",
        "properties": {
          "artifacts": {
            "description": "The group's inputs, in order.",
            "items": {
              "$ref": "#/components/schemas/LabArtifactView"
            },
            "type": "array"
          },
          "created_at": {
            "type": "string"
          },
          "form": {
            "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "in_flight": {
            "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
            "type": "boolean"
          },
          "item": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LabBatchItem"
              },
              {
                "type": "null"
              }
            ],
            "description": "The set run it is an item of; `null` for a group of the history."
          },
          "lab": {
            "$ref": "#/components/schemas/LabKind"
          },
          "override": {
            "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
            "type": [
              "string",
              "null"
            ]
          },
          "plan": {
            "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
            "items": {
              "$ref": "#/components/schemas/LabCell"
            },
            "type": "array"
          },
          "runs": {
            "description": "The runs so far, in cell order.",
            "items": {
              "$ref": "#/components/schemas/LabRunView"
            },
            "type": "array"
          },
          "title": {
            "description": "Derived once from the form: the state's first line, a prompt.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "lab",
          "title",
          "form",
          "plan",
          "override",
          "created_at",
          "runs",
          "artifacts",
          "item",
          "in_flight"
        ],
        "type": "object"
      },
      "LabKind": {
        "description": "Which lab a group belongs to; the `{lab}` of `/labs/api/{lab}/*`.",
        "enum": [
          "decision",
          "image",
          "audio"
        ],
        "type": "string"
      },
      "LabPresetKind": {
        "description": "What a preset holds.",
        "oneOf": [
          {
            "const": "question_set",
            "description": "The Decision lab's questions, model and thresholds.",
            "type": "string"
          },
          {
            "const": "image_prompt",
            "description": "The Image lab's form: the model, the prompt and every setting.",
            "type": "string"
          },
          {
            "const": "audio_settings",
            "description": "The Audio lab's speech panel and the PCM format of a stream.",
            "type": "string"
          }
        ]
      },
      "LabPresetView": {
        "description": "A kept preset.",
        "oneOf": [
          {
            "properties": {
              "body": {
                "$ref": "#/components/schemas/QuestionSet"
              },
              "kind": {
                "const": "question_set",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "body"
            ],
            "type": "object"
          },
          {
            "properties": {
              "body": {
                "$ref": "#/components/schemas/ImageGenForm"
              },
              "kind": {
                "const": "image_prompt",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "body"
            ],
            "type": "object"
          },
          {
            "properties": {
              "body": {
                "$ref": "#/components/schemas/AudioSettings2"
              },
              "kind": {
                "const": "audio_settings",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "body"
            ],
            "type": "object"
          }
        ],
        "properties": {
          "created_at": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "lab": {
            "$ref": "#/components/schemas/LabKind"
          },
          "name": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "lab",
          "name",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "LabRunView": {
        "description": "One dispatch to one `/v1` route and what came back.",
        "properties": {
          "answered_by": {
            "description": "Which model answered: `x-lmgw-fallback` when a fallback did, else the\nmodel asked.",
            "type": "string"
          },
          "artifacts": {
            "description": "What the run produced, in order.",
            "items": {
              "$ref": "#/components/schemas/LabArtifactView"
            },
            "type": "array"
          },
          "cell": {
            "description": "Its index in the group's plan.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "endpoint": {
            "description": "The route dispatched to, `/v1/systemone`.",
            "type": "string"
          },
          "error_code": {
            "description": "A failure's code: the envelope's `lmgw_code`, else its `code` when\nthat is a string, else its `type` (llama.cpp's numeric `code` only\nrepeats the status), else the numeric `code`.",
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "description": "A failure's message.",
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_reason": {
            "description": "`x-lmgw-fallback-reason`: why a fallback answered (`hold`, ...).",
            "type": [
              "string",
              "null"
            ]
          },
          "group_id": {
            "format": "int64",
            "type": "integer"
          },
          "headers": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "The `x-lmgw-*` headers the route stamped on its answer.",
            "type": "object"
          },
          "http_status": {
            "description": "The route's HTTP status, whatever it was.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "description": "`null` for a run the store could not keep: the cell's answer is still\nhere, and `store_error` beside it says why.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "input_tokens": {
            "description": "The answer's input tokens, when it reported them.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "latency_ms": {
            "description": "How long the dispatch took in the gateway, answer read included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "model_asked": {
            "type": "string"
          },
          "output_tokens": {
            "description": "The answer's output tokens, when it reported them.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "request": {
            "description": "The request as sent, as text, except that each image data URL is\n`lab-artifact:<id>`.",
            "type": "string"
          },
          "response": {
            "description": "The answer as received, as text; `null` when it was no text and is an\noutput artifact instead.",
            "type": [
              "string",
              "null"
            ]
          },
          "response_type": {
            "description": "The answer's `Content-Type`.",
            "type": [
              "string",
              "null"
            ]
          },
          "upstream_model": {
            "description": "The answer's own `model`.",
            "type": [
              "string",
              "null"
            ]
          },
          "variant": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "group_id",
          "cell",
          "variant",
          "endpoint",
          "model_asked",
          "answered_by",
          "fallback_reason",
          "upstream_model",
          "http_status",
          "error_code",
          "error_message",
          "request",
          "response",
          "response_type",
          "headers",
          "input_tokens",
          "output_tokens",
          "latency_ms",
          "created_at",
          "artifacts"
        ],
        "type": "object"
      },
      "LabVoice": {
        "description": "One voice name of a model.",
        "properties": {
          "id": {
            "description": "The name to send as `voice`.",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/LabVoiceKind",
            "description": "Where the name comes from: a preset, a library clip, a shipped voice,\nan embedding, or a name only the model's own server reported."
          },
          "send": {
            "description": "Where lmgw puts the name in the engine's request: `voice`, or\n`options.voice_id` for a native voice of a family that reads that.",
            "type": "string"
          },
          "transcript": {
            "description": "For a library clip: whether its transcript is recorded. Absent for\nevery other kind.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "kind",
          "send"
        ],
        "type": "object"
      },
      "LabVoiceKind": {
        "description": "Where a voice name comes from.",
        "oneOf": [
          {
            "const": "preset",
            "description": "A preset of the model's row.",
            "type": "string"
          },
          {
            "const": "library",
            "description": "A clip of the voice library (when the class's voice directory is it).",
            "type": "string"
          },
          {
            "const": "native",
            "description": "A voice the model's package ships.",
            "type": "string"
          },
          {
            "const": "embedding",
            "description": "A voice embedding file in the package's `embeddings/` folder.",
            "type": "string"
          },
          {
            "const": "engine",
            "description": "A name only the model's own server reported: a running container\n(or a remote upstream) knows it, lmgw's catalog does not.",
            "type": "string"
          }
        ]
      },
      "LabVoicesSource": {
        "description": "Where the list of `GET /audio-lab/api/voices` was read.",
        "oneOf": [
          {
            "const": "catalog",
            "description": "lmgw's own catalog (the model's presets, its package's voices, the\nvoice library), plus the names a running container added.",
            "type": "string"
          },
          {
            "const": "upstream",
            "description": "A remote upstream, asked: it has no container and no catalog here.",
            "type": "string"
          }
        ]
      },
      "LadderTest": {
        "description": "A ladder row's test: every rung loaded and probed in turn, then the\nmodel stopped.",
        "properties": {
          "class": {
            "const": "chat",
            "description": "Always `chat`.",
            "type": "string"
          },
          "ladder": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "description": "Every tested rung passed.",
            "type": "boolean"
          },
          "reset_to_base": {
            "description": "The model was stopped again so the next request starts at the base;\nfalse when other traffic kept it busy.",
            "type": "boolean"
          },
          "rungs": {
            "description": "The rungs tested, in order; a failure ends the list.",
            "items": {
              "$ref": "#/components/schemas/RungTest"
            },
            "type": "array"
          },
          "top_rung": {
            "description": "How many rungs the ladder has.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "was_running_rung": {
            "description": "The rung the model was on before the test, when it was running.",
            "format": "uint",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "ok",
          "model_id",
          "class",
          "ladder",
          "top_rung",
          "rungs",
          "was_running_rung",
          "reset_to_base"
        ],
        "type": "object"
      },
      "LanguageNote": {
        "description": "A speech model its language does not reach as set — the ASR the spoken\nlanguage, the TTS the reply language: a thread's `voice_resolved.language_notes`,\nand Settings' `chat_voice_language_notes` for the Chat's own models.",
        "properties": {
          "alias": {
            "description": "The stage's alias.",
            "type": "string"
          },
          "message": {
            "description": "The whole sentence the page shows: the model, then what it does\n(\"text-to-speech model 'audio/…' takes no language: …\").",
            "type": "string"
          },
          "stage": {
            "description": "`asr` or `tts`.",
            "type": "string"
          }
        },
        "required": [
          "stage",
          "alias",
          "message"
        ],
        "type": "object"
      },
      "LatencyPoint": {
        "properties": {
          "bucket": {
            "type": "string"
          },
          "p50_total_ms": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "p50_ttfb_ms": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "p95_total_ms": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "p95_ttfb_ms": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "bucket",
          "p50_total_ms",
          "p95_total_ms",
          "p50_ttfb_ms",
          "p95_ttfb_ms"
        ],
        "type": "object"
      },
      "LearnedResidency": {
        "description": "A learned audio residency.",
        "properties": {
          "bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "key": {
            "description": "The configuration it was read under. A row whose configuration has\nchanged since keeps the figure but is not charged by it.",
            "type": "string"
          },
          "learned_at": {
            "description": "When it was read (`YYYY-MM-DD HH:MM:SS`, UTC).",
            "type": "string"
          }
        },
        "required": [
          "bytes",
          "learned_at",
          "key"
        ],
        "type": "object"
      },
      "LiveTurn": {
        "description": "A turn answering a thread now, who started it, and whether it is a\nbound realtime session's voice turn.",
        "properties": {
          "by": {
            "type": "string"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          },
          "voice": {
            "type": "boolean"
          }
        },
        "required": [
          "thread_id",
          "by",
          "voice"
        ],
        "type": "object"
      },
      "LiveVoice": {
        "description": "A realtime session bound to a thread now, and who bound it (\"the\ndashboard\", \"device 'phone'\").",
        "properties": {
          "by": {
            "type": "string"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "thread_id",
          "by"
        ],
        "type": "object"
      },
      "LlamaCppError": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "description": "The HTTP status, repeated in the body as llama.cpp does.",
                "type": "integer"
              },
              "lmgw_code": {
                "description": "lmgw's own machine-readable error code, e.g. gpu_hold, gpu_benchmark, gpu_deferred, gpu_setup, engine_download.",
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "type": {
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "not_found_error",
                  "not_supported_error",
                  "unavailable_error",
                  "server_error"
                ],
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "type",
              "lmgw_code"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "LlamaParams": {
        "description": "The full llama-server parameter surface of a local model row.\n`None`/`false` = flag omitted from the rendered preset.",
        "properties": {
          "batch_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cache_ram": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cache_type_k": {
            "type": [
              "string",
              "null"
            ]
          },
          "cache_type_v": {
            "type": [
              "string",
              "null"
            ]
          },
          "chat_template_file": {
            "type": [
              "string",
              "null"
            ]
          },
          "chat_template_kwargs": {
            "additionalProperties": true,
            "type": "object"
          },
          "ctx_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "draft_gguf_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "fit": {
            "type": [
              "string",
              "null"
            ]
          },
          "fit_ctx": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "flash_attn": {
            "type": [
              "string",
              "null"
            ]
          },
          "jinja": {
            "type": "boolean"
          },
          "kv_unified": {
            "description": "`--kv-unified` (true) / `--no-kv-unified` (false); `None` leaves\nllama-server's default (unified exactly when `parallel` is unset).",
            "type": [
              "boolean",
              "null"
            ]
          },
          "kv_unified_per_slot": {
            "description": "`--kv-unified-per-slot`: per-request context cap on a unified row.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "mmproj_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "n_gpu_layers": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "n_predict": {
            "description": "`--n-predict`: the most tokens one response may generate. `None` =\nllama-server's own default (-1, unbounded). This is the number\n`/v1/models` reports as `max_output_tokens`.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "no_mmproj": {
            "type": "boolean"
          },
          "parallel": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "reasoning": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_format": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_preserve": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "spec_draft_n_max": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "spec_draft_n_min": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "spec_draft_ngl": {
            "type": [
              "string",
              "null"
            ]
          },
          "spec_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "temp": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "threads": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "ubatch_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "ctx_size",
          "n_predict",
          "n_gpu_layers",
          "threads",
          "batch_size",
          "ubatch_size",
          "parallel",
          "kv_unified",
          "kv_unified_per_slot",
          "flash_attn",
          "cache_type_k",
          "cache_type_v",
          "cache_ram",
          "jinja",
          "chat_template_file",
          "reasoning_format",
          "reasoning",
          "reasoning_budget",
          "reasoning_preserve",
          "reasoning_effort",
          "chat_template_kwargs",
          "temp",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "seed",
          "mmproj_path",
          "no_mmproj",
          "draft_gguf_path",
          "spec_type",
          "spec_draft_n_max",
          "spec_draft_n_min",
          "spec_draft_ngl",
          "fit",
          "fit_ctx"
        ],
        "type": "object"
      },
      "LlamaProps": {
        "description": "The facts a llama.cpp server reports about its loaded model, read once per start,\nclimb and adoption. Every field is optional,\nand `None` is unknown — the server did not say — never `false`.",
        "properties": {
          "audio": {
            "description": "`modalities.audio`: the server loaded a projector that hears.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "build_info": {
            "description": "`b<number>-<commit>` on official builds; ik_llama.cpp sends none.",
            "type": [
              "string",
              "null"
            ]
          },
          "caps": {
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "`chat_template_caps`, the template's own booleans; empty on\nik_llama.cpp, which sends none of them.",
            "type": [
              "object",
              "null"
            ]
          },
          "n_ctx_slot": {
            "description": "One slot's context in tokens (`default_generation_settings.n_ctx`).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "video": {
            "description": "`modalities.video` — official builds only.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "vision": {
            "description": "`modalities.vision`: the server loaded a projector that sees.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "vision",
          "audio",
          "video",
          "caps",
          "n_ctx_slot",
          "build_info"
        ],
        "type": "object"
      },
      "LoadResult": {
        "description": "The load phase, measured by the integration around `podman run`.",
        "properties": {
          "ms": {
            "description": "`podman run` → `/health` 200, container start included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "vram_bytes": {
            "description": "`vram_used_bytes` minus the baseline.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "vram_used_bytes": {
            "description": "Device VRAM used once healthy.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "ms",
          "vram_used_bytes",
          "vram_bytes"
        ],
        "type": "object"
      },
      "LocalChain": {
        "description": "One local (chat) model's full path from download to container.",
        "properties": {
          "aliases": {
            "description": "Enabled explicit aliases routing here through a llama-server upstream.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "file_exists": {
            "description": "The GGUF was found by the models-dir scan.",
            "type": "boolean"
          },
          "gguf_path": {
            "type": "string"
          },
          "hf_repo": {
            "description": "`<org>/<repo>` when the GGUF is a tracked HF download, else empty.",
            "type": "string"
          },
          "hf_status": {
            "description": "HF row status (`done | queued | downloading | failed |\nupdate_available`), empty when the file was not downloaded by lmgw.",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "model_id": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          },
          "public_name": {
            "description": "Client-facing name (prefix applied), meaningful only when `public`.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "model_id",
          "hf_repo",
          "hf_status",
          "gguf_path",
          "file_exists",
          "enabled",
          "public",
          "public_name",
          "aliases"
        ],
        "type": "object"
      },
      "LocalModel": {
        "properties": {
          "args": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "capabilities_override": {
            "description": "An alias's capabilities override for the derived `/v1/models` capability facts: a JSON\nobject with optional keys `capabilities`, `max_output_tokens`, `notes`. `None` = no\noverride."
          },
          "enabled": {
            "type": "boolean"
          },
          "extra_run_args": {
            "description": "Per-model `podman run` args override; `None` inherits the chat\nclass settings' `extra_run_args`.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The model or alias that answers whenever this one cannot (the GPU\nhold, VRAM outside lmgw, background traffic deferred, a disabled\nrow), as written. `None` = no fallback.",
            "type": [
              "string",
              "null"
            ]
          },
          "gguf_path": {
            "description": "Relative to the models dir — never an in-container `/models/…` path.",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Per-model container image override;\n`None` inherits the chat class settings' image.",
            "type": [
              "string",
              "null"
            ]
          },
          "ladder": {
            "description": "Ladder rungs above the base; empty = not a ladder. Absent in frames from before this\nfield existed.",
            "items": {
              "$ref": "#/components/schemas/Rung"
            },
            "type": "array"
          },
          "model_id": {
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/LlamaParams"
          },
          "public": {
            "type": "boolean"
          },
          "warm_start": {
            "description": "Start this model's own container at app launch.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "gguf_path",
          "params",
          "args",
          "idle_seconds",
          "enabled",
          "public",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback",
          "ladder"
        ],
        "type": "object"
      },
      "LocalModelDetail": {
        "description": "`GET /api/local-model?id=|model_id=` — full stored record plus derived\nhealth for the editor.",
        "properties": {
          "advisories": {
            "description": "Configuration that loads and serves but misbehaves under some input\n(a large image, say). Apart from `problems` because the model starts.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "capabilities_override": {
            "description": "An alias's capabilities override for the derived `/v1/models` capability facts: a JSON\nobject with optional keys `capabilities`, `max_output_tokens`, `notes`. `None` = no\noverride."
          },
          "command_line": {
            "description": "The exact `podman run …` command line this model renders to;\nthe published host port is a placeholder, since it is allocated per\nstart.",
            "type": "string"
          },
          "downloaded_from": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DownloadedFrom"
              },
              {
                "type": "null"
              }
            ],
            "description": "The download this file came from, when the downloader fetched it."
          },
          "draft_present": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "extra_args": {
            "description": "One entry per llama-server argument (round-trips with the patch field).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "extra_run_args": {
            "description": "Per-model `podman run` args override, one entry per argument (round-trips\nwith the patch field); `None` inherits the chat class settings'\n`extra_run_args`.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fallback": {
            "description": "The one fallback (openai egress design §14.2); `None` = none.",
            "type": [
              "string",
              "null"
            ]
          },
          "fit_note": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FitNote"
              },
              {
                "type": "null"
              }
            ],
            "description": "The note of a context fitted to the graphics card (find-a-model\ndesign D26): Get it's or \"Fit again\"'s; `None` when the row's\ncontext isn't a fit's shorter one."
          },
          "gguf_path": {
            "type": "string"
          },
          "gguf_present": {
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "description": "Per-model container image override;\n`None` inherits the chat class settings' image.",
            "type": [
              "string",
              "null"
            ]
          },
          "ladder": {
            "description": "Ladder rungs above the base; empty = not a ladder. The editor's ladder table reads\nit.",
            "items": {
              "$ref": "#/components/schemas/Rung"
            },
            "type": "array"
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the GGUF header states; null when it states none."
          },
          "mmproj_present": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/LlamaParams"
          },
          "problems": {
            "description": "Static findings; empty means \"nothing obviously wrong\", not \"loads\".",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "public": {
            "type": "boolean"
          },
          "rungs": {
            "description": "Every rung's own command line, per-slot context and switchover;\n`null` on a row that is not a ladder.",
            "items": {
              "$ref": "#/components/schemas/RungDetail"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "source": {
            "description": "`hf | manual`.",
            "type": "string"
          },
          "warm_start": {
            "description": "Start this model's own container at app launch.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "model_id",
          "gguf_path",
          "gguf_present",
          "licence",
          "source",
          "mmproj_present",
          "draft_present",
          "params",
          "extra_args",
          "idle_seconds",
          "enabled",
          "public",
          "image",
          "extra_run_args",
          "warm_start",
          "fallback",
          "capabilities_override",
          "ladder",
          "command_line",
          "rungs",
          "problems",
          "advisories",
          "downloaded_from",
          "fit_note"
        ],
        "type": "object"
      },
      "LocalModelView": {
        "description": "A local chat model row plus its client-facing public name.",
        "properties": {
          "deferrals_24h": {
            "description": "How many requests for `public_name` were deferred (`gpu_deferred`) in\nthe last 24 hours: background requests (`x-lmgw-background: on`) the\nmodel declined rather than disturb other work on the GPU.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the row's GGUF header states; null when it states none\nor the file cannot be read."
          },
          "model": {
            "$ref": "#/components/schemas/LocalModel"
          },
          "public_name": {
            "type": "string"
          }
        },
        "required": [
          "public_name",
          "model",
          "licence",
          "deferrals_24h"
        ],
        "type": "object"
      },
      "MachineAction": {
        "description": "What an item offers to do (§1.4, WP12).",
        "oneOf": [
          {
            "description": "Switch the model settings to the ones lmgw ships for this card:\n`machine_settings_fit` with this `fit` and `confirm` set to these\n`changes`, after a confirmation that lists them, `left` and\n`running`. An ordinary settings write: no password.",
            "properties": {
              "changes": {
                "description": "Each field the switch changes, as it is and as it would become.",
                "items": {
                  "$ref": "#/components/schemas/SettingsFitChange"
                },
                "type": "array"
              },
              "fit": {
                "$ref": "#/components/schemas/SettingsFit"
              },
              "kind": {
                "const": "settings_fit",
                "type": "string"
              },
              "label": {
                "description": "The button's words (\"Switch to the settings for AMD cards\").",
                "type": "string"
              },
              "left": {
                "description": "What it leaves as it is, and why.",
                "items": {
                  "$ref": "#/components/schemas/SettingsFitLeft"
                },
                "type": "array"
              },
              "running": {
                "description": "The running models whose settings the switch changes: each is\nstopped after the write, unless it is answering a request.",
                "items": {
                  "$ref": "#/components/schemas/SettingsFitRunning"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "fit",
              "label",
              "changes",
              "left",
              "running"
            ],
            "type": "object"
          }
        ]
      },
      "MachineCause": {
        "description": "Why an item is not plainly ok (§1's tables).",
        "oneOf": [
          {
            "description": "No NVIDIA or AMD card; `others` names the display devices there are.",
            "properties": {
              "kind": {
                "const": "no_card",
                "type": "string"
              },
              "others": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "others"
            ],
            "type": "object"
          },
          {
            "description": "An NVIDIA card bound to another driver (`nouveau`) or none.",
            "properties": {
              "bound": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "const": "no_nvidia_driver",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "bound"
            ],
            "type": "object"
          },
          {
            "description": "The driver libraries on disk are newer than the kernel module that\nruns: a restart finishes the update.",
            "properties": {
              "kernel": {
                "type": "string"
              },
              "kind": {
                "const": "driver_mismatch",
                "type": "string"
              },
              "userspace": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "kernel",
              "userspace"
            ],
            "type": "object"
          },
          {
            "description": "The driver is installed and its kernel module is not running.\n`secure_boot`: Secure Boot keeps it from loading — it is on, a module\nis built for the running kernel, and this boot started after it was\nput there. Otherwise it may still be building, or a restart starts\nit.",
            "properties": {
              "kind": {
                "const": "driver_not_running",
                "type": "string"
              },
              "secure_boot": {
                "type": "boolean"
              }
            },
            "required": [
              "kind",
              "secure_boot"
            ],
            "type": "object"
          },
          {
            "description": "The kernel module runs and its libraries are missing.",
            "properties": {
              "kind": {
                "const": "driver_libraries_missing",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "The kernel module's version could not be read.",
            "properties": {
              "kind": {
                "const": "driver_unreadable",
                "type": "string"
              },
              "why": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "why"
            ],
            "type": "object"
          },
          {
            "description": "The versions agree, and NVML in a separate process failed.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "nvml_failed",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          },
          {
            "description": "An AMD card without a device node to compute on.",
            "properties": {
              "kind": {
                "const": "amd_no_compute_node",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "NVIDIA's container toolkit is not installed.",
            "properties": {
              "kind": {
                "const": "toolkit_missing",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "The toolkit comes from Fedora's retired package.",
            "properties": {
              "kind": {
                "const": "toolkit_retired",
                "type": "string"
              },
              "package": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "package",
              "version"
            ],
            "type": "object"
          },
          {
            "description": "lmgw's description of the card could not be written, and the toolkit\nthat writes it is to blame (it failed, or what it wrote names paths\nthat are not there).",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "spec_not_written",
                "type": "string"
              },
              "owner": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error",
              "owner"
            ],
            "type": "object"
          },
          {
            "description": "Writing lmgw's description of the card did not finish within the\nload timeout: the card's driver stopped answering.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "spec_write_timed_out",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          },
          {
            "description": "A folder lmgw keeps its description of the card in is not one only\nthis user may open.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "spec_dir_not_private",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          },
          {
            "description": "lmgw's own files for the description could not be written or read.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "spec_files_failed",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          },
          {
            "description": "lmgw writes no description of its own here; the system's is used\n(D26).",
            "properties": {
              "kind": {
                "const": "spec_on_system_dirs",
                "type": "string"
              },
              "why": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "why"
            ],
            "type": "object"
          },
          {
            "description": "NVIDIA's software source has not loaded since `last_loaded` while the\nsystem's others did.",
            "properties": {
              "kind": {
                "const": "toolkit_source_frozen",
                "type": "string"
              },
              "last_loaded": {
                "type": "string"
              },
              "section": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "section",
              "last_loaded"
            ],
            "type": "object"
          },
          {
            "description": "Another enabled repository offers the toolkit.",
            "properties": {
              "kind": {
                "const": "toolkit_other_provider",
                "type": "string"
              },
              "repo": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "repo"
            ],
            "type": "object"
          },
          {
            "description": "Podman is not installed.",
            "properties": {
              "kind": {
                "const": "podman_missing",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "Podman does not work; its own error.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "podman_broken",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          },
          {
            "description": "This Podman has no `--cdi-spec-dir`.",
            "properties": {
              "kind": {
                "const": "podman_too_old",
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "version"
            ],
            "type": "object"
          },
          {
            "description": "The settings are NVIDIA's, and the card is AMD's.",
            "properties": {
              "kind": {
                "const": "settings_for_nvidia",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "The settings are AMD's, and the card is NVIDIA's.",
            "properties": {
              "kind": {
                "const": "settings_for_amd",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "These kinds of models run on the processor.",
            "properties": {
              "classes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "kind": {
                "const": "runs_on_processor",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "classes"
            ],
            "type": "object"
          },
          {
            "description": "Models still running with the settings from before a switch of the\nmodel settings (WP12): they use the new ones once they stop.",
            "properties": {
              "kind": {
                "const": "running_old_settings",
                "type": "string"
              },
              "models": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "models"
            ],
            "type": "object"
          },
          {
            "description": "Settings name a CDI device of another kind, which only the system's\nspecs define.",
            "properties": {
              "devices": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "kind": {
                "const": "other_cdi_kind",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "devices"
            ],
            "type": "object"
          },
          {
            "description": "Engine images not on the machine yet.",
            "properties": {
              "kind": {
                "const": "images_missing",
                "type": "string"
              },
              "references": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "references"
            ],
            "type": "object"
          }
        ]
      },
      "MachineCheck": {
        "description": "The whole check.",
        "properties": {
          "checked_at": {
            "description": "When it ran: UTC, `YYYY-MM-DD HH:MM:SS`.",
            "type": "string"
          },
          "failed_start": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MachineFailedStart"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last start of a local model on the graphics card that failed\nbecause of this computer (the check named why), whoever asked for it:\na client, the Chat, a lab, the model's Test. `None` before one since\nlmgw started. A surface that was told \"Not now\" asks again once this\nis another failed start than the one it was told it beside\n(machine-check design D171, D182)."
          },
          "headline": {
            "description": "The verdict in one plain sentence.",
            "type": "string"
          },
          "items": {
            "description": "The items, in the order they are checked: graphics card and driver,\nusing the card for models, running models, model settings, room, the\ndownload.",
            "items": {
              "$ref": "#/components/schemas/MachineItem"
            },
            "type": "array"
          },
          "plan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MachinePlan"
              },
              {
                "type": "null"
              }
            ],
            "description": "What can be done about it, when anything is to be done or offered."
          },
          "verdict": {
            "$ref": "#/components/schemas/MachineVerdict"
          }
        },
        "required": [
          "checked_at",
          "verdict",
          "headline",
          "items",
          "plan",
          "failed_start"
        ],
        "type": "object"
      },
      "MachineFailedStart": {
        "description": "A local model's start on the graphics card that failed because of this\ncomputer: `gpu_setup`'s start (machine-check design §2.5, D182).",
        "properties": {
          "at": {
            "description": "When it failed: UTC, `YYYY-MM-DD HH:MM:SS`.",
            "type": "string"
          },
          "class": {
            "description": "Its class: `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "count": {
            "description": "How many such starts failed since lmgw started, this one included:\ntwo in the same second are still two.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "model": {
            "description": "The model's id.",
            "type": "string"
          }
        },
        "required": [
          "model",
          "class",
          "at",
          "count"
        ],
        "type": "object"
      },
      "MachineItem": {
        "description": "One checked thing.",
        "properties": {
          "action": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MachineAction"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the person can do about it from here, without a password; only\nthe model settings item has one yet (§1.4)."
          },
          "cause": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MachineCause"
              },
              {
                "type": "null"
              }
            ],
            "description": "The typed reason, when the item is not plainly ok."
          },
          "detail": {
            "description": "What was read and where from, with the technical names: the fold.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "$ref": "#/components/schemas/MachineItemId"
          },
          "sentence": {
            "description": "What a newcomer reads.",
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/ItemState"
          }
        },
        "required": [
          "id",
          "state",
          "sentence",
          "detail",
          "cause",
          "action"
        ],
        "type": "object"
      },
      "MachineItemId": {
        "description": "Which item (§1.1 … §1.6).",
        "oneOf": [
          {
            "const": "graphics_card",
            "description": "§1.1: the graphics card and its driver.",
            "type": "string"
          },
          {
            "const": "card_for_models",
            "description": "§1.2: what lets models use the card (NVIDIA's container toolkit and\nlmgw's own description of the card).",
            "type": "string"
          },
          {
            "const": "running_models",
            "description": "§1.3: the program that runs models.",
            "type": "string"
          },
          {
            "const": "settings_fit",
            "description": "§1.4: whether the model settings fit the card.",
            "type": "string"
          },
          {
            "const": "room",
            "description": "§1.5: free disk space.",
            "type": "string"
          },
          {
            "const": "download",
            "description": "§1.6: the download of what the card needs.",
            "type": "string"
          }
        ]
      },
      "MachinePlan": {
        "description": "What can be done, and how.",
        "properties": {
          "hash": {
            "description": "SHA-256 over the steps as root runs them (lmgw-machine's\n`HashedPlan`), never over this answer: its sentences and sizes do not\nchange it.",
            "type": "string"
          },
          "how": {
            "$ref": "#/components/schemas/PlanHow"
          },
          "steps": {
            "items": {
              "$ref": "#/components/schemas/PlanStep"
            },
            "type": "array"
          }
        },
        "required": [
          "hash",
          "how",
          "steps"
        ],
        "type": "object"
      },
      "MachineSummary": {
        "description": "The verdict alone, in `GET /api/status` and the `machine` frame of\n`/api/events`.",
        "properties": {
          "checked_at": {
            "type": "string"
          },
          "failed_start": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MachineFailedStart"
              },
              {
                "type": "null"
              }
            ],
            "description": "`MachineCheck::failed_start`."
          },
          "headline": {
            "type": "string"
          },
          "verdict": {
            "$ref": "#/components/schemas/MachineVerdict"
          }
        },
        "required": [
          "verdict",
          "headline",
          "checked_at",
          "failed_start"
        ],
        "type": "object"
      },
      "MachineVerdict": {
        "description": "The headline verdict (§1.7).",
        "oneOf": [
          {
            "const": "ready",
            "description": "Local models can run.",
            "type": "string"
          },
          {
            "const": "needs_fix",
            "description": "Something is missing that lmgw can set up with a button here.",
            "type": "string"
          },
          {
            "const": "needs_steps",
            "description": "Something is missing that is added by following instructions here.",
            "type": "string"
          },
          {
            "const": "needs_restart",
            "description": "A restart finishes a driver update or start.",
            "type": "string"
          },
          {
            "const": "needs_driver",
            "description": "The NVIDIA card needs NVIDIA's driver.",
            "type": "string"
          },
          {
            "const": "cloud_only",
            "description": "No graphics card: cloud models only.",
            "type": "string"
          }
        ]
      },
      "ManifestCorpus": {
        "properties": {
          "chunk_count": {
            "format": "int64",
            "type": "integer"
          },
          "corpus_id": {
            "type": "string"
          },
          "crawl_date": {
            "type": "string"
          },
          "embed_dims": {
            "format": "int64",
            "type": "integer"
          },
          "embed_model": {
            "type": "string"
          },
          "embed_upstream": {
            "type": "string"
          },
          "eval_regression": {
            "type": "boolean"
          },
          "eval_score": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "ingest_model": {
            "type": "string"
          },
          "ingest_prompt_version": {
            "type": "string"
          },
          "library": {
            "type": "string"
          },
          "source_kind": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "corpus_id",
          "library",
          "version",
          "status",
          "embed_upstream",
          "embed_model",
          "embed_dims",
          "ingest_model",
          "ingest_prompt_version",
          "source_kind",
          "crawl_date",
          "chunk_count",
          "eval_score",
          "eval_regression"
        ],
        "type": "object"
      },
      "McpServerDetail": {
        "properties": {
          "description": {
            "description": "A toolset's purpose; \"\" for a server.",
            "type": "string"
          },
          "kind": {
            "description": "builtin: lmgw's own toolsets (lmgw, for owner credentials only; docs; kb); server: a registered MCP server; agent: a service agent's tools.",
            "enum": [
              "builtin",
              "server",
              "agent"
            ],
            "type": "string"
          },
          "name": {
            "description": "A server's configured name; a toolset's label.",
            "type": "string"
          },
          "object": {
            "enum": [
              "mcp.server"
            ],
            "type": "string"
          },
          "server_label": {
            "description": "What goes into a {\"type\": \"mcp\", \"server_label\"} tool on /v1/realtime or /v1/responses: a built-in toolset's label, a registered server's tool prefix, else its name.",
            "type": "string"
          },
          "tools": {
            "items": {
              "properties": {
                "description": {
                  "description": "\"\" when the server gave none.",
                  "type": "string"
                },
                "input_schema": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "name": {
                  "description": "The server's own name for the tool: its exposed name minus the <prefix>__ namespace.",
                  "type": "string"
                }
              },
              "required": [
                "name",
                "description",
                "input_schema"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "object",
          "server_label",
          "kind",
          "name",
          "description",
          "tools"
        ],
        "type": "object"
      },
      "McpServerList": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "description": {
                  "description": "A toolset's purpose; \"\" for a server.",
                  "type": "string"
                },
                "kind": {
                  "description": "builtin: lmgw's own toolsets (lmgw, for owner credentials only; docs; kb); server: a registered MCP server; agent: a service agent's tools.",
                  "enum": [
                    "builtin",
                    "server",
                    "agent"
                  ],
                  "type": "string"
                },
                "name": {
                  "description": "A server's configured name; a toolset's label.",
                  "type": "string"
                },
                "object": {
                  "enum": [
                    "mcp.server"
                  ],
                  "type": "string"
                },
                "server_label": {
                  "description": "What goes into a {\"type\": \"mcp\", \"server_label\"} tool on /v1/realtime or /v1/responses: a built-in toolset's label, a registered server's tool prefix, else its name.",
                  "type": "string"
                }
              },
              "required": [
                "object",
                "server_label",
                "kind",
                "name",
                "description"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "object": {
            "enum": [
              "list"
            ],
            "type": "string"
          }
        },
        "required": [
          "object",
          "data"
        ],
        "type": "object"
      },
      "McpServerView": {
        "properties": {
          "agent_id": {
            "description": "Set for an agent's own registration (container-runtime §3.3), so the\nMCP page can say who owns a row it must not offer to edit; `null` for\nevery row an owner made.",
            "type": [
              "string",
              "null"
            ]
          },
          "allow_sampling": {
            "type": "boolean"
          },
          "args": {
            "type": "string"
          },
          "autostart": {
            "type": "boolean"
          },
          "command": {
            "type": [
              "string",
              "null"
            ]
          },
          "container_image": {
            "type": [
              "string",
              "null"
            ]
          },
          "cwd": {
            "type": [
              "string",
              "null"
            ]
          },
          "device": {
            "description": "A `device` row's device, by its short name (`desktop`); `null` for\nevery other row.",
            "type": [
              "string",
              "null"
            ]
          },
          "device_key_id": {
            "description": "A `device` row's key id (`api_keys.id`); `null` for every other row.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "env": {
            "description": "`KEY=value` lines, as stored — a server's credentials usually live here.",
            "type": "string",
            "x-lmgw-secret": true
          },
          "extra_run_args": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "headers": {
            "description": "`Name: value` lines, as stored — an HTTP server's bearer lives here.",
            "type": "string",
            "x-lmgw-secret": true
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "idle_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "open_tasks": {
            "description": "The MCP tasks this server runs for Chat threads now, at list time\n(MCP Tasks design §6): started by a call of one of its `required`\ntools and not ended yet. No cap (T9); a server with open tasks is\nnever reaped for idleness (T17).",
            "format": "int64",
            "type": "integer"
          },
          "sampling_alias": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "`ready | connecting | error | stopped` at list time; live updates come\nfrom the SSE `mcp` frame.",
            "type": "string"
          },
          "status_detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "timeout_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "tool_count": {
            "format": "int64",
            "type": "integer"
          },
          "tool_prefix": {
            "type": "string"
          },
          "transport": {
            "description": "`stdio | http | sse | device`. A `device` row is a paired device's\nhosted tools (client-apps design §5.2): created by its hosting grant,\nconnected while the device's host link is open.",
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "enabled",
          "transport",
          "command",
          "args",
          "env",
          "cwd",
          "container_image",
          "extra_run_args",
          "url",
          "headers",
          "tool_prefix",
          "timeout_ms",
          "autostart",
          "idle_seconds",
          "allow_sampling",
          "sampling_alias",
          "agent_id",
          "status",
          "tool_count",
          "open_tasks",
          "status_detail",
          "device_key_id",
          "device"
        ],
        "type": "object"
      },
      "McpSettingsPatch": {
        "additionalProperties": false,
        "description": "The sparse patch the dashboard's settings save takes under `mcp`.",
        "properties": {
          "host_max_frame_mb": {
            "default": null,
            "description": "In MiB; `0` = bounded by `host_max_message_mb`. Not `0` together with\nit.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "host_max_message_mb": {
            "default": null,
            "description": "In MiB; `0` = no bound of its own. Not `0` together with\n`host_max_frame_mb`.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "host_ping_interval_s": {
            "default": null,
            "description": "Seconds between the link's pings; `0` = none.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "task_poll_interval_s": {
            "default": null,
            "description": "Seconds between two `tasks/get` of a task whose server suggests no\n`pollInterval`; at least 1.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "McpStatus": {
        "description": "One registered MCP server's connection state: `status` is `connecting` |\n`ready` | `stopped` | `error`, `tool_count` the tools it offers, and\n`detail` says why on an error, or that a stopped server was idle-reaped\nand reconnects on next use.",
        "properties": {
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tool_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "tool_count",
          "detail"
        ],
        "type": "object"
      },
      "McpToolView": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The exposed (prefixed) name a model sees and a thread stores.",
            "type": "string"
          },
          "upstream_name": {
            "description": "The server's own name for it, shown when a prefix hides it.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "upstream_name",
          "description"
        ],
        "type": "object"
      },
      "Measured": {
        "description": "Where a threshold was measured: a set run, and what the cut gave there.",
        "properties": {
          "accuracy": {
            "description": "Of those, the share of the labelled ones answered correctly. A cut\nwith no labelled item at or above it is not written (409\n`no_labels`).",
            "format": "double",
            "type": "number"
          },
          "batch_id": {
            "description": "The set run it was measured on.",
            "format": "int64",
            "type": "integer"
          },
          "coverage": {
            "description": "The share of the run's answered items at or above the threshold.",
            "format": "double",
            "type": "number"
          },
          "labelled": {
            "description": "How many labelled items the accuracy is over: at least 1.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "batch_id",
          "coverage",
          "accuracy",
          "labelled"
        ],
        "type": "object"
      },
      "MediaAction": {
        "description": "What an image card's action does (design §8.3).",
        "oneOf": [
          {
            "const": "reroll",
            "description": "The same prompt and settings, a new seed.",
            "type": "string"
          },
          {
            "const": "vary",
            "description": "A variation (img2img) of the picture, on a row without `edit`.",
            "type": "string"
          },
          {
            "const": "edit",
            "description": "An instruction edit of the picture, on a row with `edit`.",
            "type": "string"
          },
          {
            "const": "upscale",
            "description": "An ESRGAN upscale of the picture.",
            "type": "string"
          }
        ]
      },
      "MediaChoice": {
        "description": "One model a media tool can use, as a picker lists it.",
        "properties": {
          "label": {
            "description": "What a person reads: the name, and what it is (its family, on this\nmachine, a cloud model via its upstream).",
            "type": "string"
          },
          "local": {
            "description": "One of lmgw's own rows rather than an alias.",
            "type": "boolean"
          },
          "name": {
            "description": "The name the tool's `model` takes and a default stores.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "label",
          "local"
        ],
        "type": "object"
      },
      "MediaChoices": {
        "description": "What each media tool can use, for the default pickers: the same rows\nand aliases its `model` enum lists for the caller.",
        "properties": {
          "edit": {
            "items": {
              "$ref": "#/components/schemas/MediaChoice"
            },
            "type": "array"
          },
          "generate": {
            "items": {
              "$ref": "#/components/schemas/MediaChoice"
            },
            "type": "array"
          },
          "speak": {
            "items": {
              "$ref": "#/components/schemas/MediaChoice"
            },
            "type": "array"
          },
          "transcribe": {
            "items": {
              "$ref": "#/components/schemas/MediaChoice"
            },
            "type": "array"
          },
          "voices": {
            "additionalProperties": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "description": "The voices of each speech row, by its name; a cloud alias has none\nlisted (its voices are the provider's own).",
            "type": "object"
          }
        },
        "required": [
          "generate",
          "edit",
          "speak",
          "transcribe",
          "voices"
        ],
        "type": "object"
      },
      "MediaDefaults": {
        "additionalProperties": false,
        "description": "One level's default models, by tool (module doc).\n\nInput is strict (`deny_unknown_fields`): a write that names a field this\nbuild does not know is refused with the fields it does, rather than\nstored as nothing. A stored level is read through\n`MediaDefaults::from_stored`, which drops such a key on its own.",
        "properties": {
          "edit": {
            "description": "`image__edit`'s model.",
            "type": [
              "string",
              "null"
            ]
          },
          "generate": {
            "description": "`image__generate`'s model, as its `model` enum names it\n(`image/<id>` or an alias).",
            "type": [
              "string",
              "null"
            ]
          },
          "speak": {
            "description": "`audio__speak`'s model.",
            "type": [
              "string",
              "null"
            ]
          },
          "transcribe": {
            "description": "`audio__transcribe`'s model.",
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "description": "The voice `audio__speak` uses with the default speech model when a\ncall names none.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "MediaFacts": {
        "description": "The facts of a produced file, under `meta.media` of its attachment\n(design §9). Every field is optional: what a call did not have is left\nout, never guessed.",
        "properties": {
          "answered_by": {
            "description": "The model or alias that answered instead of `model`: its fallback,\nfor whatever reason it could not answer.",
            "type": [
              "string",
              "null"
            ]
          },
          "cfg": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "duration_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "job_ms": {
            "description": "The job's own time, `completed − started` (sd-server's job API).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "description": "The model the call named (`image/z-image-turbo`).",
            "type": [
              "string",
              "null"
            ]
          },
          "negative_prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "not_applied": {
            "description": "What the answering route could not take and so did not apply\n(`seed`, `steps`, ...): a cloud fallback gets no smuggled parameters.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "parent": {
            "description": "The attachment this one was made from (a card action's source).",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "scale": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "steps": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "strength": {
            "description": "A variation's strength.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "tool": {
            "description": "The tool that made it: `image__generate`, `audio__speak`, ...",
            "type": [
              "string",
              "null"
            ]
          },
          "upscaler": {
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "type": [
              "string",
              "null"
            ]
          },
          "wall_ms": {
            "description": "The call's whole time, loading included.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "width": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "MediaPhase": {
        "description": "What a running image or audio call is doing (`ToolProgressFrame::phase`).",
        "oneOf": [
          {
            "enum": [
              "speaking",
              "transcribing",
              "upscaling"
            ],
            "type": "string"
          },
          {
            "const": "downloading",
            "description": "The call's model's engine image is being downloaded before the model\ncan be loaded (machine-check design §5): `image`, `done_bytes`, and\n`total_bytes` where the size is known.",
            "type": "string"
          },
          {
            "const": "unloading",
            "description": "Another model is being stopped to make room: `model` names it.",
            "type": "string"
          },
          {
            "const": "loading",
            "description": "The call's own model is being brought onto the GPU.",
            "type": "string"
          },
          {
            "const": "waiting_for_room",
            "description": "Nothing more can be stopped yet: the call waits for memory\n(`needs_bytes`, `free_bytes`).",
            "type": "string"
          },
          {
            "const": "queued",
            "description": "The image server holds the job in its queue (`queue_position`).",
            "type": "string"
          },
          {
            "const": "generating",
            "description": "The picture is being drawn (`pass`, `step`, `total_steps`, `preview`\nwhere the image server reports them).",
            "type": "string"
          }
        ]
      },
      "MediaUnavailable": {
        "description": "A stored default that does not resolve now, and why: the model was\nswitched off or deleted, an alias lost the route, the caller's key may\nnot use it, a voice its model does not have.",
        "properties": {
          "field": {
            "description": "`generate`, `edit`, `speak`, `voice` or `transcribe`.",
            "type": "string"
          },
          "name": {
            "description": "The stored name.",
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "name",
          "reason"
        ],
        "type": "object"
      },
      "MergeOutcome": {
        "description": "One outcome an extra can have when assembled.",
        "oneOf": [
          {
            "enum": [
              "merged"
            ],
            "type": "string"
          },
          {
            "const": "already_in_base",
            "description": "Its head was already an ancestor of `HEAD`, or the merge's diff\nagainst its first parent was empty.",
            "type": "string"
          },
          {
            "const": "merged_upstream",
            "description": "Skipped on the forge's word (`merged_at` set).",
            "type": "string"
          },
          {
            "const": "squash_applied",
            "description": "No shared history with the assembled `HEAD`: applied as a squash of\nits changes since its fork point instead of a merge.",
            "type": "string"
          },
          {
            "const": "conflict",
            "description": "Only in a check-merge step or a failed run — assemble stops here.",
            "type": "string"
          }
        ]
      },
      "Message": {
        "description": "One stored message of a thread.",
        "properties": {
          "answered_by": {
            "description": "The alias that actually answered, when it was not `model` (a\nfallback); `null` when `model` itself answered.",
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "description": "The files sent with this message.",
            "items": {
              "$ref": "#/components/schemas/AttachmentMeta"
            },
            "type": "array"
          },
          "completion_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "content": {
            "type": "string"
          },
          "context": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessageContext"
              },
              {
                "type": "null"
              }
            ],
            "description": "The retrieval that ran for this user message; `null` when none ran."
          },
          "created_at": {
            "description": "When the message was written (UTC, `YYYY-MM-DD HH:MM:SS`).",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "images_note": {
            "description": "For a reply that a fallback without sight answered: who, for which\nmodel, and what went to it in the images' place. Absent otherwise.",
            "type": "string"
          },
          "ir_messages": {
            "description": "An agentic turn's tool calls and results as JSON text; `null` for a\nplain chat turn.",
            "type": [
              "string",
              "null"
            ]
          },
          "kb_refs": {
            "description": "Knowledge bases picked with `#` for this user message only.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "model": {
            "description": "A reply's model: the alias its turn asked for. `null` on user\nmessages and on replies saved before it was recorded.",
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "description": "A user message's origin: the sentence its client sent with it about\nwhere the user wrote it (`origin` of the send or the edit), which\nthe model reads before the message's text. `null` when its client\nsent none, and on every other role.",
            "type": [
              "string",
              "null"
            ]
          },
          "pending_approvals": {
            "description": "The calls a gated turn's reply still waits on\n(`POST /chat/api/threads/{id}/approvals` decides them). Absent when\nnone wait.",
            "items": {
              "$ref": "#/components/schemas/ApprovalRequest"
            },
            "type": "array"
          },
          "prompt_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning": {
            "description": "A reasoning model's thinking trace; empty otherwise.",
            "type": "string"
          },
          "role": {
            "description": "`user`, `assistant`, or `tool` (a late MCP task result).",
            "type": "string"
          },
          "task": {
            "$ref": "#/components/schemas/MessageTask",
            "description": "On a late MCP task result (role `tool`): the task's facts. Absent\notherwise."
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          },
          "voice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessageVoice"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the turn was spoken; `null` for a typed turn."
          }
        },
        "required": [
          "id",
          "thread_id",
          "role",
          "content",
          "reasoning",
          "prompt_tokens",
          "completion_tokens",
          "ir_messages",
          "kb_refs",
          "context",
          "model",
          "answered_by",
          "voice",
          "origin",
          "created_at",
          "attachments"
        ],
        "type": "object"
      },
      "MessageAck": {
        "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
        "properties": {
          "message": {
            "description": "What was done, for a person to read.",
            "type": "string"
          },
          "ok": {
            "description": "Always `true`; a failure is an error answer instead.",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "message"
        ],
        "type": "object"
      },
      "MessageContext": {
        "description": "The retrieval that ran for one user message. Excerpt `n` in the\n`<context>` block (and `[n]` in the answer) is `excerpts[n - 1]`.",
        "properties": {
          "budget_tokens": {
            "description": "The budget the retrieval ran with.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "dropped": {
            "description": "Excerpts that ranked but did not fit the budget.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "excerpts": {
            "items": {
              "$ref": "#/components/schemas/ContextExcerpt"
            },
            "type": "array"
          },
          "kb_ids": {
            "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "ms": {
            "description": "How long the retrieval took.",
            "format": "double",
            "type": "number"
          },
          "notes": {
            "description": "Why something was not searched, or not fully: one sentence each.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "query": {
            "description": "What was searched for.",
            "type": "string"
          },
          "searched": {
            "description": "The bases that were searched, by name.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "tokens": {
            "description": "Tokens the excerpts use, heading paths included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "excerpts",
          "tokens",
          "dropped",
          "budget_tokens",
          "notes",
          "searched",
          "kb_ids",
          "query",
          "ms"
        ],
        "type": "object"
      },
      "MessageTask": {
        "description": "What a result row says of its task: `task` on a message of role `tool`.",
        "properties": {
          "ended_by": {
            "description": "Who cancelled it, for a cancel lmgw sent (\"the dashboard\", \"device\n'phone'\"); `null` otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "server_label": {
            "description": "The label the tool was offered under when it was called.",
            "type": "string"
          },
          "status": {
            "description": "How it ended: `completed`, `failed`, `cancelled`, or `abandoned`\n(the server no longer knows it, or its server row was removed).",
            "enum": [
              "completed",
              "failed",
              "cancelled",
              "abandoned"
            ],
            "type": "string"
          },
          "structured_content": {
            "description": "The result's MCP `structuredContent`, for a view of the call\n(client-apps design §7.5): the model reads the result's `content`,\nand this only when the content was empty. Absent when the result\nhad none, and for a result stored by an earlier lmgw."
          },
          "task_id": {
            "description": "The server's id of the task.",
            "type": "string"
          },
          "tool": {
            "description": "The name the model called (`<label>__<tool>`).",
            "type": "string"
          }
        },
        "required": [
          "task_id",
          "server_label",
          "tool",
          "status",
          "ended_by"
        ],
        "type": "object"
      },
      "MessageVoice": {
        "description": "How a turn was spoken, on its message: `null` on the message for a typed\nturn. On a user message: how it was dictated or spoken in realtime mode,\nthe speech-to-text alias that was asked and the one that answered, and\nthe audio's length. On a spoken reply: the text-to-speech alias, the\nvoice, the part that was never heard and the turn's timing.",
        "properties": {
          "asr": {
            "type": "string"
          },
          "asr_answered_by": {
            "type": "string"
          },
          "asr_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "audio_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "input": {
            "$ref": "#/components/schemas/InputPath",
            "description": "On a user message: `audio` when the chat model heard the turn;\nabsent on the transcript path."
          },
          "timing": {
            "$ref": "#/components/schemas/VoiceTiming"
          },
          "transcript_error": {
            "description": "On a user message the model heard: why its transcription failed.",
            "type": "string"
          },
          "tts": {
            "type": "string"
          },
          "tts_answered_by": {
            "type": "string"
          },
          "unheard": {
            "description": "The reply's text after the heard part, shown behind a \"not heard\"\nmarker. Not in `content`, so the model never sees it.",
            "type": "string"
          },
          "via": {
            "description": "`dictation` or `realtime`.",
            "type": "string"
          },
          "voice": {
            "type": "string"
          }
        },
        "required": [
          "via"
        ],
        "type": "object"
      },
      "MetricDelta": {
        "description": "One headline metric of a comparison.",
        "properties": {
          "band_pct": {
            "description": "max(threshold, noise): the band a delta has to leave.",
            "format": "double",
            "type": "number"
          },
          "delta_pct": {
            "description": "(new − old) / old, in percent.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "lower_is_better": {
            "type": "boolean"
          },
          "metric": {
            "description": "Stable key: `prefill_tok_s`, `ttft_ms`, `decode_tok_s`,\n`decode_deep_tok_s`, `aggregate_tok_s`, `decode_tokens_per_joule`,\n`load_ms`, `load_vram_bytes`, `stall_ms`.",
            "type": "string"
          },
          "new": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "noise_pct": {
            "description": "The larger relative spread of the two points, in percent.",
            "format": "double",
            "type": "number"
          },
          "note": {
            "description": "E.g. the two runs measured different prompt lengths (the verdict is\nthen `not_same_point`).",
            "type": [
              "string",
              "null"
            ]
          },
          "old": {
            "description": "The previous run's value (median), and this run's.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "unit": {
            "type": "string"
          },
          "verdict": {
            "$ref": "#/components/schemas/Verdict"
          }
        },
        "required": [
          "metric",
          "label",
          "unit",
          "lower_is_better",
          "old",
          "new",
          "delta_pct",
          "noise_pct",
          "band_pct",
          "verdict",
          "note"
        ],
        "type": "object"
      },
      "MixedPlan": {
        "description": "The mixed phase's shape.",
        "properties": {
          "inject_tokens": {
            "description": "*P_inj* = min(8192, *P_max*).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "stream_predict": {
            "description": "Their `n_predict`: as much as the slot holds, so none runs out before\nthe injected prompt's first token.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "stream_prompt_tokens": {
            "description": "Their prompt length.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "streams": {
            "description": "*N_slots* − 1 decoding streams.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "streams",
          "stream_prompt_tokens",
          "stream_predict",
          "inject_tokens"
        ],
        "type": "object"
      },
      "MixedResult": {
        "description": "The mixed phase: what an arriving long prompt costs streams that\nare already decoding.",
        "properties": {
          "before_tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "Per repetition: the median over the streams of each one's rate in the\nsteady window before the injection."
          },
          "during_tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "Per repetition: the median over the streams of each one's rate from\nthe injection to the injected request's first token."
          },
          "inject_tokens": {
            "description": "*P_inj*.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "inject_ttft_ms": {
            "$ref": "#/components/schemas/Stat",
            "description": "The injected request's TTFT."
          },
          "notes": {
            "description": "Anything that makes a repetition's numbers partial (a stream that\nended before the injected first token, …).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "solo_ttft_ms": {
            "description": "The prefill phase's median TTFT at the same prompt length, when it\nmeasured that length.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "stall_ms": {
            "$ref": "#/components/schemas/Stat",
            "description": "Per repetition: the longest inter-token gap of any stream across that\nwindow — the stall."
          },
          "streams": {
            "description": "Decoding streams (*N_slots* − 1).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "streams",
          "inject_tokens",
          "before_tok_s",
          "during_tok_s",
          "stall_ms",
          "inject_ttft_ms",
          "solo_ttft_ms",
          "notes"
        ],
        "type": "object"
      },
      "ModelById": {
        "description": "The OpenAiModel shape unless the caller sent anthropic-version, in which case AnthropicModel. No lmgw block on the single-model route.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/OpenAiModel"
          },
          {
            "$ref": "#/components/schemas/AnthropicModel"
          }
        ]
      },
      "ModelCapabilities": {
        "additionalProperties": false,
        "description": "The `capabilities` object of one model on `GET /v1/models`.\n\n`task`, `endpoints` and `source` are always present — they are what makes\nthe entry actionable at all (\"this id exists, here is where to send it,\nhere is how much to trust the rest\"). Everything else is absent unless a\nsource stated it.",
        "properties": {
          "context_editing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextEditingCaps"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic's context management (`context_management` on\n`/v1/messages`: context editing and threshold compaction, and the\ntop-level on-demand `compaction`), under a name of its\nown because the Anthropic-shaped model entry puts Anthropic's\n`context_management` block beside lmgw's object. Present only on an\nAnthropic-protocol route, the one route that sends a request's\n`context_management` on as written; every other route leaves it out\nand names it in `x-lmgw-params-ignored`."
          },
          "endpoints": {
            "description": "The lmgw routes that accept this model id.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "input_modalities": {
            "description": "Subset of `text`, `image`, `audio`, `video`, `file`, `pdf`,\n`embedding`. `pdf` is a catalog's word (Anthropic's `pdf_input`,\nKilo's and OpenRouter's modality).\nAbsent = unknown, never \"none\".",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "languages": {
            "description": "ISO 639-1 codes (a few three-letter ones, `yue`) of the languages a\nlocal audio model works in, whatever its task: speech, recognition,\nalignment. A request's `language` takes them (lmgw sends each in the\nmodel's own spelling). Absent when the model's package names none\nas codes; see `multilingual` for a family that says only that it\ncovers many.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "multilingual": {
            "description": "The model's family says it is multilingual without listing codes\n(\"multilingual\", \"80+ languages\"): it works in more languages than\n`languages` names, which then holds few or none. Absent otherwise;\nabsent along with `languages` means unknown, never \"one language\".",
            "type": [
              "boolean",
              "null"
            ]
          },
          "output_modalities": {
            "description": "The same vocabulary, plus `decisions`: what a decision model answers\nwith (llama.cpp's and OpenRouter's word). A client that checks\nllama.cpp's `architecture.output_modalities` for `decisions` reads\nthis list instead. Absent = unknown.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "description": "Where the facts came from: `gguf+config`, `catalog`, `config`, or\n`owner` (an alias's capabilities override).",
            "type": "string"
          },
          "speech": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SpeechCaps"
              },
              {
                "type": "null"
              }
            ],
            "description": "A text-to-speech model's expressive controls — what `instructions`,\ninline tags, `language` and `stream_format` do on it\n(the speech capabilities object). A local audio model's is derived; a\ncloud alias has one only through an alias's capabilities override."
          },
          "structured_output": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StructuredOutputCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "task": {
            "description": "`chat` | `embedding` | `rerank` | `decision` (a decision model,\nanswering on `/v1/systemone`) | `tts` | `asr` | an audio.cpp task\nname | an image task | `realtime` (an OpenAI Realtime model, no lmgw\nroute). Determines `endpoints`.",
            "type": "string"
          },
          "tool_calls": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ToolCallCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "vision": {
            "description": "`input_modalities` contains `image`. Redundant with the list on\npurpose: a client can read this one boolean to decide whether to\nsend images, e.g. whether a session gets a screenshot tool. Absent\nexactly when `input_modalities` is absent.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "task",
          "endpoints",
          "source"
        ],
        "type": "object"
      },
      "ModelCard": {
        "description": "The card (§5, §9.2): one model and one file of it, marked by size until\nthe page reads the header (D123).",
        "properties": {
          "by": {
            "description": "The author's display name on the hub (D19), else its id.",
            "type": "string"
          },
          "by_user": {
            "description": "The account's id when the author is a person, whose display name is\nself-chosen: shown beside `by`. `None` for an organisation.",
            "type": [
              "string",
              "null"
            ]
          },
          "can": {
            "description": "\"reads pictures\", … (D22): what the listings tell.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "companions": {
            "description": "The projector D121 picks, and the first drafter.",
            "items": {
              "$ref": "#/components/schemas/HfCompanion"
            },
            "type": "array"
          },
          "disk_free_bytes": {
            "description": "Free bytes where the files land (D125).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "download": {
            "$ref": "#/components/schemas/DownloadEstimate",
            "description": "The file's bytes and its companions', with the time (D23)."
          },
          "downloads": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "file": {
            "description": "The file (a split file's first part); empty when none was read.",
            "type": "string"
          },
          "fit": {
            "$ref": "#/components/schemas/FileFit",
            "description": "The file's fit by size (D123): beside what runs now when that pick\nexists, else on the whole card (D120); `fit.measure` says which."
          },
          "gated": {
            "type": "boolean"
          },
          "kind": {
            "$ref": "#/components/schemas/CardKind"
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the hub's tags name, linked to the original's page\n(D22). Shown, never a filter."
          },
          "likes": {
            "description": "The original's likes and downloads on the hub, as its listing says\nthem (a later page's card is listed among the other models).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "more_uploads": {
            "description": "The hub has more uploads than its first page listed.",
            "type": "boolean"
          },
          "name": {
            "description": "The original's repo name with hyphens as spaces (\"Qwen3.6 27B\").",
            "type": "string"
          },
          "named_file": {
            "description": "The file a pasted address named, when `file` is that file (WP7,\nD100): the header's marks keep it as the card's file while it fits,\nand only then pass to their own pick.",
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "description": "The original, `owner/name`.",
            "type": "string"
          },
          "origin_private": {
            "description": "The original is private to the account: a share text from a public\nupload of it names the model by the upload (WP7, D109).",
            "type": "boolean"
          },
          "other_uploads": {
            "description": "The original's other uploads, plain ones first: the window the\narguments asked for (D142).",
            "items": {
              "$ref": "#/components/schemas/UploadChoice"
            },
            "type": "array"
          },
          "other_uploads_more": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "other_uploads_total": {
            "description": "How many other uploads the hub's first page listed, and how many come\nafter `other_uploads`.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "parameters": {
            "description": "The hub listing's parameter total; the header's count replaces it\nonce read (`hf_repo` with `fit`).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "parts": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "private": {
            "description": "The upload or the original is private to the account (D124).",
            "type": "boolean"
          },
          "quant": {
            "type": [
              "string",
              "null"
            ]
          },
          "share": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ShareLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "None for a private repo (D124) and for a card without a file."
          },
          "upload": {
            "description": "The upload the file is from; empty when the walk passed the model\nover without reading its uploads (`NothingFits`).",
            "type": "string"
          },
          "whole_card": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CardFile"
              },
              {
                "type": "null"
              }
            ],
            "description": "The whole card's pick, when it differs from `file` (D120)."
          },
          "why": {
            "description": "\"Why this file\" (§3.2): the upload, the rule, the width by size.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "by",
          "by_user",
          "origin",
          "likes",
          "downloads",
          "kind",
          "upload",
          "file",
          "quant",
          "parts",
          "companions",
          "can",
          "parameters",
          "licence",
          "gated",
          "private",
          "origin_private",
          "download",
          "disk_free_bytes",
          "fit",
          "whole_card",
          "why",
          "share",
          "named_file",
          "other_uploads",
          "other_uploads_total",
          "other_uploads_more",
          "more_uploads"
        ],
        "type": "object"
      },
      "ModelCheck": {
        "description": "One model's pre-flight result; `class` says which kind of model it is and\nso which fields it has.",
        "oneOf": [
          {
            "description": "A chat-class model.",
            "properties": {
              "advisories": {
                "description": "The model starts, but misbehaves under some input.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "class": {
                "const": "chat",
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              },
              "model_id": {
                "type": "string"
              },
              "ok": {
                "description": "No problems. Advisories do not count.",
                "type": "boolean"
              },
              "problems": {
                "description": "Why the model cannot load as configured.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "class",
              "model_id",
              "enabled",
              "ok",
              "problems",
              "advisories"
            ],
            "type": "object"
          },
          {
            "description": "An embedding, rerank or decision model.",
            "properties": {
              "class": {
                "const": "aux",
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              },
              "kind": {
                "description": "`embed`, `rerank` or `decision`.",
                "type": "string"
              },
              "model_id": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "problems": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "class",
              "model_id",
              "kind",
              "enabled",
              "ok",
              "problems"
            ],
            "type": "object"
          },
          {
            "description": "An image-generation model.",
            "properties": {
              "class": {
                "const": "image",
                "type": "string"
              },
              "edit": {
                "type": "boolean"
              },
              "enabled": {
                "type": "boolean"
              },
              "model_id": {
                "type": "string"
              },
              "modes": {
                "description": "The modes the row serves (`generate`, `edit`, …).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "problems": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "class",
              "model_id",
              "modes",
              "edit",
              "enabled",
              "ok",
              "problems"
            ],
            "type": "object"
          }
        ]
      },
      "ModelChoice": {
        "description": "One model in a list: \"Other models with this name\", \"Did you mean\".",
        "properties": {
          "author": {
            "description": "The author's id on the hub (a card's \"by\" is the display name).",
            "type": "string"
          },
          "downloads": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "gated": {
            "type": "boolean"
          },
          "likes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "matched_words": {
            "description": "How many of the query's words its name matched (D13).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "description": "The repo's name with hyphens as spaces.",
            "type": "string"
          },
          "note": {
            "description": "\"not available as a file lmgw can run yet\", when the walk found so.",
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "description": "The repo, `owner/name`.",
            "type": "string"
          },
          "parameters": {
            "description": "The listing's parameter total.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "pipeline": {
            "description": "The hub's pipeline name.",
            "type": [
              "string",
              "null"
            ]
          },
          "private": {
            "type": "boolean"
          }
        },
        "required": [
          "origin",
          "name",
          "author",
          "likes",
          "downloads",
          "pipeline",
          "parameters",
          "matched_words",
          "gated",
          "private",
          "note"
        ],
        "type": "object"
      },
      "ModelDone": {
        "description": "One model, `start`, `stop`, `restart` or `apply`.",
        "properties": {
          "applied": {
            "description": "`apply` only: whether the configuration was applied.",
            "type": "boolean"
          },
          "class": {
            "type": "string"
          },
          "held": {
            "description": "`apply` only: the GPU hold kept the container from starting again.",
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "description": "False when the model was still serving requests and was left\nrunning, or could not be stopped under the hold.",
            "type": "boolean"
          },
          "port": {
            "description": "The port, when the action left the container up.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "running": {
            "description": "`apply` only: whether the container is running afterwards.",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "class",
          "model_id",
          "message"
        ],
        "type": "object"
      },
      "ModelGetDone": {
        "description": "A `model_get` job's result: the row it set up.",
        "properties": {
          "created": {
            "description": "`false` when a row already served this file and the get answered\nthat one (§6.2 step 4).",
            "type": "boolean"
          },
          "ctx_size": {
            "description": "The context the row was created with.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "fit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FileFit"
              },
              {
                "type": "null"
              }
            ],
            "description": "The fit the context comes from, by the get's measure; `None` when a\nrow already served the file."
          },
          "get_id": {
            "format": "int64",
            "type": "integer"
          },
          "model_id": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          },
          "note": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FitNote"
              },
              {
                "type": "null"
              }
            ],
            "description": "The note the row keeps when its context is a fit's shorter one\n(D26)."
          },
          "public_name": {
            "type": "string"
          },
          "row_id": {
            "description": "The row's id in its class's table.",
            "format": "int64",
            "type": "integer"
          },
          "target": {
            "type": "string"
          },
          "warnings": {
            "description": "The plan's and the create's warnings, each a sentence.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "get_id",
          "model_id",
          "public_name",
          "target",
          "row_id",
          "created",
          "ctx_size",
          "fit",
          "note",
          "warnings",
          "next_step"
        ],
        "type": "object"
      },
      "ModelGetStage": {
        "description": "Where a get is (§6.2), as its job's progress detail says it.",
        "oneOf": [
          {
            "const": "downloading",
            "description": "The files are downloading.",
            "type": "string"
          },
          {
            "const": "paused",
            "description": "No file is transferring and one or more wait: paused on a metered\nconnection, or cut and not started again. `waiting` says which and\nwhy.",
            "type": "string"
          },
          {
            "const": "setting_up",
            "description": "The files are here: planning, fitting and creating the row.",
            "type": "string"
          },
          {
            "const": "ready",
            "description": "The row is there.",
            "type": "string"
          }
        ]
      },
      "ModelGetState": {
        "description": "How a get stands.",
        "oneOf": [
          {
            "const": "running",
            "description": "Waiting for its files, or setting up the row (`stage` says which).",
            "type": "string"
          },
          {
            "const": "done",
            "description": "The row is there (`row_id`, `result`).",
            "type": "string"
          },
          {
            "const": "failed",
            "description": "It stopped; `error` says why and what to do.",
            "type": "string"
          },
          {
            "const": "canceled",
            "description": "Cancelled, its own downloads with it.",
            "type": "string"
          }
        ]
      },
      "ModelIdentity": {
        "description": "The model the run measured, filled in by the benchmark runner.",
        "properties": {
          "gguf_mtime": {
            "type": [
              "string",
              "null"
            ]
          },
          "gguf_path": {
            "type": "string"
          },
          "gguf_size": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "model_id": {
            "type": "string"
          },
          "quant": {
            "description": "From the GGUF header's file type.",
            "type": [
              "string",
              "null"
            ]
          },
          "rung": {
            "description": "A ladder row's rung, 0 = base.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "model_id",
          "gguf_path",
          "gguf_size",
          "gguf_mtime",
          "quant",
          "rung"
        ],
        "type": "object"
      },
      "ModelLicence": {
        "description": "The licence a GGUF header states (`general.license`, with the optional\n`general.license.name` and `general.license.link`). Information only: it\nis never a filter, a ranking or a warning. At least one field is set.",
        "properties": {
          "id": {
            "description": "`general.license`: an SPDX-like id or a name, such as `apache-2.0`\nor `other`.",
            "type": [
              "string",
              "null"
            ]
          },
          "link": {
            "description": "`general.license.link`.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "`general.license.name`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "link"
        ],
        "type": "object"
      },
      "ModelList": {
        "description": "OpenAiModelList unless the caller sent anthropic-version, in which case AnthropicModelList.",
        "oneOf": [
          {
            "properties": {
              "data": {
                "items": {
                  "$ref": "#/components/schemas/OpenAiModel"
                },
                "type": "array"
              },
              "lmgw": {
                "properties": {
                  "endpoints": {
                    "description": "Every path listed here exists in this API and carries the capability its own operation documents.",
                    "properties": {
                      "anthropic": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "openai": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "other": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "openai",
                      "anthropic",
                      "other"
                    ],
                    "type": "object"
                  },
                  "headers": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "notes": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "version": {
                    "type": "string"
                  }
                },
                "required": [
                  "version",
                  "endpoints",
                  "headers",
                  "notes"
                ],
                "type": "object"
              },
              "object": {
                "enum": [
                  "list"
                ],
                "type": "string"
              }
            },
            "required": [
              "object",
              "data",
              "lmgw"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "items": {
                  "$ref": "#/components/schemas/AnthropicModel"
                },
                "type": "array"
              },
              "first_id": {
                "type": "null"
              },
              "has_more": {
                "enum": [
                  false
                ],
                "type": "boolean"
              },
              "last_id": {
                "type": "null"
              },
              "lmgw": {
                "properties": {
                  "endpoints": {
                    "description": "Every path listed here exists in this API and carries the capability its own operation documents.",
                    "properties": {
                      "anthropic": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "openai": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "other": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "openai",
                      "anthropic",
                      "other"
                    ],
                    "type": "object"
                  },
                  "headers": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "notes": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "version": {
                    "type": "string"
                  }
                },
                "required": [
                  "version",
                  "endpoints",
                  "headers",
                  "notes"
                ],
                "type": "object"
              }
            },
            "required": [
              "data",
              "has_more",
              "lmgw"
            ],
            "type": "object"
          }
        ]
      },
      "ModelLogs": {
        "description": "One model, `logs`.",
        "properties": {
          "class": {
            "type": "string"
          },
          "container": {
            "description": "The container's name.",
            "type": "string"
          },
          "logs": {
            "description": "The container's recent output.",
            "type": "string"
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "tail": {
            "description": "How many lines were asked for.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "ok",
          "class",
          "model_id",
          "container",
          "tail",
          "logs"
        ],
        "type": "object"
      },
      "ModelStatus": {
        "description": "One model, `status`.",
        "properties": {
          "class": {
            "type": "string"
          },
          "enabled": {
            "description": "Null when no model with this id is configured.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "engine": {
            "description": "The engine the class runs: `llama-server`, `audio.cpp` or `sd-server`.",
            "type": "string"
          },
          "idle_seconds": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "image": {
            "description": "The container image in effect.",
            "type": [
              "string",
              "null"
            ]
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "runtime": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RuntimeStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "The running container, or null when nothing has started this model."
          },
          "warm_start": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "ok",
          "class",
          "model_id",
          "engine",
          "enabled",
          "warm_start",
          "idle_seconds",
          "image",
          "runtime"
        ],
        "type": "object"
      },
      "ModelTestFailed": {
        "description": "A chat, aux or image model that did not load or did not answer.",
        "properties": {
          "class": {
            "description": "`chat`, `aux` or `image`.",
            "enum": [
              "chat",
              "aux",
              "image"
            ],
            "type": "string"
          },
          "code": {
            "description": "The gateway's error code, when the model's start or the probe failed\nwith one of lmgw's own errors (`gpu_setup` when the model could not\nstart on the graphics card because of the computer,\n`vram_queue_timeout`, …), as the `/v1` routes answer it; absent when\nthe model answered with an error of its own, or with nothing usable.",
            "type": "string"
          },
          "container_log": {
            "description": "The lines of the model's container log that look like the reason.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "endpoint": {
            "description": "For an image model: the route the probe went to.",
            "type": "string"
          },
          "error": {
            "description": "What went wrong.",
            "type": "string"
          },
          "hint": {
            "description": "What to try.",
            "type": "string"
          },
          "latency_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "loaded": {
            "const": false,
            "description": "Always `false`.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "const": false,
            "description": "Always `false`.",
            "type": "boolean"
          },
          "probe": {
            "description": "What was sent: `generate`, `embed`, `rerank` or `image_generation`.",
            "type": "string"
          },
          "public_name": {
            "description": "For an image model: the name clients call it by.",
            "type": "string"
          }
        },
        "required": [
          "ok",
          "loaded",
          "model_id",
          "class",
          "probe",
          "latency_ms",
          "error",
          "container_log",
          "hint"
        ],
        "type": "object"
      },
      "ModelTestPassed": {
        "description": "An aux model that loaded and answered its probe; the first part of a\nchat model's pass.",
        "properties": {
          "answer": {
            "$ref": "#/components/schemas/DecideAnswer",
            "description": "For `decide`: the model's answer to the probe's `choice` question, as\nit gave it. The test does not judge the choice, only that the route\nanswered with one of the options and probabilities that sum to 1\n(decision-models design §3.7)."
          },
          "class": {
            "description": "`aux` for an aux model's pass, `chat` where this is the first part of\na chat model's.",
            "enum": [
              "chat",
              "aux"
            ],
            "type": "string"
          },
          "dimensions": {
            "description": "For `embed`: the embedding's length.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "input_tokens": {
            "description": "For `decide`: the input tokens the server reported for the question.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "latency_ms": {
            "description": "How long the load and the probe took, in milliseconds.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "loaded": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "model_id": {
            "type": "string"
          },
          "ok": {
            "const": true,
            "description": "Always `true`.",
            "type": "boolean"
          },
          "probe": {
            "description": "What was sent: `generate` (one token), `embed`, `rerank` or `decide`\n(one System One `choice` question on `/v1/systemone`).",
            "type": "string"
          },
          "scored": {
            "description": "For `rerank`: how many documents came back scored.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "ok",
          "loaded",
          "model_id",
          "class",
          "probe",
          "latency_ms"
        ],
        "type": "object"
      },
      "NewSource": {
        "properties": {
          "fence": {
            "default": [],
            "description": "Domains a fetch may touch. Empty derives the fence from the root's own\nhost, which is the safe default rather than \"anywhere\".",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "kind": {
            "description": "`llms_txt` | `markdown` | `rustdoc_json` | `html`.",
            "type": "string"
          },
          "root": {
            "type": "string"
          }
        },
        "required": [
          "root",
          "kind"
        ],
        "type": "object"
      },
      "NoulAnswer": {
        "properties": {
          "noul": {
            "description": "P(yes), from 0 (no) to 1 (yes).",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "noul"
        ],
        "type": "object"
      },
      "NoulCriteria": {
        "properties": {
          "false": {
            "description": "What a no means.",
            "type": [
              "string",
              "null"
            ]
          },
          "true": {
            "description": "What a yes means.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "NoulQuestion": {
        "properties": {
          "criteria": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NoulCriteria"
              },
              {
                "type": "null"
              }
            ],
            "description": "What a yes and a no mean, when the question alone does not say."
          },
          "instructions": {
            "description": "The yes/no question: a string, an object or an array."
          }
        },
        "required": [
          "instructions"
        ],
        "type": "object"
      },
      "ObjectCounts": {
        "properties": {
          "aliases": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "api_keys": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "local_models": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "mcp_servers": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "upstreams": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "upstreams",
          "aliases",
          "local_models",
          "mcp_servers",
          "api_keys"
        ],
        "type": "object"
      },
      "OngoingInput": {
        "additionalProperties": false,
        "description": "`ongoing` in a folder create or patch: an object marks the folder as one\nongoing conversation (its defaults must name a model), `null` ends that.",
        "properties": {
          "idle_minutes": {
            "description": "Minutes without a message after which a new thread starts; `0`: only\nwhen a client asks. A whole number of zero or more.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "idle_minutes"
        ],
        "type": "object"
      },
      "OpenAiError": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "description": "lmgw's own machine-readable error code (e.g. gpu_hold, gpu_benchmark, gpu_deferred, gpu_setup — a 503: the local model could not start on the graphics card, and the message says what on the computer lmgw runs on is not ready (fixed there, not by retrying), engine_download — a 502: the engine the local model runs in could not be downloaded, response_format_unsupported — the model or its upstream cannot produce the asked structured output type, invalid_json_schema — the upstream rejected the schema, its message kept, budget_unpriced — a budgeted caller's request on a cloud model with no price on file for what it is billed in, flex without a flex price among them), not the HTTP status.",
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "param": {
                "description": "The request field the error is about: response_format (chat completions, completions) or text.format (/v1/responses) for the codes response_format_unsupported and invalid_json_schema; null for every other error.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "description": "e.g. invalid_request_error, authentication_error, not_found_error, rate_limit_error, api_error.",
                "type": "string"
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "OpenAiModel": {
        "properties": {
          "capabilities": {
            "$ref": "#/components/schemas/ModelCapabilities"
          },
          "context_length": {
            "type": "integer"
          },
          "created": {
            "description": "Stable for the life of the gateway process rather than the time of each request; the catalog's own timestamp when it has one.",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "object": {
            "enum": [
              "model"
            ],
            "type": "string"
          },
          "owned_by": {
            "type": "string"
          },
          "pricing": {
            "properties": {
              "completion": {
                "type": "string"
              },
              "prompt": {
                "description": "USD per prompt token, as a decimal string; \"0\" for a local model.",
                "type": "string"
              }
            },
            "required": [
              "prompt",
              "completion"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "owned_by"
        ],
        "type": "object"
      },
      "OpenLink": {
        "description": "One open connection of a device.",
        "properties": {
          "call": {
            "description": "A voice link that is a WebRTC call (`POST /v1/realtime/calls`): the\ncall's id, as the status block's `webrtc.calls` lists it; `null` for\na WebSocket session and for the other kinds.",
            "type": [
              "string",
              "null"
            ]
          },
          "keepalive_s": {
            "description": "The keep-alive it asked for, in seconds: a feed's `keepalive_s`;\n`null` for the other kinds.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "peer": {
            "description": "The address it connected from (IP and port); `null` when lmgw did\nnot see one.",
            "type": [
              "string",
              "null"
            ]
          },
          "since": {
            "description": "When it opened (RFC 3339 UTC).",
            "type": "string"
          }
        },
        "required": [
          "since",
          "peer",
          "keepalive_s",
          "call"
        ],
        "type": "object"
      },
      "OpenLinks": {
        "description": "How many connections of one kind a device holds open.",
        "properties": {
          "count": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "description": "`feed`, `voice` or `tools`.",
            "type": "string"
          },
          "links": {
            "description": "Each of them, the oldest first (device link design §9.3): \"feed\n(keep-alive 120 s, since 09:00, from 192.0.2.2)\".",
            "items": {
              "$ref": "#/components/schemas/OpenLink"
            },
            "type": "array"
          }
        },
        "required": [
          "kind",
          "count",
          "links"
        ],
        "type": "object"
      },
      "OptionDraft": {
        "description": "One option of a `choice` question.",
        "properties": {
          "description": {
            "description": "What the option means; blank sends `null`.",
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "description"
        ],
        "type": "object"
      },
      "OptionDraftInput": {
        "description": "One option of a `choice` question.",
        "properties": {
          "description": {
            "default": "",
            "description": "What the option means; blank sends `null`.",
            "type": "string"
          },
          "name": {
            "default": "",
            "type": "string"
          }
        },
        "type": "object"
      },
      "OptionProbability": {
        "description": "One option of a `DecideAnswer` and its probability.",
        "properties": {
          "option": {
            "type": "string"
          },
          "probability": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "option",
          "probability"
        ],
        "type": "object"
      },
      "OrphanGguf": {
        "properties": {
          "gguf_path": {
            "type": "string"
          },
          "role_guess": {
            "description": "`weights | mmproj | drafter | imatrix`, guessed from the filename.\nOnly weights can be wired up as a model; the rest are companions a\nmodel's editor attaches (or leftovers). Empty from an older gateway.",
            "type": "string"
          },
          "suggested_id": {
            "description": "Model id the create flow proposes for it.",
            "type": "string"
          }
        },
        "required": [
          "gguf_path",
          "suggested_id",
          "role_guess"
        ],
        "type": "object"
      },
      "PairingTokenView": {
        "description": "A device's latest pairing token: when it lapses, and what became of it.",
        "properties": {
          "alive": {
            "description": "Whether it is alive now: not lapsed, not ended. A used token stays\nalive until then, for its own key's repeat.",
            "type": "boolean"
          },
          "created_at": {
            "description": "When it was minted and when it lapses, RFC 3339 UTC.",
            "type": "string"
          },
          "ended_at": {
            "description": "When the owner ended it (closing the QR card, a new token).",
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": "string"
          },
          "used_at": {
            "description": "When it was used, and from which address.",
            "type": [
              "string",
              "null"
            ]
          },
          "used_from": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "created_at",
          "expires_at",
          "used_at",
          "used_from",
          "ended_at",
          "alive"
        ],
        "type": "object"
      },
      "Params": {
        "description": "Alias-level request overrides.",
        "properties": {
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "max_tokens": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "min_p": {
            "description": "llama.cpp `min_p`; the llama.cpp and OpenAI-compatible egresses send it.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "reasoning": {
            "$ref": "#/components/schemas/ReasoningControl"
          },
          "repeat_penalty": {
            "description": "llama.cpp `repeat_penalty`; the llama.cpp and OpenAI-compatible egresses send it.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": "integer"
          },
          "stop": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "temperature": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "top_k": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "PassthroughUpstream": {
        "properties": {
          "hidden": {
            "description": "Bare (unprefixed) model ids hidden from `/v1/models` and the client\ncatalog for this upstream — still reachable directly by name, just\nnot advertised. `POST /api/op/model_visibility` toggles membership.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "prefix": {
            "type": "string"
          },
          "upstream": {
            "type": "string"
          }
        },
        "required": [
          "upstream",
          "id",
          "prefix",
          "hidden"
        ],
        "type": "object"
      },
      "PcmFormat": {
        "description": "The PCM a streamed answer carries, as the page assembles it into a WAV:\nthe stream itself states none of it. The strings the inputs hold.",
        "properties": {
          "bits": {
            "type": "string"
          },
          "channels": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          }
        },
        "required": [
          "rate",
          "channels",
          "bits"
        ],
        "type": "object"
      },
      "PcmFormatInput": {
        "description": "The PCM a streamed answer carries, as the page assembles it into a WAV:\nthe stream itself states none of it. The strings the inputs hold.",
        "properties": {
          "bits": {
            "default": "16",
            "type": "string"
          },
          "channels": {
            "default": "1",
            "type": "string"
          },
          "rate": {
            "default": "24000",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Phase": {
        "description": "One phase of a run, in suite order.",
        "oneOf": [
          {
            "enum": [
              "probes",
              "prefill",
              "decode",
              "concurrent",
              "mixed"
            ],
            "type": "string"
          },
          {
            "const": "load",
            "description": "`podman run` to a healthy server (the integration's, not the engine's).",
            "type": "string"
          }
        ]
      },
      "PhaseError": {
        "description": "A phase that ended with an error. The points measured before it are kept.",
        "properties": {
          "error": {
            "type": "string"
          },
          "phase": {
            "$ref": "#/components/schemas/Phase"
          }
        },
        "required": [
          "phase",
          "error"
        ],
        "type": "object"
      },
      "PhaseSpan": {
        "description": "A phase's band on the timeline.",
        "properties": {
          "end_ms": {
            "description": "`None` while the phase is still running.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "phase": {
            "$ref": "#/components/schemas/Phase"
          },
          "start_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "phase",
          "start_ms",
          "end_ms"
        ],
        "type": "object"
      },
      "PickRule": {
        "description": "Which of the pick's rules chose the file (design §3.2, D7).",
        "oneOf": [
          {
            "const": "whole_context",
            "description": "The largest file that fits the whole trained context.",
            "type": "string"
          },
          {
            "const": "shorter_context",
            "description": "No file fits the whole context: the largest that fits at least\n32 768 tokens, or the trained context when that is smaller.",
            "type": "string"
          },
          {
            "const": "none",
            "description": "No file of 4 to 8.5 bits per weight fits at least that much.",
            "type": "string"
          }
        ]
      },
      "PlanChange": {
        "description": "One field a plan would change on a configured row.",
        "properties": {
          "current": {
            "description": "The row's value now; null when unset."
          },
          "field": {
            "type": "string"
          },
          "planned": true,
          "why": {
            "description": "The plan's reason for the planned value; null when it gives none.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "field",
          "current",
          "planned",
          "why"
        ],
        "type": "object"
      },
      "PlanFile": {
        "description": "A file a step writes.",
        "properties": {
          "content": {
            "type": "string"
          },
          "key_fingerprint": {
            "description": "For an OpenPGP public key: its fingerprint, computed from `content`,\nin groups of four hex digits as people compare it\n(`C95B 321B … F796 ECB0`). Display only.",
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "description": "The mode root gives it (`0o644`, shown as `0644`); in the hash.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "path": {
            "type": "string"
          },
          "replaces": {
            "description": "lmgw's own older file replaced, rather than a new file created.",
            "type": "boolean"
          }
        },
        "required": [
          "path",
          "content",
          "mode",
          "replaces",
          "key_fingerprint"
        ],
        "type": "object"
      },
      "PlanFit": {
        "description": "A plan's fit on the card by both measures (design §9.1): what\n`local_model_plan` answers beside a chat or aux plan, from the disk or\nthe hub. An image plan has none yet.",
        "properties": {
          "beside": {
            "$ref": "#/components/schemas/FileFit"
          },
          "card": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CardMeasure"
              },
              {
                "type": "null"
              }
            ],
            "description": "The card both fits were measured against; `None` without one (D9)."
          },
          "whole_card": {
            "$ref": "#/components/schemas/FileFit"
          }
        },
        "required": [
          "card",
          "whole_card",
          "beside"
        ],
        "type": "object"
      },
      "PlanFrom": {
        "description": "Where a plan's input came from (design §2.3, §9.1).",
        "oneOf": [
          {
            "const": "disk",
            "description": "The files on disk in the class's models directory.",
            "type": "string"
          },
          {
            "const": "hub",
            "description": "The file's header read from Hugging Face before any download.",
            "type": "string"
          }
        ]
      },
      "PlanHow": {
        "description": "Where the plan is carried out.",
        "oneOf": [
          {
            "description": "The button in the app's window: one confirmation, one password.",
            "properties": {
              "kind": {
                "const": "helper",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "Commands to type in a terminal; `why` says why there is no button.\nWith no steps, `why` says what is in the way and what to do instead.",
            "properties": {
              "kind": {
                "const": "instructions",
                "type": "string"
              },
              "why": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "why"
            ],
            "type": "object"
          }
        ]
      },
      "PlanSource": {
        "description": "A plan's input, as the plan's answer names it.",
        "properties": {
          "commit": {
            "description": "The commit `main` resolved to when the header was read.",
            "type": [
              "string",
              "null"
            ]
          },
          "file": {
            "description": "The file's path in the repo, for a plan from the hub.",
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "$ref": "#/components/schemas/PlanFrom"
          },
          "header_bytes_read": {
            "description": "The header bytes this plan fetched from the hub, every file's (the\nweights' parts and the companions'); a header the process had read\nalready (cached by its hash) adds nothing (D123).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "oid": {
            "description": "The weights' content hash the hub named (`lfs.oid`).",
            "type": [
              "string",
              "null"
            ]
          },
          "repo": {
            "description": "The Hugging Face repo, for a plan from the hub.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "from",
          "repo",
          "file",
          "oid",
          "commit",
          "header_bytes_read"
        ],
        "type": "object"
      },
      "PlanStep": {
        "description": "One step.",
        "properties": {
          "commands": {
            "description": "The exact argv of each program it runs as root, in order.",
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array"
          },
          "download_bytes": {
            "description": "The download, when the user's package metadata can tell.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/PlanStepKind"
          },
          "package_scripts": {
            "description": "What the package the step installs then changes by itself, through\nits own install scripts, beyond the step's commands (machine-check\ndesign §4.5). For the fold: display only, never in the hash.",
            "type": [
              "string",
              "null"
            ]
          },
          "sentence": {
            "description": "The confirmation's bullet.",
            "type": "string"
          },
          "terminal": {
            "description": "The same step as lines to type in a terminal, with `sudo`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "writes_file": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PlanFile"
              },
              {
                "type": "null"
              }
            ],
            "description": "The file it writes, in full."
          }
        },
        "required": [
          "kind",
          "sentence",
          "commands",
          "writes_file",
          "download_bytes",
          "terminal",
          "package_scripts"
        ],
        "type": "object"
      },
      "PlanStepKind": {
        "description": "Which step.",
        "enum": [
          "s1_add_repo",
          "s1_enable_repo",
          "s2_add_key",
          "s4_install",
          "s4_update",
          "s4_swap"
        ],
        "type": "string"
      },
      "PlanUnset": {
        "description": "One setting a plan would clear on a configured chat row.",
        "properties": {
          "current": true,
          "field": {
            "type": "string"
          },
          "why": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "current",
          "why"
        ],
        "type": "object"
      },
      "PlannedProbe": {
        "description": "A probe the plan would run, or why it would not.",
        "properties": {
          "probe": {
            "$ref": "#/components/schemas/ProbeKind"
          },
          "skip": {
            "description": "`None`: it runs. Judged on the row's capabilities; the live server's\n`chat_template_caps` may still skip `tool_call` at run time.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "probe",
          "skip"
        ],
        "type": "object"
      },
      "PlayoutSource": {
        "description": "Where a call's playout allowance comes from (calls design §5.3).",
        "oneOf": [
          {
            "const": "report",
            "description": "The client's latest playout report (`lmgw.output_audio.playout`): the\nmeasured playout delay less half the round trip.",
            "type": "string"
          },
          {
            "const": "formula",
            "description": "One frame plus twice the client's interarrival jitter: before the\nfirst report, on an unbound call, and after reports stopped.",
            "type": "string"
          },
          {
            "const": "frame",
            "description": "One frame: no receiver report yet.",
            "type": "string"
          }
        ]
      },
      "PointPlan": {
        "description": "The points a run measures, derived from the live server's per-slot\ncontext and slot count — or, in `bench_plan`, provisionally from the row's\nown numbers.",
        "properties": {
          "concurrent": {
            "description": "Stream counts *N*, ascending; the last one is *N_slots*.",
            "items": {
              "format": "uint32",
              "minimum": 0,
              "type": "integer"
            },
            "type": "array"
          },
          "decode": {
            "description": "Context depths *D*, ascending; the last one is *D_max* = *S* − *G* − 1.",
            "items": {
              "format": "uint64",
              "minimum": 0,
              "type": "integer"
            },
            "type": "array"
          },
          "generate_tokens": {
            "description": "*G*.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "mixed": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MixedPlan"
              },
              {
                "type": "null"
              }
            ],
            "description": "`None` when the server has a single slot, or its context cannot hold\na decoding stream."
          },
          "n_slots": {
            "description": "*N_slots*.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "needle_tokens": {
            "description": "The needle probe's prompt length, *P_max* − 512; `None` when the\ncontext is too small to hold one.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "notes": {
            "description": "Why a phase has fewer points than usual, or none at all.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "per_slot_ctx": {
            "description": "*S*.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "prefill": {
            "description": "Prompt lengths *P*, ascending; the last one is *P_max* = *S* − 2.",
            "items": {
              "format": "uint64",
              "minimum": 0,
              "type": "integer"
            },
            "type": "array"
          },
          "provisional": {
            "description": "True when derived from the row's configuration rather than read from a\nrunning server (`bench_plan`).",
            "type": "boolean"
          },
          "repetitions": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "per_slot_ctx",
          "n_slots",
          "generate_tokens",
          "repetitions",
          "prefill",
          "decode",
          "concurrent",
          "mixed",
          "needle_tokens",
          "provisional",
          "notes"
        ],
        "type": "object"
      },
      "PrefillPoint": {
        "description": "One prefill point: `n_predict: 1`, `cache_prompt: false`.",
        "properties": {
          "energy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Energy"
              },
              {
                "type": "null"
              }
            ],
            "description": "Over the TTFT windows; tokens are the evaluated prompt tokens."
          },
          "energy_unmeasured": {
            "description": "Why `energy` is `None` although the card reports power: a window\nshorter than the GPU sampler resolves (two of its ticks, 200 ms at\nthe 100 ms tick), whose figure would have been the\nticks' average power times its length rather than a measurement.\n`None` otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "evaluated_tokens": {
            "$ref": "#/components/schemas/Stat",
            "description": "`timings.prompt_n`: what the server actually evaluated. Equal to *P*\nwhen the KV cache stayed out of it."
          },
          "prompt_ms": {
            "$ref": "#/components/schemas/Stat",
            "description": "Server-side `timings.prompt_ms`."
          },
          "prompt_tok_s": {
            "$ref": "#/components/schemas/Stat",
            "description": "Server-side `timings.prompt_per_second`."
          },
          "prompt_tokens": {
            "description": "*P*.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "ttft_ms": {
            "$ref": "#/components/schemas/Stat",
            "description": "Client-side: request sent → first streamed token."
          }
        },
        "required": [
          "prompt_tokens",
          "prompt_tok_s",
          "prompt_ms",
          "ttft_ms",
          "evaluated_tokens",
          "energy",
          "energy_unmeasured"
        ],
        "type": "object"
      },
      "PreviewMode": {
        "description": "How sd-server draws a running job's preview (design §5.2).",
        "enum": [
          "none",
          "proj",
          "tae",
          "vae"
        ],
        "type": "string"
      },
      "PreviewTokens": {
        "description": "The token counts of a preview, through the universal counter.",
        "properties": {
          "alias": {
            "type": "string"
          },
          "answered_by": {
            "description": "The alias that counted, when it was not `alias` (a fallback).",
            "type": [
              "string",
              "null"
            ]
          },
          "approx": {
            "description": "How the counts are approximate, as `x-lmgw-count-approximate` says\nit; empty when they are exact.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "static": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "text_turn": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "voice_turn": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "alias",
          "answered_by",
          "static",
          "text_turn",
          "voice_turn",
          "approx"
        ],
        "type": "object"
      },
      "PriceRowView": {
        "description": "One price sheet. `GET /api/usage/prices`",
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "price": {
            "description": "The rate of a unit other than tokens, per that unit's scale (per\nminute of input audio, per 1M input characters, per generated image,\nper answered request). `None` on a `per_mtok` row, whose rates are the\nfour above; those four are `None` on every other row.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_cache_read": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_cache_write": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_in": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_out": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "scope_key": {
            "type": "string"
          },
          "scope_kind": {
            "type": "string"
          },
          "service_tier": {
            "description": "The OpenAI service tier the row prices (`PriceTier`):\n`standard`, `flex`, `fast`, `ultrafast` or `scale`. `standard` on\nevery other provider's row and every catalog row; a request is priced\nwith the rows of the tier its answer reported, and a tier with no row\nleaves it unpriced.",
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "scope_kind",
          "scope_key",
          "unit",
          "price_in",
          "price_out",
          "price_cache_read",
          "price_cache_write",
          "source",
          "note",
          "updated_at",
          "price",
          "service_tier"
        ],
        "type": "object"
      },
      "ProbeChange": {
        "description": "One probe's outcome in both runs.",
        "properties": {
          "new": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProbeOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "old": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProbeOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "probe": {
            "$ref": "#/components/schemas/ProbeKind"
          },
          "verdict": {
            "$ref": "#/components/schemas/Verdict",
            "description": "A pass that became a fail or an error is a regression; the reverse an\nimprovement."
          }
        },
        "required": [
          "probe",
          "old",
          "new",
          "verdict"
        ],
        "type": "object"
      },
      "ProbeEvidence": {
        "description": "One response a probe judged.",
        "properties": {
          "body": {
            "description": "The raw body when it is not a chat completion: an error status's body,\n`/apply-template`'s rendered prompt.",
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "description": "`choices[0].message.content`.",
            "type": [
              "string",
              "null"
            ]
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning": {
            "description": "`choices[0].message.reasoning_content`.",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "The HTTP status; `None` when the request never got one.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "tool_calls": {
            "description": "`choices[0].message.tool_calls`, verbatim."
          }
        },
        "required": [
          "status",
          "content",
          "reasoning",
          "finish_reason",
          "tool_calls",
          "body",
          "ms"
        ],
        "type": "object"
      },
      "ProbeKind": {
        "description": "The behaviour probes.",
        "oneOf": [
          {
            "enum": [
              "chat",
              "thinking_off",
              "thinking_on",
              "tool_call",
              "json_schema",
              "deterministic",
              "vision",
              "reasoning_history"
            ],
            "type": "string"
          },
          {
            "const": "needle",
            "description": "Always last: it is the one probe with a full-context prefill.",
            "type": "string"
          }
        ]
      },
      "ProbeOutcome": {
        "description": "How a probe ended.",
        "oneOf": [
          {
            "enum": [
              "pass",
              "fail"
            ],
            "type": "string"
          },
          {
            "const": "info",
            "description": "An observation, not a verdict (`reasoning_history`).",
            "type": "string"
          },
          {
            "const": "skipped",
            "description": "Not applicable to this model; `detail` says why.",
            "type": "string"
          },
          {
            "const": "error",
            "description": "The server answered with an error status, or not at all.",
            "type": "string"
          }
        ]
      },
      "ProbeReport": {
        "description": "The probe results stored with a run.",
        "properties": {
          "probes": {
            "items": {
              "$ref": "#/components/schemas/ProbeResult"
            },
            "type": "array"
          }
        },
        "required": [
          "probes"
        ],
        "type": "object"
      },
      "ProbeResult": {
        "description": "One probe's result.",
        "properties": {
          "detail": {
            "description": "One line: what passed or failed, the skip reason, or the error.",
            "type": "string"
          },
          "evidence": {
            "description": "The responses judged — one, or four for `deterministic` (the cached\npair, then the no-cache pair).",
            "items": {
              "$ref": "#/components/schemas/ProbeEvidence"
            },
            "type": "array"
          },
          "outcome": {
            "$ref": "#/components/schemas/ProbeOutcome"
          },
          "probe": {
            "$ref": "#/components/schemas/ProbeKind"
          }
        },
        "required": [
          "probe",
          "outcome",
          "detail",
          "evidence"
        ],
        "type": "object"
      },
      "Profile": {
        "description": "A profile as `GET /chat/api/profiles` lists it.",
        "properties": {
          "builtin": {
            "description": "The built-in profile this row is (`concise`); `null` for one of the\nowner's own. Read only.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "examples": {
            "description": "Static example exchanges, in order.",
            "items": {
              "$ref": "#/components/schemas/Example"
            },
            "type": "array"
          },
          "follows_builtin": {
            "description": "The fields a built-in row takes from the built-in text, so they\nfollow its improvements. Read only.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "length_rule": {
            "description": "How long replies are; empty for none.",
            "type": "string"
          },
          "name": {
            "description": "Unique in any case; never `default`.",
            "type": "string"
          },
          "persona": {
            "description": "Who the model is and how it sounds; empty for none. When set, it\ntakes the thread's system prompt's place.",
            "type": "string"
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Reasoning"
              },
              {
                "type": "null"
              }
            ],
            "description": "Reasoning on or off; `null` inherits."
          },
          "updated_at": {
            "type": "string"
          },
          "used_by": {
            "$ref": "#/components/schemas/UsedBy"
          },
          "voice": {
            "$ref": "#/components/schemas/ProfileVoice"
          },
          "voice_block": {
            "description": "The voice turn's block: `null` for the generic one, `\"\"` for none, a\ntext to use as it is.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "builtin",
          "persona",
          "length_rule",
          "examples",
          "voice_block",
          "reasoning",
          "voice",
          "follows_builtin",
          "used_by",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "ProfileChoice": {
        "anyOf": [
          {
            "format": "int64",
            "type": "integer"
          },
          {
            "type": "string"
          }
        ],
        "description": "`chat_profile` as a settings patch writes it (design §3.3): a profile\nid, as a number or as a numeric text, or `\"\"` for none."
      },
      "ProfileDraft": {
        "additionalProperties": false,
        "description": "A profile's content fields, with nothing saved: what Preview, Test and\nSpeak take, and what a create fills in.",
        "properties": {
          "examples": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/Example"
            },
            "type": "array"
          },
          "length_rule": {
            "default": "",
            "type": "string"
          },
          "persona": {
            "default": "",
            "type": "string"
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Reasoning"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "voice": {
            "$ref": "#/components/schemas/ProfileVoiceInput",
            "default": {
              "speech_style": null,
              "tts_alias": null,
              "voice": null
            }
          },
          "voice_block": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ProfileVoice": {
        "additionalProperties": false,
        "description": "The speech part of a profile: the subset of a thread's voice settings a\nprofile carries, with the same checks and meanings. Each `null` inherits.",
        "properties": {
          "speech_style": {
            "description": "The speaking style the text-to-speech model is given; an empty text\nis none.",
            "type": [
              "string",
              "null"
            ]
          },
          "tts_alias": {
            "description": "The text-to-speech alias (task `tts` or `vdes`).",
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "description": "A voice of that text-to-speech model, or of the Chat's own when\n`tts_alias` is `null`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tts_alias",
          "voice",
          "speech_style"
        ],
        "type": "object"
      },
      "ProfileVoiceInput": {
        "additionalProperties": false,
        "description": "The speech part of a profile: the subset of a thread's voice settings a\nprofile carries, with the same checks and meanings. Each `null` inherits.",
        "properties": {
          "speech_style": {
            "default": null,
            "description": "The speaking style the text-to-speech model is given; an empty text\nis none.",
            "type": [
              "string",
              "null"
            ]
          },
          "tts_alias": {
            "default": null,
            "description": "The text-to-speech alias (task `tts` or `vdes`).",
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "default": null,
            "description": "A voice of that text-to-speech model, or of the Chat's own when\n`tts_alias` is `null`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "PromptStyle": {
        "description": "How an image model wants its prompt written (design §3.4).",
        "oneOf": [
          {
            "const": "natural",
            "description": "Plain sentences: FLUX, Z-Image, Qwen-Image, SD 3.5 and the like.",
            "type": "string"
          },
          {
            "const": "keywords",
            "description": "Short comma-separated phrases: SDXL base.",
            "type": "string"
          },
          {
            "const": "tags",
            "description": "Booru-style tags: the anime fine-tunes.",
            "type": "string"
          }
        ]
      },
      "QuestionDraft": {
        "description": "One question as the form holds it.",
        "properties": {
          "id": {
            "description": "The key the answer comes back under.",
            "type": "string"
          },
          "instructions": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/DecisionQuestionKind"
          }
        },
        "required": [
          "id",
          "instructions",
          "kind"
        ],
        "type": "object"
      },
      "QuestionDraftInput": {
        "description": "One question as the form holds it.",
        "properties": {
          "id": {
            "default": "",
            "description": "The key the answer comes back under.",
            "type": "string"
          },
          "instructions": {
            "default": "",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/DecisionQuestionKindInput",
            "default": {
              "options": [],
              "type": "choice"
            }
          }
        },
        "type": "object"
      },
      "QuestionMetrics": {
        "description": "One question's metrics.",
        "properties": {
          "accuracy": {
            "description": "The share of `scored` answered correctly: the winner (`choice`),\nP(yes) ≥ 0.5 (`noul`), the nearest level (`score`) equal to the\nlabel; `null` when nothing is scored.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "answered": {
            "description": "Items whose run answered this question.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "classes": {
            "description": "The classes in matrix order, spelled as labels are kept: the options'\nnames, the levels' indices from `\"0\"`, or `yes` and `no`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "confusion": {
            "description": "Rows the labels, columns the predictions, both in `classes` order.",
            "items": {
              "items": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "type": "array"
            },
            "type": "array"
          },
          "curve": {
            "description": "One point per distinct confidence (`choice`, `score`) or certainty,\nmax(p, 1 − p) (`noul`), lowest first.",
            "items": {
              "$ref": "#/components/schemas/CurvePoint"
            },
            "type": "array"
          },
          "failed": {
            "description": "Items whose run is no 2xx.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "items": {
            "description": "Items in the run.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "labelled": {
            "description": "Items with an expected answer for this question.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "mae": {
            "description": "`score` only: the mean absolute distance, in levels, between the\nexpected level (the fractional `score`) and the label.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "reliability": {
            "description": "The non-empty ones of `bins` equal-width bins over the predicted\nprobability, lowest first: the winner's (`choice`), the nearest\nlevel's (`score`), P(yes) (`noul`). Labelled answers only.",
            "items": {
              "$ref": "#/components/schemas/ReliabilityBin"
            },
            "type": "array"
          },
          "scored": {
            "description": "Items both answered and labelled: what `accuracy` is over.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "type": {
            "description": "`choice`, `score` or `noul`.",
            "type": "string"
          },
          "unreadable": {
            "description": "Items whose run is a 2xx without a readable answer to this question\n(none of its type, a winner the question does not offer, the nearest\nlevel's probability missing).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "type",
          "classes",
          "items",
          "answered",
          "failed",
          "unreadable",
          "labelled",
          "scored",
          "accuracy",
          "mae",
          "confusion",
          "reliability",
          "curve"
        ],
        "type": "object"
      },
      "QuestionSet": {
        "description": "A saved list of questions.",
        "properties": {
          "default_model": {
            "description": "The model loading the set picks; blank picks none.",
            "type": "string"
          },
          "questions": {
            "description": "In the order asked.",
            "items": {
              "$ref": "#/components/schemas/QuestionDraft"
            },
            "type": "array"
          },
          "thresholds": {
            "additionalProperties": {
              "$ref": "#/components/schemas/Threshold"
            },
            "description": "Per question id; a question with none has 0, not measured.",
            "type": "object"
          }
        },
        "required": [
          "questions",
          "default_model",
          "thresholds"
        ],
        "type": "object"
      },
      "QuestionSetInput": {
        "description": "A saved list of questions.",
        "properties": {
          "default_model": {
            "default": "",
            "description": "The model loading the set picks; blank picks none.",
            "type": "string"
          },
          "questions": {
            "default": [],
            "description": "In the order asked.",
            "items": {
              "$ref": "#/components/schemas/QuestionDraftInput"
            },
            "type": "array"
          },
          "thresholds": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ThresholdInput"
            },
            "default": {},
            "description": "Per question id; a question with none has 0, not measured.",
            "type": "object"
          }
        },
        "type": "object"
      },
      "QuestionTokens": {
        "description": "One question's tokens.",
        "properties": {
          "id": {
            "type": "string"
          },
          "option_span": {
            "description": "A `choice` question's options alone; `null` for the other types.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "tokens": {
            "description": "Its instructions and its options, levels or criteria.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "tokens",
          "option_span"
        ],
        "type": "object"
      },
      "QueuedDownload": {
        "properties": {
          "dest_path": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "file",
          "dest_path",
          "status"
        ],
        "type": "object"
      },
      "RateLimit": {
        "description": "The forge API's remaining quota. Without a token GitHub allows 60 requests\nan hour; when the limit is hit, the extras picker shows the reset time\ninstead of an empty list.",
        "properties": {
          "remaining": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "reset_at": {
            "type": "string"
          }
        },
        "required": [
          "remaining",
          "reset_at"
        ],
        "type": "object"
      },
      "RateSource": {
        "description": "Where a download time's rate came from (D23).",
        "oneOf": [
          {
            "const": "downloads",
            "description": "This machine's finished Hugging Face downloads, weighted by bytes.",
            "type": "string"
          },
          {
            "const": "header_reads",
            "description": "The header reads made for this answer, from the same CDN.",
            "type": "string"
          },
          {
            "const": "none",
            "description": "Nothing measured yet: no time is given.",
            "type": "string"
          }
        ]
      },
      "RealtimeAvailability": {
        "description": "Whether voice mode may bind the thread.",
        "properties": {
          "admin_tools": {
            "description": "The thread carries lmgw's admin tools while the self-admin level is\n`full`: its tools can change lmgw. Shown, never a refusal.",
            "type": "boolean"
          },
          "code": {
            "description": "The refusal's code, the one the bind answers with\n(`chat_thread_admin`); `null` when `ok`.",
            "type": [
              "string",
              "null"
            ]
          },
          "ok": {
            "type": "boolean"
          },
          "reason": {
            "description": "The refusal in words; `null` when `ok`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ok",
          "code",
          "reason",
          "admin_tools"
        ],
        "type": "object"
      },
      "RealtimeBudgetStage": {
        "description": "One stage of the cascade and what it is expected to hold on the GPU.",
        "properties": {
          "alias": {
            "description": "The alias the stage runs on; `None` for turn detection and for a\nstage nothing is configured for.",
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "description": "The expected footprint; `None` = unknown, and the total is then a\nlower bound.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "label": {
            "description": "The stage in words.",
            "type": "string"
          },
          "model": {
            "description": "The local model, as `<class>/<model id>`.",
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "description": "Where the figure comes from, or why there is none.",
            "type": "string"
          },
          "placement": {
            "description": "`local` (a model lmgw runs on this GPU) | `cloud` | `external` (a\nserver lmgw does not manage) | `cpu` | `shared` (the same local model\nas an earlier stage, counted once) | `unset` | `unresolved`.",
            "type": "string"
          },
          "running": {
            "description": "Its container is up now.",
            "type": "boolean"
          },
          "stage": {
            "description": "`turn` | `chat` | `asr` | `check` | `tts`.",
            "type": "string"
          }
        },
        "required": [
          "stage",
          "label",
          "alias",
          "placement",
          "model",
          "running",
          "bytes",
          "note"
        ],
        "type": "object"
      },
      "RealtimeSettings": {
        "description": "The realtime settings, with `default_instructions` spelled\nout the way the Chat's default system prompt is: the text in force, the\nbuilt-in text beside it, and whether the setting is unset.",
        "properties": {
          "asr_alias": {
            "description": "The speech-to-text alias turns are transcribed with; empty =\nthe Chat's transcription model.",
            "type": "string"
          },
          "backchannel_words": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "barge_in_check": {
            "description": "`words` | `duration`.",
            "type": "string"
          },
          "barge_in_check_alias": {
            "description": "Empty = the session's own ASR alias.",
            "type": "string"
          },
          "barge_in_check_scripts": {
            "description": "Unicode script names; empty = every script.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "barge_in_check_timeout_ms": {
            "description": "`0` = no bound.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "barge_in_guard_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "barge_in_min_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "default_instructions": {
            "description": "The instructions a session with audio output uses while the client\ngives none: the configured text, `\"\"` for none, or the built-in text\nwhile the setting is unset.",
            "type": "string"
          },
          "default_instructions_builtin": {
            "description": "The built-in voice-assistant prompt — what saving\n`default_instructions` as this text returns to.",
            "type": "string"
          },
          "default_instructions_is_builtin": {
            "description": "The setting is unset, so it follows the built-in text across\nreleases.",
            "type": "boolean"
          },
          "default_model": {
            "description": "The chat alias a session starts on; empty = none.",
            "type": "string"
          },
          "default_voice": {
            "description": "The voice a session speaks with when it names none or an OpenAI\nbuilt-in voice; empty = the TTS row's default preset.",
            "type": "string"
          },
          "echo_tail_ms": {
            "description": "The barge-in margin's tail on top of the round trip, in ms: the round\ntrip from pings on a WebSocket, from RTCP receiver reports on a\nWebRTC call.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "half_duplex": {
            "type": "boolean"
          },
          "longest_pause_ms": {
            "description": "`0` = keep the engine's silences.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "max_frame_mb": {
            "description": "In MiB; `0` = bounded by the message limit (not both). WebSocket\nonly: a WebRTC call's single message is bounded by its stack, 256 KiB.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "max_message_mb": {
            "description": "In MiB; `0` = no bound (not both). The largest WebSocket message; on\na WebRTC call also the largest event lmgw sends in one message and\nwhat may wait for the call's session.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "model_map": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Client model names mapped to lmgw aliases.",
            "type": "object"
          },
          "output_lead_ms": {
            "description": "How far a WebSocket session's audio runs ahead of real time, in ms;\nnot used on a WebRTC call, whose frame clock sends in real time.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "ping_interval_s": {
            "description": "`0` = no pings and no liveness bound at all. On a WebRTC call also how\nlong it may stay silent, take to connect and open its events channel,\nor wait on a held thread, how long a closing call waits for its last\nevent's delivery, and when playout reports count as stopped.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "post_interrupt_silence_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "prefix_padding_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "semantic_floor_window_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "semantic_vad": {
            "$ref": "#/components/schemas/SemanticVadTable"
          },
          "semantic_vad_engine": {
            "description": "`smart_turn` | `server_vad` (the escape hatch).",
            "type": "string"
          },
          "silence_duration_ms": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "speech_instructions": {
            "description": "The speech instructions a session's TTS gets while the client sends\nnone: a speaking style, or a voice-design row's description;\nempty = none.",
            "type": "string"
          },
          "synthesis_ahead_s": {
            "description": "`0` = no bound.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "tag_hint": {
            "description": "An audio response's prompt says what square brackets do for the TTS:\nthe sounds it can make, or the delivery cues it takes.",
            "type": "boolean"
          },
          "threshold": {
            "description": "`server_vad.threshold`, `0.0..=1.0`.",
            "format": "double",
            "type": "number"
          },
          "tts_alias": {
            "description": "The text-to-speech alias a session speaks with; empty = none.\nIts task is `tts` or `vdes`.",
            "type": "string"
          },
          "voice_map": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Client voice names mapped to voices of the TTS model.",
            "type": "object"
          },
          "warm_on_connect": {
            "type": "boolean"
          },
          "webrtc_commit_window_ms": {
            "description": "How far past its stamp a push-to-talk commit on a WebRTC call takes\nframes, and how long it waits for them, in ms. Applies to the next\ncall.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "webrtc_enabled": {
            "description": "The UDP listener for WebRTC calls, beside the HTTP listener and\nbeside the device listener (its sockets follow that one's addresses\nand port); applies at the next start.",
            "type": "boolean"
          },
          "webrtc_output_kbps": {
            "description": "A WebRTC call's Opus output bitrate in kbps, capped by the phone's\n`maxaveragebitrate`. Applies to the next call.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "webrtc_port": {
            "description": "The UDP port WebRTC calls use beside the HTTP listener: `null` =\nthe HTTP port's number, `0` = chosen by the OS. Calls over a paired\ndevice's listener use that listener's port instead. Applies at the\nnext start.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "webrtc_reorder_ms": {
            "description": "How long a WebRTC call's frame waits for a missing earlier one, in\nms; `0` = no wait. Applies to the next call.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "default_model",
          "model_map",
          "asr_alias",
          "tts_alias",
          "default_voice",
          "voice_map",
          "speech_instructions",
          "tag_hint",
          "default_instructions",
          "default_instructions_builtin",
          "default_instructions_is_builtin",
          "threshold",
          "prefix_padding_ms",
          "silence_duration_ms",
          "semantic_vad_engine",
          "semantic_vad",
          "semantic_floor_window_ms",
          "post_interrupt_silence_ms",
          "barge_in_min_ms",
          "barge_in_guard_ms",
          "half_duplex",
          "echo_tail_ms",
          "barge_in_check",
          "backchannel_words",
          "barge_in_check_scripts",
          "barge_in_check_timeout_ms",
          "barge_in_check_alias",
          "output_lead_ms",
          "synthesis_ahead_s",
          "longest_pause_ms",
          "warm_on_connect",
          "max_message_mb",
          "max_frame_mb",
          "ping_interval_s",
          "webrtc_enabled",
          "webrtc_port",
          "webrtc_reorder_ms",
          "webrtc_commit_window_ms",
          "webrtc_output_kbps"
        ],
        "type": "object"
      },
      "RealtimeSettingsPatch": {
        "additionalProperties": false,
        "description": "Sparse patch over `RealtimeSettings`: a field left out keeps its value.\nThe two maps and the two lists are replaced whole, like a class's\n`extra_run_args`.",
        "properties": {
          "asr_alias": {
            "default": null,
            "description": "The speech-to-text alias turns are transcribed with; `\"\"` = the\nChat's transcription model. Must be an alias whose task is `asr`.",
            "type": [
              "string",
              "null"
            ]
          },
          "backchannel_words": {
            "default": null,
            "description": "Replaces the whole list.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "barge_in_check": {
            "default": null,
            "description": "`words` | `duration`.",
            "type": [
              "string",
              "null"
            ]
          },
          "barge_in_check_alias": {
            "default": null,
            "description": "The ASR alias the word check transcribes with; `\"\"` = the session's\nown ASR alias. Must be an alias whose task is `asr`.",
            "type": [
              "string",
              "null"
            ]
          },
          "barge_in_check_scripts": {
            "default": null,
            "description": "Unicode script names (Latin, Cyrillic, Han, …); `[]` = every script.\nReplaces the whole list.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "barge_in_check_timeout_ms": {
            "default": null,
            "description": "`0` = no bound.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "barge_in_guard_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "barge_in_min_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "default_instructions": {
            "default": null,
            "description": "The instructions a session with audio output uses while the client\ngives none. The built-in text returns to the built-in default (and\nfollows it from then on); `\"\"` = none.",
            "type": [
              "string",
              "null"
            ]
          },
          "default_model": {
            "default": null,
            "description": "The chat alias a session starts on when the client names none, or\nnames an OpenAI Realtime model; `\"\"` = none. Must be a chat alias.",
            "type": [
              "string",
              "null"
            ]
          },
          "default_voice": {
            "default": null,
            "description": "The voice a session speaks with when it names none, or names an\nOpenAI built-in voice; `\"\"` = the TTS row's default preset.",
            "type": [
              "string",
              "null"
            ]
          },
          "echo_tail_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "half_duplex": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "longest_pause_ms": {
            "default": null,
            "description": "The longest silence in synthesized speech, in ms; `0` = keep the\nengine's silences.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "max_frame_mb": {
            "default": null,
            "description": "In MiB; `0` = bounded by `max_message_mb`. Not `0` together with it.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "max_message_mb": {
            "default": null,
            "description": "In MiB; `0` = no bound. Not `0` together with `max_frame_mb`. The\nlargest WebSocket message a client sends; on a WebRTC call also the\nlargest event lmgw sends in one message and what may wait for the\ncall's session before the call ends.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "model_map": {
            "additionalProperties": {
              "type": "string"
            },
            "default": null,
            "description": "Client model names mapped to lmgw aliases — `session.model` to a chat\nalias, a transcription model to an ASR alias. Replaces the whole map.",
            "type": [
              "object",
              "null"
            ]
          },
          "output_lead_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "ping_interval_s": {
            "default": null,
            "description": "`0` = no pings, and no liveness bound at all.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "post_interrupt_silence_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "prefix_padding_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "semantic_floor_window_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "semantic_vad": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SemanticVadTablePatch"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Smart Turn rows by eagerness; a row or field left out keeps its\nvalue."
          },
          "semantic_vad_engine": {
            "default": null,
            "description": "`smart_turn` | `server_vad`.",
            "type": [
              "string",
              "null"
            ]
          },
          "silence_duration_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "speech_instructions": {
            "default": null,
            "description": "The speech instructions a session's TTS gets while the client sends\nnone: a speaking style, or a voice-design row's description. `\"\"` =\nnone.",
            "type": [
              "string",
              "null"
            ]
          },
          "synthesis_ahead_s": {
            "default": null,
            "description": "`0` = no bound.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "tag_hint": {
            "default": null,
            "description": "Whether an audio response's prompt names the sounds the TTS can make.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "threshold": {
            "default": null,
            "description": "`server_vad.threshold`: the speech probability that counts as voice,\n`0.0..=1.0`.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "tts_alias": {
            "default": null,
            "description": "The text-to-speech alias a session speaks with; `\"\"` = none. Must be\nan alias whose task is `tts`, or `vdes` (a voice designed from the\nspeech instructions).",
            "type": [
              "string",
              "null"
            ]
          },
          "voice_map": {
            "additionalProperties": {
              "type": "string"
            },
            "default": null,
            "description": "Client voice names mapped to voices of the TTS model. Replaces the\nwhole map.",
            "type": [
              "object",
              "null"
            ]
          },
          "warm_on_connect": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "webrtc_commit_window_ms": {
            "default": null,
            "description": "How far past its own stamp a push-to-talk commit on a WebRTC call\ntakes frames, and how long it waits for them, in ms. Applies to the\nnext call.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "webrtc_enabled": {
            "default": null,
            "description": "The UDP listener for WebRTC calls (`POST /v1/realtime/calls`),\nbeside the HTTP listener and beside the device listener, whose\naddresses and port its sockets follow; off, a call on either is\nrefused 503. Applies at the next start.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "webrtc_output_kbps": {
            "default": null,
            "description": "A WebRTC call's Opus output bitrate in kbps, 6 to 510, capped by the\nphone's maxaveragebitrate. Applies to the next call.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "webrtc_port": {
            "default": null,
            "description": "The UDP port WebRTC calls use beside the HTTP listener: `null` = the\nHTTP port's number, `0` = chosen by the OS, else 1 to 65535. Calls\nover a paired device's listener use that listener's port instead.\nApplies at the next start.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "webrtc_reorder_ms": {
            "default": null,
            "description": "How long a WebRTC call's frame waits for a missing earlier one, in\nms; `0` = no wait, the gap concealed at once. At most 40 950 (what\nstr0m can hold behind a gap). Applies to the next call.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "Reasoning": {
        "description": "A profile's reasoning switch; `null` where it is used inherits (the\nthread's own fields win over it, the route's default comes after it).",
        "enum": [
          "on",
          "off"
        ],
        "type": "string"
      },
      "ReasoningCaps": {
        "additionalProperties": false,
        "description": "Reasoning / thinking support and how a request controls it.",
        "properties": {
          "budget_tokens": {
            "description": "The configured default thinking-token budget, when set and non-zero\n(a zero budget is published as `enabled: false`, not as a budget).",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "can_disable": {
            "description": "Whether a request can switch thinking off entirely. On an Anthropic\nroute: the catalog's `thinking.types.disabled.supported`.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "control": {
            "description": "The exact header and body fields that work on this route; omitted when\nempty (nothing to control on a `fixed` model).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "default": {
            "description": "The effort in force when the request sets none.",
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "description": "The default state as this alias is configured. Absent when no source\nstates it — \"the catalog says the model supports reasoning\" does not\nsay whether it is on.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "kind": {
            "description": "`fixed` (nothing to change per request), `toggle` (on/off per\nrequest), `levels` (effort selectable per request).",
            "type": "string"
          },
          "levels": {
            "description": "Accepted effort values, least → most in the canonical order. Only for\n`kind == \"levels\"`; omitted entirely when empty.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "preserve_history": {
            "description": "Whether replayed reasoning of earlier turns reaches the model again.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "thinking_types": {
            "description": "The Messages `thinking` types the model takes, as an Anthropic\nupstream's catalog publishes them (`capabilities.thinking.types`), in\nAnthropic's order: `adaptive`, `between_tools`, `disabled`, `enabled`\n(the budget form). Only on an Anthropic route; omitted when the\ncatalog names none of them as supported.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "ReasoningControl": {
        "description": "Per-request reasoning control: on/off, effort level, thinking-token budget.",
        "properties": {
          "budget_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "effort": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "RefEntry": {
        "description": "One branch or tag as `git ls-remote` reports it.",
        "properties": {
          "name": {
            "type": "string"
          },
          "sha": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "sha"
        ],
        "type": "object"
      },
      "RegistryUpdate": {
        "description": "A registry image's update state: the digest the registry serves for\nthe tag now, against the digests podman recorded when the image was\npulled. Checked anonymously (the registry's bearer-token flow), by the same\nschedule and **Check now** as the builds.\n\nA multi-arch tag is an index: the registry answers with the index digest,\nand podman's `RepoDigests` for such a pull normally carries it too. When it\ncarries only the platform manifest's digest instead, the index is read and\nits members compared, so that case is not mistaken for an update.",
        "properties": {
          "checked_at": {
            "description": "When the registry was asked (RFC 3339).",
            "type": "string"
          },
          "error": {
            "description": "Why the comparison could not be made: the registry did not answer, it\nwants credentials, it rate-limited the check, or podman recorded no\ndigest to compare with (an image built or loaded here, not pulled).",
            "type": [
              "string",
              "null"
            ]
          },
          "local_digests": {
            "description": "The `sha256:…` digests podman recorded for this repository on the\nlocal image, right now.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "reference": {
            "description": "The fully qualified reference that was checked\n(`ghcr.io/0xshug0/audio.cpp:full-cuda12`) — what **Pull update**\n(`container_image_pull`) pulls.",
            "type": "string"
          },
          "remote_digest": {
            "description": "`sha256:…` the registry serves for the tag; `None` when it could not\nbe asked (see `error`).",
            "type": [
              "string",
              "null"
            ]
          },
          "update_available": {
            "description": "The registry serves something the local image is not.",
            "type": "boolean"
          }
        },
        "required": [
          "checked_at",
          "reference",
          "remote_digest",
          "local_digests",
          "update_available",
          "error"
        ],
        "type": "object"
      },
      "ReliabilityBin": {
        "description": "One reliability bin that holds an answer: the labelled answers whose\npredicted probability falls in `[lower, upper)` (the last bin includes\n1). `lower` is `index / bins` and `upper` `(index + 1) / bins`, the very\nvalues an answer is placed by. A bin the list skips holds none.",
        "properties": {
          "count": {
            "description": "At least 1.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "index": {
            "description": "Its place among `bins`, from 0.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "lower": {
            "format": "double",
            "type": "number"
          },
          "mean_prediction": {
            "description": "The mean predicted probability.",
            "format": "double",
            "type": "number"
          },
          "observed": {
            "description": "The observed rate of what was predicted: the share whose winner\n(`choice`) or nearest level (`score`) is the label; for `noul`, the\nshare labelled yes (the bins sort by P(yes)).",
            "format": "double",
            "type": "number"
          },
          "upper": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "index",
          "lower",
          "upper",
          "count",
          "mean_prediction",
          "observed"
        ],
        "type": "object"
      },
      "RepoFile": {
        "properties": {
          "estimated_from": {
            "description": "The file whose header this file's fit was estimated from (§3.3):\nnever smaller than the real use, so its \"fits\" is true, but its width\nisn't known and it is never the recommended file. `None` when the\nfile's own header was read, or it is marked by its size alone.",
            "type": [
              "string",
              "null"
            ]
          },
          "file": {
            "type": "string"
          },
          "fit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PlanFit"
              },
              {
                "type": "null"
              }
            ],
            "description": "With `fit`, for a `weights` file of the chat or aux class: its fit on\nthe graphics card by both measures (find-a-model design §3.3), what\n`local_model_plan` with `repo` + `file` answers as its `fit`, less\nwhat the list says once (D63): `card` is `None` where it is the\nlist's `card`, and the notes leave out the list's `fit_notes`.\n`None` without `fit` and for the other roles."
          },
          "parts": {
            "description": ">1 = split GGUF; selecting it downloads all parts.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "quant": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "description": "Filename heuristic, in the vocabulary of the target that was listed:\n`weights | mmproj | drafter | other` for chat/aux/audio, and\n`diffusion | checkpoint | vae | text_encoder | lora | upscaler | other`\nfor `image`. A string, not an enum, on\nboth sides of the wire — the image roles are guesses the editor lets\nthe user override, and a new one must not break an old client.",
            "type": "string"
          },
          "size": {
            "description": "Human-formatted size, server-rendered.",
            "type": "string"
          },
          "size_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "file",
          "role",
          "quant",
          "parts",
          "size_bytes",
          "size",
          "fit",
          "estimated_from"
        ],
        "type": "object"
      },
      "RepoFit": {
        "description": "What `GET /api/hf/repo`'s `fit` asks for (find-a-model design §3.3, D68).",
        "oneOf": [
          {
            "const": "false",
            "description": "No marks, and no header read.",
            "type": "string"
          },
          {
            "const": "true",
            "description": "Marks from the files' headers, read on a metered connection too: the\ncaller asked for them (D59).",
            "type": "string"
          },
          {
            "const": "unless_metered",
            "description": "Marks from the headers unless the connection is metered; then every\nmark is by size and `metered` says why (D123): what the dashboard\nasks by itself.",
            "type": "string"
          }
        ]
      },
      "RepoPicks": {
        "description": "The file a repo's list recommends by each measure (find-a-model design\n§3.2, D120).",
        "properties": {
          "beside": {
            "$ref": "#/components/schemas/FilePick"
          },
          "whole_card": {
            "$ref": "#/components/schemas/FilePick"
          }
        },
        "required": [
          "whole_card",
          "beside"
        ],
        "type": "object"
      },
      "RepoPreset": {
        "description": "One entry of the build editor's repository picker: a preset source repository for a\nbuild.",
        "properties": {
          "default_ref": {
            "description": "The default branch — what a new build's `ref` starts as.",
            "type": "string"
          },
          "engine": {
            "$ref": "#/components/schemas/Engine"
          },
          "forge": {
            "$ref": "#/components/schemas/Forge"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "repo_url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "engine",
          "repo_url",
          "forge",
          "default_ref"
        ],
        "type": "object"
      },
      "RequestRow": {
        "description": "One request's summary — the `request` SSE frame and the\nrow shape of `GET /api/logs` (log rows additionally carry `mcp_tool` and\n`pricing`).",
        "properties": {
          "audio_in_ms": {
            "description": "What the request processed besides tokens, each only when it was\nmeasured or the provider reported it: input audio in milliseconds,\ninput characters as sent, generated images. `None` = not measured,\nwhich is not the same as zero — render a dash.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cache_write_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cached_in_tokens": {
            "description": "The cache subsets of `prompt_tokens`, when the provider reported them —\nwithout these a row that cost 8x its neighbour looks identical to it.\n`None` = the provider said nothing, which is not the same as zero.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "chars_in": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "class": {
            "description": "`chat` | `aux` | `audio` | `tool`.",
            "type": "string"
          },
          "client_key": {
            "description": "Name of the gateway API key that made the call (never the key itself);\nabsent when auth is disabled or the call was made in-process.",
            "type": [
              "string",
              "null"
            ]
          },
          "completion_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cost_micro": {
            "description": "Currency micro-units. `None` = **unpriced**, which is not the same as\nfree — render a dash, never a 0.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "degraded": {
            "description": "What the request's content lost on its way to a model that lacks a\ncapability: \"fallback 'x' lacks vision: 3 images sent as\nplaceholders\", \"'m' lacks audio: transcript sent\", several joined by\n\"; \". `None` = nothing was degraded.",
            "type": [
              "string",
              "null"
            ]
          },
          "egress_proto": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_msg": {
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_reason": {
            "description": "Why a fallback answered instead of the requested local model: `hold`\n(the GPU hold), `external_vram` (VRAM outside lmgw's control was\nshort), `background` (a background candidate alias), `unavailable`\n(a candidate alias with no model it may use), `benchmark`, `quota`,\n`unreachable`, `disabled`, `gpu_setup` (the graphics card is not\nready on this computer) or `engine_download` (a local model's engine\ncould not be downloaded). `None` = no fallback; the fallback itself\nis `upstream_name` / `upstream_model`.",
            "type": [
              "string",
              "null"
            ]
          },
          "images_out": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "ingress_proto": {
            "type": "string"
          },
          "key_id": {
            "description": "`api_keys.id` behind `client_key` — the id is what a key filter matches\non, and a name match breaks the moment a key is renamed.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "log_id": {
            "format": "int64",
            "type": "integer"
          },
          "max_tokens_clamped": {
            "description": "`max_tokens` lmgw lowered a client-set value to, on a ladder rung or a\nguarded unified-KV pool. `None` = not clamped — either the row is unguarded, or the\nclient's value already fit.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tool": {
            "description": "MCP tool name for `ingress_proto = \"mcp\"` rows; absent on SSE frames.",
            "type": [
              "string",
              "null"
            ]
          },
          "price_note": {
            "description": "Why the row's cost is what it is, when that is not plain: \"served at\nservice tier flex; no flex price on file for 'm', a standard one is\",\n\"stream ended before the upstream reported usage\". `None` otherwise.",
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RowPricing"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the row was priced: the rates it recorded when it was written,\nso each priced part can be shown as quantity × rate even after the\nprice has changed. On `GET /api/logs` rows only; absent on SSE\nframes, which carry the cost and the quantities alone."
          },
          "prompt_tokens": {
            "description": "**Total** input for the call, cache included.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "requested_alias": {
            "type": "string"
          },
          "rung": {
            "description": "The rung a ladder row answered from — or, for a refusal, the rung it\nwas judged on — 1-based. `None` for a row without\na ladder, and for a request its fallback answered.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "service_tier": {
            "description": "The `service_tier` an OpenAI platform answer reported, verbatim\n(`default`, `flex`, `priority`, …): the tier the row is priced at.\n`None` on every other upstream, and when the answer named none.",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "streamed": {
            "type": "boolean"
          },
          "total_ms": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "ts": {
            "type": "string"
          },
          "ttfb_ms": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "upstream_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "upstream_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "log_id",
          "ts",
          "client_key",
          "ingress_proto",
          "requested_alias",
          "upstream_name",
          "upstream_model",
          "egress_proto",
          "status",
          "ttfb_ms",
          "total_ms",
          "prompt_tokens",
          "completion_tokens",
          "cached_in_tokens",
          "cache_write_tokens",
          "streamed",
          "error_kind",
          "error_msg",
          "mcp_tool",
          "cost_micro",
          "class",
          "key_id",
          "max_tokens_clamped",
          "fallback_reason",
          "rung",
          "degraded",
          "audio_in_ms",
          "chars_in",
          "images_out",
          "service_tier",
          "price_note",
          "pricing"
        ],
        "type": "object"
      },
      "RequestStats": {
        "properties": {
          "active": {
            "format": "int64",
            "type": "integer"
          },
          "completion_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "errors": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "errors_last_minute": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "last_minute": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "prompt_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "total": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "total",
          "errors",
          "active",
          "last_minute",
          "errors_last_minute",
          "prompt_tokens",
          "completion_tokens"
        ],
        "type": "object"
      },
      "RerankRequest": {
        "properties": {
          "documents": {
            "description": "Jina's spelling.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "model": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "texts": {
            "description": "TEI's spelling — either works; an embedding-only row is refused.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "top_n": {
            "type": "integer"
          }
        },
        "required": [
          "model",
          "query"
        ],
        "type": "object"
      },
      "RerankResponse": {
        "description": "Jina's results shape, regardless of which request spelling was sent. Built by lmgw from the model's scores, never relayed: no result carries its document.",
        "properties": {
          "model": {
            "description": "The model as the request named it.",
            "type": "string"
          },
          "object": {
            "enum": [
              "list"
            ],
            "type": "string"
          },
          "results": {
            "items": {
              "properties": {
                "index": {
                  "description": "The document's position in the request.",
                  "minimum": 0,
                  "type": "integer"
                },
                "relevance_score": {
                  "type": "number"
                }
              },
              "required": [
                "index",
                "relevance_score"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "usage": {
            "properties": {
              "prompt_tokens": {
                "description": "What the model reported; 0 when it reported nothing.",
                "minimum": 0,
                "type": "integer"
              },
              "total_tokens": {
                "description": "The same number: reranking generates nothing.",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "total_tokens"
            ],
            "type": "object"
          }
        },
        "required": [
          "object",
          "model",
          "results",
          "usage"
        ],
        "type": "object"
      },
      "ResolvedExtra": {
        "description": "One extra with the commit it resolved to for a run.",
        "properties": {
          "extra": {
            "$ref": "#/components/schemas/BuildExtra"
          },
          "sha": {
            "description": "Full commit SHA that was (or will be) merged.",
            "type": "string"
          }
        },
        "required": [
          "extra",
          "sha"
        ],
        "type": "object"
      },
      "ResolvedInputs": {
        "description": "What every \"auto\" and every \"follow the head\" of a build became for one\nrun. Filled by the run executor; the config hash is computed\nover these values, never over the unresolved definition.",
        "properties": {
          "arch": {
            "description": "The arch list passed to the build, in the order passed.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "base_sha": {
            "description": "Full SHA the base ref resolved to.",
            "type": "string"
          },
          "cuda_version": {
            "description": "`None` for a non-CUDA backend.",
            "type": [
              "string",
              "null"
            ]
          },
          "dockerfile": {
            "description": "Repo-relative Dockerfile path.",
            "type": "string"
          },
          "edits": {
            "description": "The edits applied — the build's explicit list, or the preset's for\n`dockerfile`.",
            "items": {
              "$ref": "#/components/schemas/BuildEdit"
            },
            "type": "array"
          },
          "extras": {
            "description": "The extras the run merges, in order, each with its resolved SHA. A\n`pr` extra already merged upstream is skipped by the run and left out\nhere — it does not change the image.",
            "items": {
              "$ref": "#/components/schemas/ResolvedExtra"
            },
            "type": "array"
          },
          "target": {
            "description": "Final build stage.",
            "type": "string"
          }
        },
        "required": [
          "base_sha",
          "extras",
          "cuda_version",
          "arch",
          "dockerfile",
          "target",
          "edits"
        ],
        "type": "object"
      },
      "Response": {
        "additionalProperties": true,
        "description": "An upstream that speaks the Responses API natively is relayed as it sends the body: such a body may carry status queued (background), a null or missing usage and no store. lmgw's own translation always sends usage and store.",
        "properties": {
          "access_programs": {
            "description": "Always null; present because OpenAI's schema requires the field.",
            "type": "null"
          },
          "created_at": {
            "type": "integer"
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "incomplete_details": {
            "properties": {
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "reason"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "response"
            ],
            "type": "string"
          },
          "output": {
            "description": "Items are loosely typed here. An output_text part of a message item carries `logprobs: []`: lmgw relays no log probabilities yet; OpenAI's schema requires the field.",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "status": {
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "incomplete",
              "failed",
              "cancelled"
            ],
            "type": "string"
          },
          "store": {
            "description": "Whether lmgw stored this response, so a later request can continue from it with previous_response_id. Sent by lmgw's own translation; a verbatim upstream body may leave it out.",
            "type": "boolean"
          },
          "usage": {
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "input_tokens_details": {
                "description": "Tokens read from and written to the prompt cache, both part of input_tokens; 0 when the upstream reported none (cache_write_tokens is lmgw's own addition and absent from a verbatim upstream body).",
                "properties": {
                  "cache_write_tokens": {
                    "type": "integer"
                  },
                  "cached_tokens": {
                    "type": "integer"
                  }
                },
                "required": [
                  "cached_tokens"
                ],
                "type": "object"
              },
              "output_tokens": {
                "type": "integer"
              },
              "output_tokens_details": {
                "properties": {
                  "reasoning_tokens": {
                    "type": "integer"
                  }
                },
                "required": [
                  "reasoning_tokens"
                ],
                "type": "object"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens",
              "input_tokens_details",
              "output_tokens",
              "output_tokens_details",
              "total_tokens"
            ],
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "created_at",
          "status",
          "model",
          "output",
          "error",
          "incomplete_details"
        ],
        "type": "object"
      },
      "ResponseDeleted": {
        "properties": {
          "deleted": {
            "enum": [
              true
            ],
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "object": {
            "enum": [
              "response"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "type": "object"
      },
      "ResponseInputItems": {
        "properties": {
          "data": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "object": {
            "enum": [
              "list"
            ],
            "type": "string"
          }
        },
        "required": [
          "object",
          "data"
        ],
        "type": "object"
      },
      "ResponseInputTokens": {
        "properties": {
          "input_tokens": {
            "type": "integer"
          },
          "object": {
            "enum": [
              "response.input_tokens"
            ],
            "type": "string"
          }
        },
        "required": [
          "object",
          "input_tokens"
        ],
        "type": "object"
      },
      "ResponseItem": {
        "properties": {
          "body": {
            "description": "Full response JSON, pretty-printed.",
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "input_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "outline": {
            "description": "Output items at a glance, e.g. `2 mcp_call, message`.",
            "type": "string"
          },
          "output_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "pending": {
            "description": "Tool calls awaiting approval, `{name} ({approval_id})`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "text": {
            "description": "Rendered assistant text.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "status",
          "input_tokens",
          "output_tokens",
          "outline",
          "text",
          "pending",
          "body"
        ],
        "type": "object"
      },
      "ResponseStreamEvent": {
        "additionalProperties": true,
        "description": "SSE event: response.<name>, data: <this object>. The response.output_text.delta and .done events carry `logprobs: []` (lmgw relays no log probabilities yet; OpenAI's schema requires the field).",
        "properties": {
          "sequence_number": {
            "type": "integer"
          },
          "type": {
            "description": "response.created … response.completed/.incomplete/.failed, response.output_text.delta, the mcp_*/function_call_* tool-call events, …",
            "type": "string"
          }
        },
        "required": [
          "type",
          "sequence_number"
        ],
        "type": "object"
      },
      "ResponsesRequest": {
        "additionalProperties": true,
        "properties": {
          "background": {
            "description": "true is refused on every path: a background response finishes after its answer has left, so lmgw could never record what it spent or hold it to a budget.",
            "type": "boolean"
          },
          "include": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "input": {
            "description": "A string (one user turn), or an array of items.",
            "items": {
              "description": "A message ({type:message,role,content}), a prior turn's {type:function_call,call_id,name,arguments} (call_id as lmgw gave it: a Gemini model's carries its thought signature and runs to hundreds of characters; echo it exactly, and do not send it to another provider directly) or {type:function_call_output,call_id,output} (output a string, or an array of {type:input_text,text} and {type:input_image,image_url} items: a base64 data: image goes on as an image where the upstream's tool results take one and as a named placeholder elsewhere, another URL as a resource naming it, and any other item as its JSON text), an mcp_call echo, or an {type:mcp_approval_response,approval_request_id,approve,reason} verdict on a previous response's pending call. On an upstream that implements the Responses API itself (the OpenAI platform, a compatible row flagged for it) every other item the API defines goes there as sent: an {type:item_reference,id} (or an untyped {id}), a hosted tool's record (web_search_call, file_search_call, code_interpreter_call, image_generation_call, computer_call and its output, …), and content parts lmgw's loop has no reading for (input_file, an input_image by file_id). lmgw's own loop refuses each of them by name (400 unsupported). For a client key, an item_reference id and any input item's own id (a reasoning item's rs_…, a message's msg_…, a hosted call's) pass only when a native answer given to that key carried the item, and a file_id anywhere in the body never does (lmgw does not proxy /v1/files, so no client key made one): either answers 404 as an unknown previous_response_id does. The owner key passes."
            }
          },
          "instructions": {
            "description": "Becomes the leading system message; an explicit empty string drops it on a chained call.",
            "type": "string"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "max_tool_calls": {
            "type": "integer"
          },
          "metadata": {
            "description": "Echoed back verbatim on the response object."
          },
          "model": {
            "type": "string"
          },
          "parallel_tool_calls": {
            "default": true,
            "type": "boolean"
          },
          "previous_response_id": {
            "description": "Continues a stored response: its conversation, tool calls and results included, goes ahead of this call's input, and mcp_approval_response items settle the calls it stopped at. 400 while the gateway's response store is switched off; 404 when no stored response has this id (it was evicted, or created with storing off). On an upstream that implements the Responses API itself, an id lmgw holds continues in lmgw's own loop and any other id goes to the upstream with the body; with mcp tools lmgw serves, such an id is a 400, since neither side can serve both.",
            "type": "string"
          },
          "reasoning": {
            "description": "The one reasoning control this dialect reads: reasoning.effort.",
            "properties": {
              "effort": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "service_tier": {
            "description": "OpenAI's processing tier (auto, default, flex, priority, fast, scale, ultrafast), forwarded as sent; on an OpenAI platform row lmgw sends auto when it is unset, and prices the answer at the tier the answer reports. A request by a caller with a budget (its key's, or the gateway's) on a cloud model with no price on file for what it is billed in is refused before the send: 403 budget_unpriced, naming the model and the missing price. A flex request needs a flex price: no other tier's price bounds a flex answer's spend, which is cheaper.",
            "type": "string"
          },
          "store": {
            "description": "Whether lmgw keeps this response, so a later call can continue it with previous_response_id (default true). Storing also needs the gateway's response store, which is on by default: a request can turn storing off, never on. The response object's store says whether this response was kept, so a client can see up front whether previous_response_id will work. On an upstream that implements the Responses API itself the body goes there as sent, and storing is the provider's.",
            "type": "boolean"
          },
          "stream": {
            "default": false,
            "type": "boolean"
          },
          "temperature": {
            "type": "number"
          },
          "text": {
            "additionalProperties": true,
            "description": "text.format (json_schema, json_object, text) is the structured output every upstream gets in its own spelling, as on /v1/chat/completions; a native Responses upstream gets the body as sent. Its refusals are 400 response_format_unsupported / invalid_json_schema with param text.format.",
            "type": "object"
          },
          "tool_choice": {
            "description": "\"auto\" | \"none\" | \"required\" | {type:function,name} everywhere; any other form the upstream's API defines ({type:web_search_preview}, {type:allowed_tools,…}, {type:mcp,server_label}, …) goes natively to an upstream that implements the Responses API itself and is refused by lmgw's own loop."
          },
          "tools": {
            "description": "function tools the loop hands back to the client; mcp tools run server-side on lmgw's own registered MCP servers, and keep the request in lmgw's own loop on an upstream that implements the Responses API itself (an mcp label lmgw does not serve goes there with the body). Hosted tools (web_search, file_search, code_interpreter, image_generation, computer_use_preview, …) go natively to such an upstream, which runs them, and are refused by lmgw's own loop.",
            "items": {
              "oneOf": [
                {
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "parameters": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "type": {
                      "enum": [
                        "function"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "name"
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "allowed_tools": {
                      "description": "Tool names, as a list or {tool_names}; a name matches the exposed or the server's own spelling (docs__query or query). An empty list leaves nothing. read_only is refused: lmgw does not read MCP tool annotations.",
                      "oneOf": [
                        {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        {
                          "properties": {
                            "tool_names": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      ]
                    },
                    "connector_id": {
                      "description": "One of OpenAI's connectors: never lmgw's to serve, handled as a foreign server_url.",
                      "type": "string"
                    },
                    "require_approval": {
                      "description": "\"never\" (default) | \"always\" | {never:{tool_names}, always:{tool_names}}. read_only is refused, as in allowed_tools."
                    },
                    "server_label": {
                      "description": "Matches a registered MCP server's own tool prefix (or its name when it has none) — lmgw resolves this against its own servers, never against a client-supplied server_url.",
                      "type": "string"
                    },
                    "server_url": {
                      "description": "A server for the upstream to dial (OpenAI's hosted MCP tool); lmgw never dials it. A block whose server_url is not this gateway's own /mcp is not lmgw's to serve: it goes to an upstream that takes /v1/responses natively, and a request served by lmgw's own loop is refused with a 400 naming it. This gateway's own /mcp reads as no server_url.",
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "mcp"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "server_label"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": true,
                  "description": "A hosted tool: goes with the body to an upstream that implements the Responses API itself, which runs it; lmgw's own loop refuses it (400 unsupported), and so does a request that also needs the loop (mcp tools lmgw serves, a previous_response_id lmgw stored), naming both. For a client key, a tool that names something stored under the provider account (a file_search vector_store_ids entry, a code_interpreter container id or file_ids, a shell container_reference or skill_id) answers 404 as an unknown id does; the owner key passes. Fees such a tool bills beyond its tokens (web search, file search, containers, image generation) are not priced yet: its row is unpriced, with a price_note naming the calls, and budgets count its token part as a lower bound.",
                  "properties": {
                    "type": {
                      "description": "web_search, file_search, code_interpreter, image_generation, computer_use_preview, shell, … as the upstream's own Responses API defines them.",
                      "not": {
                        "enum": [
                          "function",
                          "mcp"
                        ]
                      },
                      "type": "string"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "type": "object"
                }
              ]
            },
            "type": "array"
          },
          "top_k": {
            "type": "integer"
          },
          "top_p": {
            "type": "number"
          },
          "truncation": {
            "description": "\"auto\" goes natively to an upstream that implements the Responses API itself; lmgw's own loop refuses it, since it never silently drops conversation history.",
            "type": "string"
          }
        },
        "required": [
          "model"
        ],
        "type": "object"
      },
      "ResultTask": {
        "description": "The MCP task a call started, on its `result` frame.",
        "properties": {
          "id": {
            "description": "lmgw's id of the task (`ThreadTask.id`).",
            "format": "int64",
            "type": "integer"
          },
          "server_label": {
            "type": "string"
          },
          "task_id": {
            "description": "The server's id of the task.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "task_id",
          "server_label"
        ],
        "type": "object"
      },
      "RetriedRequest": {
        "description": "A request the engine sent a second time because its connection broke\nbefore any response arrived. What the\nstep recorded is the second attempt's.",
        "properties": {
          "error": {
            "description": "Why the first attempt failed, with its whole cause chain.",
            "type": "string"
          },
          "request": {
            "description": "The request, e.g. `POST /completion`.",
            "type": "string"
          },
          "stage": {
            "description": "The step it belonged to, as the progress line named it\n(\"prefill: 32768 tokens, repetition 1/3\").",
            "type": "string"
          }
        },
        "required": [
          "stage",
          "request",
          "error"
        ],
        "type": "object"
      },
      "RevokeKind": {
        "anyOf": [
          {
            "enum": [
              "device_disabled",
              "key_expired",
              "key_unknown",
              "certificate_expired",
              "revoked"
            ],
            "type": "string"
          }
        ],
        "description": "What revoked a key, as a `CLOSE_REVOKED` close's reason starts with it\nand the change feed's `revoked` event carries it (`kind`):\n\n- `device_disabled`: a paired device was disabled; it may be enabled\n  again, so it keeps its pairing;\n- `key_expired`: a paired device's key passed its expiry;\n- `key_unknown`: a paired device's key was rotated or deleted: pair the\n  device again;\n- `certificate_expired`: a paired device's client certificate passed its\n  `notAfter` while the connection was open (device link design §5.1):\n  pair the device again;\n- `revoked`: any other kind of key, for any of these.\n\nForward compatible like every enum a client reads: a token a newer\ngateway sends reads as `RevokeKind::Unknown`, as sent. One an older\ngateway does not send at all — a close reason without a token, a\n`revoked` event without `kind` — is an empty `Unknown`, the default, so\na client never reads a device's rotation as another key's revocation."
      },
      "RouterSettings": {
        "description": "The chat/aux *class* settings.\n`container_name`/`listen_port`/`models_max`/\n`auto_start` left with router mode: names are derived, ports are dynamic,\nand auto-start is the per-model `warm_start` flag.",
        "properties": {
          "extra_run_args": {
            "description": "Class default; a model's own `extra_run_args` overrides it.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "image": {
            "description": "Class default; a model's own `image` overrides it.",
            "type": "string"
          },
          "models_dir": {
            "type": "string"
          },
          "public_prefix": {
            "type": "string"
          },
          "request_timeout_seconds": {
            "description": "Per-request ceiling for the class, in seconds: how long lmgw waits for\nan answer to start, and how long a streamed answer may then go\nwithout an event before lmgw ends it with an error. **0 = the maximum\npossible** — no deadline of lmgw's own. One per class since the four\nstopped sharing a single 600 s constant.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image",
          "models_dir",
          "extra_run_args",
          "public_prefix",
          "request_timeout_seconds"
        ],
        "type": "object"
      },
      "RouterSettingsPatch": {
        "additionalProperties": false,
        "properties": {
          "extra_run_args": {
            "default": null,
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "image": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "models_dir": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "public_prefix": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "request_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "Row": {
        "description": "One row of the review table.\n\nBoth a live frame and a stored result use this shape, so the table renders\nthe same whether the run is in flight or was finished last week.",
        "properties": {
          "attention": {
            "default": false,
            "description": "The output equals the fallback, or the call failed; through a question\nset also a confidence below the set's measured threshold (`decide`).",
            "type": "boolean"
          },
          "columns": {
            "additionalProperties": true,
            "default": {},
            "description": "The manifest's `columns`, rendered. Order comes from the manifest, not\nfrom this map.",
            "type": "object"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "default": "",
            "description": "`item.id` rendered. Empty marks the row errored — there is no\nstable identity to apply anything against.",
            "type": "string"
          },
          "item": {
            "description": "The **source** item, kept so a re-run can re-fetch and re-classify this\nrow without re-listing the mailbox. Not shown anywhere."
          },
          "output": {
            "default": null,
            "description": "The structured answer. `null` for a list-only run, which makes no call."
          },
          "prompt": {
            "description": "Exactly the `user` text the model received, for the details modal.\nKept per row because \"why did it say that\" is the question the\nreview table exists to answer.",
            "type": [
              "string",
              "null"
            ]
          },
          "raw": {
            "description": "What the model actually replied, so a surprising answer is explainable.",
            "type": [
              "string",
              "null"
            ]
          },
          "set": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentRowSet"
              },
              {
                "type": "null"
              }
            ],
            "description": "The question set that classified this row, as the run read it\n(`decide`); `None` for the model call. \"Save as labelled set\" saves\na run's rows into the set stamped on them."
          }
        },
        "type": "object"
      },
      "RowPricing": {
        "description": "The rates a request row was priced with and its cost's parts, each as\nthe row snapshotted it. `None` = that part or rate did not apply, or\n(for the costs) was unknown — never 0.",
        "properties": {
          "cost_in_micro": {
            "description": "The cost's token parts and its part in every other unit, in currency\nmicro-units.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cost_out_micro": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "cost_units_micro": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "currency": {
            "description": "The gateway's configured currency, which every amount here is in.",
            "type": "string"
          },
          "in_remainder": {
            "description": "Whether this row is counted in the unpriced remainder the usage\ntotals state beside their cost (`cost_unknown_requests`): its cost is\nunknown, it is no tool call, and it was answered or spent something\n(tokens or a measured quantity). `false` for a priced row, a tool\ncall, and a refusal or failure that spent nothing: nothing billed is\nmissing from a total.",
            "type": "boolean"
          },
          "price_in": {
            "description": "The token rates, per 1M tokens.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_out": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_per_audio_minute": {
            "description": "The other units' rates: per minute of input audio, per 1M input\ncharacters, per generated image, per answered request.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_per_image": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_per_mchar": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "price_per_request": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "source": {
            "description": "`catalog`, `manual`, `free_local` or `unknown`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "currency",
          "source",
          "in_remainder",
          "price_in",
          "price_out",
          "cost_in_micro",
          "cost_out_micro",
          "cost_units_micro",
          "price_per_audio_minute",
          "price_per_mchar",
          "price_per_image",
          "price_per_request"
        ],
        "type": "object"
      },
      "RunResults": {
        "description": "Everything a run measured apart from the probes and the timeline.",
        "properties": {
          "complete": {
            "description": "True once every selected phase finished without an error. A crash, a\ncancel or a phase error leaves it false: the numbers present are real,\nthe set is partial.",
            "type": "boolean"
          },
          "concurrent": {
            "items": {
              "$ref": "#/components/schemas/ConcurrentPoint"
            },
            "type": "array"
          },
          "corpus_tokens": {
            "description": "The corpus, tokenized by the bench server.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "decode": {
            "items": {
              "$ref": "#/components/schemas/DecodePoint"
            },
            "type": "array"
          },
          "energy": {
            "$ref": "#/components/schemas/EnergySummary"
          },
          "load": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LoadResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "mixed": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MixedResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "phase_errors": {
            "items": {
              "$ref": "#/components/schemas/PhaseError"
            },
            "type": "array"
          },
          "phases_done": {
            "description": "Phases that ran to the end, in order.",
            "items": {
              "$ref": "#/components/schemas/Phase"
            },
            "type": "array"
          },
          "points": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PointPlan"
              },
              {
                "type": "null"
              }
            ]
          },
          "prefill": {
            "items": {
              "$ref": "#/components/schemas/PrefillPoint"
            },
            "type": "array"
          },
          "prompt_prefix": {
            "description": "The token ids every measured prompt starts with: the vocabulary's\nBOS where it adds one — llama-server adds none to a token-id prompt —\ncounted inside each prompt's length. Empty when the\nvocabulary adds nothing.",
            "items": {
              "format": "uint32",
              "minimum": 0,
              "type": "integer"
            },
            "type": "array"
          },
          "retried": {
            "description": "Requests sent a second time after a broken connection,\nin the order they happened.",
            "items": {
              "$ref": "#/components/schemas/RetriedRequest"
            },
            "type": "array"
          },
          "server": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServerFacts"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "complete",
          "server",
          "points",
          "corpus_tokens",
          "prompt_prefix",
          "load",
          "prefill",
          "decode",
          "concurrent",
          "mixed",
          "phases_done",
          "phase_errors",
          "retried",
          "energy"
        ],
        "type": "object"
      },
      "Rung": {
        "description": "One ladder rung above the base — its own weights and its own context. The base rung is\nnever one of these; it stays the row's own `gguf_path` and `ctx_size`.",
        "properties": {
          "ctx_size": {
            "format": "int64",
            "type": "integer"
          },
          "gguf_path": {
            "type": "string"
          }
        },
        "required": [
          "gguf_path",
          "ctx_size"
        ],
        "type": "object"
      },
      "Rung2": {
        "description": "One rung above the base: its own weights and its own `-c`.\n`ctx_size` is a real token count: a rung with no context at all is not a\nrung, so saving one with a non-positive value is refused.",
        "properties": {
          "ctx_size": {
            "description": "`--ctx-size` for this rung — the same meaning `ctx_size` has\neverywhere else: it is `-c`, never the per-slot number.",
            "format": "int64",
            "type": "integer"
          },
          "gguf_path": {
            "description": "GGUF path relative to the models dir, exactly like the base row's\n`gguf_path`.",
            "type": "string"
          }
        },
        "required": [
          "gguf_path",
          "ctx_size"
        ],
        "type": "object"
      },
      "RungDetail": {
        "description": "One ladder rung as the model read shows it.",
        "properties": {
          "command_line": {
            "description": "The `podman run …` command line this rung renders to.",
            "type": "string"
          },
          "ctx_size": {
            "format": "int64",
            "type": "integer"
          },
          "gguf_path": {
            "type": "string"
          },
          "of": {
            "description": "How many rungs the ladder has.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "per_slot_ctx": {
            "description": "The context one slot gets on this rung; null when the base row\npredates the rule that derives it.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "rung": {
            "description": "This rung's number, from 1 (the base row).",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "switchover": {
            "description": "The prompt length at which a request moves up to the next rung.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "rung",
          "of",
          "gguf_path",
          "ctx_size",
          "per_slot_ctx",
          "switchover",
          "command_line"
        ],
        "type": "object"
      },
      "RungFootprint": {
        "description": "A model's estimated GPU cost. The CUDA context, allocator slack and a\nprojector's compute buffer are not in it; those are the headroom's.",
        "properties": {
          "compute_bytes": {
            "description": "The compute buffers llama.cpp reserves on the card, derived from the\nheader and the row's slots, batch sizes and context: for a chat row\n(a ladder rung) its own context's and its MTP or draft context's,\nsummed.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "ctx_tokens": {
            "description": "Context the KV figure was computed for; `None` when it could not be\nderived (also why `kv_cache_bytes` would be 0).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "kv_cache_bytes": {
            "description": "The KV cache, a speculative row's MTP or draft cache and recurrent\nstate included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "note": {
            "description": "Why a term is missing or approximate, when it is.",
            "type": [
              "string",
              "null"
            ]
          },
          "total_bytes": {
            "description": "`weights_bytes + kv_cache_bytes + compute_bytes`.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "weights_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "weights_bytes",
          "kv_cache_bytes",
          "compute_bytes",
          "total_bytes",
          "ctx_tokens",
          "note"
        ],
        "type": "object"
      },
      "RungStatus": {
        "description": "The rung a container runs, 1-based (the base is rung 1).",
        "properties": {
          "gguf": {
            "description": "The weights' file name.",
            "type": "string"
          },
          "of": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "rung": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "rung",
          "of",
          "gguf"
        ],
        "type": "object"
      },
      "RungTest": {
        "description": "One rung's test.",
        "properties": {
          "ctx_size": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "description": "Why the rung failed, when it did.",
            "type": "string"
          },
          "gguf_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "load_seconds": {
            "description": "Seconds it took the rung to become ready.",
            "format": "double",
            "type": "number"
          },
          "of": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "ok": {
            "type": "boolean"
          },
          "per_slot_ctx": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "rung": {
            "description": "This rung's number, from 1 (the base row).",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "switchover": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "rung",
          "of",
          "gguf_path",
          "ctx_size",
          "per_slot_ctx",
          "switchover",
          "load_seconds",
          "ok"
        ],
        "type": "object"
      },
      "RuntimeStatus": {
        "description": "One model container's runtime state.",
        "properties": {
          "class": {
            "description": "`chat | aux | audio | image`.",
            "type": "string"
          },
          "climbing": {
            "$ref": "#/components/schemas/ClimbStatus",
            "description": "A climb in progress: to which rung, why, and what it is doing now."
          },
          "container_name": {
            "type": "string"
          },
          "draining_for_owner": {
            "description": "A foreground admission is waiting for room, and background traffic takes\nno new work on this model until it is over. Absent = false.",
            "type": "boolean"
          },
          "image_capabilities": {
            "$ref": "#/components/schemas/ImageCapabilities",
            "description": "What an image container reported about its loaded pipeline. `None` for\nevery other class, and for an image container whose capabilities route\nanswered anything but a 200."
          },
          "in_flight": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "last_used_age_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "llama_props": {
            "$ref": "#/components/schemas/LlamaProps",
            "description": "What a llama-server container said about itself in `GET /props`.\n`None` for every other engine, and when the\nread failed — `warnings` then says why."
          },
          "model_id": {
            "type": "string"
          },
          "owner": {
            "description": "Whom the container runs for:\n`\"background\"` when a background candidate alias started it and\nforeground traffic has not claimed it since. `None` — absent from the\nframe — is foreground: every request that is not a background candidate\nalias's, every warm, boot or operator start, and lmgw's own in-process\ncallers. That is every container of an install without background\ntraffic.",
            "type": "string"
          },
          "placement": {
            "description": "`\"cpu\"` for an audio container started on the CPU (the per-row CPU\nswitch): no VRAM, not stopped by the GPU hold. `None` — absent from\nthe frame — is the GPU, every other container.",
            "type": "string"
          },
          "port": {
            "description": "`0` while the entry is `starting` — no port has been allocated yet.",
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "rung": {
            "$ref": "#/components/schemas/RungStatus",
            "description": "The rung this container runs. `None` for a row\nwithout a ladder, and `#[serde(default)]` so a frame from before this\nfield existed still decodes."
          },
          "sends": {
            "description": "Sends in flight as the ladder gate counts them — what a climb drains.\nOnly ladder sends are counted, so this is zero on every other row.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "started_at_age_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "state": {
            "description": "`starting | ready | stopping`.",
            "type": "string"
          },
          "warnings": {
            "description": "Non-fatal problems this model's start found.\nEmpty for a clean one, and absent from a frame older than the class.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "class",
          "model_id",
          "container_name",
          "port",
          "state",
          "in_flight",
          "started_at_age_seconds",
          "last_used_age_seconds"
        ],
        "type": "object"
      },
      "Sampling": {
        "description": "The sampling every request of a run uses: pinned, so builds compare\nand speculative decoding's acceptance does not wander with the row's own\nsampler.",
        "properties": {
          "seed": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "temperature": {
            "format": "double",
            "type": "number"
          },
          "top_k": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "top_p": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "temperature",
          "top_p",
          "top_k",
          "seed"
        ],
        "type": "object"
      },
      "ScoreAnswer": {
        "properties": {
          "confidence": {
            "format": "double",
            "type": "number"
          },
          "legend": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Each level's index (`\"0\"`, `\"1\"`, …) with its description.",
            "type": "object"
          },
          "probabilities": {
            "additionalProperties": {
              "format": "double",
              "type": "number"
            },
            "description": "Each level's index with its probability.",
            "type": "object"
          },
          "score": {
            "description": "The expected level index, weighted by probability: it can fall between\ntwo levels.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "score",
          "legend",
          "probabilities",
          "confidence"
        ],
        "type": "object"
      },
      "ScoreLabels": {
        "description": "How a `score` question's label column reads: every value one way.",
        "oneOf": [
          {
            "const": "text",
            "description": "Each value is a level's exact text.",
            "type": "string"
          },
          {
            "const": "index",
            "description": "Each value is a level's index, from 0.",
            "type": "string"
          }
        ]
      },
      "ScoreQuestion": {
        "properties": {
          "criteria": {
            "description": "The levels' descriptions, lowest first: 2 to 10 of them.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "instructions": {
            "description": "The question: a string, an object or an array."
          }
        },
        "required": [
          "instructions",
          "criteria"
        ],
        "type": "object"
      },
      "SearchHit": {
        "properties": {
          "chunk": {
            "$ref": "#/components/schemas/ChunkRow"
          },
          "fts_rank": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "knn_rank": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "knn_score": {
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "rerank_score": {
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "rerank_skipped": {
            "description": "The rerank stage ran but did not score this candidate: `score` is then\nits RRF score and it ranks behind the reranked ones. Absent when false.",
            "type": "boolean"
          },
          "rrf_score": {
            "format": "float",
            "type": "number"
          },
          "score": {
            "description": "The score the final order is by: the reranker's when it ran, RRF's\notherwise.",
            "format": "float",
            "type": "number"
          },
          "tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "chunk",
          "score",
          "rrf_score",
          "fts_rank",
          "knn_rank",
          "knn_score",
          "rerank_score",
          "tokens"
        ],
        "type": "object"
      },
      "SearchHit2": {
        "description": "One place that matches.",
        "properties": {
          "kind": {
            "description": "`t` the title, `m` a message, `a` an attachment's name.",
            "type": "string"
          },
          "message_id": {
            "description": "The message, for kind `m`.",
            "format": "int64",
            "type": "integer"
          },
          "role": {
            "description": "The message's role, for kind `m`.",
            "type": "string"
          },
          "snippet": {
            "description": "The text around the match, with the match between U+E000 and U+E001\n(private-use characters; escape the text before turning them into\nmarkup).",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "snippet"
        ],
        "type": "object"
      },
      "SearchParamsView": {
        "description": "One request's stage parameters. Round-trips: this is both what the trace\nreports and what the playground posts back as `params`.",
        "properties": {
          "budget_tokens": {
            "description": "`None` returns all `limit` chunks — the budget is the caller's choice.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "fts_weights": {
            "$ref": "#/components/schemas/FtsWeightsView"
          },
          "k_fts": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "k_rerank": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "k_vec": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "rerank": {
            "type": "boolean"
          },
          "rrf_k": {
            "format": "float",
            "type": "number"
          }
        },
        "required": [
          "k_fts",
          "k_vec",
          "rrf_k",
          "fts_weights",
          "rerank",
          "k_rerank",
          "limit",
          "budget_tokens"
        ],
        "type": "object"
      },
      "SearchThread": {
        "description": "A thread with matches.",
        "properties": {
          "archived": {
            "type": "boolean"
          },
          "folder_id": {
            "description": "`null` for a thread in no folder, and for one in a folder the\ncaller cannot see.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "hits": {
            "description": "The best matches, up to three.",
            "items": {
              "$ref": "#/components/schemas/SearchHit2"
            },
            "type": "array"
          },
          "match_count": {
            "description": "How many places in the thread match.",
            "format": "int64",
            "type": "integer"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "thread_id",
          "title",
          "folder_id",
          "archived",
          "updated_at",
          "match_count",
          "hits"
        ],
        "type": "object"
      },
      "SearchTraceView": {
        "description": "Per-stage trace: what each stage saw, in the order it saw it.",
        "properties": {
          "budget_dropped": {
            "description": "Chunks the token budget dropped, in the order they would have come.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "budget_used_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "corpus_id": {
            "type": "string"
          },
          "embed_model": {
            "type": "string"
          },
          "fts": {
            "items": {
              "$ref": "#/components/schemas/StageHitView"
            },
            "type": "array"
          },
          "fts_query": {
            "description": "The FTS5 MATCH expression actually issued — user text is never passed\nthrough raw.",
            "type": "string"
          },
          "fused": {
            "items": {
              "$ref": "#/components/schemas/FusedHitView"
            },
            "type": "array"
          },
          "knn": {
            "items": {
              "$ref": "#/components/schemas/StageHitView"
            },
            "type": "array"
          },
          "knn_kernel": {
            "description": "Which widening kernel the KNN scan used.",
            "type": "string"
          },
          "knn_skipped": {
            "description": "Why the vector stage did not run, so BM25 alone answered. Absent when\nit ran.",
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/SearchParamsView"
          },
          "rerank": {
            "items": {
              "$ref": "#/components/schemas/StageHitView"
            },
            "type": "array"
          },
          "rerank_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "rerank_skipped": {
            "description": "Why the rerank stage did not run, when `params.rerank` asked for it.",
            "type": [
              "string",
              "null"
            ]
          },
          "resident_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "resident_vectors": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "timings": {
            "$ref": "#/components/schemas/TimingsView"
          },
          "token_counter": {
            "type": "string"
          }
        },
        "required": [
          "corpus_id",
          "embed_model",
          "params",
          "fts_query",
          "fts",
          "knn",
          "fused",
          "rerank_model",
          "rerank_skipped",
          "rerank",
          "token_counter",
          "budget_used_tokens",
          "budget_dropped",
          "resident_vectors",
          "resident_bytes",
          "knn_kernel",
          "timings"
        ],
        "type": "object"
      },
      "SemanticVadRow": {
        "description": "One eagerness's row of `realtime.semantic_vad`.",
        "properties": {
          "floor": {
            "description": "A score at or above this and below the threshold commits at\n`semantic_floor_window_ms`; equal to the threshold turns the middle\nband off.",
            "format": "double",
            "type": "number"
          },
          "max_wait_ms": {
            "description": "The longest a pause waits, whatever the score.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "silence_duration_ms": {
            "description": "Where a pause that could not be scored commits, and the window the\n`server_vad` engine runs this eagerness on.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "threshold": {
            "description": "A Smart Turn score at or above this commits the turn, `0.0..=1.0`.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "threshold",
          "floor",
          "max_wait_ms",
          "silence_duration_ms"
        ],
        "type": "object"
      },
      "SemanticVadRowPatch": {
        "additionalProperties": false,
        "description": "One row's patch.",
        "properties": {
          "floor": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "max_wait_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "silence_duration_ms": {
            "default": null,
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "threshold": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "SemanticVadTable": {
        "description": "`realtime.semantic_vad`: the rows by eagerness (`auto` is `medium`).",
        "properties": {
          "high": {
            "$ref": "#/components/schemas/SemanticVadRow"
          },
          "low": {
            "$ref": "#/components/schemas/SemanticVadRow"
          },
          "medium": {
            "$ref": "#/components/schemas/SemanticVadRow"
          }
        },
        "required": [
          "high",
          "medium",
          "low"
        ],
        "type": "object"
      },
      "SemanticVadTablePatch": {
        "additionalProperties": false,
        "description": "`realtime.semantic_vad`'s patch: the rows by eagerness.",
        "properties": {
          "high": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SemanticVadRowPatch"
              },
              {
                "type": "null"
              }
            ]
          },
          "low": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SemanticVadRowPatch"
              },
              {
                "type": "null"
              }
            ]
          },
          "medium": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SemanticVadRowPatch"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object"
      },
      "SeriesMeta": {
        "description": "Identity of one series, with the colour slot it wears everywhere.",
        "properties": {
          "folded": {
            "description": "On the folded \"Other\" series only: how many entities it sums, so a\nlegend can say \"Other (49 aliases)\" instead of hiding the tail's size.\n`null` on every named series.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "key": {
            "type": "string"
          },
          "label": {
            "description": "What to print — a key id resolves to its name here, an upstream id to\nits name, an alias is itself.",
            "type": "string"
          },
          "local": {
            "description": "True for a locally-served model — it can never appear in a spend chart,\nbecause its money cost is a real zero.",
            "type": "boolean"
          },
          "slot": {
            "description": "Chart colour slot 0..5, or `null` for the neutral \"Other\" bucket.\n\nAssigned from the entity's position in the gateway's own sorted list of\naliases, **not** from its rank in this response: a filter that drops a\nseries must not repaint the survivors, or a reader who learned \"qwen is\nteal\" is being lied to.",
            "format": "uint8",
            "maximum": 255,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "label",
          "slot",
          "local",
          "folded"
        ],
        "type": "object"
      },
      "ServedModel": {
        "description": "An alias a stage asked for, the one that answered when it was another,\nand (for the text-to-speech stage) the voice.",
        "properties": {
          "alias": {
            "type": "string"
          },
          "answered_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "voice": {
            "type": "string"
          }
        },
        "required": [
          "alias",
          "answered_by"
        ],
        "type": "object"
      },
      "ServerFacts": {
        "description": "What the live server says about itself: the numbers every point is\nderived from, and the build facts `/props` carries on engines that report\nthem.",
        "properties": {
          "build_info": {
            "description": "`/props` `build_info` (official llama.cpp only).",
            "type": [
              "string",
              "null"
            ]
          },
          "chat_template_caps": {
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "`/props` `chat_template_caps`, the boolean entries. Empty when the\nengine sends none (ik).",
            "type": "object"
          },
          "kv_unified": {
            "description": "Whether every slot draws its KV cells from one shared pool: then *S* is the whole pool, and\nrequests running\ntogether must fit in it side by side — a full pool aborts every\nrunning request. From the server where it says (ik's top-level\n`n_ctx` against the per-slot one), else from the row's effective\nsettings (`kv_unified`, or `parallel` left on auto); `None` when\nneither says, read as split.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "kv_unified_source": {
            "description": "Where `kv_unified` was read: `props.n_ctx` or `settings`.",
            "type": [
              "string",
              "null"
            ]
          },
          "model_ftype": {
            "description": "`/props` `model_ftype` (official llama.cpp only).",
            "type": [
              "string",
              "null"
            ]
          },
          "n_slots": {
            "description": "*N_slots*: `/props` `total_slots`, else the length of `/slots`.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "per_slot_ctx": {
            "description": "*S*: the per-slot context.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "per_slot_ctx_source": {
            "description": "Where *S* was read: `slots`, `props.default_generation_settings.n_ctx`\nor `props.n_ctx / total_slots`.",
            "type": "string"
          },
          "speculative": {
            "description": "Whether any slot reports speculative decoding (official `/slots`).",
            "type": [
              "boolean",
              "null"
            ]
          },
          "total_ctx": {
            "description": "The whole context, where the engine reports it (ik's top-level\n`/props` `n_ctx`).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "vision": {
            "description": "`/props` `modalities.vision`.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "n_slots",
          "per_slot_ctx",
          "per_slot_ctx_source",
          "total_ctx",
          "kv_unified",
          "kv_unified_source",
          "build_info",
          "model_ftype",
          "speculative",
          "chat_template_caps",
          "vision"
        ],
        "type": "object"
      },
      "SettingsFit": {
        "description": "Which card's model settings (§1.4): the images, run arguments and audio\nbackend lmgw ships for it.",
        "oneOf": [
          {
            "const": "amd_vulkan",
            "description": "AMD cards, through Vulkan: the llama.cpp, audio.cpp and\nstable-diffusion.cpp Vulkan images, given the render nodes and the\nuser's groups.",
            "type": "string"
          },
          {
            "const": "nvidia_cuda",
            "description": "NVIDIA cards, through CUDA: lmgw's defaults.",
            "type": "string"
          }
        ]
      },
      "SettingsFitChange": {
        "description": "One field the switch changes.",
        "properties": {
          "class": {
            "description": "The model class: `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "field": {
            "description": "The field as the dashboard names it: \"Settings → Runtimes → Chat →\nImage\" for a class, \"Image override\" or \"Extra podman run args\noverride\" on a model's page.",
            "type": "string"
          },
          "from": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SettingsFitValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "The value now. `None`: the model has no setting of its own and uses\nits class's."
          },
          "model": {
            "description": "The model whose own setting this is; `None` for the class's setting.",
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SettingsFitValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "The value after the switch. `None`: the model's own setting is\ncleared, so it uses its class's from then on."
          }
        },
        "required": [
          "class",
          "model",
          "field",
          "from",
          "to"
        ],
        "type": "object"
      },
      "SettingsFitChangeInput": {
        "description": "One field the switch changes.",
        "properties": {
          "class": {
            "description": "The model class: `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "field": {
            "description": "The field as the dashboard names it: \"Settings → Runtimes → Chat →\nImage\" for a class, \"Image override\" or \"Extra podman run args\noverride\" on a model's page.",
            "type": "string"
          },
          "from": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SettingsFitValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "The value now. `None`: the model has no setting of its own and uses\nits class's."
          },
          "model": {
            "description": "The model whose own setting this is; `None` for the class's setting.",
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SettingsFitValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "The value after the switch. `None`: the model's own setting is\ncleared, so it uses its class's from then on."
          }
        },
        "required": [
          "class",
          "field"
        ],
        "type": "object"
      },
      "SettingsFitLeft": {
        "description": "A setting the switch leaves as it is, and why.",
        "properties": {
          "class": {
            "description": "The model class: `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "field": {
            "description": "The field, as `SettingsFitChange::field` names it.",
            "type": "string"
          },
          "model": {
            "description": "The model whose own setting this is; `None` for the class's.",
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "$ref": "#/components/schemas/SettingsFitValue",
            "description": "Its value."
          },
          "why": {
            "description": "Why it stays, in plain words.",
            "type": "string"
          }
        },
        "required": [
          "class",
          "model",
          "field",
          "value",
          "why"
        ],
        "type": "object"
      },
      "SettingsFitOutdated": {
        "description": "Why a confirmed switch wrote nothing: the switch worked out when it was\nto be written is not the list that was confirmed.",
        "properties": {
          "added": {
            "description": "Changes the switch makes now that the confirmed list did not have.",
            "items": {
              "$ref": "#/components/schemas/SettingsFitChange"
            },
            "type": "array"
          },
          "models": {
            "description": "Models whose own settings were changed while the switch was being\nwritten.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "withdrawn": {
            "description": "Changes of the confirmed list the switch no longer makes as listed.",
            "items": {
              "$ref": "#/components/schemas/SettingsFitChange"
            },
            "type": "array"
          }
        },
        "required": [
          "withdrawn",
          "added",
          "models"
        ],
        "type": "object"
      },
      "SettingsFitRunning": {
        "description": "A running model whose settings the switch changes.",
        "properties": {
          "class": {
            "description": "The model class: `chat`, `aux`, `audio` or `image`.",
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "stop": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SettingsFitStop"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the confirmed switch did to it; `None` in an offer."
          }
        },
        "required": [
          "class",
          "model",
          "stop"
        ],
        "type": "object"
      },
      "SettingsFitStop": {
        "description": "What a confirmed switch did to a running model it concerns.",
        "oneOf": [
          {
            "description": "Stopped: its next start uses the new settings.",
            "properties": {
              "kind": {
                "const": "stopped",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "It had stopped by then.",
            "properties": {
              "kind": {
                "const": "not_running",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "It is answering `in_flight` requests, so it keeps running with the\nsettings from before until it stops.",
            "properties": {
              "in_flight": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "kind": {
                "const": "busy",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "in_flight"
            ],
            "type": "object"
          },
          {
            "description": "Stopping it failed; it may still run with the settings from before.",
            "properties": {
              "error": {
                "type": "string"
              },
              "kind": {
                "const": "failed",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "error"
            ],
            "type": "object"
          }
        ]
      },
      "SettingsFitValue": {
        "anyOf": [
          {
            "description": "An image or the audio backend.",
            "type": "string"
          },
          {
            "description": "Run arguments, one `podman run` argument each, as the field holds\nthem (one per line in the dashboard).",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ],
        "description": "A setting's value as the switch shows it."
      },
      "ShareLink": {
        "description": "\"Send this model to a friend\" (§7, D31): the file's public Hugging Face\naddress and the sentence around it.",
        "properties": {
          "text": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "text"
        ],
        "type": "object"
      },
      "Sourced_Nullable_string": {
        "description": "A value and the level it came from; `source: null` when no level sets it.",
        "properties": {
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "value",
          "source"
        ],
        "type": "object"
      },
      "Sourced_TurnDetectionMode": {
        "description": "A value and the level it came from; `source: null` when no level sets it.",
        "properties": {
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "$ref": "#/components/schemas/TurnDetectionMode"
          }
        },
        "required": [
          "value",
          "source"
        ],
        "type": "object"
      },
      "Sourced_boolean": {
        "description": "A value and the level it came from; `source: null` when no level sets it.",
        "properties": {
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": "boolean"
          }
        },
        "required": [
          "value",
          "source"
        ],
        "type": "object"
      },
      "SpeechCaps": {
        "additionalProperties": false,
        "description": "The `speech` object of a text-to-speech model's capabilities. Absent\nfields are unknown, as everywhere in the schema.",
        "properties": {
          "inline_tags": {
            "description": "What inline tags in `input` do: `none` (stripped, never read out),\n`fixed` (the ones in `tags` are rendered, stage directions mapped\nonto them, the rest stripped), `free` (every `[tag]` is rendered).",
            "type": [
              "string",
              "null"
            ]
          },
          "instructions": {
            "description": "What `instructions` do: `none` (dropped — said in `x-lmgw-speech`),\n`style` (a speaking style for the voice), `voice_design` (the voice\nis designed from them), `passthrough` (sent; the model reads them —\nit declares an instruction option, or lmgw knows its engine reads\none anyway — and decides what they do).",
            "type": [
              "string",
              "null"
            ]
          },
          "instructions_required": {
            "description": "A request without instructions is refused (`instructions_required`)\nunless the row has a default description.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "sample_rate": {
            "description": "The sample rate of its audio, in Hz, as its last answer through lmgw\nsaid (a streamed answer's PCM has no header of its own; the same\nfigure is the `x-lmgw-sample-rate` header on it). Absent until the\nmodel has answered once since lmgw started.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "streaming": {
            "description": "`stream_format` (`sse` or `audio`, `response_format: pcm`) works on\nthis row: it runs in streaming mode.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "tags": {
            "description": "The tags a `fixed` model renders, written `[tag]`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SpeechForm": {
        "description": "The TTS panel's widgets, raw. Parsed by `speech_body` so the \"Request\"\ndisclosure and the actual call are literally the same bytes.",
        "properties": {
          "input": {
            "type": "string"
          },
          "instructions": {
            "description": "OpenAI's `instructions`: delivery and style guidance, forwarded as the\nengine's `instruction` option.",
            "type": "string"
          },
          "language": {
            "description": "Language code passed to models whose contract accepts one; the\ntranscription panel sends the same field.",
            "type": "string"
          },
          "max_tokens": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "options": {
            "description": "Engine options as JSON text, sent as the body's `options`.",
            "type": "string"
          },
          "reference_text": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          },
          "seed": {
            "type": "string"
          },
          "speed": {
            "description": "`speed`: a positive multiplier, on models that support speed control\n(audio.cpp rejects it on models that do not, rather than ignoring it).",
            "type": "string"
          },
          "stream": {
            "description": "Stream the answer as server-sent events of PCM.",
            "type": "boolean"
          },
          "voice": {
            "type": "string"
          },
          "voice_ref": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input",
          "voice",
          "voice_ref",
          "reference_text",
          "speed",
          "language",
          "instructions",
          "seed",
          "max_tokens",
          "response_format",
          "stream",
          "options"
        ],
        "type": "object"
      },
      "SpeechFormInput": {
        "description": "The TTS panel's widgets, raw. Parsed by `speech_body` so the \"Request\"\ndisclosure and the actual call are literally the same bytes.",
        "properties": {
          "input": {
            "default": "",
            "type": "string"
          },
          "instructions": {
            "default": "",
            "description": "OpenAI's `instructions`: delivery and style guidance, forwarded as the\nengine's `instruction` option.",
            "type": "string"
          },
          "language": {
            "default": "",
            "description": "Language code passed to models whose contract accepts one; the\ntranscription panel sends the same field.",
            "type": "string"
          },
          "max_tokens": {
            "default": "",
            "type": "string"
          },
          "model": {
            "default": "",
            "type": "string"
          },
          "options": {
            "default": "",
            "description": "Engine options as JSON text, sent as the body's `options`.",
            "type": "string"
          },
          "reference_text": {
            "default": "",
            "type": "string"
          },
          "response_format": {
            "default": "",
            "type": "string"
          },
          "seed": {
            "default": "",
            "type": "string"
          },
          "speed": {
            "default": "",
            "description": "`speed`: a positive multiplier, on models that support speed control\n(audio.cpp rejects it on models that do not, rather than ignoring it).",
            "type": "string"
          },
          "stream": {
            "default": false,
            "description": "Stream the answer as server-sent events of PCM.",
            "type": "boolean"
          },
          "voice": {
            "default": "",
            "type": "string"
          },
          "voice_ref": {
            "default": "",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SpeechStyle": {
        "description": "The speech instructions; `\"\"` is none.",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/VoiceSource",
            "description": "The level the text came from; `row` when the text-to-speech model's\nown description stands in for it."
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "source"
        ],
        "type": "object"
      },
      "Stage": {
        "description": "One speech stage.",
        "properties": {
          "alias": {
            "description": "`null`: nothing configured at any level.",
            "type": [
              "string",
              "null"
            ]
          },
          "cpu": {
            "description": "An audio model that runs on the CPU: the GPU hold does not stop it, a\nbenchmark run's lease does.",
            "type": "boolean"
          },
          "fallback": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Fallback"
              },
              {
                "type": "null"
              }
            ],
            "description": "What answers instead while the model is blocked; `null` off this\nmachine, or when the model has no usable fallback."
          },
          "fallback_unusable": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FallbackUnusable"
              },
              {
                "type": "null"
              }
            ],
            "description": "A fallback the model names that cannot stand in, and why."
          },
          "inherited": {
            "description": "What the levels below the thread give: the alias the thread uses once\nits own override is cleared; equal to `alias` when the thread sets\nnone.",
            "type": [
              "string",
              "null"
            ]
          },
          "local": {
            "description": "`false` for an alias served off this machine; `null` when the alias\ndoes not resolve.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "managed": {
            "description": "A model lmgw starts itself: the GPU hold and a benchmark run's lease\napply to it.",
            "type": "boolean"
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceSource"
              },
              {
                "type": "null"
              }
            ],
            "description": "The level `alias` came from; `null` with no alias."
          }
        },
        "required": [
          "alias",
          "source",
          "inherited",
          "local",
          "managed",
          "cpu",
          "fallback",
          "fallback_unusable"
        ],
        "type": "object"
      },
      "StageHitView": {
        "description": "One candidate as a stage saw it. `score` is BM25 (negative, lower is\nbetter), cosine, or the reranker's — read next to the stage it came from.",
        "properties": {
          "chunk_id": {
            "type": "string"
          },
          "rank": {
            "description": "1-based within the stage.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "score": {
            "description": "`null` when the embedder or reranker returned NaN, which `serde_json`\nwrites as `null`.",
            "format": "float",
            "type": [
              "number",
              "null"
            ]
          },
          "skipped": {
            "description": "Rerank stage only: the reranker did not score this candidate (its pair\nwas over the model's input limit); `score` is then its fused score and\nit ranks behind the scored ones. Absent otherwise.",
            "type": "boolean"
          }
        },
        "required": [
          "chunk_id",
          "rank",
          "score"
        ],
        "type": "object"
      },
      "Stat": {
        "description": "Median, min and max of one metric over a point's repetitions, and the raw\nvalues in repetition order.",
        "properties": {
          "max": {
            "format": "double",
            "type": "number"
          },
          "median": {
            "format": "double",
            "type": "number"
          },
          "min": {
            "format": "double",
            "type": "number"
          },
          "values": {
            "items": {
              "format": "double",
              "type": "number"
            },
            "type": "array"
          }
        },
        "required": [
          "median",
          "min",
          "max",
          "values"
        ],
        "type": "object"
      },
      "StateMode": {
        "description": "How the state is written.",
        "oneOf": [
          {
            "const": "text",
            "description": "Plain text, sent as a JSON string.",
            "type": "string"
          },
          {
            "const": "json",
            "description": "JSON text (an object, an array, `null` for the types that take no\nstate), checked to parse and sent as typed.",
            "type": "string"
          }
        ]
      },
      "StaticCaps": {
        "description": "The statically derived capabilities a `/props` read is compared with. Each\nhas the shape the `/v1/models` capabilities object gives it.",
        "properties": {
          "input_modalities": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningCaps"
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ToolCallCaps"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "reasoning",
          "tool_calls",
          "input_modalities"
        ],
        "type": "object"
      },
      "StrList": {
        "anyOf": [
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          {
            "type": "string"
          }
        ],
        "description": "A list of short names as a patch carries it (`modes`): a JSON array, or a\ncomma/whitespace-separated string for the same reason `KeyMap` takes\ntext."
      },
      "StructuredOutputCaps": {
        "additionalProperties": false,
        "description": "`response_format` support.",
        "properties": {
          "json_object": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "json_schema": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "SuiteParams": {
        "description": "What a run was asked to do. The suite constants are stored\nbeside the caller's choices, so a stored run says exactly what it measured\nwithout anyone having to know which suite version meant what.",
        "properties": {
          "generate_tokens": {
            "description": "*G*.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "mixed_inject_max_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "mixed_steady_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "needle_margin_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "phases": {
            "description": "The selected phases, in suite order; `load` is always among them.",
            "items": {
              "$ref": "#/components/schemas/Phase"
            },
            "type": "array"
          },
          "repetitions": {
            "description": "Repetitions of every point (and of the mixed phase).",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "sampling": {
            "$ref": "#/components/schemas/Sampling"
          },
          "stream_prompt_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "suite_version": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "warmup_generate_tokens": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "warmup_prompt_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "suite_version",
          "repetitions",
          "phases",
          "generate_tokens",
          "sampling",
          "stream_prompt_tokens",
          "mixed_inject_max_tokens",
          "mixed_steady_ms",
          "needle_margin_tokens",
          "warmup_prompt_tokens",
          "warmup_generate_tokens"
        ],
        "type": "object"
      },
      "SystemOneAnswer": {
        "description": "One answer, by its question's `type`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ChoiceAnswer",
            "properties": {
              "type": {
                "const": "choice",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          },
          {
            "$ref": "#/components/schemas/ScoreAnswer",
            "properties": {
              "type": {
                "const": "score",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          },
          {
            "$ref": "#/components/schemas/NoulAnswer",
            "properties": {
              "type": {
                "const": "noul",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        ]
      },
      "SystemOneQuestion": {
        "description": "One question, by its `type`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ChoiceQuestion",
            "description": "Pick one of the named options.",
            "properties": {
              "type": {
                "const": "choice",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          },
          {
            "$ref": "#/components/schemas/ScoreQuestion",
            "description": "Rate on 2 to 10 ordered levels.",
            "properties": {
              "type": {
                "const": "score",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          },
          {
            "$ref": "#/components/schemas/NoulQuestion",
            "description": "Yes or no.",
            "properties": {
              "type": {
                "const": "noul",
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        ]
      },
      "SystemOneResponse": {
        "description": "`POST /v1/systemone`'s answer, as the upstream sent it.\n\n`model` is the upstream's own: the versioned id that answered on TypeSafe\n(`jev-1.13.0`), a dated id on OpenRouter, the server's `--alias` on\nllama.cpp. lmgw does not write the requested name back; which alias\nanswered is `x-lmgw-fallback`'s to say (§2.1).",
        "properties": {
          "answers": {
            "additionalProperties": {
              "$ref": "#/components/schemas/SystemOneAnswer"
            },
            "description": "One answer per question, under the question's key.",
            "type": "object"
          },
          "id": {
            "description": "OpenRouter's extension: the generation's id.",
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": "string"
          },
          "provider": {
            "description": "OpenRouter's extension: the provider that answered.",
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/SystemOneUsage"
          }
        },
        "required": [
          "model",
          "answers",
          "usage"
        ],
        "type": "object"
      },
      "SystemOneUsage": {
        "description": "What a request processed: lmgw logs `input_tokens` as the row's prompt\ntokens and `output_tokens` as its completion tokens, and prices them from\nits own price rows (§2.6).",
        "properties": {
          "cost": {
            "description": "OpenRouter's extension: what the request cost there, in USD. Relayed,\nnever read: lmgw prices from its own rows.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "input_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "output_tokens": {
            "description": "Always 0 on llama.cpp; TypeSafe and OpenRouter report a non-zero\ncount, which Jev's price does not charge.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "type": "object"
      },
      "Takeover": {
        "description": "`?takeover=`: whether a bind may take its thread from another session.",
        "oneOf": [
          {
            "const": "always",
            "description": "Take the thread over (what a bind without the parameter does).",
            "type": "string"
          },
          {
            "const": "never",
            "description": "Never: refuse while another session is bound to the thread.",
            "type": "string"
          },
          {
            "const": "ask",
            "description": "Ask first (WebRTC calls only, realtime calls design §2.8): a thread\nheld when the call's channel opens makes the call wait,\n`lmgw.session.bind_pending`, for the client's\n`lmgw.session.take_over` or the holder's end.",
            "type": "string"
          }
        ]
      },
      "Target": {
        "description": "A device the caller can offer a file to.",
        "properties": {
          "device_id": {
            "description": "Its key id: the offer's `to_device`.",
            "format": "int64",
            "type": "integer"
          },
          "last_seen_at": {
            "description": "When one of its connections last opened or closed (RFC 3339 UTC);\n`null` for one that never connected.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "Its paired name, without `device:`.",
            "type": "string"
          },
          "online": {
            "description": "Whether it holds its Chat feed open now, so it hears an offer at\nonce.",
            "type": "boolean"
          }
        },
        "required": [
          "device_id",
          "name",
          "online",
          "last_seen_at"
        ],
        "type": "object"
      },
      "TaskForm": {
        "description": "The generic task panel's fields.",
        "properties": {
          "flags": {
            "additionalProperties": {
              "type": "boolean"
            },
            "default": {},
            "description": "Each checkbox, by the request field it sets.",
            "type": "object"
          },
          "json": {
            "default": "",
            "description": "Raw JSON merged into the request last.",
            "type": "string"
          },
          "stream": {
            "default": false,
            "description": "Send to `/v1/tasks/stream`.",
            "type": "boolean"
          },
          "values": {
            "additionalProperties": {
              "type": "string"
            },
            "default": {},
            "description": "Each field's text, by the request field it fills.",
            "type": "object"
          }
        },
        "type": "object"
      },
      "TaskRequest": {
        "properties": {
          "model": {
            "type": "string"
          },
          "request": {
            "additionalProperties": true,
            "description": "Relayed to audio.cpp's generic task endpoint untouched; its shape is the task's own and is not modeled here.",
            "type": "object"
          }
        },
        "required": [
          "model",
          "request"
        ],
        "type": "object"
      },
      "TemplateSignals": {
        "description": "What the chat template's own text says about reasoning, effort selection\nand tool-call rendering. Pure text heuristics: a template that does it\nthrough indirection reads as absent.",
        "properties": {
          "effort_default": {
            "description": "The effort it falls back to, verbatim.",
            "type": [
              "string",
              "null"
            ]
          },
          "effort_levels": {
            "description": "The effort levels it compares against, in canonical order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "effort_var_names": {
            "description": "Which effort variables it reads.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "enable_thinking_default": {
            "description": "The default of `enable_thinking`, when the template states one.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "enable_thinking_var": {
            "description": "The template reads an `enable_thinking` variable.",
            "type": "boolean"
          },
          "parallel_tool_calls": {
            "description": "The template loops over `tool_calls`: several calls per turn.",
            "type": "boolean"
          },
          "preserve_thinking_var": {
            "description": "The template reads `preserve_thinking`.",
            "type": "boolean"
          },
          "reasoning_effort_var": {
            "description": "The template reads a reasoning-effort variable of any name.",
            "type": "boolean"
          },
          "thinking_marker": {
            "description": "The first marker that matched, verbatim.",
            "type": [
              "string",
              "null"
            ]
          },
          "thinking_markers": {
            "description": "The template renders a reasoning trace somewhere.",
            "type": "boolean"
          },
          "tool_call_format": {
            "description": "The native tool-call syntax family it renders.",
            "type": [
              "string",
              "null"
            ]
          },
          "tools_var": {
            "description": "`tools` is used as a variable.",
            "type": "boolean"
          }
        },
        "required": [
          "thinking_markers",
          "thinking_marker",
          "enable_thinking_var",
          "enable_thinking_default",
          "reasoning_effort_var",
          "effort_var_names",
          "effort_levels",
          "effort_default",
          "preserve_thinking_var",
          "tools_var",
          "parallel_tool_calls",
          "tool_call_format"
        ],
        "type": "object"
      },
      "TestUsage": {
        "description": "A test call's token usage, as the model reported it.",
        "properties": {
          "completion_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "prompt_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens"
        ],
        "type": "object"
      },
      "TextCompletion": {
        "description": "Relayed as the upstream sends it.",
        "properties": {
          "choices": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "created": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "text_completion"
            ],
            "type": "string"
          },
          "usage": {
            "additionalProperties": true,
            "type": "object"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "type": "object"
      },
      "TextCompletionChunk": {
        "additionalProperties": true,
        "description": "One frame, relayed as the upstream sends it: `data: <this object>`, repeated, ending with the literal `data: [DONE]`.",
        "properties": {
          "choices": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array"
          },
          "created": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "object": {
            "enum": [
              "text_completion"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "type": "object"
      },
      "Thread": {
        "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
        "properties": {
          "agent_id": {
            "description": "The agent the thread was opened from, if any.",
            "type": [
              "string",
              "null"
            ]
          },
          "archived_at": {
            "description": "When the thread was archived; `null` while it is active.",
            "type": [
              "string",
              "null"
            ]
          },
          "continue": {
            "$ref": "#/components/schemas/ContinueState",
            "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
          },
          "created_at": {
            "type": "string"
          },
          "folder_id": {
            "description": "The folder the thread is in; `null` for none.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "description": "Negative for a temporary thread.",
            "format": "int64",
            "type": "integer"
          },
          "kb_budget_tokens": {
            "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "description": "Knowledge bases the thread searches, by id.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "kb_mode": {
            "$ref": "#/components/schemas/KbMode"
          },
          "kind": {
            "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
            "type": "string"
          },
          "last_message_at": {
            "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
            "items": {
              "$ref": "#/components/schemas/ThreadMcp"
            },
            "type": "array"
          },
          "media_defaults": {
            "$ref": "#/components/schemas/MediaDefaults",
            "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "description": "The alias the thread's turns go to.",
            "type": "string"
          },
          "pinned": {
            "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
            "type": "boolean"
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "purge_at": {
            "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "description": "Stop sequences; empty leaves the route's default.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "system_prompt": {
            "type": "string"
          },
          "temperature": {
            "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "temporary": {
            "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "updated_at": {
            "description": "Moves with every change to the thread and every new message.",
            "type": "string"
          },
          "voice": {
            "$ref": "#/components/schemas/ThreadVoice"
          },
          "voice_resolved": {
            "$ref": "#/components/schemas/VoiceResolved",
            "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
          }
        },
        "required": [
          "id",
          "title",
          "model_alias",
          "system_prompt",
          "temperature",
          "max_tokens",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "frequency_penalty",
          "seed",
          "stop",
          "kind",
          "mcp_tools",
          "reasoning_enabled",
          "reasoning_effort",
          "reasoning_budget",
          "agent_id",
          "pinned",
          "archived_at",
          "folder_id",
          "profile_id",
          "kb_ids",
          "kb_mode",
          "kb_budget_tokens",
          "voice",
          "media_defaults",
          "created_at",
          "updated_at",
          "last_message_at",
          "purge_at",
          "temporary",
          "voice_resolved"
        ],
        "type": "object"
      },
      "ThreadChanged": {
        "description": "`thread.created` / `thread.updated` for a thread that exists at delivery:\nthe thread as `GET /chat/api/threads` lists it now, with `by` beside its\nfields.",
        "properties": {
          "agent_id": {
            "description": "The agent the thread was opened from, if any.",
            "type": [
              "string",
              "null"
            ]
          },
          "archived_at": {
            "description": "When the thread was archived; `null` while it is active.",
            "type": [
              "string",
              "null"
            ]
          },
          "by": {
            "description": "Who made the change; `null` for the gateway's own, such as the sweep.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "folder_id": {
            "description": "The folder the thread is in; `null` for none.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "description": "Negative for a temporary thread.",
            "format": "int64",
            "type": "integer"
          },
          "kb_budget_tokens": {
            "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "description": "Knowledge bases the thread searches, by id.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "kb_mode": {
            "$ref": "#/components/schemas/KbMode"
          },
          "kind": {
            "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
            "type": "string"
          },
          "last_message_at": {
            "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
            "items": {
              "$ref": "#/components/schemas/ThreadMcp"
            },
            "type": "array"
          },
          "media_defaults": {
            "$ref": "#/components/schemas/MediaDefaults",
            "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "description": "The alias the thread's turns go to.",
            "type": "string"
          },
          "pinned": {
            "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
            "type": "boolean"
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "purge_at": {
            "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "description": "Stop sequences; empty leaves the route's default.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "system_prompt": {
            "type": "string"
          },
          "temperature": {
            "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "temporary": {
            "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "updated_at": {
            "description": "Moves with every change to the thread and every new message.",
            "type": "string"
          },
          "voice": {
            "$ref": "#/components/schemas/ThreadVoice"
          }
        },
        "required": [
          "id",
          "title",
          "model_alias",
          "system_prompt",
          "temperature",
          "max_tokens",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "frequency_penalty",
          "seed",
          "stop",
          "kind",
          "mcp_tools",
          "reasoning_enabled",
          "reasoning_effort",
          "reasoning_budget",
          "agent_id",
          "pinned",
          "archived_at",
          "folder_id",
          "profile_id",
          "kb_ids",
          "kb_mode",
          "kb_budget_tokens",
          "voice",
          "media_defaults",
          "created_at",
          "updated_at",
          "last_message_at",
          "purge_at",
          "temporary",
          "by"
        ],
        "type": "object"
      },
      "ThreadDefaults": {
        "description": "What a new thread in a folder starts with. Every field is optional;\n`null` is the Chat's own default. A copy is taken when a thread is\ncreated, except that an ongoing conversation's changed defaults also\nreach its current thread — and `media_defaults`, which every thread in\nthe folder reads at each turn.",
        "properties": {
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "kb_budget_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "kb_mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KbMode"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "items": {
              "$ref": "#/components/schemas/ThreadMcp"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "media_defaults": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MediaDefaults"
              },
              {
                "type": "null"
              }
            ],
            "description": "The image and audio tools' default models of every thread in the\nfolder, read at each turn rather than copied: an absent field\ninherits Settings → Chat's, an empty one is no default, and a\nthread's own wins."
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "description": "The model of a new thread; an ongoing conversation needs one.",
            "type": [
              "string",
              "null"
            ]
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "description": "The personality profile of a new thread; `null` for the Chat's own\ndefault (Settings → Chat).",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "system_prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "temperature": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "voice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ThreadVoice"
              },
              {
                "type": "null"
              }
            ],
            "description": "Voice settings, laid field by field over a new thread's."
          }
        },
        "required": [
          "model_alias",
          "system_prompt",
          "temperature",
          "max_tokens",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "frequency_penalty",
          "seed",
          "stop",
          "reasoning_enabled",
          "reasoning_effort",
          "reasoning_budget",
          "mcp_tools",
          "kb_ids",
          "kb_mode",
          "kb_budget_tokens",
          "voice",
          "profile_id",
          "media_defaults"
        ],
        "type": "object"
      },
      "ThreadDefaultsInput": {
        "description": "What a new thread in a folder starts with. Every field is optional;\n`null` is the Chat's own default. A copy is taken when a thread is\ncreated, except that an ongoing conversation's changed defaults also\nreach its current thread — and `media_defaults`, which every thread in\nthe folder reads at each turn.",
        "properties": {
          "frequency_penalty": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "kb_budget_tokens": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "default": null,
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "kb_mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KbMode"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "max_tokens": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "default": null,
            "items": {
              "$ref": "#/components/schemas/ThreadMcpInput"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "media_defaults": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MediaDefaults"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The image and audio tools' default models of every thread in the\nfolder, read at each turn rather than copied: an absent field\ninherits Settings → Chat's, an empty one is no default, and a\nthread's own wins."
          },
          "min_p": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "default": null,
            "description": "The model of a new thread; an ongoing conversation needs one.",
            "type": [
              "string",
              "null"
            ]
          },
          "presence_penalty": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "default": null,
            "description": "The personality profile of a new thread; `null` for the Chat's own\ndefault (Settings → Chat).",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_budget": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "default": null,
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "system_prompt": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "temperature": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "top_k": {
            "default": null,
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "default": null,
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "voice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ThreadVoice"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Voice settings, laid field by field over a new thread's."
          }
        },
        "type": "object"
      },
      "ThreadGone": {
        "description": "`thread.deleted`, and `thread.created` / `thread.updated` for a thread\nthat is gone by the time the event is delivered.",
        "properties": {
          "by": {
            "description": "Who made the change; `null` for the gateway's own (the sweep).",
            "type": [
              "string",
              "null"
            ]
          },
          "deleted": {
            "type": "boolean"
          },
          "thread_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "thread_id",
          "deleted",
          "by"
        ],
        "type": "object"
      },
      "ThreadMcp": {
        "description": "A tool server attached to a thread: the label it is reached by, and\noptionally the tools of it the thread uses.",
        "properties": {
          "allowed_tools": {
            "description": "The tools of that server the thread uses; `null` for all of them.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "require_approval": {
            "description": "Which of them wait for an approval before they run, in OpenAI's\nshapes: `\"never\"` (the default, also when absent), `\"always\"`, or\n`{\"always\": {\"tool_names\": […]}, \"never\": {\"tool_names\": […]}}`. A\nname may be the tool's own or its prefixed one. `read_only` is\nrefused. A gated call stops the turn; `POST\n/chat/api/threads/{id}/approvals` decides it."
          },
          "server_label": {
            "description": "A registered tool server's tool prefix (or its name when it has\nnone), or a built-in toolset such as `kb`.",
            "type": "string"
          }
        },
        "required": [
          "server_label",
          "allowed_tools"
        ],
        "type": "object"
      },
      "ThreadMcpInput": {
        "description": "A tool server attached to a thread: the label it is reached by, and\noptionally the tools of it the thread uses.",
        "properties": {
          "allowed_tools": {
            "default": null,
            "description": "The tools of that server the thread uses; `null` for all of them.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "require_approval": {
            "description": "Which of them wait for an approval before they run, in OpenAI's\nshapes: `\"never\"` (the default, also when absent), `\"always\"`, or\n`{\"always\": {\"tool_names\": […]}, \"never\": {\"tool_names\": […]}}`. A\nname may be the tool's own or its prefixed one. `read_only` is\nrefused. A gated call stops the turn; `POST\n/chat/api/threads/{id}/approvals` decides it."
          },
          "server_label": {
            "description": "A registered tool server's tool prefix (or its name when it has\nnone), or a built-in toolset such as `kb`.",
            "type": "string"
          }
        },
        "required": [
          "server_label"
        ],
        "type": "object"
      },
      "ThreadRow": {
        "description": "A Chat thread as `GET /chat/api/threads` lists it, and as the change\nfeed's `thread.created` and `thread.updated` carry it.",
        "properties": {
          "agent_id": {
            "description": "The agent the thread was opened from, if any.",
            "type": [
              "string",
              "null"
            ]
          },
          "archived_at": {
            "description": "When the thread was archived; `null` while it is active.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "folder_id": {
            "description": "The folder the thread is in; `null` for none.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "frequency_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "description": "Negative for a temporary thread.",
            "format": "int64",
            "type": "integer"
          },
          "kb_budget_tokens": {
            "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "kb_ids": {
            "description": "Knowledge bases the thread searches, by id.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "kb_mode": {
            "$ref": "#/components/schemas/KbMode"
          },
          "kind": {
            "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
            "type": "string"
          },
          "last_message_at": {
            "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "max_tokens": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "mcp_tools": {
            "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
            "items": {
              "$ref": "#/components/schemas/ThreadMcp"
            },
            "type": "array"
          },
          "media_defaults": {
            "$ref": "#/components/schemas/MediaDefaults",
            "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
          },
          "min_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "model_alias": {
            "description": "The alias the thread's turns go to.",
            "type": "string"
          },
          "pinned": {
            "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
            "type": "boolean"
          },
          "presence_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_id": {
            "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "purge_at": {
            "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_budget": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "repeat_penalty": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "seed": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "stop": {
            "description": "Stop sequences; empty leaves the route's default.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "system_prompt": {
            "type": "string"
          },
          "temperature": {
            "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "temporary": {
            "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "top_k": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "top_p": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "updated_at": {
            "description": "Moves with every change to the thread and every new message.",
            "type": "string"
          },
          "voice": {
            "$ref": "#/components/schemas/ThreadVoice"
          }
        },
        "required": [
          "id",
          "title",
          "model_alias",
          "system_prompt",
          "temperature",
          "max_tokens",
          "top_p",
          "top_k",
          "min_p",
          "repeat_penalty",
          "presence_penalty",
          "frequency_penalty",
          "seed",
          "stop",
          "kind",
          "mcp_tools",
          "reasoning_enabled",
          "reasoning_effort",
          "reasoning_budget",
          "agent_id",
          "pinned",
          "archived_at",
          "folder_id",
          "profile_id",
          "kb_ids",
          "kb_mode",
          "kb_budget_tokens",
          "voice",
          "media_defaults",
          "created_at",
          "updated_at",
          "last_message_at",
          "purge_at",
          "temporary"
        ],
        "type": "object"
      },
      "ThreadTask": {
        "description": "One of a thread's tasks: still running, or ended with its result on its\nway into the thread.",
        "properties": {
          "by": {
            "description": "Who started it (\"the dashboard\", \"device 'phone'\").",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "description": "lmgw's id of the task: the cancel route's `{task}`.",
            "format": "int64",
            "type": "integer"
          },
          "server_label": {
            "type": "string"
          },
          "started_at": {
            "description": "When it started (UTC, `YYYY-MM-DD HH:MM:SS`).",
            "type": "string"
          },
          "status": {
            "description": "`working` or `input_required` while it runs; `completed`, `failed`,\n`cancelled` or `abandoned` once it ended.",
            "enum": [
              "working",
              "input_required",
              "completed",
              "failed",
              "cancelled",
              "abandoned"
            ],
            "type": "string"
          },
          "status_message": {
            "description": "The server's last word on it, when it gave one.",
            "type": [
              "string",
              "null"
            ]
          },
          "task_id": {
            "description": "The server's id of the task.",
            "type": "string"
          },
          "tool": {
            "description": "The name the model called.",
            "type": "string"
          },
          "ttl_ms": {
            "description": "How long the server keeps it, as it stated; `null` when it stated\nnone.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "waiting_for": {
            "description": "What it waits for, when it waits: a device that is not connected\n(its tasks are asked about again when it links), a turn of the\nthread that runs (a result enters the thread once it ended), or the\ndecision on the calls the thread's last reply waits on.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "task_id",
          "server_label",
          "tool",
          "status",
          "status_message",
          "ttl_ms",
          "started_at",
          "by",
          "waiting_for"
        ],
        "type": "object"
      },
      "ThreadVoice": {
        "description": "A thread's own voice settings. Every field is optional and absent when\nunset: an absent field takes the Chat's voice settings.",
        "properties": {
          "asr_alias": {
            "description": "The speech-to-text alias for dictation, voice mode and audio\nattachments.",
            "type": [
              "string",
              "null"
            ]
          },
          "audio_input": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AudioInputMode"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "description": "The language the user speaks, a two-letter ISO 639-1 code, or `auto`\nto let the speech-to-text model detect it.",
            "type": [
              "string",
              "null"
            ]
          },
          "read_aloud": {
            "description": "Read every reply aloud as it streams.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "reply_language": {
            "description": "The language replies are in, a two-letter code, or `auto` to follow\nthe language the user speaks.",
            "type": [
              "string",
              "null"
            ]
          },
          "seed": {
            "description": "The thread's text-to-speech seed, so one thread keeps one voice on a\nmodel that draws its voice. Set on first use.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "speech_style": {
            "description": "The speaking style the text-to-speech model is given; an empty text\nis none for this thread.",
            "type": [
              "string",
              "null"
            ]
          },
          "tts_alias": {
            "description": "The text-to-speech alias for read-aloud and voice mode.",
            "type": [
              "string",
              "null"
            ]
          },
          "turn_detection": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TurnDetectionMode"
              },
              {
                "type": "null"
              }
            ]
          },
          "voice": {
            "description": "A voice of that text-to-speech model.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ThreadsFate": {
        "description": "What a folder delete does with the threads in the folder.",
        "oneOf": [
          {
            "const": "keep",
            "description": "The threads stay, in no folder.",
            "type": "string"
          },
          {
            "const": "delete",
            "description": "The threads are deleted with the folder.",
            "type": "string"
          }
        ]
      },
      "Threshold": {
        "description": "A question's threshold: an answer whose confidence (`choice`, `score`)\nor certainty, max(p, 1 − p) (`noul`), is below it needs attention.",
        "properties": {
          "measured": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Measured"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the value was measured; `null`: not measured."
          },
          "value": {
            "description": "From 0 to 1. 0 is \"never needs attention\", what an unmeasured\nquestion has.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "value",
          "measured"
        ],
        "type": "object"
      },
      "ThresholdInput": {
        "description": "A question's threshold: an answer whose confidence (`choice`, `score`)\nor certainty, max(p, 1 − p) (`noul`), is below it needs attention.",
        "properties": {
          "measured": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Measured"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the value was measured; `null`: not measured."
          },
          "value": {
            "description": "From 0 to 1. 0 is \"never needs attention\", what an unmeasured\nquestion has.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "Timeline": {
        "description": "The sampled timeline stored with a run.",
        "properties": {
          "interval_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "phases": {
            "items": {
              "$ref": "#/components/schemas/PhaseSpan"
            },
            "type": "array"
          },
          "samples": {
            "items": {
              "$ref": "#/components/schemas/TimelineSample"
            },
            "type": "array"
          }
        },
        "required": [
          "interval_ms",
          "samples",
          "phases"
        ],
        "type": "object"
      },
      "TimelineSample": {
        "description": "One stored sample (spaced `interval_ms` apart); sums over the devices,\ntemperature is the hottest one's.",
        "properties": {
          "clock_events": {
            "description": "The OR of the NVML clock-event reason bits seen since the previous stored\nsample.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "power_w": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "t_ms": {
            "description": "Since the sampler started.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "temp_c": {
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "vram_used_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "t_ms",
          "vram_used_bytes",
          "power_w",
          "temp_c",
          "clock_events"
        ],
        "type": "object"
      },
      "Timings": {
        "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
        "properties": {
          "cache_n": {
            "description": "Prompt tokens served from the KV cache.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "draft_n": {
            "description": "Draft tokens proposed (speculative or MTP decoding).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "draft_n_accepted": {
            "description": "Draft tokens accepted.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "predicted_ms": {
            "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
            "format": "double",
            "type": "number"
          },
          "predicted_n": {
            "description": "Tokens generated so far.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "predicted_per_second": {
            "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
            "format": "double",
            "type": "number"
          },
          "prompt_ms": {
            "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
            "format": "double",
            "type": "number"
          },
          "prompt_n": {
            "description": "Prompt tokens actually processed this turn (the cache excluded).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "prompt_per_second": {
            "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "prompt_n",
          "predicted_n"
        ],
        "type": "object"
      },
      "TimingsView": {
        "properties": {
          "embed_ms": {
            "format": "double",
            "type": "number"
          },
          "fetch_ms": {
            "format": "double",
            "type": "number"
          },
          "fts_ms": {
            "format": "double",
            "type": "number"
          },
          "fuse_ms": {
            "format": "double",
            "type": "number"
          },
          "knn_ms": {
            "format": "double",
            "type": "number"
          },
          "rerank_ms": {
            "format": "double",
            "type": "number"
          },
          "total_ms": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "embed_ms",
          "fts_ms",
          "knn_ms",
          "fuse_ms",
          "fetch_ms",
          "rerank_ms",
          "total_ms"
        ],
        "type": "object"
      },
      "TokenizeRequest": {
        "additionalProperties": true,
        "description": "Every key but model is forwarded to the backend's own /tokenize verbatim. Refused with 501 not_supported_error on any backend but a real llama-server — an id from a tokenizer the backend does not run would be a hidden approximation.",
        "properties": {
          "add_special": {
            "default": false,
            "type": "boolean"
          },
          "content": {
            "description": "A string, or a mixed array of strings and token ids."
          },
          "model": {
            "description": "Required: llama-server's router mode has no other way to pick a backend. A missing model is a 400 naming GET /v1/models.",
            "type": "string"
          },
          "parse_special": {
            "default": true,
            "type": "boolean"
          },
          "with_pieces": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "model"
        ],
        "type": "object"
      },
      "TokenizeResponse": {
        "properties": {
          "tokens": {
            "description": "An array of integer token ids, or — with_pieces — an array of {id, piece} (piece a string, or a byte array when it is not valid UTF-8)."
          }
        },
        "required": [
          "tokens"
        ],
        "type": "object"
      },
      "ToolArgsFrame": {
        "description": "A fragment of a call's JSON arguments, in order.",
        "properties": {
          "fragment": {
            "type": "string"
          },
          "index": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "index",
          "fragment"
        ],
        "type": "object"
      },
      "ToolCallCaps": {
        "additionalProperties": false,
        "description": "Tool-calling support.",
        "properties": {
          "format": {
            "description": "The native syntax family the template renders (`qwen-xml`,\n`hermes-json`, …), `provider` for cloud, `unknown` when the template\nrenders tools with none of the known markers. Informational.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "description": "`native` (lmgw returns structured `tool_calls`), `none` (the template\nrenders no tools; aux/audio rows), `text` (the template renders tools\nin a syntax llama-server has no parser for, so calls may arrive as\nprose the caller must read itself).",
            "type": "string"
          },
          "parallel": {
            "description": "The template can render more than one call per turn. Absent for cloud\nmodels, which publish nothing about it.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "ToolEntryView": {
        "description": "One tool the gateway can serve, with its provenance and current state.",
        "properties": {
          "available": {
            "description": "Offered right now: `enabled` **and** its source's condition holds.",
            "type": "boolean"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "disabled_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "description": "The per-tool switch (`POST /api/op/tool_set`).",
            "type": "boolean"
          },
          "moved_from": {
            "description": "The name it would have if no other source offered a tool of that\nname: set when a collision gave it its server's name as a prefix.",
            "type": [
              "string",
              "null"
            ]
          },
          "moved_reason": {
            "description": "Why it moved: who else claims `moved_from`, and whether that\nclaim is only a server's last listing (it is not connected now).",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "Fully-qualified exposed name — the key the switch is stored under.",
            "type": "string"
          },
          "plane": {
            "type": "string"
          },
          "reason": {
            "description": "Why not, when `available` is false.",
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "source_kind": {
            "description": "`builtin | server`.",
            "type": "string"
          },
          "source_label": {
            "type": "string"
          },
          "source_name": {
            "type": "string"
          },
          "stale": {
            "description": "A disable record whose tool the gateway no longer offers.",
            "type": "boolean"
          },
          "upstream_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "source_label",
          "source_name",
          "source_kind",
          "server_id",
          "plane",
          "description",
          "upstream_name",
          "moved_from",
          "moved_reason",
          "enabled",
          "available",
          "reason",
          "stale",
          "disabled_at"
        ],
        "type": "object"
      },
      "ToolProgressFrame": {
        "description": "The `progress` event of a `tool` frame: a running image or audio call's\nstage, step and latest preview. Lossy: a reader that falls behind misses\nsome (the next one supersedes them), and they are not in the change\nfeed.",
        "properties": {
          "call_id": {
            "description": "The call's id, as its `ready` frame carries it.",
            "type": "string"
          },
          "cancel": {
            "$ref": "#/components/schemas/CancelKind",
            "description": "What a cancel would do now, while an image job runs; absent before\nthe job exists (a cancel then just stops the wait) and for audio."
          },
          "done_bytes": {
            "description": "`downloading`: compressed bytes downloaded so far.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "elapsed_ms": {
            "description": "Since the call started.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "free_bytes": {
            "description": "`waiting_for_room`: the memory free when it was last measured.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "image": {
            "description": "`downloading`: the image reference being downloaded.",
            "type": "string"
          },
          "model": {
            "description": "The model the phase is about: the one being unloaded for\n`unloading`, the call's own otherwise.",
            "type": "string"
          },
          "needs_bytes": {
            "description": "`waiting_for_room`: the memory the model needs, headroom included.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "pass": {
            "description": "The sampling pass (a batch item, a high- or low-noise stage, a hires\npass); a new pass starts its steps again.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "phase": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MediaPhase"
              },
              {
                "type": "null"
              }
            ]
          },
          "preview": {
            "description": "The latest preview as the image server drew it: base64, PNG. Its\npixel size depends on the row's preview mode (a quick sketch is the\nlatent's size, an eighth of the picture's side on the spike's\npipeline).",
            "type": "string"
          },
          "queue_position": {
            "description": "`queued`: the job's place in the image server's queue.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "size_note": {
            "description": "`downloading`: why the size is not known, when it is not (\"size not\nknown — …\").",
            "type": "string"
          },
          "step": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "total_bytes": {
            "description": "`downloading`: the download's whole size; absent when it is not\nknown.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "total_steps": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "call_id",
          "phase",
          "elapsed_ms"
        ],
        "type": "object"
      },
      "ToolReadyFrame": {
        "description": "A Chat `tool` frame whose `event` is `ready` (also the `data` of a bound\nrealtime session's `lmgw.chat.frame` for it): a call's arguments are\ncomplete, before it runs — what a host that shows the call's view at once\nneeds (client-apps design §7.5).",
        "properties": {
          "arguments": {
            "description": "The call's arguments."
          },
          "call_id": {
            "description": "The call's id, as its `result` frame carries it.",
            "type": [
              "string",
              "null"
            ]
          },
          "index": {
            "description": "The call's position in its turn.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "description": "The tool's exposed name, as the model called it.",
            "type": "string"
          },
          "needs_approval": {
            "description": "The call waits for an approval and does not run now: an `approval`\nframe follows. `false` for a call that runs (a resumed turn's decided\ncalls included). Absent from an lmgw before 2026-10-09.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "server_label": {
            "description": "The label the tool came from; `null` for a client's own function.",
            "type": [
              "string",
              "null"
            ]
          },
          "ui_resource": {
            "description": "The UI resource the tool links to, as on the result frame.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "index",
          "name",
          "arguments",
          "call_id",
          "server_label",
          "needs_approval",
          "ui_resource"
        ],
        "type": "object"
      },
      "ToolResultFrame": {
        "description": "A Chat `tool` frame whose `event` is `result` (also the `data` of a\nbound realtime session's `lmgw.chat.frame` for it), as an MCP Apps host\nreads it. MCP's `CallToolResult` for the view is `{content,\nstructuredContent: structured_content, isError: is_error}`.",
        "properties": {
          "attachments": {
            "description": "The files the call stored in the thread — an image or audio tool's\npictures and recordings in a Chat turn — so a page shows them\nwithout reading the thread again. Their bytes are at\n`GET /chat/api/attachments/{id}`; `content` names them as\n`lmgw:attachment/N` resources. Empty for every other call.",
            "items": {
              "$ref": "#/components/schemas/AttachmentMeta"
            },
            "type": "array"
          },
          "call_id": {
            "description": "The call's id, as its `ready` frame carries it.",
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "description": "The MCP result's `content` blocks as the server sent them (resource\nURIs namespaced as `/mcp` sends them; images in full — no bound of\nlmgw's own, a device's result is bounded by `mcp.host_max_message_mb`\non its link); a tool lmgw runs itself, or a call that never reached\na server, says its result in the same shape. Absent from an lmgw\nbefore 2026-10-09: `output` as one text block then.",
            "items": true,
            "type": [
              "array",
              "null"
            ]
          },
          "index": {
            "description": "The call's position in its turn.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "is_error": {
            "type": "boolean"
          },
          "ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "description": "The tool's exposed name (`<prefix>__<tool>`).",
            "type": "string"
          },
          "output": {
            "description": "The result as text.",
            "type": "string"
          },
          "server_label": {
            "description": "The label the tool came from: a server's tool prefix (else its\nname), or a built-in toolset's (`lmgw`, `docs`, `kb`).",
            "type": [
              "string",
              "null"
            ]
          },
          "structured_content": {
            "description": "The MCP result's `structuredContent`, for the view. The model was\ngiven it only when `content` is empty."
          },
          "task": {
            "$ref": "#/components/schemas/ResultTask",
            "description": "For a call that started an MCP task: which. Absent otherwise."
          },
          "ui_resource": {
            "description": "The UI resource the tool links to (`_meta.ui.resourceUri`),\nnamespaced as `/mcp` serves it: `resources/read` it there.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "index",
          "name",
          "output",
          "is_error",
          "ms",
          "server_label",
          "ui_resource",
          "structured_content",
          "content",
          "call_id"
        ],
        "type": "object"
      },
      "ToolSourceView": {
        "description": "One source of tools, so a source that currently offers none (a disabled\nserver, self-admin off, a server that has not connected) is still visible\nwith the reason: the per-tool rows cannot carry that.",
        "properties": {
          "available": {
            "type": "boolean"
          },
          "disabled_count": {
            "description": "How many of those the owner has switched off.",
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`builtin | server`.",
            "type": "string"
          },
          "label": {
            "description": "The label a thread or a `{\"type\":\"mcp\"}` block attaches: `lmgw`, `docs`,\nor a server's prefix/name.",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "plane": {
            "description": "`/mcp` or `/mcp/admin`.",
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "tool_count": {
            "description": "Tools this source contributes to the inventory right now.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "label",
          "name",
          "kind",
          "server_id",
          "plane",
          "available",
          "reason",
          "tool_count",
          "disabled_count"
        ],
        "type": "object"
      },
      "ToolStartFrame": {
        "description": "A tool call starting to stream: its position and name.",
        "properties": {
          "id": {
            "description": "The model's id of the call; only a turn without tools says it.",
            "type": "string"
          },
          "index": {
            "description": "The call's position in its turn.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "description": "The tool's exposed name.",
            "type": "string"
          }
        },
        "required": [
          "index",
          "name"
        ],
        "type": "object"
      },
      "TranscribedClip": {
        "description": "One clip `voice_transcribe` wrote a transcript for.",
        "properties": {
          "answered_by": {
            "description": "The fallback alias that answered in place of the one asked, else `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "by": {
            "description": "Who wrote it, in a sentence.",
            "type": "string"
          },
          "chars": {
            "description": "The transcript's length in characters.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "clip": {
            "description": "The clip's file name.",
            "type": "string"
          },
          "fallback_reason": {
            "description": "Why the fallback answered (`hold`, `external_vram`, ...), else `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "transcript_source": {
            "description": "`asr:<model>`: the model the transcript came from. When a fallback\nanswered, that model's name.",
            "type": "string"
          }
        },
        "required": [
          "clip",
          "chars",
          "transcript_source",
          "answered_by",
          "fallback_reason",
          "by"
        ],
        "type": "object"
      },
      "Transfer": {
        "description": "A transfer, as every route and `transfer.updated` answer it.",
        "properties": {
          "app_id": {
            "description": "The app id the offer names; the receiver declared it at pairing.",
            "type": "string"
          },
          "created_at": {
            "description": "RFC 3339 UTC.",
            "type": "string"
          },
          "end_reason": {
            "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
            "type": [
              "string",
              "null"
            ]
          },
          "ended_at": {
            "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
            "type": "string"
          },
          "filename": {
            "description": "The receiver's name for the file.",
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/TransferParty"
          },
          "id": {
            "description": "Opaque: 32 random lowercase hex digits.",
            "type": "string"
          },
          "kind": {
            "description": "The app's own word for what the file is.",
            "type": "string"
          },
          "received": {
            "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "sha256": {
            "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
            "type": "string"
          },
          "size": {
            "description": "The file's size in bytes.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "state": {
            "$ref": "#/components/schemas/TransferState"
          },
          "title": {
            "description": "What the card and the receiver show; may be empty.",
            "type": "string"
          },
          "to": {
            "$ref": "#/components/schemas/TransferParty"
          }
        },
        "required": [
          "id",
          "app_id",
          "kind",
          "title",
          "filename",
          "size",
          "sha256",
          "from",
          "to",
          "state",
          "received",
          "created_at",
          "expires_at",
          "ended_at",
          "end_reason"
        ],
        "type": "object"
      },
      "TransferParty": {
        "description": "One side of a transfer: the device by its key id, as the owner's\n`KeyRow` shows it, and its paired name without `device:`, as it was when\nthe offer was made.",
        "properties": {
          "device_id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "device_id",
          "name"
        ],
        "type": "object"
      },
      "TransferRole": {
        "description": "`GET /transfers/api/transfers`' `role` (a device's).",
        "oneOf": [
          {
            "const": "incoming",
            "description": "Offered to the caller (from `ready` on).",
            "type": "string"
          },
          {
            "const": "outgoing",
            "description": "Offered by the caller.",
            "type": "string"
          }
        ]
      },
      "TransferState": {
        "anyOf": [
          {
            "const": "uploading",
            "description": "Offered; the sender uploads its bytes. The receiver does not see it.",
            "type": "string"
          },
          {
            "const": "ready",
            "description": "Every byte arrived and its sha256 matched: offered to the receiver.",
            "type": "string"
          },
          {
            "const": "delivered",
            "description": "The receiver said it got the bytes; they are deleted.",
            "type": "string"
          },
          {
            "const": "declined",
            "description": "The receiver declined it; the bytes are deleted.",
            "type": "string"
          },
          {
            "const": "canceled",
            "description": "The sender or the owner canceled it, or a party device was disabled\nor deleted; the bytes are deleted.",
            "type": "string"
          },
          {
            "const": "expired",
            "description": "Not delivered by `expires_at`; the bytes are deleted.",
            "type": "string"
          },
          {
            "const": "failed",
            "description": "The uploaded bytes' sha256 was not the offer's; they are deleted.",
            "type": "string"
          }
        ],
        "description": "A transfer's state (§1)."
      },
      "TurnDetectionMode": {
        "anyOf": [
          {
            "const": "semantic_vad",
            "description": "A turn model decides when the speaker is done.",
            "type": "string"
          },
          {
            "const": "server_vad",
            "description": "Silence windows only.",
            "type": "string"
          },
          {
            "const": "push_to_talk",
            "description": "A turn is what is spoken while the talk key is held.",
            "type": "string"
          }
        ],
        "description": "How voice mode detects the end of the user's turn."
      },
      "UnpricedHostedTool": {
        "description": "Traffic a hosted tool's fees left unpriced (openai egress design §6.1): a\nnative `/v1/responses` answer whose upstream ran a tool that bills beyond\nits tokens (web search, file search, a code-interpreter container, image\ngeneration). lmgw has no price unit for those fees yet, so such a row\ncosts nothing anyone can name and counts toward no budget; no price row\nfixes it. Read from the request log, so its retention bounds how far back\n`requests` reaches.",
        "properties": {
          "calls": {
            "description": "Each billable call's output item type (`web_search_call`, …) with how\nmany of them those requests made.",
            "items": {
              "$ref": "#/components/schemas/HostedCallCount"
            },
            "type": "array"
          },
          "name": {
            "description": "The alias the requests asked for.",
            "type": "string"
          },
          "requests": {
            "description": "Requests left unpriced for their hosted calls, since `since`.",
            "format": "int64",
            "type": "integer"
          },
          "scope_key": {
            "description": "The upstream model that answered: `<upstream_id>:<upstream_model_id>`.",
            "type": "string"
          },
          "since": {
            "description": "When the first of them was logged (UTC, `YYYY-MM-DD HH:MM:SS`).",
            "type": "string"
          }
        },
        "required": [
          "name",
          "scope_key",
          "calls",
          "requests",
          "since"
        ],
        "type": "object"
      },
      "UnpricedModel": {
        "description": "One model that resolves to no price at all — an entry on the \"why is my\nspend incomplete\" worklist.\n\n`requests` is what it has already cost that nobody can name, from the\nrollup. A configured alias that has never been called is still listed, at\n`0`: it is about to be the same problem.",
        "properties": {
          "name": {
            "type": "string"
          },
          "requests": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "name",
          "requests"
        ],
        "type": "object"
      },
      "UnpricedTier": {
        "description": "Traffic an OpenAI service tier left unpriced: a model that answered at a\ntier it has no price row for (openai egress design §5.6). It counts\ntoward no budget until a row of that tier is entered. Read from the\nrequest log, so its retention bounds how far back `requests` reaches.",
        "properties": {
          "missing_units": {
            "description": "The units (`per_mtok`, …) the row to enter has to price: those with\na row at another tier and none at this one. Empty with no tier.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "description": "The alias the requests asked for.",
            "type": "string"
          },
          "reported": {
            "description": "What the answers reported when that names no price tier: `auto`, or\nempty for an answer that named none. Empty beside a `service_tier`.\nThere is no price action for such a group; it is listed so the\nunpriced traffic can be found.",
            "type": "string"
          },
          "requests": {
            "description": "Requests answered at that tier and left unpriced, since `since`.",
            "format": "int64",
            "type": "integer"
          },
          "scope_key": {
            "description": "The price scope a row for it would take: the alias, or\n`<upstream_id>:<upstream_model_id>`.",
            "type": "string"
          },
          "scope_kind": {
            "type": "string"
          },
          "service_tier": {
            "description": "The price tier with no row (`flex`, `fast`, …). Empty when the\nanswers reported no tier a row can be entered for (`reported`).",
            "type": "string"
          },
          "since": {
            "description": "When the first of them was logged (UTC, `YYYY-MM-DD HH:MM:SS`).",
            "type": "string"
          }
        },
        "required": [
          "name",
          "scope_key",
          "scope_kind",
          "service_tier",
          "reported",
          "missing_units",
          "requests",
          "since"
        ],
        "type": "object"
      },
      "UpdateStatus": {
        "description": "A build's update badge state: the result of the periodic (or\n\"Check now\") comparison of the resolved ref and extras against the last\nverified run.\n\n`Some` on a build view once the build has been checked against a run it\ncan be compared with; `None` before its first check, and for a build with\nno succeeded (or unverified) run. A status with no `reasons` is **up to\ndate as of `checked_at`** — `has_update` is what the Engines nav\nbadge counts. What could not be checked is in `errors`, never in `reasons`:\na rate-limited forge is not an update.\n\nThe server re-evaluates the stored remote facts against the build and its\nruns on every read, so a run that builds the new head clears \"master moved\"\nat once, and an edit shows \"definition changed since last run\" at once —\nneither waits for the next check.",
        "properties": {
          "checked_at": {
            "description": "When the remote facts behind this status were fetched (RFC 3339).",
            "type": "string"
          },
          "errors": {
            "description": "What the check could not find out, one sentence each, starting\n`check failed:` — a forge's rate limit (with its reset time), a remote\nthat did not answer, a ref that no longer exists. Shown, never counted\nas an update.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "extras": {
            "items": {
              "$ref": "#/components/schemas/ExtraChange"
            },
            "type": "array"
          },
          "reasons": {
            "description": "Human sentences, one per reason (`\"master +37 commits\"`,\n`\"master moved (abc1234 → def5678)\"` when the count is not known\nwithout fetching, `\"PR #1234 pushed\"`, `\"PR #1234 closed unmerged\"`,\n`\"definition changed since last run (ref, extras)\"`). A PR the forge\nreports merged reads `\"PR #1234 merged upstream and contained in your\nbase — drop it\"` only once the base is proven (locally, no fetch) to\nalready hold its merge or head commit; otherwise `\"PR #1234 merged\nupstream at <date>; your base doesn't contain it yet — it's still\nmerged into your build\"` — the same non-committal wording whether that\nwas proven false or is simply unknown.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "ref_moved": {
            "description": "The base `ref` itself moved (a branch or tag; a pinned commit never\nupdates).",
            "type": "boolean"
          }
        },
        "required": [
          "checked_at",
          "reasons",
          "ref_moved",
          "extras",
          "errors"
        ],
        "type": "object"
      },
      "UploadChoice": {
        "description": "Another upload of the card's model.",
        "properties": {
          "downloads": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "gated": {
            "type": "boolean"
          },
          "likes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "plain": {
            "description": "A plain upload (the original's name, D16); a renamed one (an MTP\nvariant, an abliterated one) when false.",
            "type": "boolean"
          },
          "private": {
            "type": "boolean"
          },
          "repo": {
            "type": "string"
          }
        },
        "required": [
          "repo",
          "likes",
          "downloads",
          "gated",
          "private",
          "plain"
        ],
        "type": "object"
      },
      "UploadItem": {
        "description": "One uploaded file's fate.",
        "properties": {
          "file": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KnowledgeFile"
              },
              {
                "type": "null"
              }
            ],
            "description": "The stored file; absent for a refused one."
          },
          "name": {
            "description": "The name the part carried.",
            "type": "string"
          },
          "outcome": {
            "$ref": "#/components/schemas/UploadVerdict"
          },
          "reason": {
            "description": "Why it was not added, or what it replaced.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "outcome",
          "file",
          "reason"
        ],
        "type": "object"
      },
      "UploadVerdict": {
        "description": "What became of one uploaded file.",
        "oneOf": [
          {
            "const": "added",
            "description": "Stored and queued for ingest.",
            "type": "string"
          },
          {
            "const": "replaced",
            "description": "A file of that name existed; its content was replaced and queued again.",
            "type": "string"
          },
          {
            "const": "unchanged",
            "description": "The same name with the same bytes: nothing to do.",
            "type": "string"
          },
          {
            "const": "duplicate",
            "description": "The same bytes already in the base under another name.",
            "type": "string"
          },
          {
            "const": "refused",
            "description": "Not stored; `reason` says why (images and audio are refused, as is an\nempty or unreadable file).",
            "type": "string"
          }
        ]
      },
      "UpstreamChain": {
        "description": "One remote upstream's exposure path.",
        "properties": {
          "aliases": {
            "description": "Enabled explicit aliases pointing at this upstream.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "expose_all": {
            "description": "Whole catalog passed through under `prefix`.",
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "protocol": {
            "description": "`openai | anthropic | gemini`.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "protocol",
          "enabled",
          "expose_all",
          "prefix",
          "aliases"
        ],
        "type": "object"
      },
      "UpstreamLlamaFacts": {
        "description": "What an external llama.cpp server said about itself, or a router about\none model (`GET /props`). Asked in the\nbackground, one probe per row at a time, and kept until the row is\nedited, unreachable, refuses a medium or is tested.",
        "properties": {
          "base_url": {
            "description": "The base URL it was asked at.",
            "type": "string"
          },
          "cached": {
            "description": "The answer stands until an event drops it. `false` for a probe that\nfound nothing worth keeping (a router that has not loaded the model,\na server that did not answer): it is asked again on the next use.",
            "type": "boolean"
          },
          "model": {
            "description": "Empty for the server itself: a llama-server that is no router serves\none model whatever a request names, so its facts hold for every model\nof the row. Under a router, the upstream model this entry is about,\nas the row's aliases (or an `expose_all` request) name it.",
            "type": "string"
          },
          "probing": {
            "description": "Being asked now, or waiting for the row's probe.",
            "type": "boolean"
          },
          "props": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LlamaProps"
              },
              {
                "type": "null"
              }
            ],
            "description": "The facts, when the server stated them: its build, one slot's\ncontext and its modalities. `None` is unknown; `unknown` says why."
          },
          "read_at": {
            "description": "Unix seconds of the answer shown; `None` while the first is on its way.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "router": {
            "description": "The server is a llama-server router (only on the entry with an empty\n`model`): it states its build and nothing about a model, so `props`\ncarries the build alone, and the facts are on the per-model entries.\nDefaulted, so a gateway older than the field still parses.",
            "type": "boolean"
          },
          "unknown": {
            "description": "Why the facts are unknown: the server's own answer (an old build's\n404, a 401), or why the last probe found nothing.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "model",
          "base_url",
          "router",
          "props",
          "unknown",
          "cached",
          "read_at",
          "probing"
        ],
        "type": "object"
      },
      "UpstreamModelEntry": {
        "description": "One entry of an upstream's live catalog (`catalog::ModelInfo`), including\nthe entries hidden from `/v1/models` — which is why the dashboard reads\nthis rather than `/v1/models`. Every field the catalog does not publish is\n`None`: unknown, never a default.",
        "properties": {
          "context_length": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "created": {
            "description": "Unix seconds.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "description": "Bare, as the upstream names it (no expose prefix).",
            "type": "string"
          },
          "input_modalities": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "max_output_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "price_completion": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_prompt": {
            "description": "USD per token, the upstream's verbatim decimal string.",
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning": {
            "description": "`levels` | `toggle` | `fixed`.",
            "type": [
              "string",
              "null"
            ]
          },
          "reasoning_enabled": {
            "description": "Whether it thinks by default, where the catalog says — what tells a\n`fixed` model that always reasons from one that never does.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "task": {
            "description": "`chat` | `embedding`.",
            "type": [
              "string",
              "null"
            ]
          },
          "tools": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "context_length",
          "max_output_tokens",
          "price_prompt",
          "price_completion",
          "created",
          "input_modalities",
          "task",
          "tools",
          "reasoning",
          "reasoning_enabled"
        ],
        "type": "object"
      },
      "UpstreamPriceSync": {
        "description": "What a price sync did to one upstream.",
        "properties": {
          "error": {
            "description": "The catalog fetch failed; nothing was synced for this upstream. Not\nfatal to the run as a whole — one unreachable provider should not stop\nevery other upstream's prices from refreshing. `null` when it was\nasked.",
            "type": [
              "string",
              "null"
            ]
          },
          "not_synced": {
            "additionalProperties": {
              "format": "uint",
              "minimum": 0,
              "type": "integer"
            },
            "description": "Per field of the catalog's pricing object, how many models had their\ntoken prices synced here and publish that field with a value other\nthan zero that went into no row. Left out on purpose: `image` (a\nprice per *input* image, not a generated one),\n`web_search` (no route carries a hosted search), and the fields lmgw\ndoes not model, such as `internal_reasoning`, `image_output`,\n`overrides` or `discount`. Also a `request` fee or cache rate that is\nnot a price (`\"-1\"`, unparseable). A model counted in\n`unpriced_models` had nothing synced and is not counted here again.\nEmpty when nothing published was left out.",
            "type": "object"
          },
          "rows_removed": {
            "description": "Catalog `per_request` rows deleted because their model, priced here,\nno longer publishes a `request` fee at all.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "rows_written": {
            "description": "Rows created or updated: one `per_mtok` row per priced model and\nscope, and a `per_request` row beside it where the catalog states a\nfee.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "unpriced_models": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "upstream": {
            "type": "string"
          },
          "upstream_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "upstream_id",
          "upstream",
          "rows_written",
          "rows_removed",
          "unpriced_models",
          "not_synced",
          "error"
        ],
        "type": "object"
      },
      "UpstreamQuota": {
        "description": "What lmgw remembers of an upstream's exhausted quota (openai egress\ndesign §14.6). In memory: a restart forgets it.",
        "properties": {
          "code": {
            "description": "The provider's code (`insufficient_quota`,\n`credit_balance_exhausted`, …), when it sent one.",
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "description": "The provider's message, verbatim.",
            "type": "string"
          },
          "next_check": {
            "description": "Unix seconds of the next check: the next request after it goes to\nthe upstream again. The upstream's `Retry-After` when it sent one,\notherwise `quota_recheck_seconds` after the answer.",
            "format": "int64",
            "type": "integer"
          },
          "since": {
            "description": "Unix seconds of the first quota answer since it was last clear.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "since",
          "code",
          "message",
          "next_check"
        ],
        "type": "object"
      },
      "UpstreamQuotaStatus": {
        "description": "An upstream lmgw remembers out of quota, as `GET /api/status` lists it.",
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "quota": {
            "$ref": "#/components/schemas/UpstreamQuota"
          }
        },
        "required": [
          "id",
          "name",
          "quota"
        ],
        "type": "object"
      },
      "UpstreamView": {
        "properties": {
          "base_url": {
            "type": "string"
          },
          "catalog_all_modalities": {
            "description": "The catalog request asks for every output modality\n(`GET …/models?output_modalities=all`), so OpenRouter lists its\ndecision, embedding, rerank, speech, transcription, image and video\nmodels too. Only an `openai_compatible` row of kind `generic` sends\nit; on by default, off for an endpoint that refuses it (Gemini's\nOpenAI-compatible one).",
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "expose_all": {
            "type": "boolean"
          },
          "expose_prefix": {
            "type": "string"
          },
          "extra_headers": {
            "description": "Names only; values are redacted server-side.",
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "string"
                },
                {
                  "type": "string"
                }
              ],
              "type": "array"
            },
            "type": "array"
          },
          "has_api_key": {
            "type": "boolean"
          },
          "host_note": {
            "description": "Set on an `openai` row whose host is not api.openai.com or a\nregional `*.api.openai.com` one: lmgw sends it the OpenAI platform's\nown dialect, which another provider may refuse. The same note the\nwrite and the Test answer with. `None` on every other row.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "`generic | llama_server | audio_cpp`. `llama_server` goes with\nprotocol `llama_cpp` or `anthropic`; `audio_cpp` (an external\naudio.cpp server) with `openai_compatible`.",
            "type": "string"
          },
          "llama_facts": {
            "description": "A `llama_cpp` row's server: what `GET /props` said, when, or why it\nis unknown — one entry for the server, and for a router one more per\nmodel (its `model`). Empty on every other protocol,\nand on a `llama_cpp` row until a chat request or its Test makes lmgw\nask in the background.",
            "items": {
              "$ref": "#/components/schemas/UpstreamLlamaFacts"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "protocol": {
            "description": "`openai | openai_compatible | anthropic | gemini | llama_cpp`.\n`openai` is the OpenAI platform (api.openai.com) only and always kind\n`generic`; `openai_compatible` is every other OpenAI-shaped provider.\n`llama_cpp` is llama.cpp's own server (llama-server, ik_llama.cpp) and\nis always kind `llama_server`.",
            "type": "string"
          },
          "quota": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UpstreamQuota"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set while lmgw remembers the row out of quota (openai egress design\n§14.6): its account answered `insufficient_quota`, so models and\naliases on it that have a fallback answer with the fallback until\nthe next check. `None` otherwise."
          },
          "supports_responses": {
            "description": "`/v1/responses` is forwarded to it natively rather than synthesized\nfrom `/v1/chat/completions`. A choice on `openai_compatible` rows only:\nimplied on `openai`, and `false` on every other protocol.",
            "type": "boolean"
          },
          "timeout_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "protocol",
          "kind",
          "base_url",
          "has_api_key",
          "extra_headers",
          "timeout_ms",
          "enabled",
          "expose_all",
          "expose_prefix",
          "supports_responses",
          "catalog_all_modalities",
          "host_note",
          "llama_facts",
          "quota"
        ],
        "type": "object"
      },
      "UsageCell": {
        "description": "One (bucket, series) cell.\n\nMoney is integer **micro-units** of the configured currency everywhere on\nthis plane; a float that has been through JSON twice does not add up.",
        "properties": {
          "audio_in_ms": {
            "description": "What the requests processed besides tokens, as **measured** or\nreported by the provider: input audio in milliseconds, input\ncharacters, generated images. A request that measured nothing adds 0,\nso these are measured totals, and before the series' `units_since`\nnothing was recorded at all.",
            "format": "int64",
            "type": "integer"
          },
          "bucket": {
            "description": "Local-time bucket label: `2026-09-18`, `2026-09-18T14`, `2026-W38`, `2026-09`.",
            "type": "string"
          },
          "cache_n": {
            "format": "int64",
            "type": "integer"
          },
          "chars_in": {
            "format": "int64",
            "type": "integer"
          },
          "cost_micro": {
            "format": "int64",
            "type": "integer"
          },
          "cost_unknown_audio_in_ms": {
            "description": "The same quantities of the requests `cost_unknown_requests` counts,\nso the remainder can say what it holds beside its tokens.",
            "format": "int64",
            "type": "integer"
          },
          "cost_unknown_chars_in": {
            "format": "int64",
            "type": "integer"
          },
          "cost_unknown_images_out": {
            "format": "int64",
            "type": "integer"
          },
          "cost_unknown_requests": {
            "description": "What `cost_micro` does **not** cover. Every total that is displayed is\nobliged to show this beside it — a cost figure with a\nsilent hole in it is worse than no cost figure.",
            "format": "int64",
            "type": "integer"
          },
          "cost_unknown_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "decode_ms": {
            "format": "double",
            "type": "number"
          },
          "decode_tokens": {
            "description": "Local-model throughput as a ratio pair: tok/s is Σtokens / Σms, never a\nmean of per-request rates.",
            "format": "int64",
            "type": "integer"
          },
          "draft_accepted": {
            "format": "int64",
            "type": "integer"
          },
          "draft_n": {
            "format": "int64",
            "type": "integer"
          },
          "errors": {
            "format": "int64",
            "type": "integer"
          },
          "images_out": {
            "format": "int64",
            "type": "integer"
          },
          "prefill_ms": {
            "format": "double",
            "type": "number"
          },
          "prompt_n": {
            "format": "int64",
            "type": "integer"
          },
          "refusals": {
            "format": "int64",
            "type": "integer"
          },
          "requests": {
            "format": "int64",
            "type": "integer"
          },
          "series": {
            "description": "The series key this cell belongs to (`\"\"` when ungrouped).",
            "type": "string"
          },
          "tokens_cache_write": {
            "description": "Input written *into* the prompt cache — Anthropic's 1.25x tier, the\ndearest input a window can contain. Zero everywhere else, because no\nother provider bills a cache write.",
            "format": "int64",
            "type": "integer"
          },
          "tokens_cached": {
            "description": "Input served from the provider's prompt cache, billed at the cheap\nread rate.",
            "format": "int64",
            "type": "integer"
          },
          "tokens_in": {
            "description": "**Total** input, cache included — the same meaning `ir::Usage`'s\n`prompt_tokens` carries, so fresh (uncached) input is\n`tokens_in - tokens_cached - tokens_cache_write` and never a fourth\nstored number that could drift from the other three.",
            "format": "int64",
            "type": "integer"
          },
          "tokens_out": {
            "format": "int64",
            "type": "integer"
          },
          "tokens_reasoning": {
            "format": "int64",
            "type": "integer"
          },
          "total_count": {
            "format": "int64",
            "type": "integer"
          },
          "total_sum": {
            "format": "int64",
            "type": "integer"
          },
          "ttfb_count": {
            "format": "int64",
            "type": "integer"
          },
          "ttfb_sum": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "bucket",
          "series",
          "requests",
          "tokens_in",
          "tokens_out",
          "tokens_cached",
          "tokens_cache_write",
          "tokens_reasoning",
          "cost_micro",
          "cost_unknown_requests",
          "cost_unknown_tokens",
          "errors",
          "refusals",
          "ttfb_sum",
          "ttfb_count",
          "total_sum",
          "total_count",
          "decode_tokens",
          "decode_ms",
          "prefill_ms",
          "prompt_n",
          "cache_n",
          "draft_n",
          "draft_accepted",
          "audio_in_ms",
          "chars_in",
          "images_out",
          "cost_unknown_audio_in_ms",
          "cost_unknown_chars_in",
          "cost_unknown_images_out"
        ],
        "type": "object"
      },
      "UsedBy": {
        "description": "What uses a profile, computed when it is read: what a delete would\nclear.",
        "properties": {
          "folders": {
            "description": "Folders whose defaults name it.",
            "items": {
              "$ref": "#/components/schemas/FolderRef"
            },
            "type": "array"
          },
          "threads": {
            "description": "Stored threads that picked it, archived ones included.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "threads",
          "folders"
        ],
        "type": "object"
      },
      "Variant": {
        "description": "What a cell sends: the form as written, or one of the two perturbations\n(labs-store design §2.6).",
        "oneOf": [
          {
            "enum": [
              "as_written"
            ],
            "type": "string"
          },
          {
            "const": "no_descriptions",
            "description": "Every `choice` description `null`, and no `noul` criteria.",
            "type": "string"
          },
          {
            "const": "reversed",
            "description": "Each `choice` question's options in reverse.",
            "type": "string"
          }
        ]
      },
      "Verdict": {
        "description": "How one metric moved (by the regression rule).",
        "oneOf": [
          {
            "enum": [
              "regression",
              "improvement"
            ],
            "type": "string"
          },
          {
            "const": "same",
            "description": "Within the band: max(threshold, noise).",
            "type": "string"
          },
          {
            "const": "missing",
            "description": "One of the two runs did not measure it.",
            "type": "string"
          },
          {
            "const": "not_same_point",
            "description": "Both runs measured it, but at different points — another prompt\nlength, depth or stream count, as when one run stopped early. The delta is kept as\ninformation; it is no verdict, so\nit counts neither as a regression nor as an improvement.",
            "type": "string"
          }
        ]
      },
      "VoiceCandidate": {
        "description": "One rendered candidate.",
        "properties": {
          "bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "duration_ms": {
            "description": "Its length, read from its WAV header; `None` for audio that is no\nPCM WAV.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "index": {
            "description": "Its number in the round, from 1.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "mime": {
            "description": "Its content type (`audio/wav`).",
            "type": "string"
          },
          "seed": {
            "description": "The seed it was sent; `None` when no seed reached the model.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "url": {
            "description": "Where it plays: `GET` this path.",
            "type": "string"
          }
        },
        "required": [
          "index",
          "seed",
          "duration_ms",
          "bytes",
          "mime",
          "url"
        ],
        "type": "object"
      },
      "VoiceClipFailed": {
        "description": "One clip `voice_transcribe` could not transcribe.",
        "properties": {
          "clip": {
            "type": "string"
          },
          "error": {
            "description": "Why.",
            "type": "string"
          }
        },
        "required": [
          "clip",
          "error"
        ],
        "type": "object"
      },
      "VoiceDescriptionMode": {
        "description": "What a text-to-speech model does with a voice description (the speech\nroute's `instructions`) — `capabilities.speech.instructions`.",
        "oneOf": [
          {
            "const": "none",
            "description": "Not read: a description would be dropped on the way.",
            "type": "string"
          },
          {
            "const": "style",
            "description": "A speaking style for the voice it speaks.",
            "type": "string"
          },
          {
            "const": "voice_design",
            "description": "The voice is designed from it.",
            "type": "string"
          },
          {
            "const": "passthrough",
            "description": "Sent; the model decides what it does with it (OmniVoice designs a\nvoice from it, a cloud model nobody described reads it as it reads\ninstructions).",
            "type": "string"
          }
        ]
      },
      "VoiceModels": {
        "description": "The models one spoken turn went through.",
        "properties": {
          "asr": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServedModel"
              },
              {
                "type": "null"
              }
            ]
          },
          "chat": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServedModel"
              },
              {
                "type": "null"
              }
            ]
          },
          "tts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServedModel"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "asr",
          "chat",
          "tts"
        ],
        "type": "object"
      },
      "VoiceName": {
        "description": "The voice the text-to-speech model is asked for.",
        "properties": {
          "inherits": {
            "description": "Settings → Realtime's default voice, when no name is named: applied by\nvoice mode, never sent as the voice.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The voice to ask for; `null`: none is named, and voice mode's own\nchain decides.",
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "description": "Why a voice set at a less specific level is not used here.",
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceSource"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where `name` came from. With no name, `realtime` when Settings →\nRealtime's default voice is where that chain starts, else `null`."
          }
        },
        "required": [
          "name",
          "source",
          "inherits",
          "note"
        ],
        "type": "object"
      },
      "VoiceProblem": {
        "description": "Something that blocks a voice feature.",
        "properties": {
          "code": {
            "description": "`not_configured`, `unresolved`, or `voice_needs_transcript` (a voice\nclip the text-to-speech model cannot clone without its transcript).",
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "stage": {
            "description": "`asr` or `tts`.",
            "type": "string"
          }
        },
        "required": [
          "stage",
          "code",
          "message"
        ],
        "type": "object"
      },
      "VoiceProvenance": {
        "description": "How a sample was made: kept beside the library by the Voices lab, and\nshown with the clip. \"Regenerate\" refills the lab's form from it — GPU\noutput is not bit-identical per seed, so it makes a new candidate rather\nthan restoring this one.",
        "properties": {
          "alias": {
            "description": "The alias asked.",
            "type": "string"
          },
          "answered_by": {
            "description": "The alias that answered (a fallback named as one).",
            "type": "string"
          },
          "asked_text": {
            "description": "What the round asked it to say, when lmgw's speech shaping sent the\nengine something else (`text`). Regenerate asks this again.",
            "type": [
              "string",
              "null"
            ]
          },
          "candidate": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "generated_at": {
            "description": "The round's time, RFC 3339.",
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the answering row's package states, when known."
          },
          "round": {
            "description": "The round and the candidate it came from.",
            "type": "string"
          },
          "row": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceRow"
              },
              {
                "type": "null"
              }
            ],
            "description": "The lmgw audio row behind the answering route."
          },
          "saved_at": {
            "description": "The save's time, RFC 3339.",
            "type": "string"
          },
          "seed": {
            "description": "The seed the candidate was sent, when one reached the model.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "sha256": {
            "description": "The saved clip's SHA-256, hex: a clip replaced by other means no\nlonger matches it.",
            "type": "string"
          },
          "text": {
            "description": "What the clip says: its transcript — the text the engine was sent.",
            "type": "string"
          },
          "trim": {
            "$ref": "#/components/schemas/VoiceTrim"
          },
          "upstream": {
            "type": "string"
          },
          "upstream_model": {
            "type": "string"
          },
          "voice": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "alias",
          "answered_by",
          "fallback_reason",
          "upstream",
          "upstream_model",
          "row",
          "description",
          "voice",
          "seed",
          "language",
          "text",
          "asked_text",
          "generated_at",
          "saved_at",
          "licence",
          "round",
          "candidate",
          "trim",
          "sha256"
        ],
        "type": "object"
      },
      "VoiceResolved": {
        "description": "A thread's voice, resolved.",
        "properties": {
          "asr": {
            "$ref": "#/components/schemas/Stage",
            "description": "The speech-to-text stage: dictation, voice mode, audio attachments."
          },
          "audio_input": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AudioInputShown"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether a voice turn goes to the chat model as audio, and why not."
          },
          "language": {
            "$ref": "#/components/schemas/Sourced_Nullable_string",
            "description": "The language the user speaks, ISO 639-1; `value: null` is none, the\nspeech-to-text model detects it."
          },
          "language_notes": {
            "description": "Where a stage's model does not take its language as set.",
            "items": {
              "$ref": "#/components/schemas/LanguageNote"
            },
            "type": "array"
          },
          "problems": {
            "description": "What blocks a voice feature now: a stage with no alias, or one whose\nalias no longer resolves.",
            "items": {
              "$ref": "#/components/schemas/VoiceProblem"
            },
            "type": "array"
          },
          "read_aloud": {
            "$ref": "#/components/schemas/Sourced_boolean",
            "description": "Whether replies are read aloud as they stream."
          },
          "realtime": {
            "$ref": "#/components/schemas/RealtimeAvailability",
            "description": "Whether voice mode may bind the thread."
          },
          "reply_language": {
            "$ref": "#/components/schemas/Sourced_Nullable_string",
            "description": "The language replies are in, ISO 639-1: the thread's, Settings', else\nthe spoken one (`source: speech_in`); `value: null` is none, the reply\nfollows the user."
          },
          "seed": {
            "description": "The thread's text-to-speech seed; `null` until its first use draws\none.",
            "format": "uint32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "speech_style": {
            "$ref": "#/components/schemas/SpeechStyle",
            "description": "The speech instructions the read-aloud uses."
          },
          "tts": {
            "$ref": "#/components/schemas/Stage",
            "description": "The text-to-speech stage: read-aloud and voice mode."
          },
          "turn_detection": {
            "$ref": "#/components/schemas/Sourced_TurnDetectionMode",
            "description": "How voice mode detects the end of a turn."
          },
          "voice": {
            "$ref": "#/components/schemas/VoiceName",
            "description": "The voice the text-to-speech model is asked for."
          }
        },
        "required": [
          "asr",
          "tts",
          "voice",
          "speech_style",
          "language",
          "reply_language",
          "language_notes",
          "read_aloud",
          "turn_detection",
          "audio_input",
          "seed",
          "problems",
          "realtime"
        ],
        "type": "object"
      },
      "VoiceRound": {
        "description": "One round: what was asked, who answered, and its candidates.",
        "properties": {
          "alias": {
            "description": "The alias asked.",
            "type": "string"
          },
          "answered_by": {
            "description": "The alias that answered: `alias`, or the fallback the GPU hold (or a\nbusy card) handed the round to.",
            "type": "string"
          },
          "asked": {
            "description": "How many candidates were asked for.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/VoiceCandidate"
            },
            "type": "array"
          },
          "created_at": {
            "description": "RFC 3339, UTC.",
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "fallback_reason": {
            "description": "Why a fallback answered (`hold`, `external_vram`, …).",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "description": "The round's id, its directory's name.",
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "language_note": {
            "description": "What happened to the language when it did not reach the model as\nset.",
            "type": [
              "string",
              "null"
            ]
          },
          "licence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ModelLicence"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the answering row's package states, when it states one."
          },
          "row": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceRow"
              },
              {
                "type": "null"
              }
            ],
            "description": "The lmgw audio row behind the answering route, if it is one."
          },
          "seeds_sent": {
            "description": "Each candidate's seed reached the model.",
            "type": "boolean"
          },
          "sent_text": {
            "description": "What the engine was sent instead, when lmgw's speech shaping changed\nit (inline tags or characters the engine cannot say): what the\ncandidates say, and the transcript a saved sample gets.",
            "type": [
              "string",
              "null"
            ]
          },
          "shaping": {
            "description": "What lmgw's speech shaping changed in the request\n(`x-lmgw-speech`'s words), when it changed anything.",
            "type": [
              "string",
              "null"
            ]
          },
          "stopped": {
            "description": "Why the round ended before `asked` candidates: the first failure,\nor a stop (the page left, Stop, the round discarded).",
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "description": "What every candidate was asked to say.",
            "type": "string"
          },
          "upstream": {
            "description": "The upstream that answered.",
            "type": "string"
          },
          "upstream_model": {
            "description": "The model name it was sent.",
            "type": "string"
          },
          "voice": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "alias",
          "answered_by",
          "fallback_reason",
          "upstream",
          "upstream_model",
          "row",
          "licence",
          "text",
          "sent_text",
          "language",
          "language_note",
          "description",
          "voice",
          "seeds_sent",
          "shaping",
          "asked",
          "candidates",
          "stopped"
        ],
        "type": "object"
      },
      "VoiceRow": {
        "description": "The lmgw audio row behind a route.",
        "properties": {
          "family": {
            "description": "The audio.cpp family (`qwen3_tts`).",
            "type": "string"
          },
          "model_id": {
            "description": "The row's model id.",
            "type": "string"
          },
          "variant": {
            "description": "The package's variant when it says (`voice_design`).",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "model_id",
          "family",
          "variant"
        ],
        "type": "object"
      },
      "VoiceSample": {
        "description": "One library clip with how it was made, when the Voices lab made it.",
        "properties": {
          "clip": {
            "$ref": "#/components/schemas/Clip"
          },
          "provenance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoiceProvenance"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Voices lab's record of it; `None` for a clip it did not make."
          },
          "provenance_current": {
            "description": "The record still describes the file (its SHA-256 matches). `false`\nwith a record: the clip was replaced since, by an upload or by hand.",
            "type": "boolean"
          }
        },
        "required": [
          "clip",
          "provenance",
          "provenance_current"
        ],
        "type": "object"
      },
      "VoiceSentence": {
        "description": "One language of the sentence table: the built-in sentence, the owner's\nown when saved, and the short line the cloning check speaks.",
        "properties": {
          "builtin": {
            "description": "The built-in sentence; `None` for a language the table lacks, which\nonly an owner's sentence brings into the list.",
            "type": [
              "string",
              "null"
            ]
          },
          "check_line": {
            "description": "The built-in line the cloning check speaks; empty without one.",
            "type": "string"
          },
          "language": {
            "description": "ISO 639-1 code, lowercase (`en`).",
            "type": "string"
          },
          "name": {
            "description": "The language's English name (`German`), or the code for one lmgw\nhas no name for.",
            "type": "string"
          },
          "saved": {
            "description": "`text` is the owner's own sentence, saved for this language.",
            "type": "boolean"
          },
          "text": {
            "description": "The sentence in effect: the owner's saved one, else the built-in\none, else empty.",
            "type": "string"
          }
        },
        "required": [
          "language",
          "name",
          "text",
          "builtin",
          "saved",
          "check_line"
        ],
        "type": "object"
      },
      "VoiceSource": {
        "anyOf": [
          {
            "const": "thread",
            "description": "The thread's own override.",
            "type": "string"
          },
          {
            "const": "profile",
            "description": "The thread's personality profile.",
            "type": "string"
          },
          {
            "const": "chat",
            "description": "Settings → Chat → Voice.",
            "type": "string"
          },
          {
            "const": "realtime",
            "description": "Settings → Realtime.",
            "type": "string"
          },
          {
            "const": "row",
            "description": "The text-to-speech model's own description of its voice (a speech\nstyle only).",
            "type": "string"
          },
          {
            "const": "speech_in",
            "description": "The reply language only: none is set for it, so it is the language the\nuser speaks.",
            "type": "string"
          }
        ],
        "description": "The level a value came from."
      },
      "VoiceTiming": {
        "description": "A spoken reply's timing: each stage measured from the one before,\n`to_first_audio_ms` their sum from the end of speech, `cold` the stages\nthat loaded during the turn.",
        "properties": {
          "asr_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "cold": {
            "description": "The stages that loaded during the turn.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "end_of_turn_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "first_audio_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "first_clause": {
            "description": "`announcement` when the first clause said was an announcement of a\nskipped block.",
            "type": "string"
          },
          "first_clause_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "first_token_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "input": {
            "$ref": "#/components/schemas/InputPath",
            "description": "How the turn reached the chat model; absent with audio input off."
          },
          "input_why": {
            "description": "Why the transcript went where audio input is on.",
            "type": "string"
          },
          "message_id": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "models": {
            "$ref": "#/components/schemas/VoiceModels"
          },
          "reasoning_ms": {
            "description": "How long the chat model reasoned before its first token (part of\n`first_token_ms`); absent when it did not reason.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "response_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_first_audio_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "total_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "transcript_wait_ms": {
            "description": "How long the first output was held for the turn's transcript; absent\non the transcript path.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "response_id",
          "message_id",
          "end_of_turn_ms",
          "asr_ms",
          "first_token_ms",
          "first_clause_ms",
          "first_audio_ms",
          "total_ms",
          "to_first_audio_ms",
          "cold",
          "models"
        ],
        "type": "object"
      },
      "VoiceTrim": {
        "description": "What trimming took off a saved sample. Only silence is cut; the samples\nkept are the candidate's own, at their own loudness.",
        "properties": {
          "kept_ms": {
            "description": "What is left.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "lead_ms": {
            "description": "Silence cut from the start, in milliseconds.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "note": {
            "description": "Why nothing was cut, when nothing could be (not a PCM WAV, nothing\nabove the silence floor).",
            "type": [
              "string",
              "null"
            ]
          },
          "tail_ms": {
            "description": "Silence cut from the end.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "lead_ms",
          "tail_ms",
          "kept_ms",
          "note"
        ],
        "type": "object"
      },
      "VramBenchmark": {
        "description": "A benchmark run's GPU lease.",
        "properties": {
          "model_id": {
            "type": "string"
          },
          "run_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "run_id",
          "model_id"
        ],
        "type": "object"
      },
      "VramDevice": {
        "properties": {
          "free_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "index": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "total_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "used_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "index",
          "name",
          "total_bytes",
          "used_bytes",
          "free_bytes"
        ],
        "type": "object"
      },
      "VramEstimate": {
        "description": "The GPU cost of the weights and the KV cache at the trained context; a\nchat model's is laid out as its row is charged, for one slot. Compute\nbuffers depend on a row's settings and are in the plan's footprint, not\nhere.",
        "properties": {
          "kv_cache_bytes_at_full_ctx_f16": {
            "description": "KV cache for `context_length` tokens at f16; null when the header\nlacks what the estimate needs.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "kv_cache_bytes_at_full_ctx_q8_0": {
            "description": "The same at q8_0.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "note": {
            "description": "What the figures leave out.",
            "type": "string"
          },
          "weights_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "weights_bytes",
          "kv_cache_bytes_at_full_ctx_f16",
          "kv_cache_bytes_at_full_ctx_q8_0",
          "note"
        ],
        "type": "object"
      },
      "VramKeptFree": {
        "description": "What admission keeps free on top of the memory in use: memory the driver\ncannot show yet. Each part is zero when nothing of that kind is kept.",
        "properties": {
          "image_peak_bytes": {
            "description": "What resident image pipelines take above their idle residency while\nthey draw (the residents' `peak_extra_bytes`).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "pending_load_bytes": {
            "description": "What ready audio containers will still load on their first request\n(the residents' `pending_bytes`).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "starting_bytes": {
            "description": "Containers still starting, and starts admitted whose container is not\nup yet: weights on their way onto the card.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "starting_bytes",
          "image_peak_bytes",
          "pending_load_bytes"
        ],
        "type": "object"
      },
      "VramKvPool": {
        "description": "One guarded model's shared KV pool.",
        "properties": {
          "capacity_tokens": {
            "description": "The pool's size in tokens, as the running container was started\nwith it.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "in_flight": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "queue": {
            "description": "Requests waiting for room, head first.",
            "items": {
              "$ref": "#/components/schemas/VramKvPoolWaiter"
            },
            "type": "array"
          },
          "releasing": {
            "description": "Requests that ended without a normal completion and keep their\nreservation until llama-server lets go of their slots.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "reserved_tokens": {
            "description": "Σ (prompt + max output) of the requests in flight and releasing.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "model",
          "capacity_tokens",
          "reserved_tokens",
          "in_flight",
          "releasing",
          "queue"
        ],
        "type": "object"
      },
      "VramKvPoolWaiter": {
        "description": "One request waiting for room in a pool.",
        "properties": {
          "alias": {
            "type": "string"
          },
          "needs_tokens": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "position": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "waiting_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "position",
          "alias",
          "needs_tokens",
          "waiting_ms"
        ],
        "type": "object"
      },
      "VramResident": {
        "properties": {
          "container": {
            "description": "`chat | aux | audio`.",
            "type": "string"
          },
          "estimated_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "idle_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "in_flight": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "peak_extra_bytes": {
            "description": "What one generation of a resident image pipeline has been measured to\nneed *above* its idle residency, and what admission keeps free for it. `None` for every\nother class, and for an image\nmodel that has not generated anything yet — `note` says which.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "pending_bytes": {
            "description": "What a `ready` audio container will still load on its first request,\nkept free by admission on top of the measured use: its expected\nresidency less what its processes hold now, else less what it was\nread holding at rest, or all of it where neither could be read.\n`None` once loaded (lmgw routed a request that loaded it, or its\nprocesses hold at least that much now), and for every other class.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "state": {
            "description": "`starting | ready` as the runtime registry holds it, or `reserved` for\na start the scheduler has admitted whose container is not up yet.",
            "type": "string"
          }
        },
        "required": [
          "container",
          "model",
          "state",
          "estimated_bytes",
          "in_flight",
          "idle_seconds",
          "peak_extra_bytes",
          "pending_bytes",
          "note"
        ],
        "type": "object"
      },
      "VramSettingsDto": {
        "description": "The GPU admission (VRAM) settings.",
        "properties": {
          "budget_mb": {
            "description": "`0` = the device's real total, as the driver reports it (NVML on\nNVIDIA, amdgpu sysfs on AMD).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "fallback_on_external": {
            "description": "Fall back when VRAM outside lmgw's control is short. Absent reads as on, like the server's\nown default.",
            "type": "boolean"
          },
          "headroom_mb": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "load_timeout_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "queue_timeout_seconds": {
            "description": "`0` = wait indefinitely.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "unload_timeout_seconds": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "enabled",
          "headroom_mb",
          "budget_mb",
          "queue_timeout_seconds",
          "load_timeout_seconds",
          "unload_timeout_seconds",
          "fallback_on_external"
        ],
        "type": "object"
      },
      "VramSettingsPatch": {
        "additionalProperties": false,
        "description": "VRAM admission control. Every field is optional so one knob moves\nwithout restating the rest.",
        "properties": {
          "budget_mb": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "fallback_on_external": {
            "default": null,
            "description": "Fall back when VRAM outside lmgw's control is short.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "headroom_mb": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "load_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "queue_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "unload_timeout_seconds": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "VramStatus": {
        "description": "`GET /api/vram` and the `vram` SSE frame — measured figures and\nestimated ones are separate fields on\npurpose: the UI must be able to say which is which.",
        "properties": {
          "active": {
            "description": "Whether admission is actually arbitrating; false is explained by\n`inactive_reason`.",
            "type": "boolean"
          },
          "benchmark": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VramBenchmark"
              },
              {
                "type": "null"
              }
            ],
            "description": "The benchmark run holding the card, if one does: no local model is admitted until it ends."
          },
          "capacity_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "devices": {
            "items": {
              "$ref": "#/components/schemas/VramDevice"
            },
            "type": "array"
          },
          "downloading": {
            "description": "Starts whose model's engine image is still downloading (machine-check\ndesign §5), oldest first: each `phase` is `downloading` with the bytes\nso far. They hold no place in `queue` and nothing on the card; once\nits download is done a start is admitted like any other, and enters\n`queue` if it has to wait for room. Absent from an older gateway's\nframe.",
            "items": {
              "$ref": "#/components/schemas/VramWaiter"
            },
            "type": "array"
          },
          "draining": {
            "description": "Resident model ids that are busy or still starting while hold is\nactive — visible continuously, not only in the one-shot `hold_set`\nresponse. Empty whenever hold is not active.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "estimated_resident_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "external_trigger_active": {
            "description": "Whether the outside-VRAM fallback can fire right now.",
            "type": "boolean"
          },
          "external_trigger_reason": {
            "description": "Why it cannot, when it cannot (the switch, admission, the hold, no\ntelemetry, an unattributable lmgw model).",
            "type": [
              "string",
              "null"
            ]
          },
          "free_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "free_measured": {
            "description": "False when `free_bytes` was derived from the estimate rather than read\nfrom the driver.",
            "type": "boolean"
          },
          "headroom_bytes": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "hold_active": {
            "description": "The `hold.active` setting — hold is a switch on\nthe resolve/start paths, orthogonal to `enabled`/`active` above.",
            "type": "boolean"
          },
          "inactive_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "kept_free": {
            "$ref": "#/components/schemas/VramKeptFree",
            "description": "What `free_bytes` was lowered by on top of the memory in use, by\nreason. With a measured free figure, `free_bytes` is the capacity's\nmeasured free memory — the devices' free memory, or with\n`vram.budget_mb` the budget less the devices' used memory — less\nthese (never below zero). The devices' total less their used and free\nmemory is in neither: memory the probe reports as not available\n(NVML: the driver's own reserve; an AMD APU: GTT the host's RAM\ncannot back)."
          },
          "kv_pools": {
            "description": "The token ledger of every guarded unified-KV chat model with a request\nin flight or waiting — `vram::VramView`'s\n`kv_pools`. Absent from an older gateway's frame, hence the default.",
            "items": {
              "$ref": "#/components/schemas/VramKvPool"
            },
            "type": "array"
          },
          "lmgw_share_bytes": {
            "description": "lmgw's own share of the pooled devices' used memory, measured per\nprocess. `None` when it\ncannot be measured — see `external_trigger_reason`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "note": {
            "type": "string"
          },
          "outside_share_bytes": {
            "description": "Used memory that is not lmgw's — games, the desktop, other apps.\n`None` exactly when `lmgw_share_bytes` is.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "queue": {
            "items": {
              "$ref": "#/components/schemas/VramWaiter"
            },
            "type": "array"
          },
          "resident": {
            "items": {
              "$ref": "#/components/schemas/VramResident"
            },
            "type": "array"
          },
          "telemetry": {
            "description": "Where the measured numbers come from, verbatim.",
            "type": "string"
          },
          "telemetry_ok": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled",
          "active",
          "inactive_reason",
          "telemetry",
          "telemetry_ok",
          "headroom_bytes",
          "capacity_bytes",
          "free_bytes",
          "free_measured",
          "kept_free",
          "estimated_resident_bytes",
          "devices",
          "resident",
          "queue",
          "downloading",
          "note",
          "hold_active",
          "draining",
          "kv_pools",
          "lmgw_share_bytes",
          "outside_share_bytes",
          "external_trigger_active",
          "external_trigger_reason",
          "benchmark"
        ],
        "type": "object"
      },
      "VramWaiter": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "container": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "needs_bytes": {
            "description": "Footprint plus headroom; 0 for an entry of `downloading`, whose\nfootprint is read at admission, after the download.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "phase": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WaitPhase"
              },
              {
                "type": "null"
              }
            ],
            "description": "`stage` typed: what admission is doing for this request now. Absent\nfrom an older gateway's frame."
          },
          "position": {
            "description": "The 1-based place in the admission queue; 0 for an entry of\n`downloading`, which holds no place in it.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "stage": {
            "type": "string"
          },
          "waiting_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "position",
          "alias",
          "model",
          "container",
          "needs_bytes",
          "waiting_ms",
          "stage",
          "phase"
        ],
        "type": "object"
      },
      "WaitPhase": {
        "description": "What admission is doing for a request that waits for room on the GPU\n(chat-media-tools design §5.3), told apart by `kind`.",
        "oneOf": [
          {
            "description": "The model's engine image is not on this machine yet and is being\ndownloaded (machine-check design §5), before admission: nothing is\nevicted or reserved for it meanwhile, and the queue's time budget\nstarts after it. `done_bytes` of `total_bytes` compressed layer bytes\nas Podman reports them; `total_bytes` is absent when the size is not\nknown (no registry manifest, or Podman's API was not reachable and\nthe `podman pull` command reports no byte counts — `done_bytes` then\nstays 0), and `size_note` then says why.",
            "properties": {
              "done_bytes": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "image": {
                "type": "string"
              },
              "kind": {
                "const": "downloading",
                "type": "string"
              },
              "size_note": {
                "description": "Why the size is not known, when it is not: the pull job's own\n\"size not known — …\" (`ImagePullJobDetail::size_note`). Absent\nwhile nothing has said.",
                "type": "string"
              },
              "total_bytes": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "image",
              "done_bytes",
              "total_bytes"
            ],
            "type": "object"
          },
          {
            "description": "Waiting for the admission gate: another request is being admitted.",
            "properties": {
              "kind": {
                "const": "gate",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "Measuring the GPU's memory.",
            "properties": {
              "kind": {
                "const": "measuring",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "description": "Stopping an idle model to make room: `<class>/<model>`\n(`chat/qwen3-30b`).",
            "properties": {
              "kind": {
                "const": "evicting",
                "type": "string"
              },
              "victim": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "victim"
            ],
            "type": "object"
          },
          {
            "description": "Nothing idle is left to stop: waiting for a busy model to finish, or\nfor memory held outside lmgw.",
            "properties": {
              "free_bytes": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "kind": {
                "const": "waiting_for_room",
                "type": "string"
              },
              "needs_bytes": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "kind",
              "needs_bytes",
              "free_bytes"
            ],
            "type": "object"
          },
          {
            "description": "Room is there: the container is starting.",
            "properties": {
              "kind": {
                "const": "starting",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          }
        ]
      },
      "WaitReason": {
        "description": "Why a file of a get waits with nothing transferring it (WP7, D108),\nread from its download row.",
        "oneOf": [
          {
            "const": "metered",
            "description": "Paused on a metered connection (D122): it goes on once the\nconnection isn't metered, or with Resume on the Downloads page.",
            "type": "string"
          },
          {
            "const": "not_started",
            "description": "Queued, or cut by a shutdown, and nothing transfers it yet.",
            "type": "string"
          },
          {
            "const": "other",
            "description": "The download row keeps another note: `note` says it.",
            "type": "string"
          }
        ]
      },
      "WebRtcCallState": {
        "description": "Where a call stands (calls design §3.4).",
        "oneOf": [
          {
            "const": "answered",
            "description": "Answered: waiting for ICE and DTLS.",
            "type": "string"
          },
          {
            "const": "connected",
            "description": "ICE and DTLS-SRTP are up; `oai-events` has not opened.",
            "type": "string"
          },
          {
            "const": "open",
            "description": "`oai-events` is open; the bind runs.",
            "type": "string"
          },
          {
            "const": "pending",
            "description": "`takeover=ask` found its thread held: it waits for the client's\n`lmgw.session.take_over` or the holder's end (`held_by`).",
            "type": "string"
          },
          {
            "const": "running",
            "description": "Its session runs.",
            "type": "string"
          },
          {
            "const": "closing",
            "description": "It let go: its slot is back, and it only delivers its last events\nbefore it closes, at most `realtime.ping_interval_s`.",
            "type": "string"
          }
        ]
      },
      "WebRtcCallStatus": {
        "description": "One live call (calls design §3.4, §9).",
        "properties": {
          "allowance_ms": {
            "description": "The playout allowance in ms (calls design §5.3): NetEQ's part of the\ndelay, which the window's end, drained and a barge-in's heard take.\n`null` before the call's audio out runs.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "allowance_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PlayoutSource"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the allowance comes from."
          },
          "candidate": {
            "description": "Its one host candidate: the local address its POST arrived on, on\nits group's UDP port.",
            "type": "string"
          },
          "client_jitter_ms": {
            "description": "The client's interarrival jitter on lmgw's stream, by its latest\nreceiver report, in ms (to 0.1); `null` while `closing`.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "connected_at": {
            "description": "When ICE and DTLS connected (RFC 3339 UTC); `null` before.",
            "type": [
              "string",
              "null"
            ]
          },
          "egress_loss": {
            "description": "The share of lmgw's packets the client lost, 0 to 1, by its latest\nreceiver report (to 0.001); `null` while `closing`.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "group": {
            "$ref": "#/components/schemas/WebRtcGroup",
            "description": "The socket group it lives on: the listener its POST came in on."
          },
          "held_by": {
            "description": "Who holds its thread while it is `pending`, as `voice.bound.by`\nnames a client.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "description": "Its id, `rtc_…`: what `POST /v1/realtime/calls/{call_id}/hangup`\ntakes.",
            "type": "string"
          },
          "ingress_loss": {
            "description": "The share of the client's packets lmgw lost over the last second, 0\nto 1 (to 0.001); `null` for a second in which none arrived, and while\n`closing`.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "jitter_buffer_ms": {
            "description": "The latest playout report's `jitter_buffer_ms` (to 0.1): NetEQ's own\ndelay as the client's `getStats` gives it, the allowance seen from\nthe phone.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "key": {
            "description": "The key that made it (`device:phone`, `owner:…`); `null` for an\nanonymous caller.",
            "type": [
              "string",
              "null"
            ]
          },
          "playout_report_age_ms": {
            "description": "How long ago the latest playout report arrived, whatever it carried,\nin ms: the age of `jitter_buffer_ms`. `null` before the first.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "receiver_report_age_ms": {
            "description": "How long ago the client's latest receiver report arrived, in ms: the\nage of `egress_loss`, `client_jitter_ms` and the round trip it fed.\nA client sends one every few seconds; `null` before the first, and\nwhile `closing`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "remote": {
            "description": "Where the client's last authenticated traffic came from.",
            "type": [
              "string",
              "null"
            ]
          },
          "round_trip_ms": {
            "description": "The session's round trip, in ms: the least of the last five the\nclient's receiver reports measured, as the playout allowance and the\nbarge-in margin take it. `null` before the first report reached the\ncall's audio out, and while `closing`.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "session": {
            "description": "Its realtime session's id, once the session runs.",
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/WebRtcCallState"
          },
          "thread": {
            "description": "The Chat thread its session is bound to.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "group",
          "state",
          "held_by",
          "session",
          "key",
          "candidate",
          "remote",
          "connected_at",
          "round_trip_ms",
          "egress_loss",
          "ingress_loss",
          "client_jitter_ms",
          "receiver_report_age_ms",
          "allowance_ms",
          "allowance_source",
          "jitter_buffer_ms",
          "playout_report_age_ms",
          "thread"
        ],
        "type": "object"
      },
      "WebRtcGroup": {
        "description": "Which listener a socket group serves.",
        "oneOf": [
          {
            "const": "plain",
            "description": "The plain listener's: stock clients.",
            "type": "string"
          },
          {
            "const": "devices",
            "description": "The device listener's: paired devices.",
            "type": "string"
          }
        ]
      },
      "WebRtcGroupState": {
        "description": "Where a socket group stands.",
        "oneOf": [
          {
            "const": "off",
            "description": "`realtime.webrtc_enabled` was off at the gateway's start: a call on\nits listener is refused 503 naming the setting.",
            "type": "string"
          },
          {
            "const": "down",
            "description": "Not bound: its listener does not serve, or it is moving with it.",
            "type": "string"
          },
          {
            "const": "bound",
            "description": "Bound on `addrs`.",
            "type": "string"
          },
          {
            "const": "failed",
            "description": "Its bind failed, or its sockets were lost; `error` says why. Its\nlistener serves on, and a call there is refused 503 naming it.",
            "type": "string"
          }
        ]
      },
      "WebRtcGroupStatus": {
        "description": "One socket group: the sockets of the listener a call's POST came in on.",
        "properties": {
          "addrs": {
            "description": "Its sockets, as `udp://` addresses: one per address of its listener.\nEmpty unless `bound`.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "error": {
            "description": "Why it is not bound, with state `failed`: the bind error naming the\naddress, or the call driver's stop.",
            "type": [
              "string",
              "null"
            ]
          },
          "group": {
            "$ref": "#/components/schemas/WebRtcGroup"
          },
          "rule": {
            "description": "The rule that binds it, naming its settings: the plain listener's\n`bind_addr` and `realtime.webrtc_port`, or the device listener's\naddresses and port.",
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/WebRtcGroupState"
          }
        },
        "required": [
          "group",
          "rule",
          "state",
          "addrs",
          "error"
        ],
        "type": "object"
      },
      "WebRtcStatus": {
        "description": "`GET /api/status`'s `webrtc`.",
        "properties": {
          "calls": {
            "description": "The live calls, oldest first, those still delivering their last\nevents (`closing`) included.",
            "items": {
              "$ref": "#/components/schemas/WebRtcCallStatus"
            },
            "type": "array"
          },
          "dropped": {
            "description": "Datagrams no call accepted, dropped unanswered since lmgw started\n(the count outlives the call driver, which a panic starts again).",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "enabled": {
            "description": "`realtime.webrtc_enabled` as the gateway's last start read it: the\nsetting applies at the next start, so a saved value may differ until\nthen.",
            "type": "boolean"
          },
          "groups": {
            "description": "The socket groups: the plain listener's, then the device listener's.",
            "items": {
              "$ref": "#/components/schemas/WebRtcGroupStatus"
            },
            "type": "array"
          }
        },
        "required": [
          "enabled",
          "groups",
          "dropped",
          "calls"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "adminToken": {
        "description": "POST /mcp/admin only.",
        "in": "header",
        "name": "x-lmgw-admin-token",
        "type": "apiKey"
      },
      "apiKeyHeader": {
        "description": "The same keys, in the header Anthropic SDKs send them in.",
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      },
      "bearer": {
        "description": "An lmgw API key: a client, owner or agent key. A paired device presents none: it authenticates by its client certificate on the device listener, which refuses a bearer there 400 credential_on_device_listener. A bearer key a device was paired with before TLS (lmgw-device-…) is refused 401 device_key_unknown on every listener: pair the device again.",
        "scheme": "bearer",
        "type": "http"
      },
      "session": {
        "description": "The dashboard's own session cookie. Same-origin only, and only ever an owner row.",
        "in": "cookie",
        "name": "lmgw_session",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "description": "lmgw's own HTTP API: the inference plane (OpenAI-, Anthropic- and llama.cpp-compatible, plus MCP), the device (Chat) API paired clients use, the agent run API agents use, and the dashboard that configures the gateway.",
    "title": "lmgw",
    "version": "0.6.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/agents": {
      "get": {
        "description": "Every agent in the catalog, with its warnings, requirements and last-run summary.",
        "operationId": "get_api_agents",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentCard"
                  },
                  "title": "Array_of_AgentCard",
                  "type": "array"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List agents",
        "tags": [
          "agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/agents/import": {
      "post": {
        "description": "Imports an agent from an exported manifest file (paste uses this same route). replace overwrites an id that already exists; validate_only runs the checks and reports without writing.",
        "operationId": "post_api_agents_import",
        "parameters": [
          {
            "in": "query",
            "name": "replace",
            "required": false,
            "schema": {
              "default": null,
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "validate_only",
            "required": false,
            "schema": {
              "default": null,
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/agents/import` and `lmgw__agent_set` — the same report either\nway. Errors are not in here: they are the 400 body (`ApiError`), because a\nmanifest that does not validate was not imported at all.",
                  "properties": {
                    "config_unbound": {
                      "description": "Mount slots this agent has and nothing has bound: an\nexport never carries a host path, so an imported agent arrives with its\n`directory` and `file` fields empty and the importer says which folder.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "dropped_config": {
                      "description": "Stored config keys the **new** manifest no longer declares, removed with\nthe manifest that declared them (the same rule applies to every replace). Keeping them\nwould leave a row that fails validation\non every run and cannot be fixed from its own config form.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "replaced": {
                      "description": "An existing agent was overwritten (`replace=1`), keeping its config.",
                      "type": "boolean"
                    },
                    "requires": {
                      "items": {
                        "$ref": "#/components/schemas/AgentRequirement"
                      },
                      "type": "array"
                    },
                    "validate_only": {
                      "description": "`validate_only=1`: the same report, nothing written.",
                      "type": "boolean"
                    },
                    "warnings": {
                      "description": "A missing server label or tool: the agent is saved, Start is disabled.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "warnings",
                    "requires",
                    "replaced",
                    "dropped_config",
                    "config_unbound",
                    "validate_only"
                  ],
                  "title": "AgentImportReport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Import an agent",
        "tags": [
          "agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "replace overwrites an agent id that already exists here",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/agents/runs/{job_id}": {
      "get": {
        "description": "One run with its rows: the executor's live buffer while it is in flight, the stored result once it has ended. Ownership is checked before existence, so a run that belongs to another caller and a missing one get the same refusal.",
        "operationId": "get_api_agents_runs_job_id",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/agents/runs/{job_id}` — the job plus its rows.",
                  "properties": {
                    "batch": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentBatchShape"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The agent's current review shape, so the table can be drawn from a run\nalone — including one finished last week, which is what \"reopen this\nrun's review\" needs. For a ledger run its `columns` carry the undeclared\nkeys the events brought, appended after the declared ones in first-seen\norder."
                    },
                    "job": {
                      "$ref": "#/components/schemas/AgentRunSummary"
                    },
                    "log": {
                      "description": "The run log: `log` events, rejected events, and the lines lmgw itself\nwrote. Empty for an in-process run, which has none yet.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "result": {
                      "description": "The apply step's structured output and the run's usage total, once the\nrun has finished."
                    },
                    "rows": {
                      "description": "The reviewed rows: the executor's live buffer while running, the job\nresult after. Rows are deliberately **not** pushed through the generic\njobs feed.",
                      "items": true,
                      "type": "array"
                    }
                  },
                  "required": [
                    "job",
                    "rows",
                    "result",
                    "batch",
                    "log"
                  ],
                  "title": "AgentRunDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get one agent run",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "agent-self",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/agents/runs/{job_id}/close": {
      "post": {
        "description": "Closes a run this caller owns with its terminal status.",
        "operationId": "post_api_agents_runs_job_id_close",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRunCloseBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Close an agent run",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "ledger",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/agents/runs/{job_id}/events": {
      "post": {
        "description": "Appends one ledger event, an array of them, or an NDJSON batch to a run this caller owns, straight into the run's live buffer, which the dashboard's Run tab reads.",
        "operationId": "post_api_agents_runs_job_id_events",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRunEventsBody"
              }
            },
            "application/x-ndjson": {
              "schema": {
                "description": "Newline-delimited JSON: one value per line, each decoded as the application/json form's single-object case.",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/agents/runs/{job_id}/events` — what became of the batch.",
                  "properties": {
                    "applied": {
                      "description": "How many events went into the run.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`: rejected events are reported below, not failed.",
                      "type": "boolean"
                    },
                    "rejected": {
                      "description": "One line per event the run did not take (unparseable, or refused by\nthe run's rules), in the order they were sent.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "applied",
                    "rejected"
                  ],
                  "title": "AgentEventsApplied",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Append agent run events",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "ledger",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/agents/{id}": {
      "get": {
        "description": "One agent's full definition: the complete document for owner credentials or, for the agent's own token, the same document with host paths substituted out.",
        "operationId": "get_api_agents_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/agents/{id}` — everything the detail page's three tabs need.",
                  "properties": {
                    "batch": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentBatchShape"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The run surface a `batch` or `container` agent offers. `None` for a\n`chat` agent."
                    },
                    "budget": {
                      "$ref": "#/components/schemas/AgentBudget",
                      "description": "The two Responses settings a turn is bounded by, shown next to Apply."
                    },
                    "config": {
                      "description": "Stored config values with every `secret` field replaced by\n`{ \"has_value\": bool }`. The value itself never leaves the process."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "currency": {
                      "description": "The gateway's display currency, so a run's cost is printed the way the\nUsage page prints every other one.",
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "dev_url": {
                      "description": "The dev-server override. While it is set, `/agents/<id>/app/**`\ngoes there and no container is started for the app; runs and applies\nstill use the image. Empty means \"served from the image\".",
                      "type": "string"
                    },
                    "effective_model": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "error": {
                      "description": "Set when the stored manifest could not be read at all — a row written by\na newer build. The document still comes back `200` with whatever could\nbe read, so the Definition editor stays reachable for the very manifest\nthat needs fixing; a `400` here would lock the client out of it.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fields": {
                      "description": "The config schema flattened into form fields, in document order.",
                      "items": {
                        "$ref": "#/components/schemas/AgentField"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "last_run": {
                      "$ref": "#/components/schemas/AgentRunSummary",
                      "description": "The agent's most recent run, with its outcome (`status`, `error`, tokens,\ncost) — the same summary the catalog card carries. While a run is in\nflight it is that run. Absent when the agent has never run, when\nretention pruned its runs, and on a row this build cannot read."
                    },
                    "live_job": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentRunSummary"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The run in flight, if any."
                    },
                    "manifest": {
                      "description": "The manifest as stored: the canonical serialization, **as text** — what\nthe Definition editor loads and what Export writes.\n\nText and not a `serde_json::Value` on purpose. `serde_json::Map` is a\n`BTreeMap`, so a `Value` here would alphabetize the config schema's\nproperties and silently re-sort the form the author laid out.\nParse it client-side if a tree is needed, and post it back to\n`agent_set` as a **string**: an object argument is accepted but arrives\nalready re-sorted, and the import report says so.",
                      "type": "string"
                    },
                    "model_alias": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "portability": {
                      "$ref": "#/components/schemas/AgentPortability",
                      "description": "Whether an export of this agent would land on another box, and what the\nreceiver would have to do if not. The same answer the export file's\n`portability` key carries, on the page that offers the download."
                    },
                    "provenance": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentProvenance"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Where this row was installed from. `None` for a row that came\nfrom a pasted manifest rather than from an image."
                    },
                    "requires": {
                      "items": {
                        "$ref": "#/components/schemas/AgentRequirement"
                      },
                      "type": "array"
                    },
                    "requires_ok": {
                      "type": "boolean"
                    },
                    "resettable": {
                      "description": "A shipped manifest exists for this id, so \"Reset to shipped\" applies.",
                      "type": "boolean"
                    },
                    "runtime": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentRuntime"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "What a `container` agent runs under. `None` for every other kind."
                    },
                    "service": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AgentService"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Service mode, when the manifest declares it.\n`None` means no App tab, no proxy route and no `agent:<id>` MCP row."
                    },
                    "source": {
                      "type": "string"
                    },
                    "threads": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "token": {
                      "$ref": "#/components/schemas/AgentToken",
                      "description": "The agent's own token — its name, whether one has been minted, and the scope it\ncurrently carries. **Never the value**:\nthat comes from `agent_token_get`, which is what Copy token calls.",
                      "x-lmgw-secret": true
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "warnings": {
                      "description": "Warnings that are not tool gaps. Start is disabled while any of them carries\n`blocks_start`.",
                      "items": {
                        "$ref": "#/components/schemas/AgentWarning"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "description",
                    "version",
                    "kind",
                    "source",
                    "enabled",
                    "model_alias",
                    "effective_model",
                    "manifest",
                    "config",
                    "fields",
                    "requires",
                    "requires_ok",
                    "budget",
                    "live_job",
                    "threads",
                    "resettable",
                    "batch",
                    "warnings",
                    "runtime",
                    "token",
                    "service",
                    "provenance",
                    "dev_url",
                    "portability",
                    "currency",
                    "created_at",
                    "updated_at",
                    "error"
                  ],
                  "title": "AgentDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get an agent",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "agent-self",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/agents/{id}/export": {
      "get": {
        "description": "Downloads the agent as `<id>.agent.json`: its manifest plus an envelope (export time, lmgw version, portability, the names of the secret and folder fields left out, and — with include_config=1 — the non-secret config values). A secret never leaves; the file imports back unchanged.",
        "operationId": "get_api_agents_id_export",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_config",
            "required": false,
            "schema": {
              "default": null,
              "description": "`1` adds the **non-secret** config values as `config_values`.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "description": "`GET /api/agents/{id}/export` — the `<id>.agent.json` file: the agent's\nmanifest with an envelope around it. The manifest's fields sit at the top\nlevel of the file, in the order the manifest has them; the envelope's own\nfields follow.",
                  "properties": {
                    "config_omitted": {
                      "description": "The `secret` config fields left out, so the receiver knows what to\nfill in. Absent when there are none.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "config_unbound": {
                      "description": "The folder and file slots left out: they are paths on the exporting\nmachine, so the receiver chooses its own. Absent when there are none.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "config_values": {
                      "additionalProperties": true,
                      "description": "The non-secret config values; only with `include_config=1`.",
                      "type": "object"
                    },
                    "exported_at": {
                      "description": "RFC 3339 time of the export.",
                      "type": "string"
                    },
                    "lmgw_version": {
                      "description": "The lmgw version that wrote the file.",
                      "type": "string"
                    },
                    "portability": {
                      "$ref": "#/components/schemas/AgentPortability",
                      "description": "Whether the file runs on another machine as it is, and what the\nreceiver would have to do if not."
                    }
                  },
                  "required": [
                    "exported_at",
                    "lmgw_version",
                    "portability"
                  ],
                  "title": "AgentExport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export an agent",
        "tags": [
          "agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/agents/{id}/runs": {
      "get": {
        "description": "This agent's run history. For the agent's own token, a run's error text has host paths substituted out the same way the detail read does.",
        "operationId": "get_api_agents_id_runs",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentRunSummary"
                  },
                  "title": "Array_of_AgentRunSummary",
                  "type": "array"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List an agent's runs",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "agent-self",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Opens a run from outside lmgw, exactly as the manifest's own trigger would. An agent has at most one live run: a second open while one is live is refused with the running job's id.",
        "operationId": "post_api_agents_id_runs",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "phase": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rows": {
                    "default": [],
                    "items": {
                      "$ref": "#/components/schemas/Row"
                    },
                    "type": "array"
                  }
                },
                "title": "OpenBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/agents/{id}/runs` — a run opened from outside lmgw.",
                  "properties": {
                    "deadline_seconds": {
                      "description": "How long the run has before lmgw ends it; `0` is no deadline.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "run": {
                      "description": "The run's job id, for `/api/agents/runs/{job_id}` and its events and\nclose routes.",
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "run",
                    "deadline_seconds"
                  ],
                  "title": "AgentRunOpened",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/agents/{id}/runs` refused with `409`: the agent already has a\nrun in flight, and `run` is its job id, so the caller can watch that one.",
                  "properties": {
                    "code": {
                      "description": "Always `already_running`.",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "run": {
                      "description": "The job id of the run that is in flight.",
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "run"
                  ],
                  "title": "AgentRunConflict",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Open an agent run",
        "tags": [
          "agent-runtime"
        ],
        "x-lmgw-capability": "ledger",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/audio/catalog": {
      "get": {
        "description": "audio.cpp's own spec catalog, from the cached snapshot only — an absent fetched_at means \"never fetched here\"; a page load never waits on GitHub.",
        "operationId": "get_api_audio_catalog",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/audio/catalog` — the *cached* spec catalog. Never fetches: the\nsnapshot comes from memory or the kv store, and `POST /api/op/audio_catalog`\n(`action: \"refresh\"`) is the only thing that goes to the network.",
                  "properties": {
                    "families": {
                      "description": "Families with an installed package or a served model come first.",
                      "items": {
                        "$ref": "#/components/schemas/AudioFamily"
                      },
                      "type": "array"
                    },
                    "fetched_at": {
                      "description": "RFC3339 fetch time of the snapshot; absent when nothing is cached yet.",
                      "type": "string"
                    },
                    "warnings": {
                      "description": "What the last refresh could not do — a spec file that did not load, a\npackage repo Hugging Face could not list (offline, rate-limited,\ngated) — or that it has not checked the package files yet. Stays until\nthe next refresh. Absent when there are none.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "families"
                  ],
                  "title": "AudioCatalog",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get the audio.cpp spec catalog",
        "tags": [
          "downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/connect": {
      "get": {
        "description": "Every reachable base URL, whether a key is required, the models a client can already see, and the expose-all upstream prefixes — the connect panel a fresh client reads to configure itself.",
        "operationId": "get_api_connect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/connect` — how to reach the gateway and what it exposes.",
                  "properties": {
                    "auth_enabled": {
                      "type": "boolean"
                    },
                    "bases": {
                      "description": "Every URL that reaches the gateway (wildcard binds expand to\nloopback + LAN addresses).",
                      "items": {
                        "$ref": "#/components/schemas/BaseUrl"
                      },
                      "type": "array"
                    },
                    "catalog_prefixes": {
                      "description": "Prefixes of enabled `expose_all` upstreams whose catalogs pass\nthrough dynamically (rendered as ghost entries, not copyable names).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "device_port": {
                      "description": "The device listener's port (`devices.port`, else the HTTP port plus\none): what \"this computer\" pairs on, `https://127.0.0.1:<port>`.\n`null` when none can be derived (device link design §3.1).",
                      "format": "uint16",
                      "maximum": 65535,
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "device_urls": {
                      "description": "The URLs the pairing form proposes for another device (device link\ndesign §3.1, §3.2): the addresses a device can count on, the stable\nLAN and WireGuard ones first, each with its interface. Empty when\nthe machine has none, or no port can be derived.",
                      "items": {
                        "$ref": "#/components/schemas/DeviceUrl"
                      },
                      "type": "array"
                    },
                    "models": {
                      "description": "Statically known client-facing model names.",
                      "items": {
                        "$ref": "#/components/schemas/ConnectModel"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "bases",
                    "auth_enabled",
                    "models",
                    "catalog_prefixes",
                    "device_port",
                    "device_urls"
                  ],
                  "title": "ConnectInfo",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get connection info",
        "tags": [
          "meta"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/chunks": {
      "get": {
        "description": "One document's chunks, verbatim payload included, for the corpus browser's leaf view.",
        "operationId": "get_api_docs_chunks",
        "parameters": [
          {
            "in": "query",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/chunks?document_id=`.",
                  "properties": {
                    "chunks": {
                      "items": {
                        "$ref": "#/components/schemas/ChunkRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "chunks"
                  ],
                  "title": "ChunksResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a document's chunks",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/corpora": {
      "get": {
        "description": "Every doc corpus with its badges and sources, plus the pending doc-request count and the resolved rerank model.",
        "operationId": "get_api_docs_corpora",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/corpora` — the Docs tab's list, its badges, and the two\ngateway-level facts it needs alongside them.",
                  "properties": {
                    "corpora": {
                      "items": {
                        "$ref": "#/components/schemas/CorpusView"
                      },
                      "type": "array"
                    },
                    "pending_requests": {
                      "description": "Pending `docs__request` rows — the tab badge.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "rerank_model": {
                      "description": "Alias the rerank stage would call; `null` when there is none.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "schema_version": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "corpora",
                    "pending_requests",
                    "rerank_model",
                    "schema_version"
                  ],
                  "title": "DocsOverview",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List doc corpora",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Creates a corpus, resolving and pinning its embed and ingest models before the row exists. start: true queues the ingest job immediately.",
        "operationId": "post_api_docs_corpora",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "embed_model": {
                    "description": "Model alias to embed with. Probed now, and the *resolved* identity is\nwhat the corpus pins.",
                    "type": "string"
                  },
                  "ingest_model": {
                    "description": "Model alias that will drive extraction. Validated now so the wizard\nfails at the form rather than in the job.",
                    "type": "string"
                  },
                  "library": {
                    "type": "string"
                  },
                  "sources": {
                    "items": {
                      "$ref": "#/components/schemas/NewSource"
                    },
                    "type": "array"
                  },
                  "start": {
                    "default": false,
                    "description": "Queue the ingest job immediately.",
                    "type": "boolean"
                  },
                  "version": {
                    "type": "string"
                  }
                },
                "required": [
                  "library",
                  "version",
                  "embed_model",
                  "ingest_model"
                ],
                "title": "CreateCorpus",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/docs/corpora` — the corpus that now exists, and the ingest job\nwhen it was asked to start one.",
                  "properties": {
                    "corpus": {
                      "$ref": "#/components/schemas/CorpusView"
                    },
                    "job_id": {
                      "description": "The ingest job queued with the corpus; `null` when `start` was not\nasked for (the corpus is then empty until an ingest is started).",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "corpus",
                    "job_id"
                  ],
                  "title": "CorpusCreated",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a doc corpus",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/corpora/{id}": {
      "get": {
        "description": "One corpus's row, documents, golden queries and eval history (limit caps the eval history; 0 or absent is the whole run). 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_corpora_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/corpora/{id}`.",
                  "properties": {
                    "corpus": {
                      "$ref": "#/components/schemas/CorpusView"
                    },
                    "documents": {
                      "items": {
                        "$ref": "#/components/schemas/DocumentRow"
                      },
                      "type": "array"
                    },
                    "eval_runs": {
                      "items": {
                        "$ref": "#/components/schemas/EvalRunRow"
                      },
                      "type": "array"
                    },
                    "golden_queries": {
                      "items": {
                        "$ref": "#/components/schemas/GoldenQueryRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "corpus",
                    "documents",
                    "golden_queries",
                    "eval_runs"
                  ],
                  "title": "CorpusDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a corpus",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/corpora/{id}/delete": {
      "post": {
        "description": "Deletes a corpus and everything ingested into it. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_corpora_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a corpus",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "deletes every document, chunk and golden query in this corpus",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/corpora/{id}/documents": {
      "get": {
        "description": "Every document crawled into this corpus. 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_corpora_id_documents",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/corpora/{id}/documents`.",
                  "properties": {
                    "documents": {
                      "items": {
                        "$ref": "#/components/schemas/DocumentRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "documents"
                  ],
                  "title": "DocumentsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a corpus's documents",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/corpora/{id}/ingest": {
      "post": {
        "description": "Queues (or reports already-running) the ingest job for this corpus's configured sources. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_corpora_id_ingest",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What the ingest / re-embed / eval / golden-generate triggers answer: the job\nthat is now running, or the one that already was.",
                  "properties": {
                    "already_running": {
                      "description": "`true` when a job of that kind for the corpus was already in flight:\n`job_id` is that one's.",
                      "type": "boolean"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "job_id",
                    "already_running"
                  ],
                  "title": "DocsJobStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start an ingest job",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/corpora/{id}/re-embed": {
      "post": {
        "description": "Queues (or reports already-running) a re-embed job: fills in missing vectors, or moves the pin onto a new embed_model. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_corpora_id_re_embed",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "embed_model": {
                    "default": null,
                    "description": "Move the pin onto this alias. Omitted only fills in missing vectors.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "ReEmbedBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What the ingest / re-embed / eval / golden-generate triggers answer: the job\nthat is now running, or the one that already was.",
                  "properties": {
                    "already_running": {
                      "description": "`true` when a job of that kind for the corpus was already in flight:\n`job_id` is that one's.",
                      "type": "boolean"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "job_id",
                    "already_running"
                  ],
                  "title": "DocsJobStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start a re-embed job",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/eval": {
      "get": {
        "description": "One corpus's eval-run history, most recent first (limit caps it; 0 or absent is the whole history — a score is read as a trend). 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_eval",
        "parameters": [
          {
            "in": "query",
            "name": "corpus_id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/eval?corpus_id=`.",
                  "properties": {
                    "eval_runs": {
                      "items": {
                        "$ref": "#/components/schemas/EvalRunRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "eval_runs"
                  ],
                  "title": "EvalHistory",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List eval runs",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Queues (or reports already-running) an eval run over the corpus's golden queries at the given hit@k depth. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_eval",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "corpus_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "k": {
                    "default": null,
                    "description": "hit@k depth; absent takes the configured default.",
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "params": {
                    "default": null,
                    "description": "Stage overrides to measure under; absent measures under the defaults\n`docs__query` itself runs with."
                  }
                },
                "required": [
                  "corpus_id"
                ],
                "title": "EvalBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What the ingest / re-embed / eval / golden-generate triggers answer: the job\nthat is now running, or the one that already was.",
                  "properties": {
                    "already_running": {
                      "description": "`true` when a job of that kind for the corpus was already in flight:\n`job_id` is that one's.",
                      "type": "boolean"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "job_id",
                    "already_running"
                  ],
                  "title": "DocsJobStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start an eval run",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/export": {
      "get": {
        "description": "The corpus store as a plain SQLite file — one corpus with ?corpus_id=, or the whole file. The file can be copied to another machine as is. 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_export",
        "parameters": [
          {
            "in": "query",
            "name": "corpus_id",
            "required": false,
            "schema": {
              "default": null,
              "description": "One corpus instead of the whole file.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.sqlite3": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export corpora as a SQLite file",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/export/manifest": {
      "get": {
        "description": "What a GET /api/docs/export download would contain, without transferring the file — the half a UI shows before committing, and the half an import re-derives to check against. 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_export_manifest",
        "parameters": [
          {
            "in": "query",
            "name": "corpus_id",
            "required": false,
            "schema": {
              "default": null,
              "description": "One corpus instead of the whole file.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/export/manifest[?corpus_id=]` — what that download would\ncontain, shown before committing to the transfer.",
                  "properties": {
                    "byte_size": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "corpora": {
                      "items": {
                        "$ref": "#/components/schemas/ManifestCorpus"
                      },
                      "type": "array"
                    },
                    "exported_at": {
                      "type": "string"
                    },
                    "schema_version": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "schema_version",
                    "exported_at",
                    "byte_size",
                    "corpora"
                  ],
                  "title": "ExportManifest",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview a corpus export's manifest",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/golden": {
      "get": {
        "description": "One corpus's golden queries — the hand- or candidate-curated set its eval runs are scored against. 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_golden",
        "parameters": [
          {
            "in": "query",
            "name": "corpus_id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/golden?corpus_id=`.",
                  "properties": {
                    "golden_queries": {
                      "items": {
                        "$ref": "#/components/schemas/GoldenQueryRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "golden_queries"
                  ],
                  "title": "GoldenResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List golden queries",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Creates or edits (id present) a golden query. Expected chunk ids are validated against the corpus before they are stored. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_golden",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "corpus_id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "expected_chunk_ids": {
                    "default": [],
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "id": {
                    "default": null,
                    "description": "Present = edit that query; absent = create one.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "origin": {
                    "default": null,
                    "description": "`manual` (default) or `synthetic` — a curated candidate keeps saying\nwhere it came from.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "query": {
                    "type": "string"
                  }
                },
                "required": [
                  "query"
                ],
                "title": "GoldenBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A golden query written: `POST /api/docs/golden` and accepting a\ncandidate answer the id of the query now in the set.",
                  "properties": {
                    "id": {
                      "description": "The golden query's id: the edited one, or the one just created.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id"
                  ],
                  "title": "GoldenSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create or edit a golden query",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/golden/candidates": {
      "get": {
        "description": "The synthetic golden-query curation queue, with the chunks each candidate was written from alongside it. status is pending, accepted or rejected (empty for all), anything else is a 400. 404 not_found for a corpus id nothing has.",
        "operationId": "get_api_docs_golden_candidates",
        "parameters": [
          {
            "in": "query",
            "name": "corpus_id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "default": null,
              "description": "`pending` | `accepted` | `rejected`; empty lists every one of them.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/golden/candidates?corpus_id=[&status=]` — the curation\nqueue. `chunks` carries the sections the candidates were written from, keyed\nby chunk id: deciding whether a question is a fair test means reading the\nsection it is supposed to find.",
                  "properties": {
                    "candidates": {
                      "items": {
                        "$ref": "#/components/schemas/GoldenCandidateRow"
                      },
                      "type": "array"
                    },
                    "chunks": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/ChunkRow"
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "candidates",
                    "chunks"
                  ],
                  "title": "GoldenCandidatesResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List golden-query candidates",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/golden/candidates/{id}/accept": {
      "post": {
        "description": "Promotes a candidate to a real golden query, keeping origin: synthetic. A decision is made once — a candidate not pending is refused.",
        "operationId": "post_api_docs_golden_candidates_id_accept",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "expected_chunk_ids": {
                    "default": null,
                    "description": "The expectation as edited before accepting; absent keeps the chunk the\ncandidate was written from.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "query": {
                    "default": null,
                    "description": "The query as edited before accepting; absent accepts it as proposed.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "AcceptBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A golden query written: `POST /api/docs/golden` and accepting a\ncandidate answer the id of the query now in the set.",
                  "properties": {
                    "id": {
                      "description": "The golden query's id: the edited one, or the one just created.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id"
                  ],
                  "title": "GoldenSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Accept a golden-query candidate",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/golden/candidates/{id}/reject": {
      "post": {
        "description": "Discards a candidate; the row stays rejected rather than being deleted, so a later generation run does not propose the same question again.",
        "operationId": "post_api_docs_golden_candidates_id_reject",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Reject a golden-query candidate",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/golden/generate": {
      "post": {
        "description": "Queues a run that samples chunks and asks the corpus's pinned ingest model to write candidate golden queries from them — the queue is the only path from a candidate to a real golden query. 404 not_found for a corpus id nothing has.",
        "operationId": "post_api_docs_golden_generate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "corpus_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "per_chunk": {
                    "default": null,
                    "description": "Questions to ask for per sampled chunk. Absent means one.",
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "sample": {
                    "default": null,
                    "description": "Chunks to sample. Absent or `0` samples every chunk in the corpus — the\nrun is as big as the corpus unless a smaller sample is asked for.",
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "corpus_id"
                ],
                "title": "GenerateBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What the ingest / re-embed / eval / golden-generate triggers answer: the job\nthat is now running, or the one that already was.",
                  "properties": {
                    "already_running": {
                      "description": "`true` when a job of that kind for the corpus was already in flight:\n`job_id` is that one's.",
                      "type": "boolean"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "job_id",
                    "already_running"
                  ],
                  "title": "DocsJobStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Generate golden-query candidates",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/golden/{id}/delete": {
      "post": {
        "description": "Deletes one golden query.",
        "operationId": "post_api_docs_golden_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a golden query",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/import": {
      "post": {
        "description": "Imports a corpus SQLite file (from GET /api/docs/export). validate_only runs every check and writes nothing; replace overwrites an existing library@version. Both checks happen before anything is written.",
        "operationId": "post_api_docs_import",
        "parameters": [
          {
            "in": "query",
            "name": "replace",
            "required": false,
            "schema": {
              "default": false,
              "description": "Overwrite a `library@version` that already exists here.",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "validate_only",
            "required": false,
            "schema": {
              "default": false,
              "description": "Run the checks and report, writing nothing.",
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/vnd.sqlite3": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/docs/import` — the verdict. `dry_run` is the `validate_only`\npass: every check ran, nothing was written.",
                  "properties": {
                    "dry_run": {
                      "type": "boolean"
                    },
                    "file_schema_version": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "imported": {
                      "items": {
                        "$ref": "#/components/schemas/ImportedCorpus"
                      },
                      "type": "array"
                    },
                    "schema_version": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "schema_version",
                    "file_schema_version",
                    "dry_run",
                    "imported"
                  ],
                  "title": "ImportReport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Import corpora from a SQLite file",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "replace overwrites a library@version that already exists here",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/requests": {
      "get": {
        "description": "The doc-request queue: libraries an agent asked for that this gateway has no corpus for yet. status is pending, fulfilled or dismissed (empty for all), anything else is a 400.",
        "operationId": "get_api_docs_requests",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "default": null,
              "description": "`pending` | `fulfilled` | `dismissed`; empty lists everything.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/docs/requests[?status=]`.",
                  "properties": {
                    "requests": {
                      "items": {
                        "$ref": "#/components/schemas/DocRequestRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "requests"
                  ],
                  "title": "DocRequestsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List doc requests",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/docs/requests/{id}/status": {
      "post": {
        "description": "Dismisses a doc request, or puts a dismissed one back to pending. fulfilled is set only by a matching ingest completing, never by hand.",
        "operationId": "post_api_docs_requests_id_status",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "status": {
                    "description": "`dismissed` to clear it, `pending` to put it back.",
                    "type": "string"
                  }
                },
                "required": [
                  "status"
                ],
                "title": "RequestStatusBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Set a doc request's status",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/docs/search": {
      "post": {
        "description": "Runs a retrieval search against one corpus with the same stage pipeline docs__query uses, answering both the trace and the rendered markdown a client would receive. 404 not_found for a corpus id nothing has. (A corpus named by library@version that does not exist is a 404 too.)",
        "operationId": "post_api_docs_search",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "budget_tokens": {
                    "default": null,
                    "description": "Convenience override, same precedence as the MCP tool's.",
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "corpus": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "corpus_id": {
                    "default": null,
                    "description": "Either the numeric row id or `library@version`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "params": {
                    "default": null,
                    "description": "Partial overrides of the search stage settings; anything absent keeps\nthe configured default."
                  },
                  "query": {
                    "type": "string"
                  }
                },
                "required": [
                  "query"
                ],
                "title": "SearchBody",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/docs/search` — both renderings of one answer: the trace for the\nplayground, and the exact markdown a `docs__query` caller would receive.",
                  "properties": {
                    "corpus_id": {
                      "type": "string"
                    },
                    "hits": {
                      "items": {
                        "$ref": "#/components/schemas/SearchHit"
                      },
                      "type": "array"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "status": {
                      "$ref": "#/components/schemas/CorpusStatusView"
                    },
                    "trace": {
                      "$ref": "#/components/schemas/SearchTraceView"
                    },
                    "urls": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Chunk id → source document URL, for the deep links.",
                      "type": "object"
                    }
                  },
                  "required": [
                    "corpus_id",
                    "hits",
                    "trace",
                    "urls",
                    "status",
                    "markdown"
                  ],
                  "title": "DocsSearchResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Search a corpus",
        "tags": [
          "docs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/events": {
      "get": {
        "description": "The live feed the dashboard opens once and keeps: stats, jobs, runtime, vram, mcp, updates and chat frames on connect (and machine, once the machine check has a result), then request/stats/mcp/jobs/vram/runtime/updates frames as they change, a machine frame with the machine check's summary whenever its last result changes (a run, the settings judged again, a local model's start on the graphics card that failed because of the computer), a keys frame when a key's state moves without a request (a device's connection opened or closed, a key disabled, rotated or deleted), and a chat frame naming the threads, folders and messages any writer changed in the Chat (a device, an owner key, this or another dashboard window, the sweep): read them again. The first change of a burst waits a fixed 200 ms for the rest, then one read names everything changed up to it, so a stream sends at most one chat frame per 200 ms plus that read (but for one its keep-alive read finds). The chat frame on connect is a resync: read everything shown again, since frames are not replayed across a reconnect. Never closes on its own.",
        "operationId": "get_api_events",
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "chat": {
                "description": "Something in the Chat changed: the `chat` frame of `/api/events`. The\nframe names what changed and the dashboard reads it again; it carries no\nrendering of its own.\n\nIt covers every writer: the dashboard (this window or another), a paired\ndevice, an owner key, the self-admin tools and the gateway's own sweep.\n`/api/events` is the owner's, so every thread is named, Admin Chat\nincluded. Temporary chats are never named: they live in the memory of\nthe gateway, outside the change feed.\n\n- **On connect** the stream sends one with `resync: true`: what a client\n  read before it connected may be stale, so it reads everything it shows\n  again. A reconnect is a connect, so frames missed while the stream was\n  down are covered by that one.\n- **Bursts are coalesced**: the first change of a burst waits a fixed\n  200 ms (not a setting) for the rest, then the stream reads what changed\n  once and sends one frame naming everything changed up to that read. A\n  frame therefore comes 200 ms plus one read of the change feed after the\n  first change it names, and a stream sends at most one frame per 200 ms,\n  except one its keep-alive read finds (`chat_feed_keepalive_s`, a write\n  that did not wake the feed). An id is named once however often it\n  changed in a frame. A client that reads frames more slowly than they\n  come may merge them (`merge`): a frame is a delta, never a\n  state.",
                "properties": {
                  "folders": {
                    "description": "The folders created, changed (name, defaults, ongoing, retention) or\ndeleted, and those whose current thread moved, ascending.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "messages": {
                    "description": "The threads whose messages changed, ascending: a message added (a\nuser turn, typed or spoken, as it is stored; a reply as it is saved),\nedited, continued, cut to what was heard, or deleted. A reply still\nbeing generated is not named until it is saved.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "resync": {
                    "description": "What changed is not known: read everything shown again. Sent on\nconnect, and when the stream could not tell what changed.",
                    "type": "boolean"
                  },
                  "threads": {
                    "description": "The threads whose row changed, ascending: created (a rollover's new\ncurrent thread too), renamed, settings, pinned, archived or\nrestored, moved between folders, hidden from devices, or deleted.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "threads",
                  "folders",
                  "messages",
                  "resync"
                ],
                "title": "ChatChanged",
                "type": "object"
              },
              "jobs": {
                "items": {
                  "$ref": "#/components/schemas/JobRow"
                },
                "title": "Array_of_JobRow",
                "type": "array"
              },
              "keys": {
                "description": "A key's state moved without a request landing: the `keys` frame of\n`/api/events`. A device's connection opened or closed — its online state\nand `last_seen_at` — or a key was disabled, rotated or deleted. The Keys\npage refetches its list on it, instead of polling.",
                "properties": {
                  "key_id": {
                    "description": "The `api_keys.id` it is about.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "what": {
                    "description": "`link` (a device's connection opened or closed), `disabled`,\n`rotated` or `deleted`; a device's pairing (device link design §9.3):\n`token` (a pairing token minted or ended), `enrolled` (a device sent\nits key: the row's code and peer address are in its `pairing`),\n`confirmed`, `contested` (a used token came back with another key);\nor `resync` (with `key_id` 0) when the event stream could not deliver\nevery frame: refetch the keys. `transfer` (device transfers design\n§11.1, `key_id` the sender's) is no change of a key: a transfer's\nstate moved, or an upload wrote (at most once a second) — refetch the\ntransfers, not the keys.",
                    "type": "string"
                  }
                },
                "required": [
                  "key_id",
                  "what"
                ],
                "title": "KeysChanged",
                "type": "object"
              },
              "machine": {
                "description": "The verdict alone, in `GET /api/status` and the `machine` frame of\n`/api/events`.",
                "properties": {
                  "checked_at": {
                    "type": "string"
                  },
                  "failed_start": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MachineFailedStart"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "`MachineCheck::failed_start`."
                  },
                  "headline": {
                    "type": "string"
                  },
                  "verdict": {
                    "$ref": "#/components/schemas/MachineVerdict"
                  }
                },
                "required": [
                  "verdict",
                  "headline",
                  "checked_at",
                  "failed_start"
                ],
                "title": "MachineSummary",
                "type": "object"
              },
              "mcp": {
                "items": {
                  "$ref": "#/components/schemas/McpStatus"
                },
                "title": "Array_of_McpStatus",
                "type": "array"
              },
              "request": {
                "description": "One request's summary — the `request` SSE frame and the\nrow shape of `GET /api/logs` (log rows additionally carry `mcp_tool` and\n`pricing`).",
                "properties": {
                  "audio_in_ms": {
                    "description": "What the request processed besides tokens, each only when it was\nmeasured or the provider reported it: input audio in milliseconds,\ninput characters as sent, generated images. `None` = not measured,\nwhich is not the same as zero — render a dash.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cache_write_tokens": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cached_in_tokens": {
                    "description": "The cache subsets of `prompt_tokens`, when the provider reported them —\nwithout these a row that cost 8x its neighbour looks identical to it.\n`None` = the provider said nothing, which is not the same as zero.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chars_in": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "class": {
                    "description": "`chat` | `aux` | `audio` | `tool`.",
                    "type": "string"
                  },
                  "client_key": {
                    "description": "Name of the gateway API key that made the call (never the key itself);\nabsent when auth is disabled or the call was made in-process.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cost_micro": {
                    "description": "Currency micro-units. `None` = **unpriced**, which is not the same as\nfree — render a dash, never a 0.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "degraded": {
                    "description": "What the request's content lost on its way to a model that lacks a\ncapability: \"fallback 'x' lacks vision: 3 images sent as\nplaceholders\", \"'m' lacks audio: transcript sent\", several joined by\n\"; \". `None` = nothing was degraded.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "egress_proto": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "error_kind": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "error_msg": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "fallback_reason": {
                    "description": "Why a fallback answered instead of the requested local model: `hold`\n(the GPU hold), `external_vram` (VRAM outside lmgw's control was\nshort), `background` (a background candidate alias), `unavailable`\n(a candidate alias with no model it may use), `benchmark`, `quota`,\n`unreachable`, `disabled`, `gpu_setup` (the graphics card is not\nready on this computer) or `engine_download` (a local model's engine\ncould not be downloaded). `None` = no fallback; the fallback itself\nis `upstream_name` / `upstream_model`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "images_out": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "ingress_proto": {
                    "type": "string"
                  },
                  "key_id": {
                    "description": "`api_keys.id` behind `client_key` — the id is what a key filter matches\non, and a name match breaks the moment a key is renamed.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "log_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "max_tokens_clamped": {
                    "description": "`max_tokens` lmgw lowered a client-set value to, on a ladder rung or a\nguarded unified-KV pool. `None` = not clamped — either the row is unguarded, or the\nclient's value already fit.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "mcp_tool": {
                    "description": "MCP tool name for `ingress_proto = \"mcp\"` rows; absent on SSE frames.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "price_note": {
                    "description": "Why the row's cost is what it is, when that is not plain: \"served at\nservice tier flex; no flex price on file for 'm', a standard one is\",\n\"stream ended before the upstream reported usage\". `None` otherwise.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pricing": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/RowPricing"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "How the row was priced: the rates it recorded when it was written,\nso each priced part can be shown as quantity × rate even after the\nprice has changed. On `GET /api/logs` rows only; absent on SSE\nframes, which carry the cost and the quantities alone."
                  },
                  "prompt_tokens": {
                    "description": "**Total** input for the call, cache included.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "requested_alias": {
                    "type": "string"
                  },
                  "rung": {
                    "description": "The rung a ladder row answered from — or, for a refusal, the rung it\nwas judged on — 1-based. `None` for a row without\na ladder, and for a request its fallback answered.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "service_tier": {
                    "description": "The `service_tier` an OpenAI platform answer reported, verbatim\n(`default`, `flex`, `priority`, …): the tier the row is priced at.\n`None` on every other upstream, and when the answer named none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "format": "uint16",
                    "maximum": 65535,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "streamed": {
                    "type": "boolean"
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "ts": {
                    "type": "string"
                  },
                  "ttfb_ms": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "upstream_model": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "upstream_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "log_id",
                  "ts",
                  "client_key",
                  "ingress_proto",
                  "requested_alias",
                  "upstream_name",
                  "upstream_model",
                  "egress_proto",
                  "status",
                  "ttfb_ms",
                  "total_ms",
                  "prompt_tokens",
                  "completion_tokens",
                  "cached_in_tokens",
                  "cache_write_tokens",
                  "streamed",
                  "error_kind",
                  "error_msg",
                  "mcp_tool",
                  "cost_micro",
                  "class",
                  "key_id",
                  "max_tokens_clamped",
                  "fallback_reason",
                  "rung",
                  "degraded",
                  "audio_in_ms",
                  "chars_in",
                  "images_out",
                  "service_tier",
                  "price_note",
                  "pricing"
                ],
                "title": "RequestRow",
                "type": "object"
              },
              "runtime": {
                "items": {
                  "$ref": "#/components/schemas/RuntimeStatus"
                },
                "title": "Array_of_RuntimeStatus",
                "type": "array"
              },
              "stats": {
                "description": "Aggregate request statistics — the `stats` SSE frame.",
                "properties": {
                  "active_requests": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "err_last_minute": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "req_last_minute": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "tok_s": {
                    "description": "Output tokens per second across every in-flight stream, over a short\ntrailing window; `0.0` when nothing is streaming. Approximate for\nupstreams that pack several tokens into one SSE chunk — show it with a\n\"~\". `default` so an older gateway's frame still decodes.",
                    "format": "double",
                    "type": "number"
                  },
                  "total_errors": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total_requests": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "total_requests",
                  "total_errors",
                  "prompt_tokens",
                  "completion_tokens",
                  "req_last_minute",
                  "err_last_minute",
                  "active_requests",
                  "tok_s"
                ],
                "title": "StatsView",
                "type": "object"
              },
              "updates": {
                "description": "The live `updates` frame on `/api/events`: sent when a dashboard\nconnects, and again whenever a check ends, a run finishes, a build is\nsaved, promoted or verified, an image is pulled, or a model row starts or\nstops running an image — so the Engines badge is current without the\npage polling anything.",
                "properties": {
                  "builds_with_updates": {
                    "description": "Builds whose update status has `has_update` true.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "checked_at": {
                    "description": "When the last full check (every build and image) ended; `None` before\nthe first one.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "images_with_updates": {
                    "description": "Registry images a model row runs (its own image, or its class's\ndefault while it has none) whose registry update has\n`update_available` true. A class default no row follows is checked\ntoo, and its update is on the Engines page, but it is not counted\nhere.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "builds_with_updates",
                  "images_with_updates",
                  "checked_at"
                ],
                "title": "UpdatesSummary",
                "type": "object"
              },
              "vram": {
                "description": "`GET /api/vram` and the `vram` SSE frame — measured figures and\nestimated ones are separate fields on\npurpose: the UI must be able to say which is which.",
                "properties": {
                  "active": {
                    "description": "Whether admission is actually arbitrating; false is explained by\n`inactive_reason`.",
                    "type": "boolean"
                  },
                  "benchmark": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/VramBenchmark"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The benchmark run holding the card, if one does: no local model is admitted until it ends."
                  },
                  "capacity_bytes": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "devices": {
                    "items": {
                      "$ref": "#/components/schemas/VramDevice"
                    },
                    "type": "array"
                  },
                  "downloading": {
                    "description": "Starts whose model's engine image is still downloading (machine-check\ndesign §5), oldest first: each `phase` is `downloading` with the bytes\nso far. They hold no place in `queue` and nothing on the card; once\nits download is done a start is admitted like any other, and enters\n`queue` if it has to wait for room. Absent from an older gateway's\nframe.",
                    "items": {
                      "$ref": "#/components/schemas/VramWaiter"
                    },
                    "type": "array"
                  },
                  "draining": {
                    "description": "Resident model ids that are busy or still starting while hold is\nactive — visible continuously, not only in the one-shot `hold_set`\nresponse. Empty whenever hold is not active.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "estimated_resident_bytes": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "external_trigger_active": {
                    "description": "Whether the outside-VRAM fallback can fire right now.",
                    "type": "boolean"
                  },
                  "external_trigger_reason": {
                    "description": "Why it cannot, when it cannot (the switch, admission, the hold, no\ntelemetry, an unattributable lmgw model).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "free_bytes": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "free_measured": {
                    "description": "False when `free_bytes` was derived from the estimate rather than read\nfrom the driver.",
                    "type": "boolean"
                  },
                  "headroom_bytes": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "hold_active": {
                    "description": "The `hold.active` setting — hold is a switch on\nthe resolve/start paths, orthogonal to `enabled`/`active` above.",
                    "type": "boolean"
                  },
                  "inactive_reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kept_free": {
                    "$ref": "#/components/schemas/VramKeptFree",
                    "description": "What `free_bytes` was lowered by on top of the memory in use, by\nreason. With a measured free figure, `free_bytes` is the capacity's\nmeasured free memory — the devices' free memory, or with\n`vram.budget_mb` the budget less the devices' used memory — less\nthese (never below zero). The devices' total less their used and free\nmemory is in neither: memory the probe reports as not available\n(NVML: the driver's own reserve; an AMD APU: GTT the host's RAM\ncannot back)."
                  },
                  "kv_pools": {
                    "description": "The token ledger of every guarded unified-KV chat model with a request\nin flight or waiting — `vram::VramView`'s\n`kv_pools`. Absent from an older gateway's frame, hence the default.",
                    "items": {
                      "$ref": "#/components/schemas/VramKvPool"
                    },
                    "type": "array"
                  },
                  "lmgw_share_bytes": {
                    "description": "lmgw's own share of the pooled devices' used memory, measured per\nprocess. `None` when it\ncannot be measured — see `external_trigger_reason`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "note": {
                    "type": "string"
                  },
                  "outside_share_bytes": {
                    "description": "Used memory that is not lmgw's — games, the desktop, other apps.\n`None` exactly when `lmgw_share_bytes` is.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "queue": {
                    "items": {
                      "$ref": "#/components/schemas/VramWaiter"
                    },
                    "type": "array"
                  },
                  "resident": {
                    "items": {
                      "$ref": "#/components/schemas/VramResident"
                    },
                    "type": "array"
                  },
                  "telemetry": {
                    "description": "Where the measured numbers come from, verbatim.",
                    "type": "string"
                  },
                  "telemetry_ok": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled",
                  "active",
                  "inactive_reason",
                  "telemetry",
                  "telemetry_ok",
                  "headroom_bytes",
                  "capacity_bytes",
                  "free_bytes",
                  "free_measured",
                  "kept_free",
                  "estimated_resident_bytes",
                  "devices",
                  "resident",
                  "queue",
                  "downloading",
                  "note",
                  "hold_active",
                  "draining",
                  "kv_pools",
                  "lmgw_share_bytes",
                  "outside_share_bytes",
                  "external_trigger_active",
                  "external_trigger_reason",
                  "benchmark"
                ],
                "title": "VramStatus",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Open the live event stream",
        "tags": [
          "status"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/gguf-files": {
      "get": {
        "description": "GGUF files under a class's models dir, matched against an optional search string.",
        "operationId": "get_api_gguf_files",
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "description": "`chat` (default) | `aux` | `audio` — which class's models dir to list.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/gguf-files` — GGUFs under the chat models dir.",
                  "properties": {
                    "files": {
                      "items": {
                        "$ref": "#/components/schemas/GgufFile"
                      },
                      "type": "array"
                    },
                    "models_dir": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "models_dir",
                    "files"
                  ],
                  "title": "GgufFiles",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List GGUF files on disk",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/hf/downloads": {
      "get": {
        "description": "The download queue and history. No filter returns every row ever recorded; a poller passes the ids its queueing call returned.",
        "operationId": "get_api_hf_downloads",
        "parameters": [
          {
            "in": "query",
            "name": "active",
            "required": false,
            "schema": {
              "default": null,
              "description": "`true`: only rows that are not finished (queued, downloading or failed).",
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ids",
            "required": false,
            "schema": {
              "default": null,
              "description": "Comma-separated download row ids, e.g. `1,2,3`; only these rows.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/hf/downloads`.",
                  "properties": {
                    "downloads": {
                      "items": {
                        "$ref": "#/components/schemas/DownloadRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "downloads"
                  ],
                  "title": "DownloadsView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List downloads",
        "tags": [
          "downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/hf/repo": {
      "get": {
        "description": "A Hugging Face repo's files, classified into weights, mmproj projector and speculative drafter candidates. With `fit=true` each weights file of the chat or aux class also gets its fit on this computer's graphics card, and the answer names the recommended file (find-a-model design §3.3); that reads file headers from Hugging Face, 1 to 16 MiB each, and `header_bytes_read` says how much. `fit=unless_metered` reads nothing on a metered connection: every mark is then by size, and `metered` says why. The card and what holds for every file are said once, in `card` and `fit_notes`.",
        "operationId": "get_api_hf_repo",
        "parameters": [
          {
            "in": "query",
            "name": "fit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/RepoFit"
                },
                {
                  "type": "null"
                }
              ],
              "description": "`true`: mark every `weights` file with its fit on this computer's\ngraphics card and name the recommended one (find-a-model design\n§3.3). It reads file headers from Hugging Face, 1 to 16 MiB each: one\nfile's, then only the files near the card's edge and those that could\nbe the recommended one; the answer's `header_bytes_read` says how\nmuch. `unless_metered`: the same, except that on a metered\nconnection nothing is read and every mark is by size (`metered` says\nwhy; D123). The chat and aux classes only. Default `false`: no marks,\nno header read."
            }
          },
          {
            "in": "query",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "description": "Which class's file kinds and role vocabulary to list; `chat` when the\ncaller says nothing, which is every client written before the image\nclass existed.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/hf/repo?repo=` — the repo's weights files, split parts collapsed.",
                  "properties": {
                    "card": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/CardMeasure"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "With `fit`: the card the marks were measured against, one reading for\nevery file; `None` without one (D9), when every mark is `no_card`. A\nfile's own `fit.card` is left out where it is this one."
                    },
                    "files": {
                      "items": {
                        "$ref": "#/components/schemas/RepoFile"
                      },
                      "type": "array"
                    },
                    "fit_notes": {
                      "description": "With `fit`: what holds for the whole list, each a sentence, said\nhere once rather than in every file's notes: the GPU hold's line,\nadmission off, what other programs use not being known, where the\nestimates came from, why the header reads stopped, why no file was\nmeasured (no card to measure against, a class whose files aren't\nmeasured).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "header_bytes_read": {
                      "description": "With `fit`: the file header bytes this answer received from Hugging\nFace, every file's, a read that failed after it began included; a\nheader lmgw had read before adds nothing (D123).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "metered": {
                      "description": "With `fit=unless_metered` on a metered connection (D123): why no\nheader was read. Every mark is then by size and nothing is\nrecommended; `fit=true` reads the headers.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "note": {
                      "description": "How to read `role` and what to do with the list, for a person or an\nagent. It differs by `target`: the image classes' roles are filename\nheuristics and a pipeline spans several repos, the others name the\n`weights` file to hand to `hf_add`, which fetches its companions. When\n`files` is empty (nothing in the repo matched) it says so plainly\ninstead.",
                      "type": "string"
                    },
                    "picks": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/RepoPicks"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "With `fit`: the pick by each measure, with its \"Why this file\" line."
                    },
                    "recommended": {
                      "description": "With `fit` (find-a-model design §3.2, D120): the file this list\nrecommends, the pick beside what runs on the graphics card now, else\nthe whole card's. `None` without `fit`, or when no file qualifies.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "repo": {
                      "type": "string"
                    },
                    "target": {
                      "description": "Which class's file kinds and role vocabulary were listed. Empty on a\nresponse from before the image class existed; `chat` then.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "repo",
                    "target",
                    "files",
                    "note",
                    "recommended",
                    "picks",
                    "card",
                    "header_bytes_read",
                    "fit_notes",
                    "metered"
                  ],
                  "title": "RepoFiles",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a Hugging Face repo's files",
        "tags": [
          "downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/jobs": {
      "get": {
        "description": "Poll half of the jobs feed; the SSE jobs frame on /api/events is the push half.",
        "operationId": "get_api_jobs",
        "parameters": [
          {
            "in": "query",
            "name": "active",
            "required": false,
            "schema": {
              "default": null,
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "default": null,
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/jobs`. The `jobs` SSE frame on `/api/events` carries the\n`Vec<JobRow>` of *running* jobs directly (same row shape).",
                  "properties": {
                    "jobs": {
                      "items": {
                        "$ref": "#/components/schemas/JobRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "jobs"
                  ],
                  "title": "JobsView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List background jobs",
        "tags": [
          "status"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/knowledge/bases": {
      "get": {
        "description": "Every base with its counts, its pinned embedding model, whether that model still resolves on this gateway, the live job (or the last one that ran) and `notes`: one sentence each on what needs attention (files waiting with no job running, chunks without a vector, a chunk size above what the embedding model takes).",
        "operationId": "get_api_knowledge_bases",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/knowledge/bases`.",
                  "properties": {
                    "bases": {
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeBase"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "bases"
                  ],
                  "title": "KnowledgeBaseList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List knowledge bases",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Creates an empty base and pins it to the embedding model `embed_alias` resolves to; the alias is probed once to learn the vector length, so the model must be reachable. The pin outlives the alias: a different model is a settings change that re-embeds. Chunk size defaults to 512 tokens with 64 overlap. 400 op_failed names the reason: an empty name, a name already used, an alias that is not an embedding (or rerank, or vision) model, a chunk size above what the embedding model takes per input, or an unreachable model.",
        "operationId": "post_api_knowledge_bases",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /api/knowledge/bases`.",
                "properties": {
                  "chunk_overlap": {
                    "default": null,
                    "description": "Overlap between chunks in tokens; 64 when absent.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chunk_tokens": {
                    "default": null,
                    "description": "Chunk size in tokens; 512 when absent.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "description": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "embed_alias": {
                    "description": "The embedding model alias. The base is pinned to the model it\nresolves to; the alias is probed once to learn the vector length.",
                    "type": "string"
                  },
                  "mcp_visible": {
                    "default": null,
                    "description": "Whether the `kb__*` tools on `/mcp` may search the base; true when\nabsent.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "name": {
                    "description": "Unique across the bases.",
                    "type": "string"
                  },
                  "rerank_alias": {
                    "default": null,
                    "description": "A rerank model alias; none: no rerank stage.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "vision_alias": {
                    "default": null,
                    "description": "A vision model alias that reads text-less PDF pages; none: they are\nskipped and counted.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "embed_alias"
                ],
                "title": "CreateKnowledgeBase",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A knowledge base as every route shows it.",
                  "properties": {
                    "chunk_overlap": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "chunk_tokens": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "counts": {
                      "$ref": "#/components/schemas/KnowledgeCounts"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "embed_alias": {
                      "description": "The embedding model alias the base was created with.",
                      "type": "string"
                    },
                    "embed_context": {
                      "description": "The embedding model's context in tokens, when the gateway knows it.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "embed_dims": {
                      "description": "The vector length of the pinned model.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "embed_identity": {
                      "description": "`upstream/model (Nd)`: the pin as one line.",
                      "type": "string"
                    },
                    "embed_input_limit": {
                      "description": "What one embedding input may hold, `min(context, ubatch)` for a local\nmodel; `chunk_tokens` (heading path included) is checked against it.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "embed_input_limit_source": {
                      "description": "One sentence: where `embed_input_limit` comes from.",
                      "type": "string"
                    },
                    "embed_model": {
                      "description": "The embedding model the base is pinned to.",
                      "type": "string"
                    },
                    "embed_resolvable": {
                      "description": "Whether a model on this gateway still resolves to the pin. When not,\nsearches fall back to keywords and new files cannot be embedded.",
                      "type": "boolean"
                    },
                    "embed_tokenizer": {
                      "description": "What counts the tokens: `model`, `tiktoken` or `tiktoken_guess`.",
                      "type": "string"
                    },
                    "embed_upstream": {
                      "description": "The upstream the alias resolved to when the base was pinned.",
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JobRow"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The live job on the base, or the last one that ran."
                    },
                    "mcp_visible": {
                      "description": "Whether the `kb__*` tools on `/mcp` may search this base.",
                      "type": "boolean"
                    },
                    "name": {
                      "description": "Unique across the bases.",
                      "type": "string"
                    },
                    "notes": {
                      "description": "One sentence each: what a person should know about the base now.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "rerank_alias": {
                      "description": "Empty: no rerank stage.",
                      "type": "string"
                    },
                    "resident_bytes": {
                      "description": "What the base's vectors cost resident in memory: embedded chunks x\ndimensions x 2.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "status": {
                      "description": "`ready` or `re_embed_required` (the vectors no longer match the pinned\nmodel; Resume fills them in).",
                      "enum": [
                        "ready",
                        "re_embed_required"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "vectors_rev": {
                      "description": "Moves on every chunk write.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "vision_alias": {
                      "description": "Empty: text-less PDF pages are skipped and counted.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "description",
                    "embed_alias",
                    "embed_upstream",
                    "embed_model",
                    "embed_dims",
                    "rerank_alias",
                    "vision_alias",
                    "chunk_tokens",
                    "chunk_overlap",
                    "mcp_visible",
                    "status",
                    "vectors_rev",
                    "created_at",
                    "updated_at",
                    "embed_identity",
                    "counts",
                    "resident_bytes",
                    "embed_context",
                    "embed_input_limit",
                    "embed_input_limit_source",
                    "embed_tokenizer",
                    "embed_resolvable",
                    "job",
                    "notes"
                  ],
                  "title": "KnowledgeBase",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a knowledge base",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/bases/{id}": {
      "get": {
        "description": "One base, as in the list, and its files. 400 op_failed for a base that does not exist.",
        "operationId": "get_api_knowledge_bases_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/knowledge/bases/{id}`.",
                  "properties": {
                    "base": {
                      "$ref": "#/components/schemas/KnowledgeBase"
                    },
                    "files": {
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeFile"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "base",
                    "files"
                  ],
                  "title": "KnowledgeBaseDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a knowledge base",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/knowledge/bases/{id}/cancel": {
      "post": {
        "description": "Asks the base's running ingest or re-embed to stop; the job finishes its current step and ends as canceled. Files not yet read stay pending, vectors already written stay, and Resume continues from there. 400 op_failed when no job is running on the base.",
        "operationId": "post_api_knowledge_bases_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/bases/{id}/cancel`.",
                  "properties": {
                    "job": {
                      "description": "The job that was asked to stop.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "job",
                    "message"
                  ],
                  "title": "CancelResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a base's running job",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/bases/{id}/delete": {
      "post": {
        "description": "Deletes the base with its files, chunks and vectors, and the stored originals nothing else uses. A job running on the base is cancelled first. Threads that referenced the base keep their stored citations; they lose the base from later retrievals.",
        "operationId": "post_api_knowledge_bases_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/bases/{id}/delete`.",
                  "properties": {
                    "chunks": {
                      "description": "Chunks the base held.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "deleted": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "files": {
                      "description": "Files the base held.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "deleted",
                    "name",
                    "files",
                    "chunks"
                  ],
                  "title": "KnowledgeBaseDeleted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a knowledge base",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "deletes the base, its files and every chunk and vector",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/bases/{id}/files": {
      "get": {
        "description": "The files of the base, with their ingest status (`pending`, `ingesting`, `ready`, `failed`), chunk counts and, for a failed one, the reason.",
        "operationId": "get_api_knowledge_bases_id_files",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/knowledge/bases/{id}/files`.",
                  "properties": {
                    "files": {
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeFile"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "files"
                  ],
                  "title": "KnowledgeFileList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a base's files",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "multipart/form-data, one part per file (the part's file name is the stored name, reduced to its last path component). The whole request is bounded by the max_body_mb setting (0 is unbounded): 413 body_limit naming it, for a declared or a streamed body. Each file's kind is sniffed from its bytes, never its name: images and audio are refused, as is an empty file. The answer has one item per part: `added`, `replaced` (the name existed with other bytes, or its ingest had failed; the file is queued again), `unchanged` (same name, same bytes), `duplicate` (same bytes under another name) or `refused` with the `reason`. A refused file does not fail the request. Added and replaced files are queued and the ingest job is started or joined: `job` is its id (`null` when nothing was queued). Ingestion — reading, chunking, embedding, a vision model for text-less PDF pages — runs in that job; observe it as for Resume. 400 no_files for a request without any part, 400 bad_request for a malformed multipart body.",
        "operationId": "post_api_knowledge_bases_id_files",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/bases/{id}/files`.",
                  "properties": {
                    "items": {
                      "description": "One per part, in order.",
                      "items": {
                        "$ref": "#/components/schemas/UploadItem"
                      },
                      "type": "array"
                    },
                    "job": {
                      "description": "The ingest job the upload started or joined; `null` when nothing was\nqueued.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "job"
                  ],
                  "title": "UploadResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Upload files into a base",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/bases/{id}/resume": {
      "post": {
        "description": "Starts the one job the base needs, or joins the one already running: a re-embed (`kb_reembed`) when chunks lack a vector or the base is marked `re_embed_required`, otherwise an ingest (`kb_ingest`) of the pending files. The route only starts the job and answers at once with its id in `job`; measuring the stored chunks against the model, re-chunking what does not fit and embedding all run in the job. When the last re-embed was refused as larger than the model's input, the files holding the oversized chunks are marked pending and an ingest (`kb_ingest`) re-chunks them instead: `kind` is `kb_ingest`, and `rechunk` says why. A base with nothing waiting answers `job: null` and a message. Observe progress with the job: `GET /api/jobs` lists it (key `kb:{id}`), the `jobs` frames of `GET /api/events` stream it, and the base's own `job` field keeps the last outcome. A file that failed is not retried here; re-ingest it.",
        "operationId": "post_api_knowledge_bases_id_resume",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/bases/{id}/resume`.",
                  "properties": {
                    "already_running": {
                      "description": "Present when Resume joined a running job (`true`) or started the\nplain ingest of the pending files (`false`); absent for a re-embed or\nre-chunk it started.",
                      "type": "boolean"
                    },
                    "job": {
                      "description": "The job now running (or already running); `null` when the base has\nnothing waiting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kind": {
                      "description": "`kb_ingest` or `kb_reembed`; absent when no job was started.",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "rechunk": {
                      "description": "Present when the files holding oversized chunks are re-chunked first:\nwhy.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "job"
                  ],
                  "title": "ResumeResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Resume a base's pending work",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/bases/{id}/settings": {
      "post": {
        "description": "Every field is optional; an empty `rerank_alias` or `vision_alias` clears it. A different `embed_alias` re-pins the base and starts a re-embed job (`reembed_job`); a changed `chunk_tokens` or `chunk_overlap` sends every file back to pending (`rechunk_files`) and starts an ingest job (`ingest_job`). Both are background jobs: search keeps serving the old chunks until the new ones are in. A model or chunk-size change while a job runs on the base is refused (400 op_failed naming the job): wait for it or cancel it first. Other refusals as for create.",
        "operationId": "post_api_knowledge_bases_id_settings",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /api/knowledge/bases/{id}/settings`: every field optional; an empty\n`rerank_alias` or `vision_alias` clears it.",
                "properties": {
                  "chunk_overlap": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chunk_tokens": {
                    "default": null,
                    "description": "A change re-chunks every file (a background job).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "description": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "embed_alias": {
                    "default": null,
                    "description": "A different model re-pins the base and re-embeds every chunk (a\nbackground job).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "mcp_visible": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "name": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rerank_alias": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "vision_alias": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "EditKnowledgeBase",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to a settings change: the base, and the work the change\nstarted.",
                  "properties": {
                    "ingest_job": {
                      "description": "The re-ingest a chunk-size change started.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb": {
                      "$ref": "#/components/schemas/KnowledgeBase"
                    },
                    "rechunk_files": {
                      "description": "Files a chunk-size change sent back to `pending`. A model change\ndecides inside its job which files to re-chunk; the job's stage and\ndetail say which.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reembed_job": {
                      "description": "The re-embed a model change started.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "kb",
                    "reembed_job",
                    "ingest_job",
                    "rechunk_files"
                  ],
                  "title": "KnowledgeBaseEdited",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change a base's settings",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/files/{id}/delete": {
      "post": {
        "description": "Deletes the file with its chunks and vectors, and its stored original unless another file shares the bytes. 400 op_failed for a file being ingested right now (cancel the base's job first) or one that does not exist.",
        "operationId": "post_api_knowledge_files_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/files/{id}/delete`.",
                  "properties": {
                    "chunks": {
                      "description": "Chunks the file held.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "deleted": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "deleted",
                    "name",
                    "chunks"
                  ],
                  "title": "KnowledgeFileDeleted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a file",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "deletes the file and its chunks",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/files/{id}/original": {
      "get": {
        "description": "The uploaded bytes, with the media type they were sniffed as and Content-Disposition: attachment under the file's name (an ASCII fallback plus the RFC 5987 filename*). 404 not_found for a file that does not exist or whose original is gone from disk.",
        "operationId": "get_api_knowledge_files_id_original",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Download a file's original",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/knowledge/files/{id}/reingest": {
      "post": {
        "description": "Marks the file pending and starts (or joins) the base's ingest job, whose id is `job`. Use it after the base gained a vision model, or for a failed file whose cause is fixed. The file's earlier chunks stay searchable until the new ones are in. 400 op_failed for a file being ingested right now.",
        "operationId": "post_api_knowledge_files_id_reingest",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/files/{id}/reingest`.",
                  "properties": {
                    "file": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job": {
                      "description": "The ingest job that will read it, started or joined.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "file",
                    "job"
                  ],
                  "title": "KnowledgeFileRequeued",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Ingest a file again",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/knowledge/files/{id}/text": {
      "get": {
        "description": "The source viewer: the file's extracted text (`null` until it has been ingested once), every chunk's byte range in that text, and the chunk named by `chunk` as `highlight`. A citation whose chunk id a later re-ingest renamed is found again by the `span_start`, `span_end` and `sha` the citation stored, and `notice` says so (or that the file changed since). 400 op_failed for a file that does not exist.",
        "operationId": "get_api_knowledge_files_id_text",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "chunk",
            "required": false,
            "schema": {
              "default": null,
              "description": "The chunk to highlight (a citation's chunk id).",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "sha",
            "required": false,
            "schema": {
              "default": null,
              "description": "... and the file's sha256 when it was cited.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "span_end",
            "required": false,
            "schema": {
              "default": null,
              "description": "... its end ...",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "span_start",
            "required": false,
            "schema": {
              "default": null,
              "description": "What a citation stored besides the chunk id, for one whose chunk id a\nre-ingest renamed: the passage's start (byte offset into the text) ...",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/knowledge/files/{id}/text`: the source viewer's answer.",
                  "properties": {
                    "chunks": {
                      "description": "Every chunk's span, in file order.",
                      "items": {
                        "$ref": "#/components/schemas/ChunkSpan"
                      },
                      "type": "array"
                    },
                    "file": {
                      "$ref": "#/components/schemas/KnowledgeFile"
                    },
                    "highlight": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ChunkSpan"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The cited chunk (or the one found by the citation's position)."
                    },
                    "kb_name": {
                      "type": "string"
                    },
                    "notice": {
                      "description": "Said when the highlight is not the cited chunk itself: it was found by\nthe citation's stored position because the chunk id no longer exists.",
                      "type": "string"
                    },
                    "text": {
                      "description": "The extracted text; `null` until the file has been ingested once.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "file",
                    "kb_name",
                    "text",
                    "chunks",
                    "highlight"
                  ],
                  "title": "KnowledgeSource",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a file's extracted text",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/knowledge/search": {
      "post": {
        "description": "The search playground: hybrid keyword and vector search with fusion and, where the base names a reranker, reranking, over the bases in `kb_ids` (none given: every base, whether or not it is visible to the `kb__*` tools). The answer has the excerpts with their scores and positions, `notes` for what was not searched or not fully (a base still ingesting, chunks without a vector, a model that no longer resolves), and `traces`, one per embedding and rerank model pair, with what each stage saw and how long it took. `budget_tokens` bounds the excerpts' token total; `params` overrides the search stages. Searching embeds the query, which costs a model call. A search that cannot use a model says so in `notes` instead of failing. 400 op_failed for an unknown `params` key.",
        "operationId": "post_api_knowledge_search",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /api/knowledge/search`.",
                "properties": {
                  "budget_tokens": {
                    "default": null,
                    "description": "Token budget for the excerpts; `0` or absent: none (the search's own\n`limit` decides).",
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "kb_ids": {
                    "default": [],
                    "description": "The bases to search; omitted or empty searches every base.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "params": {
                    "additionalProperties": false,
                    "default": null,
                    "description": "Stage overrides on top of the configured search defaults. Any subset of\nthe keys below; an unknown key is a 400 op_failed naming the valid ones.",
                    "properties": {
                      "budget_tokens": {
                        "description": "Token budget.",
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "fts_weights": {
                        "description": "BM25 column weights: payload, heading_path, derived_title, derived_summary.",
                        "type": "object"
                      },
                      "k_fts": {
                        "description": "Candidates from keyword search.",
                        "type": "integer"
                      },
                      "k_rerank": {
                        "description": "How many fused candidates the reranker scores.",
                        "type": "integer"
                      },
                      "k_vec": {
                        "description": "Candidates from vector search.",
                        "type": "integer"
                      },
                      "limit": {
                        "description": "Excerpts returned at most.",
                        "type": "integer"
                      },
                      "rerank": {
                        "description": "Whether the rerank stage runs.",
                        "type": "boolean"
                      },
                      "rrf_k": {
                        "description": "Reciprocal-rank-fusion constant.",
                        "type": "number"
                      }
                    },
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "query": {
                    "type": "string"
                  }
                },
                "required": [
                  "query"
                ],
                "title": "KnowledgeSearchRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/knowledge/search`: what a search found and what it could not do.",
                  "properties": {
                    "dropped": {
                      "description": "Excerpts that ranked but did not fit the budget.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "excerpts": {
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeExcerpt"
                      },
                      "type": "array"
                    },
                    "ms": {
                      "description": "How long the search took.",
                      "format": "double",
                      "type": "number"
                    },
                    "notes": {
                      "description": "Why something was not searched, or not fully; one sentence each.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "searched": {
                      "description": "The bases that were searched, by name.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "tokens": {
                      "description": "Tokens the excerpts use.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "traces": {
                      "description": "One per search (per embedding and rerank model pair): what each stage\nsaw.",
                      "items": {
                        "$ref": "#/components/schemas/SearchTraceView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "excerpts",
                    "tokens",
                    "dropped",
                    "notes",
                    "ms",
                    "searched",
                    "traces"
                  ],
                  "title": "KnowledgeSearchResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Search knowledge bases",
        "tags": [
          "knowledge"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/ladder-rung-plan": {
      "get": {
        "description": "The ladder editor's per-rung footprint table: every rung shares cache types, projector and drafter with the base row.",
        "operationId": "get_api_ladder_rung_plan",
        "parameters": [
          {
            "in": "query",
            "name": "cache_type_k",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "cache_type_v",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ctx_size",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "draft_gguf_path",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "gguf_path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "mmproj_path",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "n_gpu_layers",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/ladder-rung-plan` — one ladder rung's footprint, MTP flag and\ntrained context: what the editor's rung table\ncannot compute itself. Per-slot context and switchover are plain\narithmetic the UI does over fields it already holds, capped at\n`trained_context` the way llama-server caps every slot.",
                  "properties": {
                    "footprint": {
                      "$ref": "#/components/schemas/RungFootprint"
                    },
                    "has_mtp_layers": {
                      "description": "Whether the GGUF header carries MTP tensors.",
                      "type": "boolean"
                    },
                    "trained_context": {
                      "description": "The weights' trained context (`<arch>.context_length`): llama-server\ncaps every slot there, and a rung whose per-slot context\nis above it is refused. `None` when the header does not say.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "footprint",
                    "has_mtp_layers",
                    "trained_context"
                  ],
                  "title": "RungPlan",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Plan a ladder's rungs",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/llama-flags": {
      "get": {
        "description": "The llama-server flags a model (or a search over models) would start with — the same read lmgw__llama_flags answers.",
        "operationId": "get_api_llama_flags",
        "parameters": [
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "description": "A configured model id (any class) or an image reference; absent reads\nthe chat class image (the flag vocabulary is per image).",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/llama-flags` — the flag vocabulary of one llama-server image.",
                  "properties": {
                    "allowed_values": {
                      "additionalProperties": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "description": "For flags that take a fixed set of values, the values, keyed by flag.",
                      "type": "object"
                    },
                    "flag_count": {
                      "description": "How many flags the image has before the search filter.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "flags": {
                      "description": "The flags matching the search (all of them without one).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "image": {
                      "description": "The image whose `--help` was read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Why the vocabulary is per image.",
                      "type": "string"
                    },
                    "removed": {
                      "description": "Flags the image removed or renamed away.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "image",
                    "flag_count",
                    "flags",
                    "allowed_values",
                    "removed",
                    "note"
                  ],
                  "title": "LlamaFlags",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview a model's llama-server flags",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/local-model": {
      "get": {
        "description": "One local model's full definition, by id or model_id. Row ids are per table, so pass target together with id; without target a model_id is searched in the chat table first, then aux, image and audio. target narrows the lookup to one table. The answer's class field says which of the four shapes it is.",
        "operationId": "get_api_local_model",
        "parameters": [
          {
            "in": "query",
            "name": "id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "model_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "description": "`chat` | `aux` | `image` | `audio`; absent looks in chat first, then aux, image and audio.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One local model, with `class` naming which arm it is.",
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/LocalModelDetail",
                      "description": "A llama-server chat model.",
                      "properties": {
                        "class": {
                          "const": "chat",
                          "type": "string"
                        }
                      },
                      "required": [
                        "class"
                      ],
                      "type": "object"
                    },
                    {
                      "$ref": "#/components/schemas/AuxModelDetail",
                      "description": "An embedding, rerank or decision model.",
                      "properties": {
                        "class": {
                          "const": "aux",
                          "type": "string"
                        }
                      },
                      "required": [
                        "class"
                      ],
                      "type": "object"
                    },
                    {
                      "$ref": "#/components/schemas/ImageModelDetail",
                      "description": "A stable-diffusion.cpp pipeline.",
                      "properties": {
                        "class": {
                          "const": "image",
                          "type": "string"
                        }
                      },
                      "required": [
                        "class"
                      ],
                      "type": "object"
                    },
                    {
                      "$ref": "#/components/schemas/AudioModelDetail",
                      "description": "An audio.cpp model.",
                      "properties": {
                        "class": {
                          "const": "audio",
                          "type": "string"
                        }
                      },
                      "required": [
                        "class"
                      ],
                      "type": "object"
                    }
                  ],
                  "title": "LocalModelRead"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a local model's definition",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/local-model-check": {
      "get": {
        "description": "Checks a local model's config without starting it (missing files, a port already in use, and the like) — the same read lmgw__local_model_check answers.",
        "operationId": "get_api_local_model_check",
        "parameters": [
          {
            "in": "query",
            "name": "model_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/local-model-check` — the static pre-flight over local models,\nwithout starting any of them.",
                  "properties": {
                    "broken": {
                      "description": "How many of `models` have problems (`ok` false).",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "checked": {
                      "description": "How many models were looked at (all classes asked for).",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "models": {
                      "description": "Models with something to report, or the one asked for by name.",
                      "items": {
                        "$ref": "#/components/schemas/ModelCheck"
                      },
                      "type": "array"
                    },
                    "note": {
                      "description": "What the check does and does not prove.",
                      "type": "string"
                    },
                    "with_advisories": {
                      "description": "How many carry advisories; those never count as broken.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "checked",
                    "broken",
                    "with_advisories",
                    "models",
                    "note"
                  ],
                  "title": "LocalModelCheck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Check a local model's config",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/local-model-plan": {
      "get": {
        "description": "A complete, ready-to-apply local-model parameter set derived from a GGUF file's own metadata, with a rationale for each value — the editor's wizard read, and the same one lmgw__local_model_plan answers. A file on disk is named by path; a file on Hugging Face by repo and file, planned from its header before anything is downloaded (1 to 16 MiB read a file). A chat or aux plan carries its source and its fit on the graphics card, against the whole card and beside what runs on it now; an image plan (target=image) carries neither yet.",
        "operationId": "get_api_local_model_plan",
        "parameters": [
          {
            "in": "query",
            "name": "file",
            "required": false,
            "schema": {
              "description": "The weights file's path in `repo`.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "path",
            "required": false,
            "schema": {
              "description": "The weights GGUF relative to the target's models dir.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "repo",
            "required": false,
            "schema": {
              "description": "A Hugging Face repo (`owner/name`), with `file`: the plan reads the\nfile's header from the hub (1 to 16 MiB) before anything is downloaded.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "description": "`chat` (default) | `aux` | `image` — which class's models dir `path`\nis under; for `repo` + `file`, the class to plan for, else the\nheader's.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/local-model-plan?path=` — ready-to-apply parameter set derived\nfrom GGUF metadata. `params` stays dynamic (it is LocalModelPatch-shaped\nand merges straight into a `local_model_set` create call).",
                  "properties": {
                    "configured_as": {
                      "description": "The rows of the planned class already serving this GGUF, each with how\nit differs from the plan. A row's comparison is the plan's own: it\nknows what the plan's raw `params` do not (a tuning the row may take\nfurther, a projector its args already name, placement left to the\nowner), so an editor refills a saved row from `change`, not `params`.",
                      "items": {
                        "$ref": "#/components/schemas/ConfiguredAs"
                      },
                      "type": "array"
                    },
                    "fit": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/PlanFit"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The planned file's fit on the card, by both measures (find-a-model\ndesign §3.1); `None` for an image plan, whose fit on the card isn't\nmeasured yet."
                    },
                    "model_id": {
                      "type": "string"
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "rationale": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "source": {
                      "$ref": "#/components/schemas/PlanSource",
                      "description": "Where the plan's input came from: the disk, or the hub before any\ndownload (find-a-model design §2.3). An image plan (`target=image`)\nhas no `source` in its answer: it is always from the disk."
                    },
                    "warnings": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "model_id",
                    "params",
                    "rationale",
                    "warnings",
                    "configured_as",
                    "next_step",
                    "source",
                    "fit"
                  ],
                  "title": "PlanResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Plan a local model's parameters",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/logs": {
      "get": {
        "description": "A page of the request log, filterable by alias, upstream, key, error kind and class — the same row shape the request SSE frame carries, so the live feed and pagination share one type.",
        "operationId": "get_api_logs",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "alias_q",
            "required": false,
            "schema": {
              "description": "Substring matches (case-insensitive) for what a Traffic filter box\ntypes; `alias`/`upstream` stay exact, which is what a link carries.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "error_kind",
            "required": false,
            "schema": {
              "description": "One refusal or error kind — what the Usage page's errors chart links a\nsegment to. Without it the link would silently return the unfiltered\nhead, which looks like an answer.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "errors_only",
            "required": false,
            "schema": {
              "description": "`1`, `true`, `yes` or `on` (any case) lists errors only.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "description": "Identity, not name: a key filter has to survive a rename.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream_q",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/logs` — newest first; `before_id` pages further back.",
                  "properties": {
                    "logs": {
                      "items": {
                        "$ref": "#/components/schemas/RequestRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "logs"
                  ],
                  "title": "LogsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List recent requests",
        "tags": [
          "status"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/mcp-servers": {
      "get": {
        "description": "Every registered southbound MCP server, its connection state, its exposed tools and how many MCP tasks it runs for Chat threads now (`open_tasks`).",
        "operationId": "get_api_mcp_servers",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/mcp-servers` — config plus live status. List-valued fields are\nnewline-joined strings (the ops-plane schema shape); secret env/header\nvalues arrive as `<set>` and round-trip safely.",
                  "properties": {
                    "mcp_servers": {
                      "items": {
                        "$ref": "#/components/schemas/McpServerView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "mcp_servers"
                  ],
                  "title": "McpServersResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List registered MCP servers",
        "tags": [
          "tools"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-tool": "lmgw__mcp_servers",
        "x-lmgw-writes": false
      }
    },
    "/api/mcp-servers/{id}/tools": {
      "get": {
        "description": "One server's exposed tools — what a Chat thread's MCP picker offers.",
        "operationId": "get_api_mcp_servers_id_tools",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/mcp-servers/{id}/tools` — one server's exposed surface, for the\nChat thread picker that narrows which of them a conversation may call.",
                  "properties": {
                    "tools": {
                      "items": {
                        "$ref": "#/components/schemas/McpToolView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "tools"
                  ],
                  "title": "McpServerToolsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List one MCP server's tools",
        "tags": [
          "tools"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/model-inspect": {
      "get": {
        "description": "Reads a GGUF file's metadata, optionally probing it — the same read lmgw__model_inspect answers.",
        "operationId": "get_api_model_inspect",
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "description": "`chat` (default) | `aux` — which class's models dir `path` is under.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/model-inspect` — what a GGUF file is, from its header.",
                  "properties": {
                    "architecture": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "aux_kind": {
                      "description": "For an aux file: `embed`, `rerank` or `decision`.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "block_count": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "context_length": {
                      "description": "The model's trained context, in tokens.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "file_size": {
                      "description": "`file_size_bytes` for a person to read.",
                      "type": "string"
                    },
                    "file_size_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "full_attention_interval": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "has_audio_encoder": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "has_chat_template": {
                      "type": "boolean"
                    },
                    "has_classifier_head": {
                      "description": "A classification head, as a cross-encoder reranker has.",
                      "type": "boolean"
                    },
                    "has_mtp_layers": {
                      "type": "boolean"
                    },
                    "has_vision_encoder": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "head_count": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "head_count_kv": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "head_count_kv_per_layer": {
                      "description": "Per-layer KV heads, on models whose layers differ.",
                      "items": {
                        "format": "uint64",
                        "minimum": 0,
                        "type": "integer"
                      },
                      "type": [
                        "array",
                        "null"
                      ]
                    },
                    "licence": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelLicence"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The licence the header states; null when it states none."
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "path": {
                      "description": "The path under the class's models dir.",
                      "type": "string"
                    },
                    "pooling_type": {
                      "description": "`none`, `mean`, `cls`, `last` or `rank`; set on encoders.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "projector_type": {
                      "description": "On a projector file: its type.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quant": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "role": {
                      "description": "`weights`, `mmproj` (a projector), `drafter` or `unknown`.",
                      "type": "string"
                    },
                    "serve_as": {
                      "description": "Which class serves this file, from its header rather than its\ndirectory: `chat` or `aux`.",
                      "type": "string"
                    },
                    "signals": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/TemplateSignals"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Text heuristics over the chat template; null without a template."
                    },
                    "size_label": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sliding_window": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "sliding_window_pattern": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "sliding_window_pattern_is_array": {
                      "description": "`sliding_window_pattern` counts layers described, not a stride.",
                      "type": "boolean"
                    },
                    "suggested_spec_type": {
                      "description": "The `spec_type` the file calls for when it is a drafter or carries\nMTP layers.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "target": {
                      "description": "The models dir class the path was resolved in: `chat` or `aux`.",
                      "type": "string"
                    },
                    "vision_block_count": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "vram_estimate": {
                      "$ref": "#/components/schemas/VramEstimate"
                    }
                  },
                  "required": [
                    "path",
                    "target",
                    "role",
                    "serve_as",
                    "aux_kind",
                    "pooling_type",
                    "has_classifier_head",
                    "suggested_spec_type",
                    "architecture",
                    "name",
                    "size_label",
                    "licence",
                    "quant",
                    "context_length",
                    "block_count",
                    "head_count",
                    "head_count_kv",
                    "head_count_kv_per_layer",
                    "sliding_window",
                    "sliding_window_pattern",
                    "sliding_window_pattern_is_array",
                    "full_attention_interval",
                    "has_chat_template",
                    "signals",
                    "has_mtp_layers",
                    "projector_type",
                    "vision_block_count",
                    "has_vision_encoder",
                    "has_audio_encoder",
                    "file_size_bytes",
                    "file_size",
                    "vram_estimate"
                  ],
                  "title": "ModelInspect",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Inspect a GGUF file",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/models/full": {
      "get": {
        "description": "Every configured model, all five kinds, plus candidate aliases and expose-all passthrough upstreams — the Models page's one read.",
        "operationId": "get_api_models_full",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/models/full` — every configured model, all five kinds.",
                  "properties": {
                    "aliases": {
                      "items": {
                        "$ref": "#/components/schemas/AliasView"
                      },
                      "type": "array"
                    },
                    "audio": {
                      "items": {
                        "$ref": "#/components/schemas/AudioModelView"
                      },
                      "type": "array"
                    },
                    "aux": {
                      "items": {
                        "$ref": "#/components/schemas/AuxModelView"
                      },
                      "type": "array"
                    },
                    "candidate_aliases": {
                      "description": "Candidate aliases. Defaulted, like\n`image`, so a UI bundle newer than the gateway it is talking to still\nparses the payload.",
                      "items": {
                        "$ref": "#/components/schemas/CandidateAliasView"
                      },
                      "type": "array"
                    },
                    "image": {
                      "description": "The stable-diffusion.cpp class. Defaulted\nrather than required, so a UI bundle newer than the gateway it is\ntalking to still parses the payload.",
                      "items": {
                        "$ref": "#/components/schemas/ImageModelView"
                      },
                      "type": "array"
                    },
                    "local": {
                      "items": {
                        "$ref": "#/components/schemas/LocalModelView"
                      },
                      "type": "array"
                    },
                    "passthrough": {
                      "description": "Enabled `expose_all` upstreams: (upstream name, request prefix).",
                      "items": {
                        "$ref": "#/components/schemas/PassthroughUpstream"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "aliases",
                    "candidate_aliases",
                    "local",
                    "aux",
                    "audio",
                    "image",
                    "passthrough"
                  ],
                  "title": "ModelsFull",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List every configured model",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/op/agent_config_set": {
      "post": {
        "description": "A sparse patch over the stored config values. `clear` is the way out of the patch's one asymmetry: an empty submission keeps a stored secret (the house convention for tokens), so removing a value — including clearing a secret — is its own explicit list, which can also reset any field to its schema default.",
        "operationId": "op_agent_config_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "clear": {
                    "description": "Field names to remove from the stored config outright (the one gesture for 'forget this value', including a secret an empty submission would otherwise keep).",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  },
                  "values": {
                    "description": "A sparse patch over the stored config values — a field left out keeps what is stored.",
                    "type": "object",
                    "x-lmgw-secret": true
                  }
                },
                "required": [
                  "id",
                  "values"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_config_set` — the stored config after a sparse patch.",
                  "properties": {
                    "cleared_undeclared": {
                      "description": "Names in `clear` that the manifest does not declare. Clearing one is\nlegitimate (it is how a value orphaned by a manifest change goes away),\nbut a typo in `clear` looks exactly like it.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "config": {
                      "description": "What is now stored, with every `secret` field replaced by\n`{ \"has_value\": bool }` — the merged values, not the patch."
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "mounts_repointed": {
                      "description": "The folder and file slots whose stored path changed, cleared ones\nincluded.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "service_stopped": {
                      "description": "A running app container holds the old folder, so a re-pointed slot stops\nit: the name of the container that was stopped; absent when none was\nrunning.",
                      "type": "string"
                    },
                    "token_scope": {
                      "description": "The agent's token scope, re-derived from the saved config, in words:\n`token: any model` or the aliases it is fenced to.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "token_scope",
                    "mounts_repointed",
                    "config",
                    "cleared_undeclared",
                    "message"
                  ],
                  "title": "AgentConfigSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save a sparse patch over an agent's stored config",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_config_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_delete": {
      "post": {
        "description": "Remove an agent from the catalog. A shipped agent stays deleted across restarts; the `agents_restore` op on the dashboard is the deliberate way back. If it was hand-written, read its manifest with lmgw__agent_get first — that is the only copy.",
        "operationId": "op_agent_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from lmgw__agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_delete` and `lmgw__agent_delete`.",
                  "properties": {
                    "hint": {
                      "description": "How to bring it back: `agents_restore` for a shipped agent, importing\nthe exported file for any other.",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "threads_kept": {
                      "description": "Chat threads that were opened through the agent and were kept, on the\nChat page, without it.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "threads_kept",
                    "message",
                    "hint"
                  ],
                  "title": "AgentDeleted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Remove an agent from the catalog",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_delete",
        "x-lmgw-tool": "lmgw__agent_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_dev_url_set": {
      "post": {
        "description": "A row setting, never part of the manifest: overrides service mode only. Setting one stops a running app container, since it was started from the image this override replaces. Omitting url (or an empty string) clears it back to the image. Both are refused for an agent that declares no run.service.",
        "operationId": "op_agent_dev_url_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  },
                  "url": {
                    "description": "The dev server's URL. Omit or empty to serve from the image again.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_dev_url_set` — the agent's app is served from a dev\nserver (`dev_url` is its URL), or from its image again (`dev_url` is empty).",
                  "properties": {
                    "dev_url": {
                      "description": "The dev server's URL as stored; empty when the override was cleared.",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "stopped": {
                      "description": "Setting a URL stops a running app container, since it was started from\nthe image the URL replaces: the name of the container that was stopped.\nAbsent when none was running, and when the override was cleared.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "dev_url",
                    "message"
                  ],
                  "title": "AgentDevUrlSet",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Point an agent's app at a dev server, or back at its image",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_dev_url_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_duplicate": {
      "post": {
        "description": "Same manifest under a new id, config copied minus secrets — a copy must not silently inherit a credential.",
        "operationId": "op_agent_duplicate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id to copy, from /api/agents.",
                    "type": "string"
                  },
                  "name": {
                    "description": "The copy's display name. Default: '<name> (copy)'.",
                    "type": "string"
                  },
                  "new_id": {
                    "description": "The copy's id — a DNS label ([a-z0-9][a-z0-9-]*).",
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "new_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_duplicate` — a copy of an agent under a new id.",
                  "properties": {
                    "config_omitted": {
                      "description": "The `secret` config fields left out of the copy: a copy must not\nsilently inherit a credential.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The copy's id.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "The copy's name: the one asked for, or the original's with ` (copy)`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "config_omitted",
                    "message"
                  ],
                  "title": "AgentDuplicated",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Copy an agent's manifest under a new id",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_duplicate",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_enable": {
      "post": {
        "description": "Disable is the kill switch: the agent's token stops authenticating anywhere, and a running app container is stopped (`service_stopped` names it; the sentence is in `message`).",
        "operationId": "op_agent_enable",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "description": "Whether the agent (and its token) is usable at all.",
                    "type": "boolean"
                  },
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "enabled"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_enable` — the agent was enabled or disabled.",
                  "properties": {
                    "enabled": {
                      "description": "The state it is in now.",
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "service_stopped": {
                      "description": "Disabling stops a running app container: the name of the container that\nwas stopped; absent when none was running or the agent was enabled. The\nsentence is in `message`.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "enabled",
                    "message"
                  ],
                  "title": "AgentEnabled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Enable or disable an agent",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_enable",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_install": {
      "post": {
        "description": "Install an agent from an image: lmgw reads its manifest out of the image at /lmgw/agent.json without starting it, then installs it through the same path agent_set uses, so the report shape is the same (plus image, digest — absent when podman reports none — pulled, manifest_path and message). `pull` defaults to 'never' — an image not already on the box is reported rather than downloaded.",
        "operationId": "op_agent_install",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "image": {
                    "description": "The image reference, tag and all (e.g. localhost/mail-labeler:1).",
                    "type": "string"
                  },
                  "pull": {
                    "description": "What to do when the image is not on this box. Default 'never' — report it, download nothing.",
                    "enum": [
                      "never",
                      "missing",
                      "always"
                    ],
                    "type": "string"
                  },
                  "replace": {
                    "description": "Overwrite an existing agent with the id inside the image (its config is kept). Default false.",
                    "type": "boolean"
                  },
                  "validate_only": {
                    "description": "Report what the image would install and write nothing. Default false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "image"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_install` and `lmgw__agent_install` — the import report\nof the manifest read out of the image (what `agent_set` returns), and where\nit came from. `warnings` can carry a line a pasted manifest never earns: a\ndigest podman could not report, or a `run.image` other than the image\ninstalled.",
                  "properties": {
                    "config_unbound": {
                      "description": "Mount slots this agent has and nothing has bound: an\nexport never carries a host path, so an imported agent arrives with its\n`directory` and `file` fields empty and the importer says which folder.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "digest": {
                      "description": "The image's digest; absent when podman could not report one.",
                      "type": "string"
                    },
                    "dropped_config": {
                      "description": "Stored config keys the **new** manifest no longer declares, removed with\nthe manifest that declared them (the same rule applies to every replace). Keeping them\nwould leave a row that fails validation\non every run and cannot be fixed from its own config form.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "description": "The image reference that was installed, trimmed.",
                      "type": "string"
                    },
                    "manifest_path": {
                      "description": "Where the manifest was read from inside the image: `/lmgw/agent.json`.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "pulled": {
                      "description": "This call downloaded the image: `false` when it was already on the box\n(or `always` found it unchanged), so a download is never left to be\ninferred from how long the call took.",
                      "type": "boolean"
                    },
                    "replaced": {
                      "description": "An existing agent was overwritten (`replace=1`), keeping its config.",
                      "type": "boolean"
                    },
                    "requires": {
                      "items": {
                        "$ref": "#/components/schemas/AgentRequirement"
                      },
                      "type": "array"
                    },
                    "validate_only": {
                      "description": "`validate_only=1`: the same report, nothing written.",
                      "type": "boolean"
                    },
                    "warnings": {
                      "description": "A missing server label or tool: the agent is saved, Start is disabled.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "warnings",
                    "requires",
                    "replaced",
                    "dropped_config",
                    "config_unbound",
                    "validate_only",
                    "image",
                    "pulled",
                    "manifest_path",
                    "message"
                  ],
                  "title": "AgentInstalled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Install an agent from an OCI image carrying its manifest",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_install",
        "x-lmgw-tool": "lmgw__agent_install",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_open_chat": {
      "post": {
        "description": "Open a new Chat thread configured from a `chat`-kind agent's manifest — model alias, system prompt, attached MCP tools — optionally patched by `values` for this thread only.",
        "operationId": "op_agent_open_chat",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  },
                  "values": {
                    "description": "A sparse patch over the stored config, applied to this run only — same shape as agent_config_set's values.",
                    "type": "object",
                    "x-lmgw-secret": true
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_open_chat` — a new Chat thread was opened from a `chat`\nagent's manifest.",
                  "properties": {
                    "id": {
                      "description": "The agent's id.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "model": {
                      "description": "The model alias the thread was opened on: the manifest's, rendered\nagainst the config.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "thread_id": {
                      "description": "The new thread's id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "tools": {
                      "description": "The tool labels the thread attaches, in manifest order.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "url": {
                      "description": "Where the dashboard navigates to: `/chat?t=<thread_id>`.",
                      "type": "string"
                    },
                    "warnings": {
                      "description": "What is off about a thread that did open: an alias the gateway does not\nserve, a tool server that is not registered, manifest sampling knobs a\nthread has no column for.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "thread_id",
                    "model",
                    "tools",
                    "url",
                    "warnings",
                    "message"
                  ],
                  "title": "AgentChatOpened",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Open a chat thread for a chat-kind agent",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_open_chat",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_pull": {
      "post": {
        "description": "Pressing this is the consent, so it pulls under every policy, 'never' included. `changed` is true when the digest moved or the image arrived (none before), false when it did not, and absent when podman reports no digest after the pull. When it is true, the new image's manifest is read and compared with the stored one — never adopted automatically; that is what agent_reimport is for.",
        "operationId": "op_agent_pull",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_pull` — the agent's image was fetched again, and this is\nwhether it moved. Nothing is adopted: when the digest moved and the new image\ncarries a different manifest, `agent_reimport` is the owner saying yes.",
                  "properties": {
                    "changed": {
                      "description": "Whether the image changed. Both digests known: they differ. No digest\nbefore and one now: `true`, the image arrived. Absent when podman could\nnot report a digest after the pull (unknown).",
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "description": "The image reference that was pulled.",
                      "type": "string"
                    },
                    "manifest_differs": {
                      "description": "Only asked when `changed` is `true`: the new image's manifest differs from\nthe stored one (`true`), is the same (`false`), or could not be compared\n(`null`, and `note` says why). `null` too when nothing moved.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "new_digest": {
                      "description": "The digest after the pull; absent when podman could not report one.",
                      "type": "string"
                    },
                    "note": {
                      "description": "What the comparison found, for a person to read; empty when nothing\nmoved.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "old_digest": {
                      "description": "The digest podman held before the pull; absent when it held none, or\ncould not report one.",
                      "type": "string"
                    },
                    "recorded_digest": {
                      "description": "The digest the agent's row recorded when it was installed or last\npulled — different from `old_digest` whenever something else on the box\nmoved the image. Absent for a row that never recorded one.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "image",
                    "manifest_differs",
                    "note",
                    "message"
                  ],
                  "title": "AgentPulled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Fetch this agent's image again and report whether it moved",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_pull",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_reimport": {
      "post": {
        "description": "Run the install path again over an existing row: the manifest is replaced and the config is kept. The answer is the import report plus the image, whether its manifest differed from the stored one, and a message. Refused when the image carries a different agent id than this row — install it as its own agent instead.",
        "operationId": "op_agent_reimport",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_reimport` — the install path ran again over an existing\nrow: the manifest was replaced and the config kept. The import report of the\nmanifest read out of the image, and whether it differed from the stored one.",
                  "properties": {
                    "changed": {
                      "description": "The image's manifest differs from the one that was stored. `false`\nalso adds a line to `warnings` saying nothing about the agent changed.",
                      "type": "boolean"
                    },
                    "config_unbound": {
                      "description": "Mount slots this agent has and nothing has bound: an\nexport never carries a host path, so an imported agent arrives with its\n`directory` and `file` fields empty and the importer says which folder.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "dropped_config": {
                      "description": "Stored config keys the **new** manifest no longer declares, removed with\nthe manifest that declared them (the same rule applies to every replace). Keeping them\nwould leave a row that fails validation\non every run and cannot be fixed from its own config form.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "description": "The image the manifest was read from.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "replaced": {
                      "description": "An existing agent was overwritten (`replace=1`), keeping its config.",
                      "type": "boolean"
                    },
                    "requires": {
                      "items": {
                        "$ref": "#/components/schemas/AgentRequirement"
                      },
                      "type": "array"
                    },
                    "validate_only": {
                      "description": "`validate_only=1`: the same report, nothing written.",
                      "type": "boolean"
                    },
                    "warnings": {
                      "description": "A missing server label or tool: the agent is saved, Start is disabled.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "warnings",
                    "requires",
                    "replaced",
                    "dropped_config",
                    "config_unbound",
                    "validate_only",
                    "image",
                    "changed",
                    "message"
                  ],
                  "title": "AgentReimported",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Re-run the install path over an existing agent's row",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_reimport",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_reset": {
      "post": {
        "description": "A shipped agent back to its built-in manifest, keeping its config — except a value the new schema no longer declares, which is dropped and named in the answer.",
        "operationId": "op_agent_reset",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_reset` — a shipped agent is back on its built-in\nmanifest, keeping its config.",
                  "properties": {
                    "dropped_config": {
                      "description": "Stored config keys the shipped schema no longer declares, dropped so the\nnext Start does not fail on them.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "dropped_config",
                    "message"
                  ],
                  "title": "AgentReset",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Restore a shipped agent to its built-in manifest",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_reset",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_run": {
      "post": {
        "description": "One live run per agent: when one is in flight, nothing starts and the answer is that run, with `already_running` true and its own `phase`.",
        "operationId": "op_agent_run",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "base_job": 1234,
                  "id": "mail-labeler",
                  "phase": "apply"
                },
                "properties": {
                  "base_job": {
                    "description": "apply only: the job id whose config this apply reuses.",
                    "type": "integer"
                  },
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  },
                  "phase": {
                    "description": "What to run.",
                    "enum": [
                      "list",
                      "classify",
                      "rerun",
                      "apply"
                    ],
                    "type": "string"
                  },
                  "rows": {
                    "description": "apply only: the reviewed rows from a finished 'classify' run.",
                    "items": {},
                    "type": "array"
                  },
                  "values": {
                    "description": "A sparse patch over the stored config, applied to this run only.",
                    "type": "object",
                    "x-lmgw-secret": true
                  }
                },
                "required": [
                  "id",
                  "phase"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_run` and `lmgw__agent_run` — one phase of a run was\nstarted, or a run of the agent is already in flight and this is that one.",
                  "properties": {
                    "already_running": {
                      "description": "\"One live run per agent\" is a report, not a refusal: a run of this\nagent was in flight, `job_id` is that one and nothing was started.",
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "job_id": {
                      "description": "The run's job id, for `GET /api/agents/runs/{job_id}`: the new run's,\nor the one in flight when `already_running`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "phase": {
                      "description": "The phase of the run `job_id` names — the one asked for, or when\n`already_running` the in-flight run's own: `list`, `classify`, `rerun`,\n`apply`, or `run` for a `container` agent.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "job_id",
                    "phase",
                    "already_running",
                    "message"
                  ],
                  "title": "AgentRunStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start one phase of a batch agent's run",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_run",
        "x-lmgw-tool": "lmgw__agent_run",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_run_cancel": {
      "post": {
        "description": "Cooperative cancel: the executor stops between items and keeps the rows it has.",
        "operationId": "op_agent_run_cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_run_cancel` — the agent's run was asked to stop. The\nexecutor stops between items and keeps the rows it has.",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "AgentRunCancelled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Ask an agent's in-flight run to stop",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_run_cancel",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_service_log": {
      "post": {
        "description": "The App tab's log block, as long as the reader asks for — asking for 0 lines means the whole log; the answer's `lines` counts what came back. The only account of a detached service container: it writes no run ledger, no job row and no result.",
        "operationId": "op_agent_service_log",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  },
                  "lines": {
                    "description": "How many lines from the end. 0 = the whole log. Default a short excerpt.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_service_log` — the tail of the agent's app container's\nlog, as long as the reader asked for. Nothing running is an answer, not an\nerror: the container may have idle-stopped between the page load and the\nclick.",
                  "properties": {
                    "container": {
                      "description": "The container the log is read from. Absent when nothing is running.",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "lines": {
                      "description": "How many lines `log` holds. Fewer than asked for when the container has\nlogged less (`0` asked for is the whole log).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "log": {
                      "description": "The log's tail.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "running": {
                      "description": "Whether the app container is running; `log` is empty when it is not.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "lines",
                    "running",
                    "log",
                    "message"
                  ],
                  "title": "AgentServiceLog",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read an agent's app container's log tail",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_service_log",
        "x-lmgw-writes": false
      }
    },
    "/api/op/agent_service_start": {
      "post": {
        "description": "The same on-demand path a proxied request takes, pressed by hand: one start however many callers ask, the manifest's health probe, its start_timeout_seconds.",
        "operationId": "op_agent_service_start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_service_start` — the agent's app container is up, and\nhealthy.",
                  "properties": {
                    "container": {
                      "description": "The container's name.",
                      "type": "string"
                    },
                    "host_port": {
                      "description": "The loopback port the container's app is published on.",
                      "format": "uint16",
                      "maximum": 65535,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "origin": {
                      "description": "Where the app answers now: the agent's own origin, which is what a\nreader opens (the host port is lmgw's business).",
                      "type": "string"
                    },
                    "running": {
                      "description": "Always `true`.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "running",
                    "container",
                    "host_port",
                    "origin",
                    "message"
                  ],
                  "title": "AgentServiceStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start an agent's app container",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_service_start",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_service_stop": {
      "post": {
        "description": "The stop ladder. Stopping something that is not running is success — \"make sure this is not running\" is what the button means.",
        "operationId": "op_agent_service_stop",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_service_stop` — the agent's app container is not\nrunning. Stopping something that is not running is success.",
                  "properties": {
                    "cancelled_start": {
                      "description": "A start was in flight and was interrupted, rather than a running\ncontainer being stopped.",
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "running": {
                      "description": "Always `false`.",
                      "type": "boolean"
                    },
                    "stopped": {
                      "description": "The name of the container that was stopped or collected; absent when\nthere was none.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "running",
                    "cancelled_start",
                    "message"
                  ],
                  "title": "AgentServiceStopped",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Stop an agent's app container",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_service_stop",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_set": {
      "post": {
        "description": "Install or replace an agent from a manifest. `manifest` is the whole JSON document as a string — schema_version 1, an id matching [a-z0-9][a-z0-9-]*, a name, a model (`{{config.model}}` lets whoever configures the agent pick), an optional config schema, the MCP tool labels it may reach, and a run block (`chat` or `batch`). Unknown fields are refused naming the key, and every {{config.<field>}} must name a field of the config schema. This is exactly the import path the dashboard uses, so the report it returns is the same: warnings for tool labels this gateway does not have (the agent still installs; it just cannot run yet). Validate first with validate_only=true. Replacing keeps the stored config. Pass the manifest as a JSON *string*, not as an object: an object is accepted but arrives with its keys re-sorted, which reorders the config form the author wrote, and the report says so.",
        "operationId": "op_agent_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "manifest": {
                    "description": "The whole manifest document, as a JSON string. An object works too, but re-sorts the config form — send the string.",
                    "type": "string"
                  },
                  "replace": {
                    "description": "Overwrite an existing agent with this id. Default true.",
                    "type": "boolean"
                  },
                  "validate_only": {
                    "description": "Report what would happen and write nothing. Default false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "manifest"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/agents/import` and `lmgw__agent_set` — the same report either\nway. Errors are not in here: they are the 400 body (`ApiError`), because a\nmanifest that does not validate was not imported at all.",
                  "properties": {
                    "config_unbound": {
                      "description": "Mount slots this agent has and nothing has bound: an\nexport never carries a host path, so an imported agent arrives with its\n`directory` and `file` fields empty and the importer says which folder.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "dropped_config": {
                      "description": "Stored config keys the **new** manifest no longer declares, removed with\nthe manifest that declared them (the same rule applies to every replace). Keeping them\nwould leave a row that fails validation\non every run and cannot be fixed from its own config form.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "replaced": {
                      "description": "An existing agent was overwritten (`replace=1`), keeping its config.",
                      "type": "boolean"
                    },
                    "requires": {
                      "items": {
                        "$ref": "#/components/schemas/AgentRequirement"
                      },
                      "type": "array"
                    },
                    "validate_only": {
                      "description": "`validate_only=1`: the same report, nothing written.",
                      "type": "boolean"
                    },
                    "warnings": {
                      "description": "A missing server label or tool: the agent is saved, Start is disabled.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "warnings",
                    "requires",
                    "replaced",
                    "dropped_config",
                    "config_unbound",
                    "validate_only"
                  ],
                  "title": "AgentImportReport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Install or replace an agent from a manifest",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_set",
        "x-lmgw-tool": "lmgw__agent_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_token_get": {
      "post": {
        "description": "A read of the column that already holds the value, not a reveal-once: lmgw hands this token to the agent's container on every run, including one it did not start. Mints the token first if the agent has none yet, and re-derives its scope from the manifest either way.",
        "operationId": "op_agent_token_get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_token_get` — the agent's own token, in the clear: a read\nof the column that already holds it (minted first if the agent had none).\n`agent_token_rotate` answers with `AgentTokenIssued`.",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "`agent:<id>` — the name Logs and the usage page print.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "scope_mode": {
                      "description": "`all` or `allow`: whether the token is fenced to model aliases.",
                      "type": "string"
                    },
                    "scope_note": {
                      "description": "The scope in words, as the detail page prints it.",
                      "type": "string"
                    },
                    "scope_patterns": {
                      "description": "The model aliases the token is fenced to, one per line; empty for `all`.",
                      "type": "string"
                    },
                    "token": {
                      "description": "The bearer token. Secret: it is shown here and nowhere else.",
                      "type": "string",
                      "x-lmgw-secret": true
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "token",
                    "scope_mode",
                    "scope_patterns",
                    "scope_note",
                    "message"
                  ],
                  "title": "AgentTokenRead",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read an agent's own MCP/API token",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_token_get",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": true
      }
    },
    "/api/op/agent_token_rotate": {
      "post": {
        "description": "Replaces the agent's token in one write. A running service container is holding the old one, so it is stopped — the next request to the agent's origin starts it again with the new token. What the old token holds open ends at once: its realtime sessions close with 4003, and its /mcp notification streams end.",
        "operationId": "op_agent_token_rotate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Agent id, from /api/agents.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agent_token_rotate` — the agent's new token, in the clear, and\nwhat the rotation did to the app container that was holding the old one.",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "`agent:<id>` — the name Logs and the usage page print.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "scope_mode": {
                      "description": "`all` or `allow`: whether the token is fenced to model aliases.",
                      "type": "string"
                    },
                    "scope_note": {
                      "description": "The scope in words, as the detail page prints it.",
                      "type": "string"
                    },
                    "scope_patterns": {
                      "description": "The model aliases the token is fenced to, one per line; empty for `all`.",
                      "type": "string"
                    },
                    "service_stopped": {
                      "description": "A rotation stops the app container that was holding the old token: the\nname of the container that was stopped; absent when none was running.",
                      "type": "string"
                    },
                    "token": {
                      "description": "The bearer token. Secret: it is shown here and nowhere else.",
                      "type": "string",
                      "x-lmgw-secret": true
                    },
                    "warning": {
                      "description": "A rotation that could not re-derive the scope still rotated: the token\nabove is the live one, and this says what did not happen. Absent\notherwise.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "token",
                    "scope_mode",
                    "scope_patterns",
                    "scope_note",
                    "message"
                  ],
                  "title": "AgentTokenIssued",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Mint a new token for an agent, invalidating the old one",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agent_token_rotate",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": true
      }
    },
    "/api/op/agents_restore": {
      "post": {
        "description": "Every shipped agent not currently installed is put back with its built-in manifest. An agent still installed, edited or not, is left alone.",
        "operationId": "op_agents_restore",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/agents_restore` — the shipped agents the catalog was missing\nare back.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "restored": {
                      "description": "The ids that were put back; empty when every shipped agent was already\nthere.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "restored",
                    "message"
                  ],
                  "title": "AgentsRestored",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Reinstall any shipped agent that was deleted",
        "tags": [
          "ops-agents"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "agents_restore",
        "x-lmgw-writes": true
      }
    },
    "/api/op/alias_set": {
      "post": {
        "description": "Alias create/update including param overrides, which model_set does not carry (its tool-plane schema stays scalar-only). Overrides are replaced wholesale — the form always sends the complete set.",
        "operationId": "op_alias_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Alias create/update including param overrides, which the self-admin\n`model_set` tool does not carry (its schema stays scalar-only). Overrides\nare replaced wholesale — the form always sends the complete set.",
                "properties": {
                  "action": {
                    "default": "",
                    "type": "string"
                  },
                  "alias": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "capabilities_override": {
                    "default": null,
                    "description": "An alias's capabilities override: the derived `/v1/models` capability\nfacts it replaces or extends. An empty *string* clears a stored\noverride; an absent field (or `null`) leaves the stored value as is."
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset: `fallback`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The alias's one fallback (openai egress design §14.2), checked as\n`model_set` checks it; `clear: \"fallback\"` removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "overrides": {
                    "default": null
                  },
                  "upstream_id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "upstream_model": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "AliasFullPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a routing row that names the row it wrote: `{\"ok\": true, \"id\": …,\n\"message\": …}`. `POST /api/op/upstream_set` and `model_set` answer it, for\nevery action.",
                  "properties": {
                    "fallback_notes": {
                      "description": "A plain alias's write (`model_set`): what the save says about its fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Something to warn about on a row that was saved all the same: an\n`openai` upstream on a host that is not OpenAI's (`UpstreamView::host_note`).\nOnly the dashboard's `upstream_set_full` sets it; left out otherwise.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "RowSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create or update a model alias, including parameter overrides",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "alias_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/audio_catalog": {
      "post": {
        "description": "The two catalog actions of the Audio lab, as one op: 'refresh' live-fetches audio.cpp's model_specs catalog, lists each package repo on Hugging Face once (which spec files are published — a package's unpublished_files), and persists the snapshot (the only network calls in this domain; a spec file or repo listing that fails is one of its warnings, not a failed refresh); 'download' queues the files one package lacks (family + package) through the shared Hugging Face download queue, target audio — every file for a package never downloaded, only the missing ones for one the spec grew since (the catalog's missing_files; 'complete install' in the Audio catalog). The same function lmgw__audio_catalog calls.",
        "operationId": "op_audio_catalog",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "action": "download",
                  "family": "kokoro",
                  "package": "kokoro-82m"
                },
                "properties": {
                  "action": {
                    "description": "'refresh' live-fetches the audio.cpp model_specs catalog; 'download' queues the files one package lacks.",
                    "enum": [
                      "refresh",
                      "download"
                    ],
                    "type": "string"
                  },
                  "family": {
                    "description": "download only: the catalog family (e.g. 'kokoro').",
                    "type": "string"
                  },
                  "package": {
                    "description": "download only: the package within that family.",
                    "type": "string"
                  }
                },
                "required": [
                  "action"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AudioCatalogRefreshed",
                      "description": "`action: refresh`."
                    },
                    {
                      "$ref": "#/components/schemas/AudioCatalogInstall",
                      "description": "`action: download`."
                    }
                  ],
                  "description": "The `audio_catalog` op's answer: a refresh's summary or a queued\ndownload, by `action`.",
                  "title": "AudioCatalogAnswer"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Refresh the audio.cpp model catalog, or queue one package's download",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "audio_catalog",
        "x-lmgw-tool": "lmgw__audio_catalog",
        "x-lmgw-writes": true
      }
    },
    "/api/op/audio_model_set": {
      "post": {
        "description": "Audio model CRUD — the same shape as aux_model_set (sparse patch, unknown fields rejected, the snapshot reloaded after every write, apply stays a separate step), adapted to the wider audio.cpp field set (task, mode, load/session/request options, voice presets, and where the row runs: backend 'cpu' with its threads, which takes no VRAM and keeps serving under the GPU hold). The same function lmgw__audio_model_set calls.",
        "operationId": "op_audio_model_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Audio model CRUD: a sparse patch (unknown fields are rejected) over the wider\naudio.cpp field set, like the aux model patch. A save does not restart the\nmodel's container; apply does. A save is validated: a task from the fixed\n13-value list, every voice preset naming a `voice_id`/`voice_ref`, a bare\n`default_voice_preset` resolving to a declared preset, and every `voice_ref`\nunder `/models/...` existing on disk — audiocpp_server opens reference clips\nat startup and exits if one is missing.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "backend": {
                    "default": null,
                    "description": "Where this row runs: 'cpu' runs it on the CPU — no VRAM charged, never evicted, not stopped by the GPU hold, no residency learned; its inherited run args lose the GPU passthrough. Omit to keep, name 'backend' in clear to inherit the audio class backend again. No other value: another GPU backend is the class setting.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "busy_timeout_ms": {
                    "default": null,
                    "description": "How long a request waits for the model while another one runs, in ms; 0 waits forever. Negative is refused. Name 'busy_timeout_ms' in clear to inherit again.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset, comma- or space-separated: 'lazy', 'busy_timeout_ms', 'backend', 'threads', 'extra_run_args', 'fallback', and on update 'residency' (forget the learned residency). A field named here is unset on create too, whatever value came with it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "config_id": {
                    "default": null,
                    "description": "Named config asset id, for a model directory holding several. Empty clears.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "default_request_options": {
                    "additionalProperties": true,
                    "default": null,
                    "description": "Request-option defaults applied to every call, as a JSON object (a JSON string here), e.g. '{\"speed\": 1.1}' — the family's 'request' options. A request that names one still wins.",
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "default_voice_preset": {
                    "default": null,
                    "description": "The voice a request that names none gets: a preset name from voice_presets, or an inline preset as a JSON object string. Empty clears."
                  },
                  "enabled": {
                    "default": null,
                    "description": "Serve this model (a disabled model has no container).",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "extra_run_args": {
                    "default": null,
                    "description": "'podman run' args override, one argument per entry. Absent leaves it unchanged; name it in 'clear' to revert to the class default — which carries the GPU and SELinux flags, so override it only knowingly. An override with no args is never stored: it is the class default. A row on the CPU runs its own override as written; one that still passes a GPU is named in lmgw__local_model_get's problems.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (a model of the same task: speech-to-text for asr, text-to-speech for tts. A row on the CPU is not stopped by the hold, so its fallback answers only for the other reasons); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "family": {
                    "default": null,
                    "description": "audio.cpp model family, e.g. 'pocket_tts' or 'qwen3_asr' — the catalog's family id. Required on create.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Audio model row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Podman image override for this model's own container. Empty clears back to the audio class image.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "lazy": {
                    "default": null,
                    "description": "Load the model on its first request (true) or at container start (false). Omit to inherit the audio class setting; name 'lazy' in clear to go back to inheriting.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "load_options": {
                    "additionalProperties": true,
                    "default": null,
                    "description": "audio.cpp load options as a JSON object (written as a JSON string on this tool plane), e.g. '{\"language\": \"de\"}' — the family's 'load' options. Replaces the stored object; '{}' empties it.",
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "mode": {
                    "default": null,
                    "description": "'offline' (default: one buffered answer) or 'streaming' (the family streams its output as server-sent events).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": null,
                    "description": "Client-facing model id (the part after the audio prefix, so 'audio/<model_id>'). Required on create. Without id it selects the row to update, delete, enable or disable; WITH id, on update, it renames the row, and the old container is removed.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_spec_override": {
                    "default": null,
                    "description": "A '<family>.json' spec (or a directory of them) relative to the audio models dir that replaces the image's built-in catalog for this row. Empty clears.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "path": {
                    "default": null,
                    "description": "The model directory, RELATIVE to the audio models dir — a package's suggested_path, e.g. 'audio-cpp/audio.cpp-gguf/PocketTTS-GGUF/german'. Required on create.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "session_options": {
                    "additionalProperties": true,
                    "default": null,
                    "description": "audio.cpp session options as a JSON object (a JSON string here), e.g. '{\"weight_type\": \"q8_0\"}' — the family's 'session' options. Replaces the stored object; '{}' empties it.",
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "task": {
                    "default": null,
                    "description": "What the model does: tts, asr, gen (music, sound), clon (voice cloning), vc, svc, s2s, sep (separation), vad, diar, align, vdes (voice design), spk, midi. A package's suggested_task. Required on create.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "threads": {
                    "default": null,
                    "description": "This row's thread count, 1 or more (no upper cap; above this machine's CPUs the save says so). Name 'threads' in clear for the default: this machine's physical cores for a row switched to the CPU (backend='cpu' on the row), the audio class's threads for every other row — one that inherits a class backend of cpu included. Several CPU rows busy at once each run their own pool, so split the cores between them.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "voice_presets": {
                    "additionalProperties": true,
                    "default": null,
                    "description": "Named voices as a JSON object (a JSON string here): name -> {\"voice_id\": \"<shipped voice>\"} or {\"voice_ref\": \"/models/<clip>.wav\"}, e.g. '{\"alba\": {\"voice_id\": \"alba\"}}'. Replaces the stored object.",
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "warm_start": {
                    "default": null,
                    "description": "Start this model's container when lmgw launches.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "weight_id": {
                    "default": null,
                    "description": "Named weights asset id, for a model directory holding several variants (e.g. 'q8_0'). Empty clears.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "AudioPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to an audio model: `create`, `update` (also `enable` and\n`disable`) or `delete`.",
                  "properties": {
                    "fallback_notes": {
                      "description": "What the save says about the fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "residency_reset": {
                      "description": "`update`: whether the save reset the model's learned residency (the\nowner named `residency` in `clear` and one was learned). Absent for\nevery other action.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "AudioModelSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable or disable an audio.cpp model",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "audio_model_set",
        "x-lmgw-tool": "lmgw__audio_model_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/aux_model_set": {
      "post": {
        "description": "Create, update, delete, enable or disable an AUX model: an embedding model (served on /v1/embeddings with --embeddings), a reranker (served on /v1/rerank with --reranking) or a decision model (a GGUF whose header declares decision.type, served on /v1/systemone). This is the class for models that answer without generating: encoders, whose header declares a pooling_type or a classifier head and which have no LM head, and decision models, causal ones included, which llama-server serves without a generation route. Neither can be a chat model. Aux models live in their own models directory (download with lmgw__hf_add target=aux, list with lmgw__gguf_files target=aux) and are exposed under their kind's prefix, both in lmgw__settings' aux_router: public_prefix for embedders and rerankers (usually 'embed/<model_id>'), decision_prefix for decision models (usually 'decide/<model_id>'); a row answers to its own prefix only. Get kind, pooling and ctx_size (and for a decision model ubatch_size, batch_size and backend) from lmgw__local_model_plan target=aux rather than guessing: the wrong pooling produces vectors that look fine and retrieve garbage. Update is partial: pass only what changes, and use 'clear' to unset a field. A model's own container starts on its first request; lmgw__local_model_test target=aux then proves it embeds, reranks or answers one System One question.",
        "operationId": "op_aux_model_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for an aux (embedding / rerank / decision) model — a slimmer\nsibling of the local model patch: no sampling, no template, no\nspeculation. What an aux row *does* need beyond a path is its kind and,\nfor embedders, the pooling the model was trained with; both are read out\nof the GGUF by `lmgw__local_model_plan target=aux`.\n\nPlacement, the batch sizes and a projector are fields\n(decision-models design §3.3): `backend`, `threads`, `ubatch_size`,\n`batch_size`, `mmproj_path`.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "backend": {
                    "default": null,
                    "description": "'cpu' runs the model on the CPU: --n-gpu-layers 0, the class's run args without the GPU passthrough, no VRAM charged, and it keeps serving while the GPU hold is on. Omit to keep the current value; an empty string (or 'backend' in clear) runs it on the GPU.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "batch_size": {
                    "default": null,
                    "description": "--batch-size, 1 or more; omit for llama-server's default.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset to unset, comma-separated: 'extra_args', 'extra_run_args', 'image', 'fallback', 'ctx_size', 'ubatch_size', 'batch_size', 'mmproj_path', 'backend', 'threads'.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ctx_size": {
                    "default": null,
                    "description": "Context length (--ctx-size). Use the model's trained context from the plan; llama-server refuses a longer input with an error rather than truncating it. 'ctx_size' in clear takes llama-server's default.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Serve this model (a disabled model has no container).",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "extra_args": {
                    "default": null,
                    "description": "Escape hatch for llama-server flags with no field above, one argument per entry (['--flash-attn', 'on']). --embeddings, --reranking, --pooling, --ctx-size, --ubatch-size, --batch-size, --mmproj, --n-gpu-layers and --threads are rendered from the fields above; a copy here is ignored when its field is set.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "extra_run_args": {
                    "default": null,
                    "description": "'podman run' args override, one argument per entry. Absent leaves it unchanged; name it in 'clear' to revert to the class default. An override with no args is never stored: it is the class default.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (an embedder for an embedder, a reranker for a reranker, a decision model that answers /v1/systemone for a decision row); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "gguf_path": {
                    "default": null,
                    "description": "Weights GGUF, relative to the AUX models directory (e.g. 'Qwen/Qwen3-Embedding-4B-GGUF/Qwen3-Embedding-4B-Q4_K_M.gguf'). Required on create. Files in the chat models directory cannot be addressed — download into the aux dir with lmgw__hf_add target=aux.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Aux model row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "idle_seconds": {
                    "default": null,
                    "description": "Seconds idle before the model unloads. 0 = never. Default 300.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Podman image override for this model's own container. Empty or absent leaves it unset; 'clear' reverts to the aux class image.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {
                    "default": null,
                    "description": "'embed' (default on create) serves /v1/embeddings; 'rerank' serves /v1/rerank; 'decision' serves /v1/systemone (no kind flag, no pooling). lmgw__model_inspect reports which a file is.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "mmproj_path": {
                    "default": null,
                    "description": "A projector (--mmproj) relative to the AUX models directory, for a model that reads images (a vision-language embedder, an image-capable decision model). Use the one lmgw__local_model_plan finds beside the weights. Charged with the weights. Empty string clears.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": null,
                    "description": "Client-facing model id (the part after the aux prefix); also selects the row when id is omitted.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pooling": {
                    "default": null,
                    "description": "Pooling strategy (--pooling) for an embedding model. Use the value lmgw__local_model_plan reads from the GGUF header; omit to let llama-server pick the model's default. Never set on a rerank model (--reranking selects rank pooling itself, and a second pooling flag breaks it) or a decision model. Empty string clears.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "threads": {
                    "default": null,
                    "description": "--threads, 1 or more. Unset renders none on the GPU, and on the CPU this machine's physical cores (the logical CPU count where the core topology cannot be read) unless extra_args name a count.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "ubatch_size": {
                    "default": null,
                    "description": "--ubatch-size, 1 or more; omit for llama-server's default. An encoder whose input llama-server cannot split (any but a last-token embedder or a causal reranker) evaluates its whole input in one ubatch, so this bounds every input it answers; lmgw__local_model_plan sets it to the context there. Raise batch_size with it: llama.cpp lowers the ubatch to the batch. The VRAM ledger charges the compute buffer it grows.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "warm_start": {
                    "default": null,
                    "description": "Start this model's container when lmgw launches.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "title": "AuxModelPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to an aux (embedding, rerank or decision) model: `create`, `update` (also\n`enable` and `disable`) or `delete`.",
                  "properties": {
                    "fallback_notes": {
                      "description": "What the save says about the fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read, with the next step.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "public_name": {
                      "description": "`create`: the name clients request the model by. Absent for every\nother action.",
                      "type": "string"
                    },
                    "warnings": {
                      "description": "`create`, `update`: why the model may not load (empty when none fired).\nAbsent for `delete`.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "AuxModelSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable or disable an aux (embedding, rerank or decision) model",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "aux_model_set",
        "x-lmgw-tool": "lmgw__aux_model_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/bench_cancel": {
      "post": {
        "description": "Cancel the benchmark run that is going: its in-flight requests are dropped, its container removed, the GPU released, and the run kept as 'canceled' with the points measured so far. Models it stopped are not restarted.",
        "operationId": "op_bench_cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_cancel`: the running run; `run_id` only has to match it.",
                "properties": {
                  "run_id": {
                    "default": null,
                    "description": "Optional: the run you mean — refused if another one is going.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BenchCancelArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_cancel`, `bench_run_set` and `bench_delete`'s answer.",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "run_id": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "run_id",
                    "message"
                  ],
                  "title": "BenchDone",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel the running benchmark run",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_cancel",
        "x-lmgw-tool": "lmgw__bench_cancel",
        "x-lmgw-writes": true
      }
    },
    "/api/op/bench_delete": {
      "post": {
        "description": "Delete a finished benchmark run for good (nothing else prunes runs). A run still going must be canceled first.",
        "operationId": "op_bench_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_delete`: a finished run.",
                "properties": {
                  "id": {
                    "default": 0,
                    "description": "The run id (lmgw__bench_runs).",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "title": "BenchDeleteArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_cancel`, `bench_run_set` and `bench_delete`'s answer.",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "run_id": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "run_id",
                    "message"
                  ],
                  "title": "BenchDone",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a finished benchmark run",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_delete",
        "x-lmgw-tool": "lmgw__bench_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/bench_plan": {
      "post": {
        "description": "Preview a benchmark run of one local chat model without starting anything: the effective settings after your overrides, the exact podman command line, the build (image and its labels), the points each phase would measure (derived from the row's numbers and marked provisional — a run reads the real slot count and context from the live server), which behaviour probes apply, and every container a start would stop, with whether it is busy. 'blocked' says why a start would be refused right now: the GPU hold is on, another run is going (with its run_id), the row is missing, disabled or not a chat model, the rung does not exist, or the image is not on this machine. Always call this before lmgw__bench_start and show the user what will be stopped.",
        "operationId": "op_bench_plan",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_plan` and `bench_start`: the row, the flat overrides, the\nphases and repetitions. `notes` is stored by `bench_start` and ignored by\n`bench_plan`, so the dashboard's modal sends one shape to both.",
                "properties": {
                  "batch_size": {
                    "default": null,
                    "description": "Override -b for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cache_type_k": {
                    "default": null,
                    "description": "Override the K cache type (f16, q8_0, q4_0, …) for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cache_type_v": {
                    "default": null,
                    "description": "Override the V cache type for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ctx_size": {
                    "default": null,
                    "description": "Override --ctx-size for this run only (the row is never changed).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "flash_attn": {
                    "default": null,
                    "description": "Override flash attention (auto, on, off) for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Run it on this image instead of the row's (a tag or ID from lmgw__container_images) — comparing two builds is two runs of one row with two images. It must already be on this machine.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kv_unified": {
                    "default": null,
                    "description": "Override --kv-unified for this run only.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": "",
                    "description": "The local chat model to benchmark (its model_id, see lmgw__models).",
                    "type": "string"
                  },
                  "n_gpu_layers": {
                    "default": null,
                    "description": "Override -ngl for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "no_draft": {
                    "default": false,
                    "description": "Run without the row's speculative drafter. Default false.",
                    "type": "boolean"
                  },
                  "notes": {
                    "default": "",
                    "type": "string"
                  },
                  "parallel": {
                    "default": null,
                    "description": "Override -np (slots) for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "phases": {
                    "default": [],
                    "description": "Comma-separated phases to run: probes, prefill, decode, concurrent, mixed (load always runs). Empty or absent: all of them.",
                    "items": {
                      "$ref": "#/components/schemas/Phase"
                    },
                    "type": "array"
                  },
                  "repetitions": {
                    "default": null,
                    "description": "Repetitions per point (median, min and max are stored). Default 3.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "rung": {
                    "default": 0,
                    "description": "A ladder row's rung: 0 = base (default), up to the row's top rung.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "ubatch_size": {
                    "default": null,
                    "description": "Override -ub for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BenchArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_plan`'s answer: everything the confirmation shows.",
                  "properties": {
                    "blocked": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/BenchBlocked"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Why it cannot start now; `None` means `bench_start` would start it."
                    },
                    "build": {
                      "$ref": "#/components/schemas/BuildIdentity"
                    },
                    "command_line": {
                      "description": "`podman run …` as it would be started, with the port it would get\nshown as `<port>`.",
                      "type": "string"
                    },
                    "model": {
                      "$ref": "#/components/schemas/ModelIdentity"
                    },
                    "model_id": {
                      "type": "string"
                    },
                    "params": {
                      "$ref": "#/components/schemas/SuiteParams"
                    },
                    "points": {
                      "$ref": "#/components/schemas/PointPlan",
                      "description": "Derived from the row's numbers (`provisional: true`); a run derives\nthem again from the live server."
                    },
                    "probes": {
                      "items": {
                        "$ref": "#/components/schemas/PlannedProbe"
                      },
                      "type": "array"
                    },
                    "rung": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "rungs": {
                      "description": "The row's rungs, base included (1 for a row without a ladder).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "settings": {
                      "$ref": "#/components/schemas/BenchSettings"
                    },
                    "settings_hash": {
                      "type": "string"
                    },
                    "stops": {
                      "description": "Every lmgw container on the card, which a start stops (all classes).",
                      "items": {
                        "$ref": "#/components/schemas/BenchStop"
                      },
                      "type": "array"
                    },
                    "total_steps": {
                      "description": "Progress steps the plan takes (`JobRow.total`), from the provisional\npoints.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "warnings": {
                      "description": "Things worth knowing that do not block (a projector the row cannot\nread, …).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "model_id",
                    "rung",
                    "rungs",
                    "settings",
                    "settings_hash",
                    "command_line",
                    "model",
                    "build",
                    "params",
                    "points",
                    "total_steps",
                    "probes",
                    "stops",
                    "blocked",
                    "warnings"
                  ],
                  "title": "BenchPlan",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview a benchmark run: settings, command line, points, probes, what it stops",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_plan",
        "x-lmgw-tool": "lmgw__bench_plan",
        "x-lmgw-writes": false
      }
    },
    "/api/op/bench_run": {
      "post": {
        "description": "One benchmark run in full: its identity (model file and quant, build, GPU, settings, command line), every probe with its evidence, every measured point per phase (median, min, max over the repetitions, energy and tokens per joule), phase errors, and the comparison with its previous comparable run: per headline metric the delta, the noise band and a verdict (regression, improvement, same, missing, or not_same_point when the two runs measured it at different points — a run that stopped early; its delta is information and counts for nothing), and probes that changed outcome. The 500 ms power/VRAM/temperature timeline is left out unless timeline=true — it is the bulk of a run.",
        "operationId": "op_bench_run",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_run`.",
                "properties": {
                  "id": {
                    "default": 0,
                    "description": "The run id (lmgw__bench_runs).",
                    "format": "int64",
                    "type": "integer"
                  },
                  "threshold_pct": {
                    "default": null,
                    "description": "The regression threshold in percent. Default 5.",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "timeline": {
                    "default": null,
                    "description": "Include the 500 ms timeline samples. Default false.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "title": "BenchRunArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_run`'s answer.",
                  "properties": {
                    "comparison": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/BenchComparison"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Against the previous comparable run; `None` when there is none."
                    },
                    "headline": {
                      "$ref": "#/components/schemas/Headline"
                    },
                    "live_job_id": {
                      "description": "The job still running this run, for the live jobs feed.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "run": {
                      "$ref": "#/components/schemas/BenchRun"
                    },
                    "threshold_pct": {
                      "format": "double",
                      "type": "number"
                    }
                  },
                  "required": [
                    "run",
                    "headline",
                    "comparison",
                    "threshold_pct",
                    "live_job_id"
                  ],
                  "title": "BenchRunDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "One whole benchmark run, compared with its previous comparable run",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_run",
        "x-lmgw-tool": "lmgw__bench_run",
        "x-lmgw-writes": false
      }
    },
    "/api/op/bench_run_set": {
      "post": {
        "description": "Free-text notes on one run (dashboard only).",
        "operationId": "op_bench_run_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_run_set`: the notes on a run (dashboard only).",
                "properties": {
                  "id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  },
                  "notes": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "BenchRunSetArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_cancel`, `bench_run_set` and `bench_delete`'s answer.",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "run_id": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "run_id",
                    "message"
                  ],
                  "title": "BenchDone",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Edit a benchmark run's notes",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_run_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/bench_runs": {
      "post": {
        "description": "List benchmark runs, newest first: model, quant, rung, image and build, GPU, status (running, done, failed, canceled, aborted, interrupted), the headline numbers (prefill tok/s and TTFT at 2048 tokens, decode tok/s at depth 64 and at the deepest point, aggregate tok/s at all slots, decode tokens per joule, load time, VRAM after load, the mixed-phase stall), probes passed of judged, and against the previous comparable run (same model file, settings, suite version and GPU) how many metrics regressed or improved beyond threshold_pct.",
        "operationId": "op_bench_runs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_runs`: run summaries, newest first.",
                "properties": {
                  "before": {
                    "default": null,
                    "description": "Only runs older than this run id (the next page).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "limit": {
                    "default": null,
                    "description": "At most this many runs. Absent: every run.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": null,
                    "description": "Only this model's runs.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "threshold_pct": {
                    "default": null,
                    "description": "The regression threshold in percent, widened by each metric's measured noise. Default 5.",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "title": "BenchRunsArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "more": {
                      "description": "Older runs exist beyond this page.",
                      "type": "boolean"
                    },
                    "runs": {
                      "items": {
                        "$ref": "#/components/schemas/BenchRunSummary"
                      },
                      "type": "array"
                    },
                    "threshold_pct": {
                      "format": "double",
                      "type": "number"
                    }
                  },
                  "required": [
                    "runs",
                    "more",
                    "threshold_pct"
                  ],
                  "title": "BenchRunsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List benchmark runs with their headline numbers, newest first",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "bench_runs",
        "x-lmgw-tool": "lmgw__bench_runs",
        "x-lmgw-writes": false
      }
    },
    "/api/op/bench_start": {
      "post": {
        "description": "Start a benchmark run: one local chat model, as its row is configured (plus your overrides), measured through a fixed suite — load time and VRAM, behaviour probes (chat, thinking on/off, tool calls, JSON schema, determinism, vision, reasoning history, needle), prefill throughput and time to first token at several prompt lengths, decode at several depths, concurrent streams, and a long prompt arriving mid-decode — with power and energy throughout. It takes the WHOLE GPU: it STOPS EVERY MODEL on the card (chat, embedding, audio, image; busy ones after their requests finish, nothing is killed) and, until the run ends, BLOCKS ALL LOCAL TRAFFIC — requests for local models go to their fallback alias or are refused with 503 'gpu_benchmark'. Stopped models are not restarted; they load again on their next request. It is refused while the GPU hold is on, and while another run is going (one at a time). A run of a large model at a long context takes minutes; its top points come from the model's real context, nothing is capped. Returns run_id and job_id at once: follow it with lmgw__bench_run id=<run_id>; lmgw__bench_cancel ends it early (partial results are kept). Call lmgw__bench_plan first and confirm what will be stopped with the user.",
        "operationId": "op_bench_start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`bench_plan` and `bench_start`: the row, the flat overrides, the\nphases and repetitions. `notes` is stored by `bench_start` and ignored by\n`bench_plan`, so the dashboard's modal sends one shape to both.",
                "properties": {
                  "batch_size": {
                    "default": null,
                    "description": "Override -b for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cache_type_k": {
                    "default": null,
                    "description": "Override the K cache type (f16, q8_0, q4_0, …) for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cache_type_v": {
                    "default": null,
                    "description": "Override the V cache type for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ctx_size": {
                    "default": null,
                    "description": "Override --ctx-size for this run only (the row is never changed).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "flash_attn": {
                    "default": null,
                    "description": "Override flash attention (auto, on, off) for this run only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Run it on this image instead of the row's (a tag or ID from lmgw__container_images) — comparing two builds is two runs of one row with two images. It must already be on this machine.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kv_unified": {
                    "default": null,
                    "description": "Override --kv-unified for this run only.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": "",
                    "description": "The local chat model to benchmark (its model_id, see lmgw__models).",
                    "type": "string"
                  },
                  "n_gpu_layers": {
                    "default": null,
                    "description": "Override -ngl for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "no_draft": {
                    "default": false,
                    "description": "Run without the row's speculative drafter. Default false.",
                    "type": "boolean"
                  },
                  "notes": {
                    "default": "",
                    "description": "Free text stored with the run (why you ran it).",
                    "type": "string"
                  },
                  "parallel": {
                    "default": null,
                    "description": "Override -np (slots) for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "phases": {
                    "default": [],
                    "description": "Comma-separated phases to run: probes, prefill, decode, concurrent, mixed (load always runs). Empty or absent: all of them.",
                    "items": {
                      "$ref": "#/components/schemas/Phase"
                    },
                    "type": "array"
                  },
                  "repetitions": {
                    "default": null,
                    "description": "Repetitions per point (median, min and max are stored). Default 3.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "rung": {
                    "default": 0,
                    "description": "A ladder row's rung: 0 = base (default), up to the row's top rung.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "ubatch_size": {
                    "default": null,
                    "description": "Override -ub for this run only.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BenchArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`bench_start`'s answer.",
                  "properties": {
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "run_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "stops": {
                      "description": "What the run is stopping (as `bench_plan` listed it).",
                      "items": {
                        "$ref": "#/components/schemas/BenchStop"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "run_id",
                    "job_id",
                    "stops",
                    "message"
                  ],
                  "title": "BenchStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start a benchmark run of a local chat model",
        "tags": [
          "ops-bench"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "stops every model on the GPU (all classes) and refuses local traffic, or sends it to its fallback, until the run ends",
        "x-lmgw-op": "bench_start",
        "x-lmgw-tool": "lmgw__bench_start",
        "x-lmgw-writes": true
      }
    },
    "/api/op/build_check_merge": {
      "post": {
        "description": "Check whether a build's extras merge cleanly onto its ref, without building: fetches the ref and every extra into lmgw's git pool, merges them in order in a throwaway worktree with the same code a run uses, and reports per extra: merged, already_in_base, merged_upstream (the forge says the PR is merged, so it is skipped), squash_applied (no shared history — applied as a squash) or conflict (with the conflicting files). ok=true when nothing conflicts. Takes seconds on a warm pool; the first fetch of a large repository downloads it. Listed with the writes because it downloads repositories to disk and runs git on this machine.",
        "operationId": "op_build_check_merge",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_check_merge` args: either a saved build (`id`) or\nan unsaved spec straight from the editor.",
                "properties": {
                  "id": {
                    "default": null,
                    "description": "The build to check (lmgw__builds).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "spec": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/BuildSpecInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null
                  }
                },
                "title": "BuildCheckMergeArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_check_merge` response: fetches, then merges into\na throwaway worktree running the same code as the run's assemble phase,\nand reports the outcome without building or touching the run's worktree.",
                  "properties": {
                    "base_sha": {
                      "type": "string"
                    },
                    "ok": {
                      "description": "`true` when every extra merged cleanly (no `conflict` step).",
                      "type": "boolean"
                    },
                    "steps": {
                      "items": {
                        "$ref": "#/components/schemas/CheckMergeStep"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "base_sha",
                    "ok",
                    "steps"
                  ],
                  "title": "CheckMergeReport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Check whether a build's extras merge cleanly onto its ref, without building",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_check_merge",
        "x-lmgw-tool": "lmgw__build_check_merge",
        "x-lmgw-writes": true
      }
    },
    "/api/op/build_env": {
      "post": {
        "operationId": "op_build_env",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_env` response: static and host-detected context the build\neditor needs, fetched once when it opens.",
                  "properties": {
                    "arch_auto": {
                      "description": "The host GPUs' unique `compute_cap` values, for an `arch` of \"auto\".",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "builds_dir": {
                      "type": "string"
                    },
                    "builds_dir_free_bytes": {
                      "description": "Free space on the filesystem of `builds_dir` (or of its nearest\nexisting ancestor), for the editor's \"free disk next to the last run's\nfootprint\" (a warning, never a block). `None` when it could not\nbe read.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "builds_dir_warning": {
                      "description": "Set when `builds_dir` is on tmpfs — a dev instance must move it\nbefore it can run builds.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cuda_default": {
                      "description": "`DEFAULT_CUDA_VERSION`: `13.0.0`, prefilled unless the build\noverrides it.",
                      "type": "string"
                    },
                    "driver_cuda_max": {
                      "description": "The driver's max supported CUDA version, for the \"asks for more than\nthe driver supports\" warning.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "git_ok": {
                      "description": "Whether a working `git` was found.",
                      "type": "boolean"
                    },
                    "repo_presets": {
                      "items": {
                        "$ref": "#/components/schemas/RepoPreset"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "repo_presets",
                    "cuda_default",
                    "arch_auto",
                    "driver_cuda_max",
                    "git_ok",
                    "builds_dir",
                    "builds_dir_warning",
                    "builds_dir_free_bytes"
                  ],
                  "title": "BuildEnv",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "What the build editor needs when it opens",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_env",
        "x-lmgw-writes": false
      }
    },
    "/api/op/build_get": {
      "post": {
        "description": "One build's row plus a page of its runs, newest first. `limit` is the page size (absent means every run); `before` is an exclusive run-id cursor.",
        "operationId": "op_build_get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_get` args: one build's detail plus a page of its run history,\nnewest first. `limit` is explicit — the UI pages with ShowMore\nrather than an unbounded fetch. `before` pages further back: the id of\nthe oldest run already shown, so the next page starts strictly older\nthan it. It is an exclusive run-id cursor and need not name an existing\nrun: `before = run_id + 1` with `limit = 1` fetches exactly `run_id`.",
                "properties": {
                  "before": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  },
                  "limit": {
                    "default": null,
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BuildsGetArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_get` response: one build's detail plus a page of its run\nhistory, newest first. `more` says whether an older page exists.",
                  "properties": {
                    "more": {
                      "type": "boolean"
                    },
                    "runs": {
                      "items": {
                        "$ref": "#/components/schemas/BuildRun"
                      },
                      "type": "array"
                    },
                    "usage_error": {
                      "description": "As `usage_error` of the builds response, for `view.used_by`.",
                      "type": "string"
                    },
                    "view": {
                      "$ref": "#/components/schemas/BuildView"
                    }
                  },
                  "required": [
                    "view",
                    "runs",
                    "more"
                  ],
                  "title": "BuildGetResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "One build's detail plus a page of its run history",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_get",
        "x-lmgw-writes": false
      }
    },
    "/api/op/build_promote": {
      "post": {
        "operationId": "op_build_promote",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_promote` args: move the\nbuild's moving tag to this run's image.",
                "properties": {
                  "run_id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "title": "BuildPromoteArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_promote` response: the moving tag's new\ntarget, and who was using the old one — the success panel's \"Recreate N\nrunning containers\" / \"Set as default for …\" offers.",
                  "properties": {
                    "from_image": {
                      "description": "`None` when nothing held the moving tag before (a build's first\npromotion).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "moving_tag": {
                      "type": "string"
                    },
                    "to_image": {
                      "type": "string"
                    },
                    "used_by": {
                      "items": {
                        "$ref": "#/components/schemas/ImageUse"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "moving_tag",
                    "from_image",
                    "to_image",
                    "used_by"
                  ],
                  "title": "PromoteResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Move a build's moving tag to one of its runs (\"Make current\")",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_promote",
        "x-lmgw-writes": true
      }
    },
    "/api/op/build_resolve": {
      "post": {
        "description": "What a spec resolves to right now — commits, tags — fetched but not built. The build editor's \"Resolve\" button.",
        "operationId": "op_build_resolve",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_resolve` args: preview what a spec resolves to right now,\nwithout building — the build editor's \"Resolve\" button.",
                "properties": {
                  "spec": {
                    "$ref": "#/components/schemas/BuildSpecInput",
                    "default": {
                      "arch": null,
                      "backend": "cuda",
                      "build_args": "",
                      "ccache": true,
                      "ccache_max_size": "10G",
                      "cpus": null,
                      "cuda_version": null,
                      "dockerfile": null,
                      "edits": null,
                      "engine": "llama",
                      "extras": [],
                      "forge": "plain",
                      "keep_layers": false,
                      "keep_runs": null,
                      "name": "",
                      "notes": "",
                      "ref": "",
                      "repo_url": "",
                      "slug": "",
                      "target": null
                    }
                  }
                },
                "title": "BuildResolveArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_resolve` response: what a spec resolves to right now — the\neditor's \"Resolve\" button and tag preview.",
                  "properties": {
                    "base_sha": {
                      "type": "string"
                    },
                    "build_args": {
                      "description": "Extra `--build-arg KEY=VALUE` pairs, in order.",
                      "items": {
                        "maxItems": 2,
                        "minItems": 2,
                        "prefixItems": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "string"
                          }
                        ],
                        "type": "array"
                      },
                      "type": "array"
                    },
                    "build_number": {
                      "description": "`rev-list --count <base>` — `llama` engines only; `None` for\n`audio`/`sdcpp`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "dockerfile": {
                      "type": "string"
                    },
                    "edit_outcomes": {
                      "description": "How each of `edits` fared against the resolved Dockerfile, in the same\norder — which matched and how often. Checked against the **base**'s\nDockerfile (a preview merges nothing), so an extra that changes the\nDockerfile can still move a run's result.",
                      "items": {
                        "$ref": "#/components/schemas/EditApplied"
                      },
                      "type": "array"
                    },
                    "edits": {
                      "description": "The preset's edits for the resolved Dockerfile, or the build's own\nexplicit list — each already carries its role.",
                      "items": {
                        "$ref": "#/components/schemas/BuildEdit"
                      },
                      "type": "array"
                    },
                    "immutable_tag": {
                      "type": "string"
                    },
                    "moving_tag": {
                      "type": "string"
                    },
                    "profile": {
                      "description": "The label of the matched Dockerfile profile.",
                      "type": "string"
                    },
                    "target": {
                      "type": "string"
                    },
                    "warnings": {
                      "description": "E.g. the build asks for a newer CUDA than the driver supports.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "base_sha",
                    "build_number",
                    "dockerfile",
                    "target",
                    "profile",
                    "edits",
                    "build_args",
                    "moving_tag",
                    "immutable_tag",
                    "warnings",
                    "edit_outcomes"
                  ],
                  "title": "ResolvedPreview",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview what an unsaved build spec resolves to, without building",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_resolve",
        "x-lmgw-writes": false
      }
    },
    "/api/op/build_run": {
      "post": {
        "description": "Start a run of a build: fetch its ref and extras, merge, podman build, verify the image on the GPU, and — when verification passes — move the build's moving tag to it. Returns job_id and run_id at once; the run takes minutes (a cold llama.cpp CUDA build about 6, a cached rebuild about 2). Follow it with lmgw__build_log run_id=<run_id> and lmgw__builds id=<build id> until live_job_id is null, then read the run's status. One run per machine builds at a time; a queued one shows phase 'waiting'. If the exact inputs were already built and verified, the run ends 'up_to_date' without building (rebuild=true builds anyway). Nothing running is restarted: models whose image names the moving tag (used_by on lmgw__builds) keep the old image until recreated with lmgw__container model=<id> action=apply — then lmgw__local_model_test proves the new build serves. Cancel from the dashboard's Jobs.",
        "operationId": "op_build_run",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_run` args. `rebuild` forces `--pull=newer` and a\nfull build even when the immutable tag already exists and is verified\n(\"Rebuild anyway\").",
                "properties": {
                  "id": {
                    "default": 0,
                    "description": "The build to run (lmgw__builds).",
                    "format": "int64",
                    "type": "integer"
                  },
                  "rebuild": {
                    "default": false,
                    "description": "Build even when these exact inputs were already built and verified, pulling newer base images. Default false.",
                    "type": "boolean"
                  }
                },
                "title": "BuildRunArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_run` response: the background job started, and the run row\nit will fill in as it goes.",
                  "properties": {
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "run_id": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "job_id",
                    "run_id"
                  ],
                  "title": "BuildRunStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start a build run",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_run",
        "x-lmgw-tool": "lmgw__build_run",
        "x-lmgw-writes": true
      }
    },
    "/api/op/build_run_log": {
      "post": {
        "description": "A chunk of a run's log (at most 1 MiB per call), from a byte offset, or its last `tail` lines — not both. The reply's next_offset continues a following call.",
        "operationId": "op_build_run_log",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_run_log` args: a byte-offset chunk of the run's\nlog file (at most 1 MiB per reply). The UI polls with the previous\nresponse's `next_offset`, only while `done` is false.\n\n`tail` asks for the log's last `tail` lines instead — how a long run\nended, without paging through it from the start; the reply's\n`next_offset` continues from there. It cannot be combined with a non-zero\n`offset`.",
                "properties": {
                  "offset": {
                    "default": 0,
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "run_id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  },
                  "tail": {
                    "format": "uint",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BuildRunLogArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_run_log` response: a tail of the run's log file starting at\nthe requested byte offset. `next_offset` is what the next poll should\nsend; `done` stops the UI's polling.",
                  "properties": {
                    "done": {
                      "type": "boolean"
                    },
                    "next_offset": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "text",
                    "next_offset",
                    "done"
                  ],
                  "title": "RunLogChunk",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a byte-offset or tail chunk of a run's log",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_run_log",
        "x-lmgw-writes": false
      }
    },
    "/api/op/build_set": {
      "post": {
        "description": "Create, update, delete or duplicate a container build — the definition of an engine image lmgw builds from git (see lmgw__builds). create: name a slug and either a preset (official = ggml-org/llama.cpp, ik = ik_llama.cpp, audio = audio.cpp, sdcpp = stable-diffusion.cpp; the list with their repos is 'repo_presets' in lmgw__builds) or engine + repo_url + ref; everything else has a working default (CUDA, the preset's CUDA version, arch auto-detected from this machine's GPUs, the preset's Dockerfile and edits, ccache on, keep every run). update is partial: pass only what changes. Empty strings mean 'auto' for cuda_version, arch, dockerfile, target and cpus. duplicate copies id under slug/name (default '<slug>-copy'); it is the quick way to get 'official-master' and 'official-master-pr16391' side by side. delete removes the definition (its run history stays) and, with delete_images=true, its images where nothing uses them — the answer lists what was removed and what was kept, and why. A run in progress blocks delete. Every field is checked and a refusal names it. Custom Dockerfile edits are dashboard-only. Building a PR runs that PR's build code on this machine (rootless podman, no GPU).",
        "operationId": "op_build_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_set` args: create, update, delete or duplicate a build.\n`spec` carries the fields for `create`/`update`; `slug`/`name` rename the\ncopy on `duplicate`; `delete_images` extends `delete` to also remove the\nbuild's images (refused while any is in use, like\n`container_image_delete`).",
                "properties": {
                  "action": {
                    "$ref": "#/components/schemas/BuildSetAction",
                    "default": "create",
                    "description": "What to do."
                  },
                  "delete_images": {
                    "default": false,
                    "description": "On delete: also remove this build's images that nothing uses. Default false.",
                    "type": "boolean"
                  },
                  "id": {
                    "default": null,
                    "description": "The build (lmgw__builds). Required except on create.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "name": {
                    "default": null,
                    "description": "Display name. Default: the slug. On duplicate: the copy's name.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "slug": {
                    "default": null,
                    "description": "The image tag: lowercase letters, digits, '.', '_', '-' (e.g. 'official-master'). Fixed once the build has a run. On duplicate: the copy's slug.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "spec": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/BuildSpecInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null
                  }
                },
                "title": "BuildSetArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_set` response. `build` is `None` after a `delete`. With\n`delete_images`, `removed_images` lists the tags actually removed (an\nimage goes with its last one) and `kept` the tags left in place, each with\nits reason; both are empty otherwise. A `delete` (regardless of\n`delete_images`) also removes the build's own per-build ccache and npm\ncache directories and lists them in `removed_caches`, each entry\nnaming the cache-mount id and, when it could be read for free, its size\n(`\"lmgw-llama-cuda-master-pr1 (572.1 MiB)\"`) — empty when the build never\nhad one (no extras were ever built), a run of it was live (the delete\nitself is refused then) or this is a dev instance, whose `/var/tmp` is\nproduction's.",
                  "properties": {
                    "build": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Build"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "kept": {
                      "items": {
                        "$ref": "#/components/schemas/KeptImage"
                      },
                      "type": "array"
                    },
                    "notes": {
                      "description": "What a `create` / `update` saved without being able to check — today\na `cpus` podman (or the kernel's CPU list) could not be asked about,\nwhich is then passed as set. Empty otherwise.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "removed_caches": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "removed_images": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "build",
                    "removed_images",
                    "kept",
                    "removed_caches",
                    "notes"
                  ],
                  "title": "BuildSetResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete or duplicate a container build definition",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_set",
        "x-lmgw-tool": "lmgw__build_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/build_updates_check": {
      "post": {
        "description": "Ask the remotes now for one build (`id`), or every build and every registry image in use. A build with no succeeded or unverified run has nothing to compare with.",
        "operationId": "op_build_updates_check",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_updates_check` args: one build, or every build when\n`id` is absent. Without `id` the registry images in use are checked too\n(their results are on `container_images`).",
                "properties": {
                  "id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "BuildUpdatesCheckArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_updates_check` response.",
                  "properties": {
                    "updates": {
                      "items": {
                        "$ref": "#/components/schemas/BuildUpdateEntry"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "updates"
                  ],
                  "title": "BuildUpdatesResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Check now whether a build's branch or PRs have moved",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_updates_check",
        "x-lmgw-writes": false
      }
    },
    "/api/op/build_verify": {
      "post": {
        "operationId": "op_build_verify",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`build_verify` args: re-run the help/device-probe checks\nfor a run that was built but not GPU-verified (\"Verify now\").",
                "properties": {
                  "run_id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "title": "BuildVerifyArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`build_verify` response: also updates the run's\nstatus (`succeeded`, `unverified` or `broken`).",
                  "properties": {
                    "devices": {
                      "description": "Devices the `--list-devices` (or engine equivalent) probe reported.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "gpu_verified": {
                      "description": "The device probe matched the build's backend (the success\npattern). `false` under GPU hold or a CUDA OOM while probing —\n\"not GPU-verified\", not \"broken\".",
                      "type": "boolean"
                    },
                    "help_ok": {
                      "description": "The `--help` probe parsed cleanly.",
                      "type": "boolean"
                    },
                    "notes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "help_ok",
                    "devices",
                    "gpu_verified",
                    "notes"
                  ],
                  "title": "VerifyReport",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Re-run the GPU verify checks for a built-but-unverified run",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "build_verify",
        "x-lmgw-writes": true
      }
    },
    "/api/op/builds": {
      "post": {
        "description": "Container builds: lmgw can build its own llama.cpp / ik_llama.cpp / audio.cpp / stable-diffusion.cpp server images from git — a repository and ref, plus PRs or other branches merged on top — and tags each result 'localhost/lmgw-<engine-repo>:<slug>' (the MOVING tag, which follows the build's last verified run) and '…:<slug>-<base7>-<cfg6>' (immutable, one per run). Without id: every build with its newest run (last_run), the run its moving tag points at (current_run), the job id of a run in progress (live_job_id, null when idle) and who uses its moving tag (used_by: class defaults, model overrides, containers running or stopped) and its 'update' badge: null before the first update check (every build_update_check_hours; see lmgw__settings) or when it has no succeeded run to compare with, else {checked_at, reasons, ref_moved, extras, errors} — reasons like 'master +37 commits', 'master moved (abc1234 → def5678)', 'PR #1234 pushed', 'PR #1234 merged upstream and contained in your base — drop it' (only once the build's own base is proven to already hold the PR's merge or head commit; otherwise 'PR #1234 merged upstream at <date>; your base doesn't contain it yet — it's still merged into your build'), 'PR #1234 closed unmerged', 'definition changed since last run (ref)'; empty reasons = up to date as of checked_at; what could not be checked (a forge rate limit with its reset time) is in errors. An update is acted on with lmgw__build_run. Also 'repo_presets' — the repository presets (the id is what lmgw__build_set preset= takes). With id: that build and its runs, newest first, each with its status (running; succeeded; unverified = built but not GPU-checked, e.g. under the GPU hold; broken = a verify check failed; failed; canceled; up_to_date = those exact inputs were already built and verified), resolved commits, image, tags, size, verify result and error. Poll this with id after lmgw__build_run until live_job_id is null.",
        "operationId": "op_builds",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`builds` response: every build, for the Builds tab.",
                  "properties": {
                    "builds": {
                      "items": {
                        "$ref": "#/components/schemas/BuildView"
                      },
                      "type": "array"
                    },
                    "usage_error": {
                      "description": "Set when who uses which image could not be determined (podman did not\nanswer). Every `used_by` is then empty **for that reason** — not\nbecause nothing uses the image — and the page should say so.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "builds"
                  ],
                  "title": "BuildsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List every container build, with its newest run and update badge",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "builds",
        "x-lmgw-tool": "lmgw__builds",
        "x-lmgw-writes": false
      }
    },
    "/api/op/candidate_alias_set": {
      "post": {
        "description": "The answer follows the action: `preview` answers CandidateAliasPreview (the draft's derivation and the models it could add, written nowhere), every other action CandidateAliasSaved.",
        "operationId": "op_candidate_alias_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for a candidate alias. Every list-shaped field is flat text\n(no nested objects, no arrays), comma/space/newline separated like `extra_run_args`.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do. 'preview' validates and derives a draft (any of the fields below, over an existing row named by id/alias or a brand-new one) without saving it — the same response shape, plus 'addable' (local chat models not yet in candidates and which enabled facet each would drop) and an 'error' that never aborts the rest of the answer.",
                    "type": "string"
                  },
                  "alias": {
                    "default": null,
                    "description": "The client-facing model name. On create this is the new alias; otherwise it selects the row (pass id as well to rename). Refused if it already names a plain alias or a local model of any class.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "background": {
                    "default": null,
                    "description": "Scheduled/background traffic: never evicts a model foreground requests use, never waits, and may only start the primary into free VRAM or evict another idle background-owned entry. Default false.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "candidates": {
                    "default": null,
                    "description": "Local chat model ids (lmgw__local_model_set rows, not aliases), one per line or comma-separated. The FIRST is the primary — the only one the alias ever starts; the rest are alternates in preference order, used only when already loaded. Every id must name an enabled local chat model. On update, absent leaves the stored list unchanged; it can never be saved empty — delete the alias instead.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "capabilities_disabled": {
                    "default": null,
                    "description": "Facet names switched OFF, one per line or comma-separated: vision, audio, tool_calls, reasoning, structured_output. This is the FULL desired list of the alias's own switches, not a delta and never auto-filled — every facet not named here that every candidate currently supports ends up enabled, including one that becomes supported later (it turns on by itself unless named here). On create, nothing is refused: an unsupported facet is simply left off. On update, switching a facet back on (removing it from this list) or leaving an already-enabled facet unnamed while a candidate drops it is refused, naming the facet. Absent leaves the stored list unchanged; use clear=capabilities_disabled to reset it to empty (every common facet back on).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset to unset, comma-separated: capabilities_disabled, fallback, notes.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Whether the alias resolves.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (a chat model; it answers for the whole alias, a candidate's own row fallback is never used through it. Without one, the alias refuses (503 gpu_hold under the hold, 503 gpu_deferred for a background request) rather than leave the machine); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Candidate alias row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "notes": {
                    "default": null,
                    "description": "Free-text notes.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "CandidateAliasPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/CandidateAliasPreview",
                      "description": "`action: preview`."
                    },
                    {
                      "$ref": "#/components/schemas/CandidateAliasSaved",
                      "description": "`action: create`, `update`, `enable`, `disable` or `delete`."
                    }
                  ],
                  "description": "What `candidate_alias_set` answers, by `action`: `CandidateAliasPreview`\nfor `preview`, `CandidateAliasSaved` for every other.\n\nThe two shapes share most keys, so this is the document's description of\nthe one op, not a type to read an answer into: a reader knows the action it\nsent and reads that action's type.",
                  "title": "CandidateAliasAnswer"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable, disable or preview a candidate alias",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "candidate_alias_set",
        "x-lmgw-tool": "lmgw__candidate_alias_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/container": {
      "post": {
        "description": "Control the per-model container runtime: lmgw runs one podman container per loaded chat/aux/audio/image model, started on demand and stopped independently — there is no shared per-class container any more. Address one model with `model=<id>` (its class is found automatically from the local/aux/audio/image tables; pass `target` too only to disambiguate an id that exists in more than one class); address a whole group with `target` alone. 'start' on a model warms it (a no-op if it is already up); 'start' on a group only starts that group's warm_start-flagged models, never every configured one — starting an entire class at once can ask for more VRAM than the box has, so start any other model on demand with `model=<id>`. 'stop' refuses a model still serving requests unless `override=true`. 'restart' and 'apply' are the same operation on a single model (stop, then start with freshly rendered arguments — there is no drift concept, argv is always rendered fresh); on a group, 'apply' additionally reports the same pre-flight lmgw__local_model_check runs (missing files, spec_type mismatches) for every enabled model in scope, not only the running ones. 'logs' (model only) returns the container's recent output — with one container per model this is the only place a failed start is visible. 'status' shows, for a llama-server container, what it said about itself in GET /props at its start (llama_props: build_info, modalities, n_ctx_slot — null where the server did not say), or among its warnings why it could not.",
        "operationId": "op_container",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "description": "What to do. 'logs' requires 'model'.",
                    "enum": [
                      "status",
                      "start",
                      "stop",
                      "restart",
                      "apply",
                      "logs"
                    ],
                    "type": "string"
                  },
                  "model": {
                    "description": "Address one model by its id instead of a whole group.",
                    "type": "string"
                  },
                  "override": {
                    "description": "Force a 'stop' that would otherwise be refused because the model is still serving requests.",
                    "type": "boolean"
                  },
                  "tail": {
                    "description": "Lines of container output 'logs' returns, from the end. Default 60.",
                    "type": "integer"
                  },
                  "target": {
                    "description": "Which group of models. Omit when 'model' is given.",
                    "enum": [
                      "all",
                      "chat",
                      "aux",
                      "audio",
                      "image"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "action"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/GroupApplied",
                      "description": "A group, `action: apply`."
                    },
                    {
                      "$ref": "#/components/schemas/GroupStarted",
                      "description": "A group, `action: start`."
                    },
                    {
                      "$ref": "#/components/schemas/GroupRestarted",
                      "description": "A group, `action: restart`."
                    },
                    {
                      "$ref": "#/components/schemas/GroupStopped",
                      "description": "A group, `action: stop`."
                    },
                    {
                      "$ref": "#/components/schemas/GroupStatus",
                      "description": "A group, `action: status`."
                    },
                    {
                      "$ref": "#/components/schemas/ModelLogs",
                      "description": "One model, `action: logs`."
                    },
                    {
                      "$ref": "#/components/schemas/ModelStatus",
                      "description": "One model, `action: status`."
                    },
                    {
                      "$ref": "#/components/schemas/ModelDone",
                      "description": "One model, `action: start`, `stop`, `restart` or `apply`."
                    }
                  ],
                  "description": "Which shape an answer has follows from the address and the action; every\nshape carries `ok`. The actions that change something add a `message`, a\n`note` or both (apply); the status and log answers carry neither.",
                  "title": "ContainerAnswer"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Control the per-model container runtime",
        "tags": [
          "ops-runtime"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container",
        "x-lmgw-tool": "lmgw__container",
        "x-lmgw-writes": true
      }
    },
    "/api/op/container_image_delete": {
      "post": {
        "description": "Delete a local image by tag or ID (lmgw__container_images). A tag of an image that has other tags is only untagged; the last tag, or an ID, removes the image. While a class default, a model override or any container (running or stopped) uses it, it is refused with the users named and what force would do; show that to the user and pass force=true only once they confirm. Forced, every container on the image is stopped (a running model mid-request too) and removed first, and the class defaults / model overrides naming it are left naming a missing image (listed in still_named_by). Refused on a dev instance, which shares production's image store.",
        "operationId": "op_container_image_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`container_image_delete` args: `image` is a tag or an ID. While\n`used_by` is non-empty it is refused (the error lists the users and what\n`force` would do) unless `force` is set; refused on a dev instance\neither way.",
                "properties": {
                  "force": {
                    "default": false,
                    "description": "Delete even though it is in use — only after the user confirmed the users the refusal named. Default false.",
                    "type": "boolean"
                  },
                  "image": {
                    "default": "",
                    "description": "Image tag (repo:tag) or ID (at least 12 hex).",
                    "type": "string"
                  }
                },
                "title": "ContainerImageDeleteArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`container_image_delete` response.",
                  "properties": {
                    "removed": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "removed_containers": {
                      "description": "A forced delete: the containers it stopped and removed first.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "still_named_by": {
                      "description": "A forced delete: the class defaults and model overrides that still\nname the image — now a missing one.",
                      "items": {
                        "$ref": "#/components/schemas/ImageUse"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "removed",
                    "removed_containers",
                    "still_named_by"
                  ],
                  "title": "ContainerImageDeleteResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a local podman image by tag or id",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container_image_delete",
        "x-lmgw-tool": "lmgw__container_image_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/container_image_pull": {
      "post": {
        "operationId": "op_container_image_pull",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`container_image_pull` args: the registry reference\nto pull — normally a registry update's `reference`.",
                "properties": {
                  "image": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "ContainerImagePullArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`container_image_pull` response: the background job\nrunning `podman pull` (`JobRow.kind = \"image_pull\"`, `key =\n\"image:<reference>\"`). A second pull of the same reference while one runs\nanswers with the running job's id.",
                  "properties": {
                    "image": {
                      "type": "string"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "job_id",
                    "image"
                  ],
                  "title": "ContainerImagePullStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Pull a registry image's update as a background job",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container_image_pull",
        "x-lmgw-writes": true
      }
    },
    "/api/op/container_image_pull_status": {
      "post": {
        "description": "What a `container_image_pull` job is doing, or did — the Pull update panel's result and its \"recreate N running containers\" prompt. While it runs, `detail.done_bytes` of `detail.total_bytes` is the download so far (`size_note` says why the size is not known, when it is not). A model's first start pulls a missing image through the same job before its admission, so a start and this op's pull of one image are one download.",
        "operationId": "op_container_image_pull_status",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`container_image_pull_status` args: the `image_pull` job to read — the\n`job_id` the pull start returned.",
                "properties": {
                  "job_id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "title": "ContainerImagePullStatusArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`container_image_pull_status` response: one `image_pull` job as it\nstands — how the Engines page learns what a finished pull did (the jobs\nfeed carries only running jobs, and a job row's result is not on it).\n`result` is set once the job is `done`; `error` once it `failed`.",
                  "properties": {
                    "detail": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ImagePullJobDetail"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The latest progress while it runs (podman's last line, the bytes so\nfar)."
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "image": {
                      "description": "The reference being (or that was) pulled.",
                      "type": "string"
                    },
                    "job_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ImagePullResult"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "status": {
                      "description": "`queued | running | done | failed | canceled`.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "job_id",
                    "image",
                    "status",
                    "detail",
                    "result",
                    "error"
                  ],
                  "title": "ContainerImagePullStatus",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a pull job's progress or result",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container_image_pull_status",
        "x-lmgw-writes": false
      }
    },
    "/api/op/container_image_tag": {
      "post": {
        "operationId": "op_container_image_tag",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`container_image_tag` args: add and/or remove one tag on an image.",
                "properties": {
                  "add": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "image": {
                    "default": "",
                    "type": "string"
                  },
                  "remove": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "ContainerImageTagArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`container_image_tag` response: the image's tags after the change.",
                  "properties": {
                    "tags": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "tags"
                  ],
                  "title": "ContainerImageTagResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Add and/or remove one tag on a local image",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container_image_tag",
        "x-lmgw-writes": true
      }
    },
    "/api/op/container_images": {
      "post": {
        "description": "Every local podman image of the three engines (llama.cpp and ik_llama.cpp, audio.cpp, stable-diffusion.cpp) — images lmgw built, with their provenance (build, run, repository, ref, base commit, merged extras) and their run's status, and external ones (hand-built tags, registry pulls) — with tags, size, creation time, GPU backend label and who uses each: class defaults, model overrides, running and stopped containers, matched by image ID, so two names of one image are one image. A registry image in use (e.g. the ghcr.io audio and stable-diffusion defaults) carries 'registry_update': the digest the registry serves for its tag at the last update check against the digests podman holds, update_available, and an error when it could not be compared — pull an update with lmgw__container_image_pull. The 'disk' footer has podman's image totals and any buildah leftovers on disk, for information: nothing is pruned from here.",
        "operationId": "op_container_images",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`container_images` args: every local image, or\nonly one engine's.\n\n`disk: false` skips the disk footer — `podman system df` and the scan for\nbuildah leftovers, most of this op's time — for a caller that shows no\nfooter (the image picker); the response then says so in\n`disk_skipped`. Absent means `true`, as before.",
                "properties": {
                  "disk": {
                    "default": true,
                    "type": "boolean"
                  },
                  "engine": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Engine"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "Only this engine's images. Omit for all three."
                  }
                },
                "title": "ContainerImagesArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`container_images` response: one entry per image ID, every tag of\nit in `tags`.",
                  "properties": {
                    "disk": {
                      "$ref": "#/components/schemas/DiskInfo"
                    },
                    "disk_skipped": {
                      "description": "The call asked for no disk footer (`disk: false`): `disk` is empty\nbecause it was not read, not because the store is.",
                      "type": "boolean"
                    },
                    "images": {
                      "items": {
                        "$ref": "#/components/schemas/ContainerImage"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "images",
                    "disk",
                    "disk_skipped"
                  ],
                  "title": "ContainerImagesResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List every local podman image of the three engines",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "container_images",
        "x-lmgw-tool": "lmgw__container_images",
        "x-lmgw-writes": false
      }
    },
    "/api/op/device_ca_rotate": {
      "post": {
        "description": "Replace lmgw's device CA: a new key under a new wrapping key and a new certificate replace tls/ca.key and tls/ca.crt, and the old key is not kept. Every enrolled device loses its key and certificate (its policy kept) and must be paired again with a new token; what each holds open closes at once, and every pairing token alive ends, since its link pins the old CA. The server certificates are issued anew. Answers DeviceCaRotated with the new fp and the devices reset.",
        "operationId": "op_device_ca_rotate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "required": [],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/device_ca_rotate`: lmgw's device CA replaced (device link\ndesign §5.5); every enrolled device was reset to wait for a new token.",
                  "properties": {
                    "devices_reset": {
                      "description": "The devices reset, by name without `device:`: each lost its key and\nits certificate and waits for **New token…**.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fp": {
                      "description": "The new CA's pin: `sha256:` and the hex SHA-256 of its\nSubjectPublicKeyInfo, what every new pairing link carries.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "fp",
                    "devices_reset",
                    "message"
                  ],
                  "title": "DeviceCaRotated",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Replace lmgw's device CA and reset every device",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "every paired device stops connecting at once and must be paired again with a new token; rotate only if lmgw's data directory, or its wallet, may have been copied",
        "x-lmgw-op": "device_ca_rotate",
        "x-lmgw-writes": true
      }
    },
    "/api/op/device_confirm": {
      "post": {
        "description": "Confirm the key a device enrolled, after comparing the code the Keys list shows (pairing.confirm_code) with the one the device shows, and sending that code: the key waiting for the confirmation must have it, else 409 confirm_code_mismatch and nothing changes (a card showing an earlier enrolment confirms nothing). Until then every request of that key is refused 403 device_unconfirmed; from now on it is served. A key that waited beside one the device kept (a re-pair that kept the current key) replaces it: the kept key ends, and what it holds open closes. Answers DeviceConfirmed with the code confirmed and whether it replaced a kept key.",
        "operationId": "op_device_confirm",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "confirm_code": "7F3A-91C2",
                  "id": 12
                },
                "properties": {
                  "confirm_code": {
                    "description": "The code the device shows, compared with the Keys list's pairing.confirm_code: eight hex digits, e.g. 7F3A-91C2 (either case; the hyphen and spaces optional). The key waiting for the confirmation must have it, or nothing is confirmed (409 confirm_code_mismatch).",
                    "type": "string"
                  },
                  "id": {
                    "description": "Device id, from the Keys table.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id",
                  "confirm_code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/device_confirm`: the owner confirmed a device's enrolment\n(device link design §3.5); its next request is served.",
                  "properties": {
                    "confirm_code": {
                      "description": "The confirmation code of the key confirmed, `7F3A-91C2`: the one the\ndevice shows, and the one the call sent.",
                      "type": "string"
                    },
                    "id": {
                      "description": "The device row's `api_keys.id`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "`device:<name>`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "replaced": {
                      "description": "Whether the confirmed key replaced one the device kept until now (a\nre-pair that kept the current key, §5.2): the kept key ended, and\nwhat it held open closed.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "confirm_code",
                    "replaced",
                    "message"
                  ],
                  "title": "DeviceConfirmed",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Confirm a device's enrolment",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "device_confirm",
        "x-lmgw-writes": true
      }
    },
    "/api/op/device_token": {
      "post": {
        "description": "A new one-time pairing token for a device row, replacing its earlier one; the row keeps its id, policy and history. end_current: true ends the key the device holds now (a lost or stolen device): what it holds open closes at once, as on a disable, and its requests are refused until the new token enrols. Left out or false, the current key works on: a new key the token enrols waits beside it for its own confirmation (device_confirm), which ends the current key (a new phone), and the same key enrolling again gets a fresh certificate and keeps its confirmation (a renewal before the old one lapses). A key that waited from an earlier token, and the contested mark, go with the new token. local_only and urls replace the row's, which a device paired before TLS has none of. Answers DevicePaired with the new link, as key_create does. Refused 409 device_listener_off while the device listener does not serve.",
        "operationId": "op_device_token",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "end_current": false,
                  "id": 12
                },
                "properties": {
                  "end_current": {
                    "description": "End the device's current key now: its connections close and its requests are refused until the new token enrols (a lost or stolen device). Default false: the current key works until the new token's enrolment replaces it.",
                    "type": "boolean"
                  },
                  "id": {
                    "description": "Device id, from the Keys table.",
                    "type": "integer"
                  },
                  "local_only": {
                    "description": "Replace the device's \"this computer\" flag; default: as it is.",
                    "type": "boolean"
                  },
                  "urls": {
                    "description": "Device keys: the device's lmgw URLs, https base URLs of the device listener in the order the device tries them (a LAN or WireGuard address, or a name; IP addresses and names of letters, digits and hyphens, which every server certificate carries). Default: for this computer https://127.0.0.1:<device port>; for another device every network address of this machine on the device port.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A device's pairing link minted: `POST /api/op/key_create` with `kind:\ndevice` (the row and its first pairing token) and `device_token` (a new\ntoken for the same row; device link design §3.2, §5.2). The token goes to\nthe owner once, inside the link.",
                  "properties": {
                    "fp": {
                      "description": "`sha256:` and the hex SHA-256 of the device CA's SubjectPublicKeyInfo:\nthe link's `fp`, which the device's enrolment pins.",
                      "type": "string"
                    },
                    "id": {
                      "description": "The device row's `api_keys.id`; a new token keeps it.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "link": {
                      "description": "`lmgw-pair:?v=2&name=…&url=…[&url=…]&fp=sha256:…&token=lmgw-enrol-…`:\ncarries the one-time pairing token to the device. Secret while its\ntoken lives: shown once, never logged.",
                      "type": "string",
                      "x-lmgw-secret": true
                    },
                    "local_only": {
                      "description": "Paired as \"this computer\": the device reaches lmgw on a loopback\naddress only.",
                      "type": "boolean"
                    },
                    "message": {
                      "description": "What was done, for a person to read: what the device does next, and\nwhether the device listener reaches it from where it is.",
                      "type": "string"
                    },
                    "name": {
                      "description": "`device:<name>`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "token_expires_at": {
                      "description": "When the pairing token lapses (RFC 3339, UTC): `devices.token_minutes`\nafter it was minted.",
                      "type": "string"
                    },
                    "urls": {
                      "description": "The device's lmgw URLs: `https` base URLs of the device listener, in\nthe owner's order, as the link carries them and enrolment answers\nthem.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "link",
                    "urls",
                    "local_only",
                    "token_expires_at",
                    "fp",
                    "message"
                  ],
                  "title": "DevicePaired",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Give a device a new pairing token (re-pair it)",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "with end_current the device's current key stops working at once and what it holds open closes",
        "x-lmgw-op": "device_token",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": true
      }
    },
    "/api/op/device_token_end": {
      "post": {
        "description": "End a device's pairing token while it lives (the QR card's close): its link pairs nothing any more, a used one included, whose own key can then no longer ask for its enrolment's answer again. Answers DeviceTokenEnded, ended false when no token was alive.",
        "operationId": "op_device_token_end",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Device id, from the Keys table.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/device_token_end`: a device's pairing token ended (device\nlink design §3.3), or said to be none.",
                  "properties": {
                    "ended": {
                      "description": "Whether a token was alive and is ended now; `false` when none was\n(never issued, lapsed, or ended already).",
                      "type": "boolean"
                    },
                    "id": {
                      "description": "The device row's `api_keys.id`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "`device:<name>`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "ended",
                    "message"
                  ],
                  "title": "DeviceTokenEnded",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "End a device's pairing token",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "device_token_end",
        "x-lmgw-writes": true
      }
    },
    "/api/op/forge_pr": {
      "post": {
        "operationId": "op_forge_pr",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`forge_pr` args: one\nPR/MR's current forge state.",
                "properties": {
                  "forge": {
                    "$ref": "#/components/schemas/Forge",
                    "default": "plain"
                  },
                  "number": {
                    "default": 0,
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "repo_url": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "ForgePrArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One PR (GitHub) or MR (GitLab) as the extras picker shows it.",
                  "properties": {
                    "author": {
                      "type": "string"
                    },
                    "base_sha": {
                      "type": "string"
                    },
                    "draft": {
                      "type": "boolean"
                    },
                    "head_sha": {
                      "type": "string"
                    },
                    "merge_commit_sha": {
                      "description": "The commit the merge put on its target branch — the merge, squash or\nrebase commit (GitHub `merge_commit_sha`; GitLab `merge_commit_sha`,\nelse `squash_commit_sha`). Empty when the forge gives none (an open\nPR, an old GitLab). A build skips a merged PR as \"merged upstream\"\nonly when its base contains this commit (or the PR's head).",
                      "type": "string"
                    },
                    "merged_at": {
                      "description": "Set once the forge reports it merged.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "number": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "description": "The forge's own spelling (`open` | `closed`).",
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "number",
                    "title",
                    "author",
                    "updated_at",
                    "draft",
                    "state",
                    "head_sha",
                    "base_sha",
                    "merged_at",
                    "url",
                    "merge_commit_sha"
                  ],
                  "title": "ForgePr",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "One pull/merge request's current forge state",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "forge_pr",
        "x-lmgw-writes": false
      }
    },
    "/api/op/forge_prs": {
      "post": {
        "description": "List a repository's open pull requests (GitHub) or merge requests (GitLab), most recently updated first, 100 per page — to find the number to put in a build's extras. Each has number, title, author, draft, state, head and base commit, merged_at and URL. A 'query' that is a number ('16391', '#16391') or a pasted PR URL returns that one PR whatever its state; other words filter the page (GitHub: every word must appear in the number, title or author; GitLab: server-side search), so a filtered page can be empty while next_page says more pages exist. Uses the forge token configured for the repository's host, if any; without one GitHub allows 60 requests an hour, and an exhausted quota is an error saying when it resets (rate_limit shows what is left).",
        "operationId": "op_forge_prs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`forge_prs` args: one page of the extras picker's PR/MR list.",
                "properties": {
                  "forge": {
                    "$ref": "#/components/schemas/Forge",
                    "default": "plain",
                    "description": "Where the repository's PRs live. Default: the build's; for a repo_url, github for github.com (always), gitlab for a host with a configured forge token, otherwise plain — which has no PR list."
                  },
                  "page": {
                    "default": null,
                    "description": "Page number, from 1 — the previous answer's next_page.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "query": {
                    "default": null,
                    "description": "A PR number or URL, or words to filter titles and authors by.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "repo_url": {
                    "default": "",
                    "description": "The repository, when not naming a build: e.g. https://github.com/ggml-org/llama.cpp.",
                    "type": "string"
                  }
                },
                "title": "ForgePrsArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`forge_prs` response: one page of the extras picker's PR/MR list.",
                  "properties": {
                    "next_page": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "prs": {
                      "items": {
                        "$ref": "#/components/schemas/ForgePr"
                      },
                      "type": "array"
                    },
                    "rate_limit": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/RateLimit"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "prs",
                    "next_page",
                    "rate_limit"
                  ],
                  "title": "ForgePrPage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a repository's open pull/merge requests",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "forge_prs",
        "x-lmgw-tool": "lmgw__forge_prs",
        "x-lmgw-writes": false
      }
    },
    "/api/op/forge_refs": {
      "post": {
        "description": "The remote's branches and tags, for the ref combobox.",
        "operationId": "op_forge_refs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`forge_refs` args: branch/tag suggestions for the ref\ncombobox.",
                "properties": {
                  "repo_url": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "ForgeRefsArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`forge_refs` response: ref suggestions for the editor's ref\ncombobox, from `git ls-remote --heads --tags` (annotated tags peeled to\n`^{}`).",
                  "properties": {
                    "default_branch": {
                      "type": "string"
                    },
                    "heads": {
                      "items": {
                        "$ref": "#/components/schemas/RefEntry"
                      },
                      "type": "array"
                    },
                    "tags": {
                      "items": {
                        "$ref": "#/components/schemas/RefEntry"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "default_branch",
                    "heads",
                    "tags"
                  ],
                  "title": "RemoteRefsView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a repository's branches and tags",
        "tags": [
          "ops-builds"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "forge_refs",
        "x-lmgw-writes": false
      }
    },
    "/api/op/hf_add": {
      "post": {
        "description": "Download a model from Hugging Face into the models directory — the normal way to get a new model onto this gateway. Fetches the weights file you name (or pick by quantization) together with its multimodal projector and, for target=chat, its speculative drafter from the same directory, because a model usually needs all of them. Split GGUFs expand to every part automatically. Downloads run in the background: poll lmgw__hf_downloads with ids=<the queued ids>, then call lmgw__local_model_plan on the result. target=image downloads the stable-diffusion.cpp kinds (.safetensors, .ckpt, .pt, .pth as well as .gguf) into the image models dir and fetches no companions — an image pipeline's VAE and text encoders live in OTHER repos, so use lmgw__image_recipe_add to bring a whole family down in one call and this tool only for a single file a recipe does not cover. When the image the target class's models run in (its Settings → Runtimes Image) is not on this machine, this also starts its download, a multi-gigabyte image_pull job of its own that starts no model: 'engine' in the answer names the image and the job (the model's first start joins it rather than downloading again), or says why it could not begin or why podman could not say whether it is needed; 'engine' is null when the image is here.",
        "operationId": "op_hf_add",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "companions": {
                    "description": "Also fetch the projector beside the weights, and for target=chat the drafter (an aux row has none). Default true; set false to download only the file you named.",
                    "type": "boolean"
                  },
                  "file": {
                    "description": "Exact path of the weights file within the repo. Omit to select by quant instead.",
                    "type": "string"
                  },
                  "quant": {
                    "description": "Pick the weights file by quantization label instead of exact name, e.g. 'Q4_K_XL' or 'IQ4_XS'. See lmgw__hf_repo for what is offered.",
                    "type": "string"
                  },
                  "repo": {
                    "description": "Repo id like 'unsloth/Qwen3.5-9B-GGUF' — owner/name only, not a full huggingface.co URL.",
                    "type": "string"
                  },
                  "target": {
                    "description": "Which models directory to download into. Default 'chat'. Use 'aux' for embedding, rerank and decision models and 'image' for stable-diffusion.cpp pipeline files — a row can only address files in its own class's directory, and this is what keeps the file in the updater's view (lmgw__hf_set check_updates).",
                    "enum": [
                      "chat",
                      "aux",
                      "audio",
                      "image"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "repo"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/hf_add` result.",
                  "properties": {
                    "companions": {
                      "description": "The projector and the drafter queued beside the weights. Empty when\n`companions` was off, when the repo has none beside that file, and for\nthe `image` target (a pipeline's components live in other repos).",
                      "items": {
                        "$ref": "#/components/schemas/HfCompanion"
                      },
                      "type": "array"
                    },
                    "dest_prefix": {
                      "description": "`repo/`: the directory under the models dir that the repo's files land\nin, with the trailing slash.",
                      "type": "string"
                    },
                    "downloads": {
                      "description": "The tracked rows of the file asked for, the companions and every part\nof a split GGUF, with the id each can be followed by in\n`GET /api/hf/downloads`.",
                      "items": {
                        "$ref": "#/components/schemas/QueuedDownload"
                      },
                      "type": "array"
                    },
                    "engine": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/EngineDownload"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The image `target`'s models run in, when it is not on this machine\nor podman could not say: the download fetches a missing one too, a\nmulti-gigabyte download of its own, and starts nothing\n(`EngineDownload`). `null` when it is here."
                    },
                    "files_queued": {
                      "description": "How many files went into the queue: the weights, the companions, and\nevery part of a split GGUF.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "gguf_path": {
                      "description": "Relative GGUF path (`repo/file`) — feed to plan/create once done.",
                      "type": "string"
                    },
                    "message": {
                      "description": "What was queued and what to do next, which depends on `target`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "repo": {
                      "type": "string"
                    },
                    "target": {
                      "description": "The class whose models dir the files go to: `chat | aux | audio |\nimage` (`embed` as asked is `aux` here).",
                      "type": "string"
                    },
                    "warnings": {
                      "description": "What to look out for in what was queued, one sentence each; empty when\nnothing. Today: a shard of a sharded `.safetensors` is queued alone,\nand stable-diffusion.cpp cannot reassemble shards.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "weights": {
                      "description": "The weights file asked for: the `file`, or the one the `quant` named.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "repo",
                    "weights",
                    "companions",
                    "files_queued",
                    "downloads",
                    "warnings",
                    "gguf_path",
                    "dest_prefix",
                    "target",
                    "message",
                    "engine"
                  ],
                  "title": "HfAddResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Download a model from Hugging Face into a models directory",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "hf_add",
        "x-lmgw-tool": "lmgw__hf_add",
        "x-lmgw-writes": true
      }
    },
    "/api/op/hf_set": {
      "post": {
        "description": "Manage tracked Hugging Face downloads: re-fetch one, cancel a running transfer, untrack and delete its file, or ETag-check every completed download against the hub for updates. An audio catalog file is checked and re-fetched at the revision audio.catalog_revision takes it at now: under 'pinned' the commit its audio.cpp spec pins today, else main. The answer follows the action: `check_updates` answers HfUpdatesChecked (how many finished downloads of the `target` class differ from the hub, and one sentence per file it could not ask about, in which case `ok` is false); `redownload`, `cancel` and `delete` answer a MessageAck.",
        "operationId": "op_hf_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "description": "What to do. 'cancel' stops a transfer that is still running; the entry stays tracked and can be re-fetched with 'redownload'.",
                    "enum": [
                      "redownload",
                      "cancel",
                      "delete",
                      "check_updates"
                    ],
                    "type": "string"
                  },
                  "id": {
                    "description": "Download row id from lmgw__hf_downloads. Required except for check_updates.",
                    "type": "integer"
                  },
                  "target": {
                    "description": "Which models directory check_updates scans. Default 'chat'.",
                    "enum": [
                      "chat",
                      "aux",
                      "audio",
                      "image"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "action"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MessageAck",
                      "description": "`action: redownload | cancel | delete`."
                    },
                    {
                      "$ref": "#/components/schemas/HfUpdatesChecked",
                      "description": "`action: check_updates`."
                    }
                  ],
                  "description": "What `hf_set` answers, by `action`: a `MessageAck` for `redownload`,\n`cancel` and `delete`, an `HfUpdatesChecked` for `check_updates`.\n\nThe two shapes share only `ok`, so this is the document's description of\nthe one op, not a type to read an answer into: a reader knows the action it\nsent and reads that action's type.",
                  "title": "HfSetAnswer"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Re-fetch, cancel, untrack or check-updates on a tracked Hugging Face download",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "hf_set",
        "x-lmgw-tool": "lmgw__hf_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/hold_set": {
      "post": {
        "description": "Engaging stops every idle local container (`stopped`), leaves the ones still working to the next reaper tick (`draining`), names the stops that failed (`failed`) and aborts a benchmark run in flight (`benchmark_aborted`, absent when none was). Asking for the state the hold is already in is not an error: nothing changes, and the answer reports the current state.",
        "operationId": "op_hold_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "active": {
                    "description": "true engages the hold (and stops idle local containers); false releases it.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "active"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Engaging or releasing the GPU hold: `POST /api/op/hold_set` (and\n`lmgw__hold_set`). The hold already being in the state asked for is not an\nerror: the answer reports the state and what is still working.",
                  "properties": {
                    "active": {
                      "description": "Whether the hold is on now. A held model answers with its own\nfallback, where one is set.",
                      "type": "boolean"
                    },
                    "benchmark_aborted": {
                      "description": "The id of the benchmark run that engaging the hold aborted. Absent\nwhen no run was aborted: none was running, the hold was released, or it\nwas already as asked.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "draining": {
                      "description": "The containers left running because they are still working, as\n`class/model`; the next reaper tick stops them. When the hold was\nalready as asked this is the registry's own view of what is working.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "failed": {
                      "description": "The containers whose stop failed, as `class/model: reason`; they still\nhold GPU memory.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "kept_on_cpu": {
                      "description": "The containers on the CPU, left running: they use no VRAM.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "What was done, for a person to read: the failures are in the sentence\nas well as in `failed`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "stopped": {
                      "description": "The containers this call stopped, as `class/model` (empty when it\nstopped none, and when the hold was released or already as asked).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "active",
                    "stopped",
                    "draining",
                    "failed",
                    "kept_on_cpu",
                    "message"
                  ],
                  "title": "HoldSet",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Engage or release the GPU hold",
        "tags": [
          "ops-runtime"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "hold_set",
        "x-lmgw-tool": "lmgw__hold_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/image_model_set": {
      "post": {
        "description": "Create, update, delete, enable or disable an IMAGE model: a stable-diffusion.cpp pipeline served by sd-server on /v1/images/generations (and /v1/images/edits when the row is an edit pipeline). This is the class for diffusion models — they have no chat template and no embeddings, so they are neither a chat nor an aux row. The whole chain, and the short way round it: lmgw__image_recipes -> lmgw__image_recipe_add key=<key> (it queues every component and hands back a prefilled row) -> lmgw__hf_downloads ids=<the queued ids> until each says 'done' -> THIS TOOL with the returned row -> lmgw__local_model_test model_id=<id> target=image to prove it loads and draws. For a pipeline no recipe covers, download the files yourself with lmgw__hf_add target=image (one call per component — they live in different repos) and write 'files' by hand. The container starts on the first request; there is no separate apply for a model that has never run. 'files' is a map of flag key -> path RELATIVE to the image models directory, one 'key = value' per line: the key is sd-server's long flag with '-' written as '_' (model, diffusion_model, vae, clip_l, clip_g, t5xxl, llm, llm_vision, clip_vision, taesd, control_net, ip_adapter, photo_maker, upscale_model, high_noise_diffusion_model, tokenizer, lora_model_dir, hires_upscalers_dir, embd_dir, …). EXACTLY ONE of 'model' (an all-in-one checkpoint) and 'diffusion_model' (a standalone DiT) is required — everything else hangs off it. 'args' is the same shape for runtime and default-generation flags (type, offload_to_cpu, diffusion_fa, vae_tiling, cfg_scale, steps, sampling_method, width, height, …); a key with no value is a switch. Both maps are checked against the container image's own --help when the row is saved, so a wrong key is refused by name (with a suggestion) instead of failing at the first start — lmgw__llama_flags does the same job for the chat class. Per-request parameters are NOT row fields: steps, seed, negative prompt, sampler and LoRA reach a request through sd.cpp's own <sd_cpp_extra_args>{…}</sd_cpp_extra_args> block inside the prompt. What goes in 'args' are this row's DEFAULTS.",
        "operationId": "op_image_model_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for an image (stable-diffusion.cpp) model. It is shared by\n`/api/op/image_model_set` and `lmgw__image_model_set`, because an image row\nis `files` + `args` and nothing an agent cannot check.\n\nSame conventions as every other model patch: a field left out keeps what the\nrow has, an empty string clears the fields that can be cleared, and `clear`\nnames the rest.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "args": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/KeyMap"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Runtime and default-generation flags, one 'key = value' per line — e.g. 'diffusion_fa' (a bare key is a switch) then 'cfg_scale = 1.0' then 'steps = 8' then 'offload_to_cpu'. Same replace-wholesale rule as 'files'. A JSON object is accepted too."
                  },
                  "capabilities_override": {
                    "default": null,
                    "description": "An override of the derived /v1/models facts for this row, as a JSON object (keys: capabilities, max_output_tokens, notes). Empty clears it."
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset to unset, comma-separated: 'args', 'modes', 'extra_run_args', 'image', 'fallback', 'capabilities_override', 'prompt_style', 'preview_mode'. Not 'files': a row with no files names no pipeline.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "edit": {
                    "default": null,
                    "description": "This pipeline takes reference images (Kontext, Qwen-Image-Edit, Z-Image-Omni) and may serve /v1/images/edits. Load-bearing, not descriptive: sd-server does not refuse a reference-image request against a pipeline that cannot take one, it segfaults, so lmgw refuses that request itself for every row without this flag.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Serve this model (a disabled model has no container).",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "extra_run_args": {
                    "default": null,
                    "description": "'podman run' args override, one argument per entry. Absent leaves it unchanged; name it in 'clear' to revert to the class default (an override with no args is never stored: it is the class default). The GPU device flags live here — sd-server links libcuda directly and will not even print its help without the card.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (an image model); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "files": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/KeyMap"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The pipeline's files, one 'key = path' per line, each path relative to the image models directory — e.g. 'diffusion_model = Tongyi-MAI/Z-Image-Turbo/z-image-turbo-Q4_K.gguf' then 'vae = Comfy-Org/flux/ae.safetensors' then 'llm = Qwen/Qwen3-4B-Instruct-GGUF/Qwen3-4B-Q4_K_M.gguf'. Required on create. Replaces the stored map wholesale on update (send the whole set, not just the line that changed). A leading '/models/' — the spelling the rendered command line shows — is dropped for you. A JSON object is accepted too."
                  },
                  "id": {
                    "default": null,
                    "description": "Image model row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "idle_seconds": {
                    "default": null,
                    "description": "Seconds idle before the model unloads. 0 = never. Default 300. Worth keeping low: a loaded pipeline is 7-13 GiB of the card that nothing else can use.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Podman image override for this model's own container (the class default is stable-diffusion.cpp's master-cuda tag). Empty or absent leaves it unset; 'clear' reverts to the class image.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": null,
                    "description": "Client-facing model id (the part after the image prefix, so 'image/<model_id>'); also selects the row when id is omitted.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "modes": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/StrList"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "What this pipeline does, comma-separated: 'img_gen' (the default when empty), or 'img_gen,vid_gen' for one that also makes video. This drives task and endpoints on /v1/models before the container has ever run; it is compared against what the running server reports and a mismatch becomes a warning, never a silent correction."
                  },
                  "preview_mode": {
                    "default": null,
                    "description": "How the live preview of a running generation is drawn: 'none' (no preview, elapsed time only), 'proj' (a quick colour sketch, free), 'tae' (needs a TAE file in files, which then also decodes the final image at lower quality) or 'vae' (the row's VAE every step: slower, more memory). 'clear' goes back to the default: 'proj' where the build offers it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "prompt_style": {
                    "default": null,
                    "description": "How the chat model writes this row's prompts when it calls image__generate: 'natural' (plain sentences: FLUX, Z-Image, Qwen-Image), 'keywords' (short comma-separated phrases: SDXL) or 'tags' (booru-style tags: anime fine-tunes). 'clear' goes back to what the matching shipped recipe says.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "warm_start": {
                    "default": null,
                    "description": "Start this model's container when lmgw launches.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "title": "ImageModelPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to an image (stable-diffusion.cpp) model: `create`, `update` (also\n`enable` and `disable`) or `delete`.",
                  "properties": {
                    "command_line": {
                      "description": "`create`, `update`: the `podman run` line the saved row starts with (an\nempty text when the row is not found). Absent for `delete`.",
                      "type": "string"
                    },
                    "fallback_notes": {
                      "description": "What the save says about the fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read, with the next step.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "peak_reset": {
                      "description": "`update`: whether the save dropped the learned peak because the files or\na flag changed, so the figure no longer describes the pipeline. Absent\nfor every other action.",
                      "type": "boolean"
                    },
                    "public_name": {
                      "description": "`create`: the name clients request the model by. Absent for every\nother action.",
                      "type": "string"
                    },
                    "warnings": {
                      "description": "`create`, `update`: why the model may not load (empty when none fired).\nAbsent for `delete`.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "ImageModelSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable or disable an image (stable-diffusion.cpp) model",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "image_model_set",
        "x-lmgw-tool": "lmgw__image_model_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/image_recipe_add": {
      "post": {
        "description": "Download every component of one shipped image pipeline and get back a PREFILLED ROW for it. The whole chain: lmgw__image_recipes to choose a key -> THIS TOOL -> lmgw__hf_downloads ids=<the queued ids> until every one says 'done' -> lmgw__image_model_set action=create with the returned 'row' (it is already in that tool's field names: model_id, files, args, modes, edit) -> lmgw__local_model_test model_id=<id> target=image. Components already on disk are skipped, not re-fetched — a VAE or text encoder shared with a pipeline you already have costs nothing. It does NOT create the row itself: the files are still transferring, and lmgw__image_model_set refuses a row whose files are not on disk, which is the check that keeps a broken row out of the table. Refuses cleanly when the image models directory is not configured, or when a component's repo is licence-gated and no Hugging Face token is set (naming the component). When the image class's image (Settings → Runtimes → Image → Image) is not on this machine, this also starts its download, a multi-gigabyte image_pull job of its own that starts no model; 'engine' in the answer names the image and the job, or says why it could not begin or why podman could not say whether it is needed, and is null when the image is here.",
        "operationId": "op_image_recipe_add",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "diffusion_file": {
                    "description": "Pick a different quantization of the pipeline's diffusion model (or checkpoint) by exact filename — one of the 'alternatives' that recipe's primary component lists. Omit for the recipe's default. A name the recipe does not know is refused rather than ignored.",
                    "type": "string"
                  },
                  "key": {
                    "description": "Recipe key from lmgw__image_recipes, e.g. 'z-image-turbo' or 'flux1-schnell'.",
                    "type": "string"
                  }
                },
                "required": [
                  "key"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/image_recipe_add` — components queued, plus the row the\neditor is about to be filled with.\n\nIt does **not** create the row (it hands a prefilled row to the\neditor): the files are not on disk yet, and `image_model_set` refuses a\nrow whose `files` do not resolve — correctly, because that check is what\nkeeps a broken row out of the table. So the caller downloads, then posts\n`row` at `image_model_set action=create`.",
                  "properties": {
                    "already_present": {
                      "description": "Components skipped because the file was already there.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "already_queued": {
                      "description": "Components skipped because a download for them is already queued or\nrunning — re-queueing one would flip its row back to `queued` under\nthe job that is downloading it.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "display_name": {
                      "type": "string"
                    },
                    "downloads": {
                      "items": {
                        "$ref": "#/components/schemas/QueuedDownload"
                      },
                      "type": "array"
                    },
                    "engine": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/EngineDownload"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The image class's image, when it is not on this machine or podman\ncould not say: the download fetches a missing one too, a\nmulti-gigabyte download of its own, and starts nothing\n(`EngineDownload`). `null` when it is here."
                    },
                    "files_queued": {
                      "description": "Components queued now (the ones that were not already on disk).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "key": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "row": {
                      "$ref": "#/components/schemas/ImageRecipeRow",
                      "description": "The `image_model_set` patch, ready to post once the downloads are done."
                    }
                  },
                  "required": [
                    "ok",
                    "key",
                    "display_name",
                    "files_queued",
                    "downloads",
                    "already_present",
                    "already_queued",
                    "row",
                    "message",
                    "engine"
                  ],
                  "title": "ImageRecipeAddResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Queue every missing component of one image recipe",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "image_recipe_add",
        "x-lmgw-tool": "lmgw__image_recipe_add",
        "x-lmgw-writes": true
      }
    },
    "/api/op/image_recipes": {
      "post": {
        "description": "The image pipelines lmgw ships a recipe for — Z-Image-Turbo, FLUX.1 schnell/dev/Kontext, SDXL, Qwen-Image — and, for each, every file it needs: the Hugging Face repo, the exact filename, the size, whether the repo is licence-gated, the quantization alternatives, and whether that file is already on this box ('present') or downloading. START HERE for the image class. A stable-diffusion.cpp pipeline is NOT one weights file: it is a diffusion model (or an all-in-one checkpoint) plus a VAE plus one to three text encoders, and they live in DIFFERENT repos under different owners, so there is nothing lmgw__hf_repo can show you that describes a whole pipeline. Each recipe also carries the 'args' the family wants and a VRAM note — measured where a spike measured it, and the word 'unmeasured' where none did. Takes no arguments; the list is compiled in, so this makes no network call. Then: lmgw__image_recipe_add.",
        "operationId": "op_image_recipes",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "required": [],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/image_recipes` — the shipped pipeline list, joined against\nwhat is on disk and what is downloading.\n\nThe audio catalog's sibling with a static source: there is no upstream\ncatalog for stable-diffusion.cpp pipelines, and a pipeline spans repos, so\nthe list is compiled into the binary and every `(repo, file, size, gated)`\nin it was checked against the hub's public metadata API.",
                  "properties": {
                    "hf_token_set": {
                      "description": "A Hugging Face token is configured, so a gated component is reachable.",
                      "type": "boolean"
                    },
                    "models_dir": {
                      "description": "The image class's models dir; empty means the class is unconfigured and\nnothing can be downloaded or found.",
                      "type": "string"
                    },
                    "models_dir_missing": {
                      "description": "True when `models_dir` is empty — the one refusal the UI can show\nbefore the user clicks anything.",
                      "type": "boolean"
                    },
                    "next_step": {
                      "description": "What to call next, for a caller that has no dashboard (the tool plane's\nrule: a result names the tool that follows it).",
                      "type": "string"
                    },
                    "recipes": {
                      "items": {
                        "$ref": "#/components/schemas/ImageRecipe"
                      },
                      "type": "array"
                    },
                    "upscalers": {
                      "$ref": "#/components/schemas/ImageUpscalers",
                      "description": "The upscalers (chat-media-tools design §9): the shipped ESRGAN models\nand the files the image models dir's `upscalers/` holds."
                    }
                  },
                  "required": [
                    "recipes",
                    "models_dir",
                    "models_dir_missing",
                    "hf_token_set",
                    "next_step",
                    "upscalers"
                  ],
                  "title": "ImageRecipes",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the image pipelines lmgw ships a recipe for",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "image_recipes",
        "x-lmgw-tool": "lmgw__image_recipes",
        "x-lmgw-writes": false
      }
    },
    "/api/op/image_upscaler_add": {
      "post": {
        "description": "Downloads one of the upscalers image_recipes lists under upscalers.shipped into upscalers/<file> of the image models dir — not the <owner>/<repo>/<file> layout of hf_add — because sd-server finds upscalers at the top level of that one directory, which every image row reads. A file already there or already downloading is not queued again. An image model's server sees the file from its next start; image__upscale and the Chat card's Upscale then offer it by its file stem. Refused when the image models dir is not configured.",
        "operationId": "op_image_upscaler_add",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "key": {
                    "description": "Upscaler key from upscalers.shipped, e.g. 'realesrgan-x4plus'.",
                    "type": "string"
                  }
                },
                "required": [
                  "key"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/image_upscaler_add {key}`: the shipped upscaler queued into\n`upscalers/<file>` of the image models dir.",
                  "properties": {
                    "already_present": {
                      "type": "boolean"
                    },
                    "already_queued": {
                      "type": "boolean"
                    },
                    "download": {
                      "$ref": "#/components/schemas/QueuedDownload",
                      "description": "The download queued now; `None` when the file is already there or\nalready on its way."
                    },
                    "key": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "key",
                    "already_present",
                    "already_queued",
                    "message"
                  ],
                  "title": "ImageUpscalerAddResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Queue a shipped ESRGAN upscaler into the image models dir's upscalers/",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "image_upscaler_add",
        "x-lmgw-tool": "lmgw__image_upscaler_add",
        "x-lmgw-writes": true
      }
    },
    "/api/op/job_cancel": {
      "post": {
        "description": "Cancel a running background job (a download, a build run, an image pull, …) by its job id.",
        "operationId": "op_job_cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "The job id, from /api/jobs or the SSE `jobs` frame.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a running background job",
        "tags": [
          "ops-runtime"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "job_cancel",
        "x-lmgw-writes": true
      }
    },
    "/api/op/key_create": {
      "post": {
        "description": "Create a new API key: a client key (default), an owner key or a device key. The plaintext is returned once for a client key; an owner key's plaintext stays retrievable with key_reveal for as long as the row exists. A client key may be created with its alias scope, MCP tool scope and device-tools grant already set (scope_mode, scope_patterns, tool_scope_mode, tool_scope_patterns, device_tools — the same fields and rules as key_set); an owner key refuses them. A device key (kind 'device', named device:<name>) pairs one client app: it is created with its whole policy — the scopes, the device-tools grant, budget, limits and expiry key_set takes — an optional hosts_label, an optional self_admin level (off by default), local_only (paired as this computer) and urls (its lmgw URLs on the device listener; proposed when left out). It holds no key yet: it answers DevicePaired {id, name, link, urls, local_only, token_expires_at, fp}, where link is lmgw-pair:?v=2&name=…&url=…&fp=…&token=…, carrying a one-time pairing token that lapses after devices.token_minutes. The device enrols its own key with it on POST /devices/enrol and is served once the owner confirms its code (device_confirm). Refused 409 device_listener_off while the device listener does not serve. A device holds the Chat API on top of a client key's inference, and nothing of the admin plane. A client or owner key answers KeyCreated ({id, name, key}).",
        "operationId": "op_key_create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "name": "ci-bot",
                  "tool_scope_mode": "allow",
                  "tool_scope_patterns": "docs__*"
                },
                "properties": {
                  "budget_micro": {
                    "description": "Device keys: the budget in currency micro-units, 0 for none (the default).",
                    "type": "integer"
                  },
                  "budget_period": {
                    "description": "Device keys: the budget's period. Default 'month'.",
                    "enum": [
                      "day",
                      "month",
                      "total"
                    ],
                    "type": "string"
                  },
                  "concurrency_limit": {
                    "description": "Device keys: concurrent requests, 0 for no limit.",
                    "type": "integer"
                  },
                  "device_tools": {
                    "description": "Client and device keys: the device-hosted labels whose tools the key reaches (e.g. [\"kai\"] for Kai desktop's tools), whatever tool_scope_mode says; the tool scope then filters which of those tools it sees, as it does any server's. Without it no key reaches another device's hosted tools, whatever its tool scope names. Any label a device could host is taken (letters, digits, '_' and '-', no '__', no trailing '_', none of lmgw's own namespaces), hosted now or not. Default none; refused for an owner key.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "expires_at": {
                    "description": "Device keys: YYYY-MM-DD (the whole of that day) or an RFC3339 timestamp. At that moment the device's open connections end.",
                    "type": "string"
                  },
                  "hosts_label": {
                    "description": "Device keys: the label (tool prefix) the device may host MCP tools under. Unique among the MCP servers' prefixes and names, and not one of lmgw's own namespaces.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Default 'client'.",
                    "enum": [
                      "client",
                      "owner",
                      "device"
                    ],
                    "type": "string"
                  },
                  "local_only": {
                    "description": "Device keys: paired as \"this computer\" — the device reaches lmgw on a loopback address only. Default false.",
                    "type": "boolean"
                  },
                  "name": {
                    "description": "Display name for the new key. The server adds the kind's prefix: a device named `desktop` is listed as `device:desktop`.",
                    "type": "string"
                  },
                  "note": {
                    "description": "Device keys: a free-text note.",
                    "type": "string"
                  },
                  "rpm_limit": {
                    "description": "Device keys: requests per minute, 0 for no limit.",
                    "type": "integer"
                  },
                  "scope_mode": {
                    "description": "Client and device keys: which model aliases the key may ask for. Default 'all'.",
                    "enum": [
                      "all",
                      "allow",
                      "deny"
                    ],
                    "type": "string"
                  },
                  "scope_patterns": {
                    "description": "Newline-delimited `*` globs over alias names, for scope_mode allow/deny.",
                    "type": "string"
                  },
                  "self_admin": {
                    "description": "Device keys: the device's level of lmgw's admin tools. read_only reads lmgw's configuration and state; full also changes it, which includes registering programs that run on the gateway's machine as the lmgw user (an MCP server's command, containers, agents, builds). Above off the device sees and uses the Chat threads and folders that carry the self-admin toolset (lmgw), in text and in voice, and its tool scope takes in the lmgw label; the self-admin level in Settings caps what the tools may do, and Admin Chat stays hidden from every device. Below full (after that cap) it reads those threads and sends to them, but does not attach the toolset to a thread or folder, change such a thread's settings or messages, nor such a folder's defaults (403 chat_toolset_needs_full); at full it may. Default off. Refused for any other kind of key.",
                    "enum": [
                      "off",
                      "read_only",
                      "full"
                    ],
                    "type": "string"
                  },
                  "tool_scope_mode": {
                    "description": "Client and device keys: which MCP tools the key may see and call. Default 'all'.",
                    "enum": [
                      "all",
                      "allow",
                      "deny"
                    ],
                    "type": "string"
                  },
                  "tool_scope_patterns": {
                    "description": "Newline-delimited `*` globs over exposed tool names (e.g. `docs__*`, `github__search`), for tool_scope_mode allow/deny.",
                    "type": "string"
                  },
                  "tpm_limit": {
                    "description": "Device keys: tokens per minute, 0 for no limit.",
                    "type": "integer"
                  },
                  "urls": {
                    "description": "Device keys: the device's lmgw URLs, https base URLs of the device listener in the order the device tries them (a LAN or WireGuard address, or a name; IP addresses and names of letters, digits and hyphens, which every server certificate carries). Default: for this computer https://127.0.0.1:<device port>; for another device every network address of this machine on the device port.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/KeyCreated",
                      "description": "`kind: client` (or `key`, or none) and `kind: owner`."
                    },
                    {
                      "$ref": "#/components/schemas/DevicePaired",
                      "description": "`kind: device`."
                    }
                  ],
                  "description": "What `key_create` answers, by `kind`: `DevicePaired` for `device`,\n`KeyCreated` for a client or an owner key.\n\nThe two shapes share only `ok`, `id`, `name` and `message`, so this is the\ndocument's description of the one op, not a type to read an answer into: a\nreader knows the kind it sent and reads that kind's type.",
                  "title": "KeyCreateAnswer"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a client, owner or device API key",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "key_create",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": true
      }
    },
    "/api/op/key_delete": {
      "post": {
        "description": "Delete a key by id. Deleting the dashboard's own owner key is allowed and means \"closed\": the next start seeds it again, disabled, until it is enabled — the credential handed out until then is gone. Deleting a key ends what it holds open at once, as disabling it does.",
        "operationId": "op_key_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Key id, from the Keys table or /api/usage/keys.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Revoke an API key",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "key_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/key_reveal": {
      "post": {
        "description": "The stored plaintext of one owner-kind key. A client key is hashed and shown only once at creation, so there is nothing to reveal for it; a device authenticates with a key of its own that never leaves it (device_token pairs it again); an agent token is read from the agent's own page instead.",
        "operationId": "op_key_reveal",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Owner key id, from the Keys table.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "An owner key handed out: `POST /api/op/key_reveal` (its stored plaintext)\nand `key_rotate` (the new one). Both refuse a device row: it holds no\nsecret of lmgw's making, and pairs again with `device_token`.",
                  "properties": {
                    "id": {
                      "description": "The key's `api_keys.id`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "key": {
                      "description": "The key, in the clear. Secret.",
                      "type": "string",
                      "x-lmgw-secret": true
                    },
                    "message": {
                      "description": "What was done, for a person to read; after a rotation it also says when\nthe configuration could not be reloaded.",
                      "type": "string"
                    },
                    "name": {
                      "description": "The key's name.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "key",
                    "message"
                  ],
                  "title": "KeySecret",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Show an owner key's stored plaintext",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "key_reveal",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": false
      }
    },
    "/api/op/key_rotate": {
      "post": {
        "description": "Replace an owner key's hash and plaintext in one write, so the old value stops working the moment the new one is live. A disabled owner:self-admin key stays disabled after rotation — the plane stays closed. What the old value holds open ends at once, as on a disable: realtime sessions close with 4003, Chat streams end with an error frame whose code is revoked, the change feed with a revoked event, and /mcp notification streams end. A device row is refused: it holds no secret of lmgw's making, and pairs again with device_token. Answers KeySecret ({id, name, key}).",
        "operationId": "op_key_rotate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Owner key id, from the Keys table.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "An owner key handed out: `POST /api/op/key_reveal` (its stored plaintext)\nand `key_rotate` (the new one). Both refuse a device row: it holds no\nsecret of lmgw's making, and pairs again with `device_token`.",
                  "properties": {
                    "id": {
                      "description": "The key's `api_keys.id`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "key": {
                      "description": "The key, in the clear. Secret.",
                      "type": "string",
                      "x-lmgw-secret": true
                    },
                    "message": {
                      "description": "What was done, for a person to read; after a rotation it also says when\nthe configuration could not be reloaded.",
                      "type": "string"
                    },
                    "name": {
                      "description": "The key's name.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "key",
                    "message"
                  ],
                  "title": "KeySecret",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Mint a new plaintext for an owner key, invalidating the old one",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "rotating owner:dashboard signs every browser out and ends the dashboard's running Chat turn and voice session; rotating any other owner key ends what it holds open",
        "x-lmgw-op": "key_rotate",
        "x-lmgw-reveals-secret": true,
        "x-lmgw-writes": true
      }
    },
    "/api/op/key_set": {
      "post": {
        "description": "The settable half of one key's policy. Sparse like every other patch: a field left out keeps the value the row already has. The other half of a key's policy is derived (an agent token's scope and enabled flag are written by lmgw from the agent's manifest and row) and is refused here rather than accepted and silently taken back by the next resync. A client or device key's device_tools names the device-hosted labels whose tools it reaches (e.g. [\"kai\"]), whatever its tool scope's mode, which then filters those tools as any server's; [] clears it, and a label no device hosts yet is taken. A device key also takes hosts_label (\"\" clears it), urls (its lmgw URLs, which every server certificate carries from the next connection on) and self_admin, its level of lmgw's admin tools: off, read_only or full, capped by the self-admin level in Settings; what the device sees follows the capped level. Raised above off (under a self-admin level above off), the device's change feed receives the threads and folders with the self-admin toolset as created; set to off, as deleted, its Chat turns on such a thread stop, and its realtime sessions bound to such a thread close with 4004. Lowered to read_only, a turn still running is refused its next write tool. On any change its change feed sends a state event with self_admin, what its admin tools may do now, and its realtime sessions that carry the lmgw label list it again. Disabling a key of any kind, or its expires_at passing, ends what it holds open at once: its realtime sessions close with 4003, its Chat streams end with an error frame whose code is revoked, its change feed with a revoked event, and its /mcp notification stream ends.",
        "operationId": "op_key_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "The **settable** half of one key's policy. Sparse like every other\npatch: a field left out keeps the value the row already has.\n\nThe other half is *derived* — an agent token's scope and enabled flag are\nwritten by lmgw from the agent's manifest and row — and `key_set` refuses to\nchange those rather than writing a value the next resync would silently take\nback.",
                "properties": {
                  "budget_micro": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "budget_period": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "concurrency_limit": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "device_tools": {
                    "default": null,
                    "description": "Client and device keys: the device-hosted labels whose tools the key\nreaches (e.g. `[\"kai\"]` for Kai desktop's tools), whatever the tool\nscope's mode; the tool scope then filters which of those tools it\nsees, as it does any server's. Without it no key reaches another\ndevice's hosted tools, whatever its tool scope says. Any label a\ndevice could host is taken, hosted now or not; `[]` clears it.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "expires_at": {
                    "default": null,
                    "description": "`YYYY-MM-DD` — which means the **whole** of that day, the same reading\nexpiry enforcement applies — or an RFC3339 timestamp. `\"\"` clears it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "hosts_label": {
                    "default": null,
                    "description": "Device keys only: the label the device may host MCP tools under.\n`\"\"` clears the grant.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": 0,
                    "format": "int64",
                    "type": "integer"
                  },
                  "note": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rpm_limit": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "scope_mode": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "scope_patterns": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "self_admin": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/AdminLevel"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "Device keys only: the device's level of lmgw's admin tools — `off`,\n`read_only` or `full`. Above `off` it uses the Chat threads and\nfolders with the self-admin toolset and the `lmgw` label in its tool\nscope; what the tools may do is this level capped by the self-admin\nlevel in Settings."
                  },
                  "tool_scope_mode": {
                    "default": null,
                    "description": "The MCP tool scope: the same modes and glob syntax, over exposed tool\nnames.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tool_scope_patterns": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tpm_limit": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "urls": {
                    "default": null,
                    "description": "Device keys only: the device's lmgw URLs, `https` base URLs of the\ndevice listener in the order the device tries them. Every server\ncertificate carries their hosts from the next connection on, and the\ndevice reads the list at its next enrolment.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  }
                },
                "title": "KeyPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to one key's policy: `POST /api/op/key_set`.",
                  "properties": {
                    "changed": {
                      "description": "The fields the call changed (`enabled`, `scope_mode`, `budget_micro`,\n…), in the order the op checks them; empty when every field sent\nalready read that way and nothing was written.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The key's `api_keys.id`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "name": {
                      "description": "The key's name.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "name",
                    "changed",
                    "message"
                  ],
                  "title": "KeySaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change a key's policy — scope, budget, rate limits, expiry",
        "tags": [
          "ops-keys"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "key_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/local_model_set": {
      "post": {
        "description": "Create, update, delete, enable, disable or duplicate a local llama.cpp CHAT model entry. Every llama-server parameter lmgw manages is settable here. Embedding, rerank and decision models are a different class with their own directory and tool — lmgw__aux_model_set — and must not be created here (a chat row serves none of /v1/embeddings, /v1/rerank and /v1/systemone). Prefer lmgw__local_model_plan to derive these values from the GGUF itself rather than guessing them. Update is partial: pass only what changes, and use 'clear' to unset a field. Duplicate clones the model named by id/ model_id under a fresh '<id>-copy' id (GGUF, params, args and flags carry over verbatim) — a quick way to try a different configuration (reasoning vs not, a different slot/context split) against the same weights. A model's own container starts automatically on its first request; if it might already be running under stale config, run lmgw__container model=<id> action=apply to recreate it explicitly. lmgw__local_model_test then confirms the model really loads (it starts the container itself, so it works either way).",
        "operationId": "op_local_model_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for a local (llama.cpp) model.\n\nUnlike the other model patches this one is *complete*: every llama.cpp\nparameter of the row is reachable, including multimodal and speculative\nsetups, without the freeform `extra_args` escape hatch or knowledge of\nllama-server's path conventions. An `update` preserves every field not\nnamed.\n\nBecause an omitted field means \"leave as is\", there is no value a caller can\nsend to *unset* a field — hence `clear`, a list of field names to reset.\nThat keeps every argument a flat scalar while still allowing \"remove the\ndrafter\".",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "batch_size": {
                    "default": null,
                    "description": "Logical batch size (--batch-size).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cache_ram": {
                    "default": null,
                    "description": "Host RAM in MiB for holding the prompt state of idle slots (--cache-ram), so returning to an earlier conversation skips reprocessing it. -1 = no limit, 0 = disabled; omit to keep llama.cpp's own default of 8192.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "cache_type_k": {
                    "default": null,
                    "description": "KV cache K quantization (--cache-type-k). q8_0 roughly halves KV memory versus the f16 default.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cache_type_v": {
                    "default": null,
                    "description": "KV cache V quantization (--cache-type-v).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "capabilities_override": {
                    "default": null,
                    "description": "Capability facts set on the row, merged over what lmgw derives for /v1/models: a JSON object with optional keys capabilities (deep-merged; e.g. {\"input_modalities\":[\"text\",\"image\"],\"reasoning\":{\"kind\":\"levels\",\"levels\":[\"low\",\"high\"]}}), max_output_tokens, notes (appended). Use it only for facts the GGUF or the provider catalog does not state; the result is published with source \"owner\"."
                  },
                  "chat_template_file": {
                    "default": null,
                    "description": "Override the embedded template (--chat-template-file), relative to the models directory.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_template_kwargs": {
                    "default": null,
                    "description": "Further chat-template variables, as the JSON object string --chat-template-kwargs takes, e.g. '{\"preserve_thinking\":true}'. This is the only route to that flag — one in extra_args is ignored. A 'reasoning_effort' key here is folded into the field above, since both reach the same template variable.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset to unset, comma-separated (e.g. 'spec_type,draft_gguf_path'). Needed because omitting a field means 'leave unchanged'. 'fallback' removes the row's fallback. 'ladder' resets the row to not-a-ladder — the base's own gguf_path/ctx_size are untouched.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ctx_size": {
                    "default": null,
                    "description": "Context length (--ctx-size). Use the model's real trained context from lmgw__model_inspect; do not pick a smaller round number defensively.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "draft_gguf_path": {
                    "default": null,
                    "description": "Speculative drafter GGUF (--model-draft), relative to the models directory. Often shipped alongside the weights in the same repo.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Serve this model (a disabled model has no container).",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "extra_args": {
                    "default": null,
                    "description": "Escape hatch for llama-server flags with no field above, one argument per entry (e.g. ['--no-warmup'], ['--threads', '16']). Absent leaves them unchanged; an empty list clears them. Validated against the running build. A flag that HAS a field above is ignored here — use the field.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "extra_run_args": {
                    "default": null,
                    "description": "`podman run` args override, one entry per argument. Absent leaves it\nunchanged; an empty list is no override either, and `clear` reverts a\npreviously set override back to inheriting the class's\n`extra_run_args`. An override is never stored as an empty list.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (a chat model); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "fit": {
                    "default": null,
                    "description": "Let llama-server shrink UNSET arguments to fit device memory (--fit). It never touches a value set here, so it cannot silently cap a context length you configured.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "fit_ctx": {
                    "default": null,
                    "description": "Floor on the context --fit may choose (--fit-ctx).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "flash_attn": {
                    "default": null,
                    "description": "Flash attention (--flash-attn).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "gguf_path": {
                    "default": null,
                    "description": "Weights GGUF, relative to the models directory (e.g. 'unsloth/Qwen3.5-9B-GGUF/Qwen3.5-9B-UD-Q4_K_XL.gguf'). Required on create. Prefer lmgw__hf_add to obtain one: it fetches the projector and drafter along with the weights, which this route cannot discover. lmgw__gguf_files lists what is already on disk.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Local model row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "idle_seconds": {
                    "default": null,
                    "description": "Seconds idle before the model unloads and frees VRAM. 0 = never.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "image": {
                    "default": null,
                    "description": "Podman image override for this model's own container. Empty (or\nabsent) leaves it unset; `clear` is what reverts a previously set\noverride back to inheriting the class image.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jinja": {
                    "default": null,
                    "description": "Use the chat template embedded in the GGUF (--jinja). Required for any model with a custom template, and for tool calling.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "kv_unified": {
                    "default": null,
                    "description": "One shared KV pool across every slot instead of one pool per slot (--kv-unified true / --no-kv-unified false), so a single conversation can use the whole context instead of being capped to ctx_size / parallel. llama-server aborts every running request when a shared pool overflows, so lmgw refuses to save this as true with more than one effective slot unless n_predict is also set (it bounds the reservation the pool ledger guards the row with). Omit to leave llama-server's own default, which is unified exactly when parallel is also omitted.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "kv_unified_per_slot": {
                    "default": null,
                    "description": "Per-request context cap on a unified row, and — only when ctx_size is unset — how large the shared pool is sized (--kv-unified-per-slot, parallel x this). Meaningless on a split row (kv_unified effectively off), so it is refused there; must be positive.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "ladder": {
                    "default": null,
                    "description": "Turn this row into a ladder: rungs above the base, given as a JSON array string, e.g. '[{\"gguf_path\":\"top.gguf\",\"ctx_size\":65536}]' — each a GGUF and its own --ctx-size (gguf_path/ctx_size here stay the row's own, as rung 1). Every other field — template, sampling, projector, drafter, parallel, cache types — is shared by every rung. A request that outgrows the running rung makes the whole model climb to the smallest rung that fits, and it only comes back down when the container stops. Refused at save time unless: n_predict is set and positive (no rung can promise an answer fits without a max output ceiling); parallel is at least 1 with no effectively-unified KV cache (a shared pool has no per-slot guarantee); each rung's per-slot context (ctx_size / parallel) is strictly increasing, base included, exceeds n_predict (room for at least one prompt token) and stays at or below its own GGUF's trained context; every rung's GGUF shares the base's architecture and tokenizer, and — with a projector configured — its embedding width (the fit check counts identically whichever rung is running); spec_type draft-mtp needs either every rung's own GGUF to carry MTP layers or a drafter (draft_gguf_path); and, with a projector configured, its per-image token bound is known. Omitted or empty leaves the ladder unchanged, the same convention every optional field here follows; '[]' or clear: \"ladder\" is what turns the row back into a plain one.",
                    "items": {
                      "$ref": "#/components/schemas/Rung2"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "min_p": {
                    "default": null,
                    "description": "Minimum probability (--min-p).",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "mmproj_path": {
                    "default": null,
                    "description": "Multimodal vision/audio projector GGUF (--mmproj), relative to the models directory exactly like gguf_path. Required for a multimodal model to see images; without it the model loads text-only.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": null,
                    "description": "Client-facing model id; also selects the row when id is omitted.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "n_gpu_layers": {
                    "default": null,
                    "description": "Layers to offload to the GPU (--n-gpu-layers). 999 = all.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "n_predict": {
                    "default": null,
                    "description": "Maximum tokens one response may generate (--n-predict). This is what /v1/models reports as max_output_tokens; omit for llama-server's unbounded default rather than guessing a cap. -1 = unbounded.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "no_mmproj": {
                    "default": null,
                    "description": "Refuse to auto-load a projector sitting next to the weights (--no-mmproj). For the text-only twin of a multimodal repo.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "parallel": {
                    "default": null,
                    "description": "Concurrent request slots (--parallel). Splits the context.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "presence_penalty": {
                    "default": null,
                    "description": "Presence penalty (--presence-penalty).",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "public": {
                    "default": null,
                    "description": "Routable by model id without a manual alias.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "reasoning": {
                    "default": null,
                    "description": "Enable thinking (--reasoning).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reasoning_budget": {
                    "default": null,
                    "description": "Thinking token budget (--reasoning-budget). -1 = unrestricted.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_effort": {
                    "default": null,
                    "description": "Default thinking depth (--reasoning-effort) for a model whose chat template reads a 'reasoning_effort' variable (Qwen3.8, GPT-OSS, …); a request that sets reasoning_effort still overrides it. Usual levels are minimal, low, medium, high, xhigh, max, and 'none' for templates that use it to skip thinking — but llama-server passes the value to the template unchecked, so the accepted set belongs to that template. Omit to leave the template's own default.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reasoning_format": {
                    "default": null,
                    "description": "How thinking output is parsed back out of the response (--reasoning-format). 'deepseek' puts it in message.reasoning_content.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reasoning_preserve": {
                    "default": null,
                    "description": "Keep the thinking trace of EVERY assistant turn in the history rather than only the last one (--reasoning-preserve). Honoured only by templates advertising 'supports_preserve_reasoning'; omit to leave the template's own default in place.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "repeat_penalty": {
                    "default": null,
                    "description": "Repetition penalty (--repeat-penalty).",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "seed": {
                    "default": null,
                    "description": "RNG seed (--seed). -1 = random.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "spec_draft_n_max": {
                    "default": null,
                    "description": "Tokens to draft per step (--spec-draft-n-max).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "spec_draft_n_min": {
                    "default": null,
                    "description": "Minimum drafted tokens (--spec-draft-n-min).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "spec_draft_ngl": {
                    "default": null,
                    "description": "Drafter GPU layers (--spec-draft-ngl): a number, 'auto' or 'all'.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "spec_type": {
                    "default": null,
                    "description": "Speculative decoding strategy (--spec-type). It MUST match the drafter: an MTP-heads GGUF is 'draft-mtp', a 'dflash'-architecture one is 'draft-dflash'. lmgw__model_inspect reports the right value for a given file. 'draft-mtp' without draft_gguf_path requires MTP layers inside the weights themselves, or the model will not load.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "temp": {
                    "default": null,
                    "description": "Sampling temperature (--temp).",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "threads": {
                    "default": null,
                    "description": "CPU threads (--threads).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "top_k": {
                    "default": null,
                    "description": "Top-k sampling (--top-k).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "top_p": {
                    "default": null,
                    "description": "Nucleus sampling (--top-p).",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "ubatch_size": {
                    "default": null,
                    "description": "Physical batch size (--ubatch-size).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "warm_start": {
                    "default": null,
                    "description": "Start this model's own container at app launch, once the per-model\nruntime exists.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "title": "LocalModelPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a local chat model: `create`, `update` (also `enable` and\n`disable`), `delete` or `duplicate`.",
                  "properties": {
                    "advisories": {
                      "description": "`create`, `update`: saved and loadable, but misbehaving under some\ninput; kept apart from `warnings`, which are reasons it may not load.\nAbsent for `delete` and `duplicate`.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "container_kept_previous_config": {
                      "description": "`update`: whether a container is still up on the configuration before\nthis change (mid-request, or a stop that failed), so a test now would\nload that one. Absent for every other action.",
                      "type": "boolean"
                    },
                    "fallback_notes": {
                      "description": "What the save says about the fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create` and `duplicate`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read, with the next step.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "warnings": {
                      "description": "`create`, `update`: why the model may not load, from the checks of the\nsave (empty when none fired). Absent for `delete` and `duplicate`.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "LocalModelSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable, disable or duplicate a local chat model",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "local_model_set",
        "x-lmgw-tool": "lmgw__local_model_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/local_model_test": {
      "post": {
        "description": "Load a configured local model and prove it does its job: a chat model generates one token, an embedding model returns one vector (checked to be non-zero — an embedder misconfigured as a reranker answers with zeros), a reranker scores two documents, a decision model answers one System One choice question on /v1/systemone (its input tokens and answer come back), an image model draws one 256x256 four-step image and reports how many bytes came back. Works for chat, aux and image models alike; the probe is chosen by class and kind, so an encoder is never judged by token generation and a diffusion pipeline is never asked to chat. The image probe goes out on /v1/images/generations and never on /v1/images/edits — an edit sends a reference image, which a pipeline that cannot read one dies on rather than refusing. Starts the model's own container itself (through the same admission path a real request takes), so there is no separate 'apply first' step — reports the verbatim llama-server error and the relevant container log lines when it fails, plus a hint for the known failure modes. Loading a large model off disk can take minutes and occupies VRAM, which is why this counts as a mutating tool. For a chat model that loaded successfully, also compares the running build's /props chat_template_caps and modalities with what /v1/models derives statically for this row and lists disagreements — an empty list means the static derivation agrees with the running build; a null props means /props could not be read, which never fails the test. A chat row with a ladder tests every rung in turn instead of one: whatever is running is stopped first (refused, touching nothing, while it is still serving real requests), the base is loaded and probed, then each higher rung is climbed to and probed the same way, in order — a failure ends the run there, since nothing above a broken rung can be reached through it. The result's 'rungs' array reports each one: rung k/n, the GGUF, its context and per-slot context, how many seconds it took to become ready, and ok/error. Neither the opening nor the closing stop is forced, so a real request is never killed for this — but that means the closing stop can also be refused: an idle claim counts as 'still serving' too (a tool loop or an agent run sitting between turns), and reset_to_base: false then means the model is left up on the last rung this test reached, to be stopped by hand (or lmgw__container action=restart) rather than at the next request. Any real traffic already on the model when this runs waits out each rung's drain and reload along with it — several seconds per rung — and ends up moved to the same top rung, reprocessing its history on its next turn.",
        "operationId": "op_local_model_test",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "model_id": {
                    "description": "The local model id to load and test.",
                    "type": "string"
                  },
                  "target": {
                    "description": "The model's class. Omit to find it by id; needed only when two classes share the same id.",
                    "enum": [
                      "chat",
                      "aux",
                      "image"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "model_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/LadderTest",
                      "description": "A ladder row, every rung tested in turn."
                    },
                    {
                      "$ref": "#/components/schemas/ImageTestPassed",
                      "description": "An image pipeline that drew."
                    },
                    {
                      "$ref": "#/components/schemas/ModelTestFailed",
                      "description": "A chat, aux or image model that did not load or did not answer."
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/ChatTestPassed",
                          "description": "A chat model that loaded and answered. Boxed: its two capability\nobjects make it far the largest arm."
                        },
                        {
                          "properties": {
                            "class": {
                              "const": "chat"
                            }
                          }
                        }
                      ]
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/ModelTestPassed",
                          "description": "An aux model that loaded and answered."
                        },
                        {
                          "properties": {
                            "class": {
                              "const": "aux"
                            }
                          }
                        }
                      ]
                    }
                  ],
                  "description": "What the load test found. Which shape it is follows from the model:\na ladder row answers per rung, an image pipeline has its own probe, and\nevery other model answers a pass or a failure.",
                  "title": "ModelTest"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Load a configured local model and prove it does its job",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "local_model_test",
        "x-lmgw-tool": "lmgw__local_model_test",
        "x-lmgw-writes": true
      }
    },
    "/api/op/machine_check": {
      "post": {
        "description": "Whether this computer can run local models, item by item: the graphics card and its driver (the running kernel module against the driver libraries on disk, NVML read in a separate process), what lets models use the card (who owns /usr/bin/nvidia-ctk and whether lmgw could write its own CDI spec), the program that runs models (Podman), whether the model settings fit the card, free disk space and whether the engine images are downloaded. Each item has a plain sentence for the person, technical detail lines and a typed cause; the verdict is ready, needs_fix, needs_steps, needs_restart, needs_driver or cloud_only. When something can be done, the answer carries the plan: every step with the exact commands it runs as root, the full text of the files it writes, the same lines to type in a terminal, and how it is carried out (the app's button or instructions, and why). The fix itself runs only from lmgw's own app window on this computer, after the person confirms and types their password: explain the plan to them, but it cannot be run from here. When the model settings are for the other maker's card, the settings item carries an action instead: every field the switch to the settings for this card changes, as it is and as it would become, what it leaves, and the running models it stops; that switch needs no password and is the machine_settings_fit op (POST /api/op/machine_settings_fit, with confirm set to the listed changes), which is not a tool here. Without fresh this is the last result (the check runs at boot); fresh: true runs it now, joining a run already in progress that began after the call. It only reads, with the user's rights, and runs these programs: lmgw's own NVML probe (lmgw --machine-probe nvml, in a process of its own), rpm and rpmkeys queries, nvidia-ctk --version, one cache-only dnf repoquery for the toolkit's download sizes, and Podman's --version, --help, info and image exists for each engine image, and podman images; for an engine image that is not one of the engines' published images it reads its build label, or lists its ggml libraries in a throwaway container with no network and no device, to tell which card it is built for; for an engine image that is not downloaded yet it reads its registry manifest anonymously, for the download's size.",
        "operationId": "op_machine_check",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`machine_check`'s arguments.",
                "properties": {
                  "fresh": {
                    "default": false,
                    "description": "Run the check now instead of answering the last result.",
                    "type": "boolean"
                  }
                },
                "title": "MachineCheckArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The whole check.",
                  "properties": {
                    "checked_at": {
                      "description": "When it ran: UTC, `YYYY-MM-DD HH:MM:SS`.",
                      "type": "string"
                    },
                    "failed_start": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/MachineFailedStart"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The last start of a local model on the graphics card that failed\nbecause of this computer (the check named why), whoever asked for it:\na client, the Chat, a lab, the model's Test. `None` before one since\nlmgw started. A surface that was told \"Not now\" asks again once this\nis another failed start than the one it was told it beside\n(machine-check design D171, D182)."
                    },
                    "headline": {
                      "description": "The verdict in one plain sentence.",
                      "type": "string"
                    },
                    "items": {
                      "description": "The items, in the order they are checked: graphics card and driver,\nusing the card for models, running models, model settings, room, the\ndownload.",
                      "items": {
                        "$ref": "#/components/schemas/MachineItem"
                      },
                      "type": "array"
                    },
                    "plan": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/MachinePlan"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "What can be done about it, when anything is to be done or offered."
                    },
                    "verdict": {
                      "$ref": "#/components/schemas/MachineVerdict"
                    }
                  },
                  "required": [
                    "checked_at",
                    "verdict",
                    "headline",
                    "items",
                    "plan",
                    "failed_start"
                  ],
                  "title": "MachineCheck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Check whether this computer can run local models",
        "tags": [
          "ops-runtime"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "machine_check",
        "x-lmgw-tool": "lmgw__machine_check",
        "x-lmgw-writes": false
      }
    },
    "/api/op/machine_settings_fit": {
      "post": {
        "description": "Switches each model class's image and extra podman run arguments (and the audio class's backend) to the values lmgw ships for the card `fit` names: `amd_vulkan` (llama.cpp's, audio.cpp's and stable-diffusion.cpp's Vulkan images, `--device /dev/dri --group-add keep-groups --security-opt label=disable`) or `nvidia_cuda` (lmgw's defaults). Only a class set for the other card is switched; one on the processor, one naming another CDI device and one giving models the render nodes with an image that is not lmgw's for AMD cards are left as they are (`left` says why). Run arguments, a class's and a model's own alike, keep every argument but the other card's flags, which are swapped for this card's (none for a model on the processor); arguments that would add the user's groups beside a group of their own are left, since Podman refuses the two together. A model's own image that is one of the engines' published images for the other card becomes this card's; either is cleared when it then equals its class's, so the model follows its class again. An image lmgw can tell is built for the other card by its build label or its libraries, and one it cannot tell, stay, named in `left`. Without `confirm` nothing is written and the answer lists what would change and the running models it concerns, as the machine check's settings item does (its `action`). `confirm` is that list of `changes`, as it was shown: the switch is worked out again under the settings lock and written only when it is the same list, the classes through the Settings page's own save and the models' settings in its transaction, all or nothing; otherwise nothing is written and the answer's `outdated` says what differs, with the switch as it is now to confirm again. After the write each running model it concerns is stopped (never forced: one answering a request keeps running with the settings from before, and the answer and the machine check say so until it stops), and the answer carries the machine check run again. Refused when this computer has no card of that maker. No password: it is an ordinary settings write.",
        "operationId": "op_machine_settings_fit",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`machine_settings_fit`'s arguments.",
                "properties": {
                  "confirm": {
                    "default": null,
                    "description": "Write the switch: the `changes` of the offer being confirmed (the\nsettings item's action, or an answer without `confirm`), as they\nwere shown. The switch is worked out again from the settings as they\nare when it is written; it is written only when that gives this same\nlist, and otherwise nothing is written and the answer carries the\nlist as it is now (`outdated`). Without it nothing is written, and\nthe answer says what the switch would change.",
                    "items": {
                      "$ref": "#/components/schemas/SettingsFitChangeInput"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "fit": {
                    "$ref": "#/components/schemas/SettingsFit",
                    "description": "Which card's settings to switch to."
                  }
                },
                "required": [
                  "fit"
                ],
                "title": "MachineSettingsFitArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`machine_settings_fit`'s answer.",
                  "properties": {
                    "applied": {
                      "description": "Whether the settings were written, or the answer only says what the\nswitch would change.",
                      "type": "boolean"
                    },
                    "changes": {
                      "description": "Each field changed (or that would be), as it was and as it is. When\na confirmed list was outdated, the switch as it is now: confirm this\nlist to write it.",
                      "items": {
                        "$ref": "#/components/schemas/SettingsFitChange"
                      },
                      "type": "array"
                    },
                    "check": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/MachineCheck"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The machine check after the write; `None` when nothing was written."
                    },
                    "fit": {
                      "$ref": "#/components/schemas/SettingsFit"
                    },
                    "left": {
                      "description": "What was left as it is, and why.",
                      "items": {
                        "$ref": "#/components/schemas/SettingsFitLeft"
                      },
                      "type": "array"
                    },
                    "notes": {
                      "description": "The settings save's own notes.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "outdated": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/SettingsFitOutdated"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Set when `confirm` was not the switch as it is now, so nothing was\nwritten: what differs."
                    },
                    "running": {
                      "description": "The running models the switch concerns, and after a write what\nhappened to each.",
                      "items": {
                        "$ref": "#/components/schemas/SettingsFitRunning"
                      },
                      "type": "array"
                    },
                    "sentence": {
                      "description": "What was done, or would be, in plain sentences.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "fit",
                    "applied",
                    "sentence",
                    "changes",
                    "left",
                    "running",
                    "outdated",
                    "notes",
                    "check"
                  ],
                  "title": "MachineSettingsFit",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Switch the model settings to the ones for this computer's graphics card",
        "tags": [
          "ops-runtime"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "changes the image and run arguments of every model class set for the other card, and the models' own ones that follow them, then stops the running models whose settings changed",
        "x-lmgw-op": "machine_settings_fit",
        "x-lmgw-writes": true
      }
    },
    "/api/op/mcp_server_set": {
      "post": {
        "description": "Every action answers the server's id and a sentence. `test` connects to the server and also answers how many tools it lists (`tool_count`); a server that cannot be reached is an error answer instead.",
        "operationId": "op_mcp_server_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for a southbound MCP server. `extra_run_args` is a list of\nstrings; the other list-valued fields arrive as newline-delimited text\n(`args`), `KEY=VALUE` lines\n(`env`), or `Name: Value` lines (`headers`) — flat strings rather than\nnested JSON, so a small local model can fill them in.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do. 'test' connects once and reports the tool count.",
                    "type": "string"
                  },
                  "allow_sampling": {
                    "default": null,
                    "description": "Let this server ask lmgw for LLM completions (MCP sampling).",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "args": {
                    "default": null,
                    "description": "Command arguments, one per line.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "autostart": {
                    "default": null,
                    "description": "Connect at startup instead of on first use.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "command": {
                    "default": null,
                    "description": "Executable for stdio transport (bare, or inside the container).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "container_image": {
                    "default": null,
                    "description": "Podman image to run the stdio server isolated in. Recommended.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cwd": {
                    "default": null,
                    "description": "Working directory for a bare stdio subprocess.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Whether the server is aggregated at all.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "env": {
                    "default": null,
                    "description": "Environment for the server process, KEY=VALUE one per line.",
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "extra_run_args": {
                    "default": null,
                    "description": "Extra 'podman run' arguments, one per entry.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "headers": {
                    "default": null,
                    "description": "HTTP headers for http/sse, 'Name: Value' one per line.",
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "id": {
                    "default": null,
                    "description": "MCP server id. Required except on create.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "idle_seconds": {
                    "default": null,
                    "description": "Disconnect after this many idle seconds. 0 = stay connected.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "name": {
                    "default": null,
                    "description": "Display name.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sampling_alias": {
                    "default": null,
                    "description": "Model alias to answer this server's sampling requests with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "timeout_ms": {
                    "default": null,
                    "description": "Timeout in ms for each tool call and for the connect handshake. Not bounded by it: the pull of a container image before the handshake, and the whole start of a stdio server without a container image (an npx or uvx command may install its package first). Default 60000.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "tool_prefix": {
                    "default": null,
                    "description": "Namespace for this server's tools: prefix 'gh' exposes 'gh__search'. 'lmgw' is reserved.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "transport": {
                    "default": null,
                    "description": "How to reach the server. Required on create.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "url": {
                    "default": null,
                    "description": "Endpoint URL for http/sse transports. Moving it needs headers, as text, in the same call when the server holds any.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "McpServerPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a southbound MCP server, or its connection test:\n`POST /api/op/mcp_server_set` (and `lmgw__mcp_server_set`) for every\naction. A refusal, or a test that cannot connect, is an error answer\ninstead.",
                  "properties": {
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "tool_count": {
                      "description": "`test`: how many tools the server listed. Absent for every other\naction.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "McpServerSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable, disable or test a southbound MCP server",
        "tags": [
          "ops-tools"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "mcp_server_set",
        "x-lmgw-tool": "lmgw__mcp_server_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/model_find": {
      "post": {
        "description": "Finds a model by the name someone said ('qwen 3.6'), a Hugging Face address (a repo, a file, a download link, also inside pasted text) or owner/repo, and picks one model and one file of it that fits this computer's graphics card. Names are searched as typed, with no aliases: numbers are written as digits ('gemma 4', not 'gemma four'). It asks Hugging Face's model search twice (every repo, and GGUF repos, each the hub's first page by downloads); keeps the repos whose name has every query word; takes the originals, not uploads of them; ranks them by matched words, weights of their own, likes and downloads; and walks the top author's originals of the top one's kind to the first whose upload has a file that fits by its size (an upload by the maker first, gated ones last); when none fits, the card is the one closest to fitting (nothing_fits). It reads no file header, so the card's marks are by size ('fits_by_size'): lmgw__hf_repo with fit=true on the card's upload reads the header (1 to 16 MiB) and checks exactly. A search usually costs 3 to 8 Hugging Face requests: the two searches, two per model the walk reads (its uploads, a tree) plus one per gated or unanswered upload or further tree page, and the display name; lmgw sets no bound of its own, the hub's limit is the bound. hub_budget carries the hub's own RateLimit and RateLimit-Policy figures, near when fewer requests are left than this answer took; a limit used up before anything was found answers rate_limited with the seconds to the reset, and one used up partway keeps what was found, with a note. An address on another host, or a Hugging Face page that isn't a model's (not_a_model), is answered without asking anyone. A private repo's card has no share link. others, did_you_mean and the card's other_uploads are windows of 10 by default (each one's *_total and *_more say how many there are); the *_offset and *_count arguments ask for another window, which runs the same search again. next_cursor continues the search with the hub's next pages (answer 'more': the lists only).",
        "operationId": "op_model_find",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`model_find`'s arguments (§9.1).",
                "example": {
                  "query": "qwen 3.6"
                },
                "properties": {
                  "cursor": {
                    "default": null,
                    "description": "A previous answer's next_cursor: the search's next pages.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "did_you_mean_count": {
                    "default": 10,
                    "description": "How many entries of did_you_mean to answer with (default 10).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "did_you_mean_offset": {
                    "default": 0,
                    "description": "The first entry of did_you_mean to answer with (default 0).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "other_uploads_count": {
                    "default": 10,
                    "description": "How many entries of the card's other_uploads to answer with (default 10).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "other_uploads_offset": {
                    "default": 0,
                    "description": "The first entry of the card's other_uploads to answer with (default 0).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "others_count": {
                    "default": 10,
                    "description": "How many entries of others to answer with (default 10).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "others_offset": {
                    "default": 0,
                    "description": "The first entry of others to answer with (default 0).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "query": {
                    "default": "",
                    "description": "A model's name as people say it ('qwen 3.6'), a Hugging Face address, or owner/repo.",
                    "type": "string"
                  }
                },
                "title": "ModelFindArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`model_find`'s answer (§9.2).",
                  "properties": {
                    "answer": {
                      "$ref": "#/components/schemas/FindAnswer"
                    },
                    "card": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelCard"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "None: see `answer`."
                    },
                    "did_you_mean": {
                      "description": "Partial matches (D13), by matched words: the window asked for.",
                      "items": {
                        "$ref": "#/components/schemas/ModelChoice"
                      },
                      "type": "array"
                    },
                    "did_you_mean_more": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "did_you_mean_total": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "hub_budget": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/HubBudget"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_cursor": {
                      "description": "The search's next page, for `cursor`.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "notes": {
                      "description": "What the walk passed over and why, and what couldn't be read (the\nfold).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "others": {
                      "description": "The other originals found, by rank (D15): the window the arguments\nasked for (D142).",
                      "items": {
                        "$ref": "#/components/schemas/ModelChoice"
                      },
                      "type": "array"
                    },
                    "others_more": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "others_total": {
                      "description": "How many other originals the search found, and how many come after\n`others`.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "query": {
                      "type": "string"
                    },
                    "sentence": {
                      "description": "What the person reads for `answer`.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "query",
                    "card",
                    "others",
                    "others_total",
                    "others_more",
                    "did_you_mean",
                    "did_you_mean_total",
                    "did_you_mean_more",
                    "answer",
                    "sentence",
                    "next_cursor",
                    "hub_budget",
                    "notes"
                  ],
                  "title": "ModelFind",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Find a model on Hugging Face by its name, sized to this computer's card",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "model_find",
        "x-lmgw-tool": "lmgw__model_find",
        "x-lmgw-writes": false
      }
    },
    "/api/op/model_fit_again": {
      "post": {
        "description": "The model editor's \"Fit again\" (find-a-model design D26): the fit of the row's own parameters on the graphics card as it is now, searched up to the model's trained context, with the row itself left out of what is beside it. The measure is the one the row's fit note records, else beside what runs now. Without `confirm` nothing is written and the answer lists the `changes` a save makes: the context, and for an aux row an ubatch and a batch it ties to the context. `confirm` is that list as it was shown: the fit is taken again, and the list is saved when the context it sets still fits the card now and the row's parameters are still the ones it was made from; else nothing is written and `outdated` is true with the new changes. A save writes the row through its class's own update and renews the row's fit note (none when the whole trained context fits). Nothing is started. The note itself is on the row's read (`fit_note`).",
        "operationId": "op_model_fit_again",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "\"Fit again\"'s arguments (`model_fit_again`).",
                "properties": {
                  "confirm": {
                    "default": null,
                    "description": "Save the changes the answer without it listed, as they were shown.\nThe fit is taken again first; when it gives other changes nothing\nis written and the answer lists the new ones to confirm.",
                    "items": {
                      "$ref": "#/components/schemas/FitChangeInput"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "model_id": {
                    "default": "",
                    "description": "The row's id in its class (`model_id`, not the public name).",
                    "type": "string"
                  },
                  "target": {
                    "default": "",
                    "description": "`chat` or `aux`.",
                    "type": "string"
                  }
                },
                "title": "ModelFitAgainArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "\"Fit again\"'s answer.",
                  "properties": {
                    "changes": {
                      "description": "What a save changes; empty when the row is as the fit says.",
                      "items": {
                        "$ref": "#/components/schemas/FitChange"
                      },
                      "type": "array"
                    },
                    "fit": {
                      "$ref": "#/components/schemas/FileFit",
                      "description": "The fit of the row's own parameters on the card now, the row left\nout of what is beside it (D55)."
                    },
                    "measure": {
                      "$ref": "#/components/schemas/FitMeasure",
                      "description": "The measure fitted to: the note's, else beside what runs (D120)."
                    },
                    "model_id": {
                      "type": "string"
                    },
                    "note": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/FitNote"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The row's note as it is now (after a save, the new one); `None`\nwhen its context isn't a fit's shorter one."
                    },
                    "outdated": {
                      "description": "The confirmed changes weren't the fit's any more: nothing was\nwritten, and `changes` are the new ones.",
                      "type": "boolean"
                    },
                    "saved": {
                      "description": "The changes were written.",
                      "type": "boolean"
                    },
                    "sentence": {
                      "description": "What the person reads.",
                      "type": "string"
                    },
                    "target": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "model_id",
                    "target",
                    "measure",
                    "note",
                    "fit",
                    "changes",
                    "saved",
                    "outdated",
                    "sentence"
                  ],
                  "title": "ModelFitAgain",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Fit a chat or aux model's context to the graphics card again",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "changes the model's context, and an aux model's ubatch and batch tied to it",
        "x-lmgw-op": "model_fit_again",
        "x-lmgw-writes": true
      }
    },
    "/api/op/model_get": {
      "post": {
        "description": "Get a llama.cpp model from Hugging Face and set it up, sized to this machine's graphics card: the one call after choosing a file (lmgw__model_find, or lmgw__hf_repo with fit=true for the exact pick). It downloads the weights with the companions lmgw__hf_add would fetch (the one projector, and for chat the drafter; a file already downloaded isn't fetched again), then, in the background, plans the file on disk, fits it to the graphics card and creates the row: when the card fits a shorter conversation than the model's trained context, the row takes the largest that fits and keeps a note of the fit (an aux row is planned again at that context, its ubatch and batch with it). A row that already serves the file is the answer instead of a second one: then row_id is set, nothing is queued and there is no get. It never starts the model. The answer has the get_id (lmgw__model_get_status reads how it stands and, at the end, the row it made or why it stopped), the download ids for lmgw__hf_downloads, the model id and the name it will answer to, and the free-disk check (a warning, never a block). A second call for the same file joins the first. A failed get is started again by calling this again: it fetches only what isn't there yet. It survives a restart: the downloads go on from where they stopped and the setup follows.",
        "operationId": "op_model_get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "file": {
                    "description": "Exact path of the weights file in the repo; for a split GGUF its first part.",
                    "type": "string"
                  },
                  "measure": {
                    "description": "What the context is fitted to: 'beside' what runs on the card now (the default), or the 'whole_card' with nothing else on it.",
                    "enum": [
                      "beside",
                      "whole_card"
                    ],
                    "type": "string"
                  },
                  "model_id": {
                    "description": "The model's id. Absent: the repo's name in lower case without a trailing -GGUF. A name a row or an alias already holds on /v1 gets -2, -3 and so on; one an upstream passes through to its own models is refused, naming that upstream.",
                    "type": "string"
                  },
                  "repo": {
                    "description": "Repo id like 'unsloth/Qwen3.5-9B-GGUF' — owner/name only.",
                    "type": "string"
                  },
                  "target": {
                    "description": "The class to set it up in. Absent: the file's header decides (an embedder, a reranker or a decision model is aux, read from the header before the download, 1 to 16 MiB).",
                    "enum": [
                      "chat",
                      "aux"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "repo",
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`model_get`'s answer: what was queued and the job that sets it up.",
                  "properties": {
                    "companions": {
                      "description": "The projector (D121) and, for chat, the drafter.",
                      "items": {
                        "$ref": "#/components/schemas/HfCompanion"
                      },
                      "type": "array"
                    },
                    "disk": {
                      "$ref": "#/components/schemas/DiskRoom",
                      "description": "The free-disk check (D125)."
                    },
                    "downloads": {
                      "description": "Every file of the get with its download row, the weights' parts and\nthe companions alike; a file already on disk is listed with its row\nas `done` and isn't fetched again.",
                      "items": {
                        "$ref": "#/components/schemas/QueuedDownload"
                      },
                      "type": "array"
                    },
                    "engine": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/EngineDownload"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The image the class's models run in, when it isn't on this machine\n(machine check §5); `null` when it is here."
                    },
                    "file": {
                      "type": "string"
                    },
                    "get_id": {
                      "description": "The get (`model_get_status` reads it); `None` when a row already\nserves the file.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "job_id": {
                      "description": "The `model_get` job (kind `model_get`), on the jobs feed; `None`\nwhen a row already serves the file (`row_id`).",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "joined": {
                      "description": "A get of this file was already under way, and this answer is that\none's: nothing new was queued.",
                      "type": "boolean"
                    },
                    "measure": {
                      "$ref": "#/components/schemas/FitMeasure"
                    },
                    "message": {
                      "type": "string"
                    },
                    "model_id": {
                      "description": "The id the row will have (D28); the job may still suffix it when\nanother row takes the name before it is created, and\n`model_get_status` then says the one it got.",
                      "type": "string"
                    },
                    "public_name": {
                      "description": "The name it will answer to on `/v1` (D27): the chat class's public\nname, or the aux prefix's.",
                      "type": "string"
                    },
                    "repo": {
                      "type": "string"
                    },
                    "row_id": {
                      "description": "A row of the class that already serves the file (D87), by its id in\nits class's table: that row is the answer, nothing was queued and no\nget runs. `model_id` and `public_name` are its own.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "target": {
                      "description": "`chat` or `aux`.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "job_id",
                    "get_id",
                    "row_id",
                    "model_id",
                    "public_name",
                    "target",
                    "measure",
                    "repo",
                    "file",
                    "downloads",
                    "companions",
                    "engine",
                    "disk",
                    "joined",
                    "message"
                  ],
                  "title": "ModelGetStarted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a model from Hugging Face and set it up, sized to the graphics card",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "model_get",
        "x-lmgw-tool": "lmgw__model_get",
        "x-lmgw-writes": true
      }
    },
    "/api/op/model_get_status": {
      "post": {
        "description": "One get by the `get_id` `model_get` answered (find-a-model design §6.2): its state (running, done, failed, canceled), a running get's stage (downloading, paused, setting up, ready) with each file that waits and why (`waiting`: `metered`, `not_started`, or `other` with the download's note) and its bytes so far, every file's download row, why a failed get stopped and what to do, and a finished get's result: the row it created or found, its context, the fit that context comes from and the note the row keeps. Reads only.",
        "operationId": "op_model_get_status",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`model_get_status`'s arguments.",
                "properties": {
                  "get_id": {
                    "default": 0,
                    "description": "The get, as lmgw__model_get answered it.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "title": "ModelGetStatusArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`model_get_status`'s answer: one get as it stands now, read from its\nrow and its job.",
                  "properties": {
                    "done_bytes": {
                      "description": "The bytes of its files here so far, and their total when every\nsize is known (a running get's).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "downloads": {
                      "description": "Every file of the get with its download row as it is now.",
                      "items": {
                        "$ref": "#/components/schemas/QueuedDownload"
                      },
                      "type": "array"
                    },
                    "error": {
                      "description": "Why a failed get stopped, and what to do.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "file": {
                      "type": "string"
                    },
                    "get_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job_id": {
                      "description": "The job that runs or ran it.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "model_id": {
                      "description": "The id the row has, or will have: settled again when it is created\n(D28).",
                      "type": "string"
                    },
                    "public_name": {
                      "description": "The name it answers to on `/v1`.",
                      "type": "string"
                    },
                    "repo": {
                      "type": "string"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelGetDone"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "A finished get's result."
                    },
                    "row_id": {
                      "description": "The row it set up or found, in its class's table.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stage": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelGetStage"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Where a running get is; `None` once it ended, or before its job\nreported."
                    },
                    "state": {
                      "$ref": "#/components/schemas/ModelGetState"
                    },
                    "target": {
                      "description": "`chat` or `aux`.",
                      "type": "string"
                    },
                    "total_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "waiting": {
                      "description": "Each file that waits with nothing transferring it, and why (a\nrunning get's); empty when none waits.",
                      "items": {
                        "$ref": "#/components/schemas/GetWaiting"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "get_id",
                    "repo",
                    "file",
                    "target",
                    "model_id",
                    "public_name",
                    "state",
                    "stage",
                    "waiting",
                    "done_bytes",
                    "total_bytes",
                    "error",
                    "row_id",
                    "job_id",
                    "downloads",
                    "result"
                  ],
                  "title": "ModelGetStatus",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "How a Get it stands, and the model it set up",
        "tags": [
          "ops-downloads"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "model_get_status",
        "x-lmgw-tool": "lmgw__model_get_status",
        "x-lmgw-writes": false
      }
    },
    "/api/op/model_set": {
      "post": {
        "description": "Create, update, delete, enable or disable a model alias — the friendly name clients request, mapped onto an upstream and its real model id. Identify an existing alias by id or by its current alias name. This maps a name onto a REMOTE upstream; to configure a local llama.cpp GGUF use lmgw__local_model_set instead.",
        "operationId": "op_model_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for a model alias.",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "alias": {
                    "default": null,
                    "description": "The client-facing model name. On create this is the new alias; otherwise it selects the row (pass id as well to rename).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "capabilities_override": {
                    "default": null,
                    "description": "Capability facts set on the row, merged over what lmgw derives for /v1/models: a JSON object with optional keys capabilities (deep-merged; e.g. {\"input_modalities\":[\"text\",\"image\"],\"reasoning\":{\"kind\":\"levels\",\"levels\":[\"low\",\"high\"]}}), max_output_tokens, notes (appended). Use it only for facts the GGUF or the provider catalog does not state; the result is published with source \"owner\"."
                  },
                  "clear": {
                    "default": null,
                    "description": "Field names to reset to unset, comma-separated: 'capabilities_override', 'fallback'.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Whether the alias resolves.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "fallback": {
                    "default": null,
                    "description": "The model or alias that answers when this one cannot: the GPU hold, VRAM outside lmgw, background traffic deferred, an unavailable candidate, an exhausted upstream quota, an unreachable upstream, or a disabled row. A local model id, a passthrough id or a plain alias of the same model type (what this alias's upstream model is: a chat model for a chat model, an embedder for an embedder); not a candidate alias. Chains are allowed; a loop is refused. clear: 'fallback' removes it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Alias row id.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "upstream": {
                    "default": null,
                    "description": "Upstream to route to, by name or numeric id.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "upstream_model": {
                    "default": null,
                    "description": "The real model id at the upstream, e.g. gpt-4o-mini.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "AliasPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a routing row that names the row it wrote: `{\"ok\": true, \"id\": …,\n\"message\": …}`. `POST /api/op/upstream_set` and `model_set` answer it, for\nevery action.",
                  "properties": {
                    "fallback_notes": {
                      "description": "A plain alias's write (`model_set`): what the save says about its fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Something to warn about on a row that was saved all the same: an\n`openai` upstream on a host that is not OpenAI's (`UpstreamView::host_note`).\nOnly the dashboard's `upstream_set_full` sets it; left out otherwise.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "RowSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable or disable a model alias",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "model_set",
        "x-lmgw-tool": "lmgw__model_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/model_visibility": {
      "post": {
        "description": "Hide/unhide one or more models of an `expose_all` upstream's live catalog from /v1/models and the client-facing model list. The model itself is never configured here — it is whatever the upstream's catalog reports — so there is no `id`, only the (upstream_id, model_id) pair that names one entry of a live catalog.",
        "operationId": "op_model_visibility",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Hide/unhide one model of an `expose_all` upstream's live catalog from\n`/v1/models` and the client-facing model list. The model itself\nis never configured here — it is whatever the upstream's catalog reports —\nso there is no `id`, only the `(upstream_id, model_id)` pair that names one\nentry of a live catalog.",
                "properties": {
                  "action": {
                    "default": "",
                    "type": "string"
                  },
                  "model_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "model_ids": {
                    "default": null,
                    "description": "Several entries of the same catalog at once (\"hide the 17 shown\"):\none transaction and one snapshot reload instead of 17 of each.\nCombines with `model_id`.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "upstream_id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "ModelVisibilityPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/model_visibility`: models of an `expose_all` upstream's live\ncatalog were hidden from, or restored to, the client-facing model list.",
                  "properties": {
                    "count": {
                      "description": "How many distinct models the call named: `model_id` and `model_ids`\ntogether, trimmed, empty entries and repeats dropped.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, naming the model or how many, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message",
                    "count"
                  ],
                  "title": "ModelVisibilitySaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Hide or unhide models of an expose-all upstream's live catalog",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "model_visibility",
        "x-lmgw-writes": true
      }
    },
    "/api/op/price_delete": {
      "post": {
        "description": "404 not_found for an id no price row has.",
        "operationId": "op_price_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Price row id, from lmgw__prices.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that names the row it acted on and has nothing else to report:\n`{\"ok\": true, \"id\": …}`. `POST /api/op/price_delete` answers it, with the id\nit was given.",
                  "properties": {
                    "id": {
                      "description": "The row's id, as the call named it.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id"
                  ],
                  "title": "IdAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete one price row",
        "tags": [
          "ops-usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "price_delete",
        "x-lmgw-tool": "lmgw__price_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/price_set": {
      "post": {
        "description": "`unit` says what is counted: `per_mtok` (the default) takes `price_in`, `price_out` and the two cache rates, per 1M tokens; `per_audio_minute`, `per_mchar`, `per_image` and `per_request` take one `price`, per minute of input audio, per 1M input characters, per generated image and per answered request. A scope holds one row per unit, and a request costs the sum of every unit priced for it; a manual row wins over a catalog row of the same scope and unit. `service_tier` (default `standard`) is the OpenAI price tier the row is for: an OpenAI platform answer is priced with the rows of the tier it reported, and a tier with no row leaves it unpriced with a `price_note`, never priced at `standard`.",
        "operationId": "op_price_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "price_in": 3.5,
                  "price_out": 10.5,
                  "scope_key": "my-alias",
                  "scope_kind": "alias",
                  "unit": "per_mtok"
                },
                "properties": {
                  "note": {
                    "description": "Free-text note, e.g. where this number came from.",
                    "type": "string"
                  },
                  "price": {
                    "description": "Every unit but per_mtok: its one rate — per_audio_minute per minute of input audio, per_mchar per 1M characters of input text, per_image per generated image, per_request per answered request.",
                    "type": "number"
                  },
                  "price_cache_read": {
                    "description": "per_mtok only: cache-read price per 1M tokens. Omit to bill at price_in.",
                    "type": "number"
                  },
                  "price_cache_write": {
                    "description": "per_mtok only: cache-write price per 1M tokens. Omit to bill at price_in.",
                    "type": "number"
                  },
                  "price_in": {
                    "description": "per_mtok only: input price per 1M tokens.",
                    "type": "number"
                  },
                  "price_out": {
                    "description": "per_mtok only: output price per 1M tokens.",
                    "type": "number"
                  },
                  "scope_key": {
                    "description": "The alias name for scope_kind=alias, or '<upstream_id>:<upstream_model_id>' for scope_kind=upstream_model — /api/upstream-models lists existing scope_keys.",
                    "type": "string"
                  },
                  "scope_kind": {
                    "description": "What scope_key names. Default 'alias'.",
                    "enum": [
                      "alias",
                      "upstream_model"
                    ],
                    "type": "string"
                  },
                  "service_tier": {
                    "description": "The OpenAI service tier the price is for. Default standard, the one tier every other provider has. An OpenAI platform answer is priced with the rows of the tier it reported (default is standard, priority is fast); a tier with no row leaves it unpriced, never priced at standard. Part of the row's key: a flex row stands beside the standard one.",
                    "enum": [
                      "standard",
                      "flex",
                      "fast",
                      "ultrafast",
                      "scale"
                    ],
                    "type": "string"
                  },
                  "unit": {
                    "description": "What the price counts. Default per_mtok (tokens). A row's unit is part of its key: setting another unit adds a row beside the existing one rather than changing it.",
                    "enum": [
                      "per_mtok",
                      "per_audio_minute",
                      "per_mchar",
                      "per_image",
                      "per_request"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "scope_key"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to one price sheet: `POST /api/op/price_set`. It names the row the\ncall wrote, not the rates it carried.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "scope_key": {
                      "description": "The alias name, or `<upstream_id>:<upstream_model_id>`; trimmed.",
                      "type": "string"
                    },
                    "scope_kind": {
                      "description": "`alias` or `upstream_model`: what the row prices.",
                      "type": "string"
                    },
                    "service_tier": {
                      "description": "The row's OpenAI service tier (`standard` when the call named none).",
                      "type": "string"
                    },
                    "source": {
                      "description": "Always `manual`: the op writes no other source.",
                      "type": "string"
                    },
                    "unit": {
                      "description": "The row's billable unit (`per_mtok` when the call named none).",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "scope_kind",
                    "scope_key",
                    "unit",
                    "service_tier",
                    "source"
                  ],
                  "title": "PriceSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Set a manual price for one alias or upstream model, in one billable unit",
        "tags": [
          "ops-usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "price_set",
        "x-lmgw-tool": "lmgw__price_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/prices_sync": {
      "post": {
        "description": "Re-read every enabled upstream's model catalog and upsert its advertised prices (source=catalog) into the price table: the token rates (unit per_mtok, per 1M tokens, cache read and write included) and, beside a usable token row, a per-request fee (unit per_request). A model that advertises no price gets no row — never a zero, which would read as an authoritative price and be wrong downward. Never touches a manual row (lmgw__price_set), which always wins over a catalog row for the same scope and unit. A catalog per_request row whose fee the catalog no longer publishes is removed. Takes effect immediately, no restart. Reports, per upstream and in total: rows written, rows_removed (those fee rows), models with no advertised price, and not_synced — each advertised price field lmgw has no unit for (image, web_search, …) with how many models publish it, counted rather than silently dropped.",
        "operationId": "op_prices_sync",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "required": [],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Summary of one price sync run: `POST /api/op/prices_sync`.",
                  "properties": {
                    "not_synced": {
                      "additionalProperties": {
                        "format": "uint",
                        "minimum": 0,
                        "type": "integer"
                      },
                      "description": "The upstreams' `not_synced`, summed per field.",
                      "type": "object"
                    },
                    "rows_removed": {
                      "description": "The upstreams' `rows_removed`, summed.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "rows_written": {
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unpriced_models": {
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "upstreams": {
                      "items": {
                        "$ref": "#/components/schemas/UpstreamPriceSync"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "rows_written",
                    "rows_removed",
                    "unpriced_models",
                    "not_synced",
                    "upstreams"
                  ],
                  "title": "PriceSyncSummary",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Re-sync every enabled upstream's advertised catalog prices",
        "tags": [
          "ops-usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "prices_sync",
        "x-lmgw-tool": "lmgw__prices_sync",
        "x-lmgw-writes": true
      }
    },
    "/api/op/realtime_budget": {
      "post": {
        "description": "What the configured GET /v1/realtime cascade is expected to hold on the GPU, stage by stage — turn detection (CPU), the chat model, speech to text, the barge-in word check when it uses another model, text to speech — with their sum, the VRAM headroom, what lmgw may use (vram.budget_mb or the GPU's total) and what other programs hold now. Each figure is the one admission charges: a chat row's GGUF weights + KV cache + compute buffers, an audio row's learned residency or, before it has one, its on-disk size; a cloud stage holds nothing, and a stage with no figure is listed as unknown. An argument left out is the saved setting, so a draft can be sized before it is saved. Starts nothing.",
        "operationId": "op_realtime_budget",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`realtime_budget`'s arguments: the cascade to size. An argument left out\nis the saved setting, so the dashboard can size the choices in its draft\nbefore they are saved; `\"\"` is \"none\".",
                "properties": {
                  "asr_alias": {
                    "default": null,
                    "description": "`\"\"` falls back to the Chat's transcription model, as a session does.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "barge_in_check": {
                    "default": null,
                    "description": "`words` | `duration`; with `duration` there is no word check to size.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "barge_in_check_alias": {
                    "default": null,
                    "description": "`\"\"` = the ASR alias.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "default_model": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tts_alias": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "RealtimeBudgetArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`realtime_budget`'s answer.",
                  "properties": {
                    "capacity_bytes": {
                      "description": "What lmgw may plan against: `vram.budget_mb`, or the devices' real\ntotal. `None` when admission has nothing to measure against.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "capacity_source": {
                      "description": "Where the capacity comes from, or why there is none.",
                      "type": "string"
                    },
                    "headroom_bytes": {
                      "description": "`vram.headroom_mb`: what admission keeps free above a model's\nestimate when it starts one.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "needed_bytes": {
                      "description": "`total_bytes + headroom_bytes`: what the last of the cascade's models\nto start needs free.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "outside_bytes": {
                      "description": "GPU memory held now by programs lmgw cannot free (games, the\ndesktop), measured per process. `None` when it cannot be measured.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "outside_note": {
                      "description": "Why `outside_bytes` is missing, when it is.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stages": {
                      "description": "Turn detection, chat, ASR, the word check (when it uses another\nmodel), TTS — in that order.",
                      "items": {
                        "$ref": "#/components/schemas/RealtimeBudgetStage"
                      },
                      "type": "array"
                    },
                    "summary": {
                      "description": "The verdict in a sentence.",
                      "type": "string"
                    },
                    "total_bytes": {
                      "description": "The known figures summed, each local model once.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unknown": {
                      "description": "The stages whose figure is unknown; while any is listed the total is\na lower bound.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "verdict": {
                      "description": "`fits` | `tight` (fits what lmgw may use, not beside what other\nprograms hold now) | `too_large` | `unknown`.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "stages",
                    "total_bytes",
                    "unknown",
                    "headroom_bytes",
                    "needed_bytes",
                    "capacity_bytes",
                    "capacity_source",
                    "outside_bytes",
                    "outside_note",
                    "verdict",
                    "summary"
                  ],
                  "title": "RealtimeBudget",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Size the realtime voice cascade against the GPU",
        "tags": [
          "ops-settings"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "realtime_budget",
        "x-lmgw-writes": false
      }
    },
    "/api/op/response_chain_delete": {
      "post": {
        "description": "Delete every stored response sharing one chain_id.",
        "operationId": "op_response_chain_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "chain_id": {
                    "description": "The stored-response chain to delete, from /api/responses.",
                    "type": "string"
                  }
                },
                "required": [
                  "chain_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete every stored response of one conversation chain",
        "tags": [
          "ops-responses"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "response_chain_delete",
        "x-lmgw-writes": true
      }
    },
    "/api/op/responses_gc": {
      "post": {
        "description": "Evict stored responses now: 'rules' (default) applies the retention settings (responses_retention_hours, responses_max_chains); 'all' clears every stored response regardless of age.",
        "operationId": "op_responses_gc",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "scope": "rules"
                },
                "properties": {
                  "scope": {
                    "description": "'rules' (default) evicts by the retention settings; 'all' clears every stored response.",
                    "enum": [
                      "rules",
                      "all"
                    ],
                    "type": "string"
                  }
                },
                "required": [],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Evict stored responses by the retention settings, or clear all of them",
        "tags": [
          "ops-responses"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "responses_gc",
        "x-lmgw-writes": true
      }
    },
    "/api/op/settings_set": {
      "post": {
        "description": "Change gateway settings. Pass only the fields to change. Never settable here, by any caller: the settings that decide who may reach lmgw and with what credential — auth_enabled, self_admin, bind_addr, agent_origin_suffix and devices (the device listener and how long a pairing token and a device's certificate live). They change on Settings in the dashboard; a call that names one is refused, naming it, and changes nothing. Also left to the dashboard: the HF/update/forge tokens and the builds directory.",
        "operationId": "op_settings_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for gateway settings.\n\nDeliberately narrow. Three groups of settings are **not** reachable here,\nand each omission is a decision rather than an oversight:\n\n- `self_admin` — the gate on this whole surface. An agent that can widen its\n  own permissions is ungated; change it in the dashboard. It is one of the\n  access settings `lmgw__settings_set` refuses by name for every caller\n  (`selfadmin::ACCESS_SETTINGS`, 2026-10-07), with `auth_enabled`, which\n  only this patch's dashboard op (`/api/op/settings_set`) still takes.\n- `bind_addr` — takes effect only on restart, and a wrong value strands the\n  gateway on an address nothing is talking to.\n- `hf_token` / `update_token` / `forge_tokens` — secrets. They are redacted\n  on read, and writing them through a tool call would put them in the\n  request log.\n\nContainer settings (images, ports, model directories) likewise stay on the\ndashboard; `lmgw__container` drives their lifecycle, not their definition.\nSo does `builds_dir`, for the reason a models dir does: it is where lmgw\nwrites gigabytes and removes directories, and pointing it somewhere is a\ndecision for the dashboard, not for a tool.",
                "properties": {
                  "audio_catalog_revision": {
                    "default": null,
                    "description": "What an audio catalog download (lmgw__audio_catalog action=download) takes when the audio.cpp spec pins a package to a commit: 'pinned' (default) fetches every file of the package at that commit, the one the spec was tested with; 'latest' always takes main. A package the spec does not pin takes main either way. lmgw__hf_set check_updates and redownload follow the same rule for catalog files, at the pin the spec names now. A pin that cannot be fetched fails the download — lmgw never falls back to main on its own. Read back as audio.catalog_revision in lmgw__settings.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "auth_enabled": {
                    "default": null,
                    "description": "Require a gateway API key on /v1/* and /mcp. Taken by this op only:\nthe lmgw__settings_set tool refuses it, as it refuses every setting\nthat decides who may reach lmgw.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "build_update_check_hours": {
                    "default": null,
                    "description": "How often lmgw checks whether a container build's branch or PRs have moved since its last verified run, in hours: 0 to 8760 (a year). 0 turns the periodic check off (a check on demand still works). Default 6.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_archive_days": {
                    "default": null,
                    "description": "Archive a Chat thread this many days after its last activity (a new message or a settings change; pinning does not count). 0 disables auto-archive. Archiving is reversible: a pin, a restore, or sending into the thread brings it back.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_keepalive_max_s": {
                    "default": null,
                    "description": "The longest keep-alive, in seconds, a feed may ask for itself (GET /chat/api/feed?keepalive_s=, as a phone holding its feed in the background does), at least 1 and at most 32767 (about nine hours, the longest Linux accepts for a TCP keep-alive timer). A request past it is refused naming this setting. Between events a feed sends only its keep-alive, so this bounds how long a feed whose device vanished silently stays open. Applies to feeds opened after the change.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_keepalive_s": {
                    "default": null,
                    "description": "Seconds between the Chat feed's keep-alive comments, at least 1 and at most chat_feed_keepalive_max_s; said in the feed's hello as keepalive_s. A feed that asks for its own keeps that instead, and an open feed keeps the interval it opened with.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_live_buffer": {
                    "default": null,
                    "description": "Live Chat feed events (turn.*, voice.*, hold) held for a client that reads slower than they happen, at least 1 and at most 65536 (the buffer is allocated whole). One that falls further behind gets a fresh state frame naming this setting.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_page_size": {
                    "default": null,
                    "description": "Records the Chat feed reads per query while a client catches up, at least 1 and at most 10000. Bounds memory, not delivery: every record is sent.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_retention_days": {
                    "default": null,
                    "description": "Keep the Chat change feed's records (GET /chat/api/feed) this many days. 0 keeps every record. A client away longer resumes with a resync that names this setting.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_kb_budget_tokens": {
                    "default": null,
                    "description": "Tokens of knowledge-base excerpts one Chat turn may carry; a thread can override it. Must be above 0 (default 4000).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_media_defaults": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MediaDefaults"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "The image and audio tools' default models, as a JSON-encoded object with only the fields to change: generate, edit, speak, transcribe (each a name of that tool's model enum, as tools/list shows it) and voice (a voice of the default speech model). '' clears a field: no default, the calling model must pick. With a default, a call may leave out model (and voice) and the tool's description names the default. A Chat folder and a thread can override each field; /mcp, /v1/responses and agent runs use these. A default whose model is switched off or deleted later is no default (not replaced), and lmgw__settings reads it back as stored."
                  },
                  "chat_pdf_mode": {
                    "default": null,
                    "description": "How a text PDF attached in Chat starts out: 'text' (the extracted text, default), 'images' (every page as an image; needs a vision model) or 'ask' (the chip starts unset and Send waits for a choice).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_profile": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ProfileChoice"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The personality profile a new Chat thread starts with: a profile id (lmgw__settings chat_profile says the one now; the Chat's GET /chat/api/profiles lists them), or '' for none (\"Default\", the default). A thread in a folder whose defaults name a profile takes that one instead; existing threads are not changed. An unknown id is refused. Deleting the profile empties this setting."
                  },
                  "chat_purge_days": {
                    "default": null,
                    "description": "Delete an archived, unpinned Chat thread this many days after it was archived. 0 keeps archived threads forever. The clock is when it was archived, not when it was last active, so a thread archived by hand gets the full period too.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_read_aloud": {
                    "default": null,
                    "description": "Read Chat replies aloud as they stream (default false): the page that sends a turn (send, edit, regenerate, continue) asks for its speech, which starts at the first clause while the text still streams. Tables and fenced code are not read; each is announced ('Code block, rust.', 'Table.'). A thread can override it; voice mode speaks on its own and ignores it.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "chat_speech_style": {
                    "default": null,
                    "description": "The speech instructions the Chat's text-to-speech model gets (a speaking style, or a voice description for a voice-design model). '' = realtime.speech_instructions. Global like that setting, it stands back for a voice-design row that describes its own voice. A thread can override it, '' included (no style for that thread), and a thread's own style wins over the row's description.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_stt_alias": {
                    "default": null,
                    "description": "The Chat's speech-to-text alias: dictation, voice mode (a realtime session bound to the thread), and the transcript of an audio attachment when the thread's model takes no audio itself. Must be a model whose capability task is 'asr'. '' = realtime.asr_alias; realtime falls back the other way (a /v1/realtime session uses this alias while realtime.asr_alias is empty), so either one serves both. A thread's own override wins over both. With none of the three set the thread cannot transcribe: dictation and voice mode are refused (asr_not_configured), and an audio attachment its model cannot hear blocks Send. The audio goes where the alias routes, its GPU-hold fallback included; the model that answered is named.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_system_prompt": {
                    "default": null,
                    "description": "The system prompt a new Chat thread starts with; each thread keeps its own copy, so existing threads are not changed. {{model}} and {{date}} in a thread's prompt become its model alias and today's date when a message is sent. Passing the built-in text (see lmgw__settings chat_system_prompt while chat_system_prompt_is_builtin is true) returns to the built-in default; '' starts new threads with no system prompt.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_tts_alias": {
                    "default": null,
                    "description": "The Chat's text-to-speech alias, for read-aloud and voice mode. Must be a model whose capability task is 'tts' or 'vdes'. '' = realtime.tts_alias (realtime never falls back to this one). A thread can override it. It loads on first use (a speaker press, a turn read aloud, entering voice mode), never when a chat opens.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_turn_detection": {
                    "default": null,
                    "description": "How voice mode in the Chat detects the end of a turn: 'semantic_vad' (Silero VAD plus Smart Turn, default), 'server_vad' (silence only) or 'push_to_talk' (hold Space or the Talk button). It is the mode the panel starts in; the panel's Auto / Push to talk switch changes it for that session only (a thread at push_to_talk switched to Auto uses semantic_vad). A thread can override it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice": {
                    "default": null,
                    "description": "The Chat's voice, a voice of its text-to-speech model (chat_tts_alias, else realtime.tts_alias). '' = none named: realtime's voice chain decides (realtime.default_voice, then the TTS row's default preset). Not checked on save: a name the model does not know fails the speech with voice_not_found. A thread can override it; a thread that speaks with another model than the Chat's does not take it. Each thread also keeps its own TTS seed, so a model that designs or draws its voice keeps one voice per thread.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_audio_input": {
                    "default": null,
                    "description": "Whether a voice-mode turn goes to the chat model as audio: 'off' (default: the model reads the speech-to-text transcript) or 'on' (experimental). Under 'on' a turn goes as audio when the model that answers it — the thread's model, or the fallback a GPU hold, a benchmark run, an outside-VRAM verdict or a candidate alias's walk hands it to — is a chat model whose input_modalities include audio and lmgw can send it audio (OpenAI-compatible, llama.cpp and Gemini upstreams; not Anthropic), without a context guard (a ladder or a guarded shared KV pool), and the thread's knowledge bases are not in auto mode; otherwise it goes as the transcript, and the thread's voice_resolved.audio_input says why. A model whose capabilities lmgw cannot read counts as not taking audio: to make it hear, give its alias (or local row) a capabilities override with task chat and input_modalities text and audio — a passthrough model needs an alias for that. A configured fallback is always used, wherever it runs, and hears the turn when it takes audio. The speech-to-text model still transcribes every turn — with either value, so a cloud speech-to-text model still receives each turn's audio: the transcript is what is stored (no audio is), and the reply is held until it is in. Dictation stays on speech-to-text. A thread can override it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_language": {
                    "default": null,
                    "description": "The language the user speaks in the Chat, an ISO 639-1 code such as 'de' or 'en' (case folded; anything else is refused): the speech-to-text model is told it where it takes a language, and the prompt says the user speaks it. Replies are in chat_voice_reply_language, which falls back to this one. '' = none: the ASR detects, and without a reply language the reply follows the user's language; it does not fall back to a realtime setting. A thread can override it (voice.language).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_reply_language": {
                    "default": null,
                    "description": "The language Chat replies are in, an ISO 639-1 code such as 'en' (case folded; anything else is refused): the model is asked to answer in it, and the text-to-speech model speaks it where it takes a language (a thread's voice_resolved.language_notes say where a model does not). '' = the language the user speaks (chat_voice_language), so one language set there drives both. Set both to speak one language and hear replies in another. It also picks the words read-aloud and voice mode announce a skipped code block or table with (en, de, fr, es, it; English otherwise). A thread can override it (voice.reply_language).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "devices": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/DevicesSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Settings → Network & access → Devices: the device link's bounds (a\npairing token's lifetime, the certificates' validity, the\nconnection timeouts, the failed-enrolment rate), each refused by\nname outside its range. Taken by this op only: like `bind_addr`, an\naccess setting the lmgw__settings_set tool refuses."
                  },
                  "fallback_on_external": {
                    "default": null,
                    "description": "Fall back when VRAM outside lmgw's control is short (vram.fallback_on_external): when a local model does not fit because games, browsers or other apps hold GPU memory lmgw cannot free, its configured fallback answers at once instead of queueing. Contention between lmgw's own models still queues. On by default; turn off on shared-memory systems (APUs), where GPU memory is host RAM that grows and shrinks with everything else running.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "max_body_mb": {
                    "default": null,
                    "description": "Largest request body accepted on the JSON /v1 routes, in MiB. 0 = unlimited. Raise it when clients inline large base64 images or documents; over it they get a 413 with code 'body_limit'. Applies to the next request, no restart. /v1/audio/* and /v1/tasks/* are unbounded regardless.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "quota_recheck_seconds": {
                    "default": null,
                    "description": "Seconds before an upstream remembered out of quota is asked again, when its answer carried no Retry-After (at least 1). Until then a model with a fallback on it answers with the fallback.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "realtime": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/RealtimeSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "GET /v1/realtime's settings, as a JSON-encoded object with only the fields to change, named as lmgw__settings reports them under 'realtime' (its two default_instructions_* read-outs are not settable; lists and maps are replaced whole). The cascade: default_model (a chat alias), asr_alias (task asr; '' = the Chat's transcription model), tts_alias (task tts or vdes), default_voice, model_map and voice_map ({client name: alias or voice}). Speech: speech_instructions (the TTS's style, or a voice-design row's description, while a session sends none; '' = none), tag_hint (an audio response's prompt says what square brackets do: the sounds the TTS makes, or delivery cues such as [laughing] for a style or passthrough TTS that renders no tags, e.g. Qwen3 CustomVoice; a cloud TTS only when its alias declares capabilities.speech.instructions 'style'). default_instructions: the built-in text (default_instructions_builtin) returns to the built-in prompt, '' turns it off. Turn detection: threshold, prefix_padding_ms, silence_duration_ms, semantic_vad_engine ('smart_turn' | 'server_vad'), semantic_vad ({high|medium|low: {threshold, floor, max_wait_ms, silence_duration_ms}}, a row or field left out keeps its value), semantic_floor_window_ms. Barge-in: barge_in_min_ms, barge_in_guard_ms, post_interrupt_silence_ms, half_duplex, echo_tail_ms, barge_in_check ('words' | 'duration'), backchannel_words, barge_in_check_scripts, barge_in_check_timeout_ms, barge_in_check_alias (task asr; '' = the session's own). Output: output_lead_ms, synthesis_ahead_s, longest_pause_ms (0 = keep the engine's silences), warm_on_connect. Limits: max_message_mb, max_frame_mb (not both 0), ping_interval_s. WebRTC calls, both applied at the next start: webrtc_enabled, webrtc_port (null = the HTTP port's number, 0 = chosen by the OS); their audio, applied to the next call: webrtc_reorder_ms (0 = no wait, at most 40950), webrtc_commit_window_ms, webrtc_output_kbps (6 to 510). Refused, naming the field: an alias of the wrong task, a semantic_vad row that cannot run, an unknown script, a value out of its range. Example: '{\"tts_alias\": \"audio/pocket-tts\", \"warm_on_connect\": true}'."
                  },
                  "retention_days": {
                    "default": null,
                    "description": "Days of request logs to keep. 0 = forever.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "retention_max_rows": {
                    "default": null,
                    "description": "Hard row cap on the request log. 0 = unlimited.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "sampling_alias": {
                    "default": null,
                    "description": "Default model alias answering MCP sampling requests.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "update_check_enabled": {
                    "default": null,
                    "description": "Poll the package registry for new lmgw releases.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "title": "SettingsPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to the gateway's settings through the tool plane's patch:\n`POST /api/op/settings_set` (and `lmgw__settings_set`). A patch that names\nno setting, or one the checks refuse, is an error answer instead.",
                  "properties": {
                    "changed": {
                      "description": "The settings the call wrote, in the order the op applies them, by the\npatch's field names (`retention_days`, `jobs_retention_days`, …); a\nsection's field is named under it (`realtime.asr_alias`).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "What was done, for a person to read; it says so when the rest of the\nconfiguration could not be reloaded after the save.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "changed",
                    "message"
                  ],
                  "title": "SettingsSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change gateway settings",
        "tags": [
          "ops-settings"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "settings_set",
        "x-lmgw-tool": "lmgw__settings_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/settings_set_full": {
      "post": {
        "description": "Sparse patch over the whole Settings struct — the dashboard's Settings page save, including the self-admin mode, the bind address, the HF/update/forge tokens, the builds directory and the four container classes' definitions, none of which the self-admin tool plane exposes. Secrets: a non-empty value replaces, an empty one keeps the stored value, and the matching clear_* flag erases it. A change of self_admin applies to every paired device at once, since it caps each device's own level: a device whose admin tools may now do more or less gets a state event on its change feed saying so, its realtime sessions that carry the lmgw label list it again, and a turn still running is refused its next write tool when the level was lowered. Set to off, every device stops seeing the Chat threads and folders that carry the self-admin toolset: its change feed receives them as deleted, its turns on them stop, and its realtime sessions bound to one close with 4004; raised from off, a device whose own level is above off receives them as created.",
        "operationId": "op_settings_set_full",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch over the whole Settings struct. Secrets: a non-empty value\nreplaces, empty keeps, the matching `clear_*` flag erases.",
                "properties": {
                  "agent_origin_suffix": {
                    "default": null,
                    "description": "The DNS suffix a service agent's UI is served under:\n`http://<id>.<agent_origin_suffix>:<bind port>/`. Refused when it would\nshadow a name the gateway itself answers on, and a **change** stops\nevery running app container.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "agent_script_image": {
                    "default": null,
                    "description": "The stock image a manifest's `script` step runs in. Empty restores the shipped default rather than leaving a script\nstep with no image to run in.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "audio": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/AudioSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "auth_enabled": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "aux_router": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/AuxRouterSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bind_addr": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "build_update_check_hours": {
                    "default": null,
                    "description": "Build update check interval in hours; `0` = off, at most 8760.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "builds_dir": {
                    "default": null,
                    "description": "Where container builds keep their files. `\"\"`\nclears it back to the default; otherwise an absolute path.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_archive_days": {
                    "default": null,
                    "description": "Archive an idle Chat thread this many days after its last activity.\n`0` disables auto-archive. A folder's own `archive_days` overrides it\nfor the threads in that folder, and an ongoing conversation's current\nthread is never archived.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_keepalive_max_s": {
                    "default": null,
                    "description": "The longest keep-alive a feed may ask for itself\n(`GET /chat/api/feed?keepalive_s=`), from 1 to 32767 seconds (the longest Linux accepts for a TCP\nkeep-alive timer).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_keepalive_s": {
                    "default": null,
                    "description": "Seconds between the Chat feed's keep-alive comments, from 1 to\n`chat_feed_keepalive_max_s`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_live_buffer": {
                    "default": null,
                    "description": "Live events the Chat feed holds for a slow client before it sends it\na fresh `state` instead, from 1 to 65536.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_page_size": {
                    "default": null,
                    "description": "Records the Chat feed reads per query while a client catches up,\nfrom 1 to 10000.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_feed_retention_days": {
                    "default": null,
                    "description": "Keep the Chat change feed's records this many days; `0` keeps every\nrecord. A client away longer resumes with a `resync`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_kb_budget_tokens": {
                    "default": null,
                    "description": "Tokens of knowledge-base excerpts one Chat turn may carry; above 0.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_media_defaults": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MediaDefaults"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "The image and audio tools' default models: only the fields given\nchange, `\"\"` clears one. Each name must be one of its tool's\n`model` choices (`GET /chat/api/media/defaults`)."
                  },
                  "chat_pdf_mode": {
                    "default": null,
                    "description": "How a text PDF attached in Chat starts out: `text` | `images` | `ask`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_profile": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ProfileChoice"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The personality profile new Chat threads start with: a profile id,\nor `\"\"` for none. An unknown id is refused."
                  },
                  "chat_purge_days": {
                    "default": null,
                    "description": "Delete an archived, unpinned Chat thread this many days after it was\narchived. `0` keeps archived threads forever. A folder's own\n`purge_days` overrides it for the threads in that folder.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "chat_read_aloud": {
                    "default": null,
                    "description": "Read every Chat reply aloud as it streams; a thread can override it.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "chat_speech_style": {
                    "default": null,
                    "description": "What the Chat's voice is told (a speaking style, or a voice-design\ndescription); `\"\"` = `realtime.speech_instructions`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_stt_alias": {
                    "default": null,
                    "description": "The Chat's speech-to-text alias; `\"\"` = `realtime.asr_alias`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_system_prompt": {
                    "default": null,
                    "description": "The system prompt new Chat threads start with. The built-in text\nreturns to the built-in default (and follows it from then on); `\"\"`\nstarts new threads with no system prompt.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_tts_alias": {
                    "default": null,
                    "description": "The Chat's text-to-speech alias (task `tts` or `vdes`); `\"\"` =\n`realtime.tts_alias`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_turn_detection": {
                    "default": null,
                    "description": "How voice mode detects the end of a turn: `semantic_vad` |\n`server_vad` | `push_to_talk`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice": {
                    "default": null,
                    "description": "The Chat's voice, a voice of the Chat's text-to-speech model; `\"\"` =\nnone named, so realtime's chain decides (`realtime.default_voice`,\nthen the model's default).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_audio_input": {
                    "default": null,
                    "description": "`off` | `on`: whether a voice turn goes to the chat model as audio\nwhen the model that answers it takes audio input, wherever it runs\n(experimental); a thread can override it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_language": {
                    "default": null,
                    "description": "The language the user speaks, an ISO 639-1 code the speech-to-text\nmodel is told; `\"\"` = none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chat_voice_reply_language": {
                    "default": null,
                    "description": "The language replies are in, an ISO 639-1 code: the model answers in\nit and the text-to-speech model speaks it; `\"\"` = the spoken one.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clear_forge_tokens": {
                    "default": null,
                    "description": "Hosts whose forge token to erase.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "clear_hf_token": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "clear_update_token": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "container_prefix": {
                    "default": null,
                    "description": "Podman container name prefix for the per-model container runtime.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "currency": {
                    "default": null,
                    "description": "The label every amount on the Usage page is shown under. One currency,\nno conversion.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "devices": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/DevicesSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The device link's bounds (Settings → Network & access → Devices) —\nthe same patch the `settings_set` op takes, with the same checks."
                  },
                  "docs_embed_batch": {
                    "default": null,
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "docs_fetch_delay_ms": {
                    "default": null,
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "docs_ingest_reply_tokens": {
                    "default": null,
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "docs_rerank_model": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "docs_search": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/DocsSearchPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "forge_tokens": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "default": null,
                    "description": "Forge tokens to set, by host. Secrets like\n`hf_token`: a non-empty value replaces that host's token, an empty one\nkeeps it, and a host not named is untouched.",
                    "type": [
                      "object",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "global_budget_micro": {
                    "default": null,
                    "description": "Spend ceiling across every key, in currency micro-units. `0` = none.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "global_budget_period": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "hf_token": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "image": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ImageSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "jobs_max_rows": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "jobs_retention_days": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "local_reference_alias": {
                    "default": null,
                    "description": "Alias whose price answers the local/cloud counterfactual.\n`\"\"` clears it back to \"no reference configured\".",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "max_body_mb": {
                    "default": null,
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "mcp": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/McpSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The device MCP host link's limits (Settings → MCP)."
                  },
                  "quota_recheck_seconds": {
                    "default": null,
                    "description": "Seconds before an upstream remembered out of quota is asked again,\nwhen its answer carried no `Retry-After`; at least 1.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "realtime": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/RealtimeSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "`GET /v1/realtime`'s settings — the same patch\n`settings_set` takes, with the same checks."
                  },
                  "responses_max_chains": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "responses_max_tool_calls": {
                    "default": null,
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "responses_retention_hours": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "responses_store": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "responses_timeout_seconds": {
                    "default": null,
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "retention_days": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "retention_max_rows": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "router": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/RouterSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sampling_alias": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "self_admin": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "update_check_enabled": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "update_token": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "usage_retention_months": {
                    "default": null,
                    "description": "Keep hourly usage rollups this many months. `0` = forever.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "vram": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/VramSettingsPatch"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "title": "SettingsFullPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change gateway settings, including the fields the self-admin tool excludes",
        "tags": [
          "ops-settings"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "settings_set_full",
        "x-lmgw-writes": true
      }
    },
    "/api/op/tool_set": {
      "post": {
        "description": "Flip a tool's per-tool switch. Disabling requires the tool to be offered right now — a typo would otherwise persist a switch for a name that does not exist. Enabling never checks, which is how a stale row is cleared.",
        "operationId": "op_tool_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "enabled": false,
                  "name": "gh__search"
                },
                "properties": {
                  "enabled": {
                    "description": "Whether the tool is offered to callers.",
                    "type": "boolean"
                  },
                  "name": {
                    "description": "The fully-qualified tool name (e.g. 'gh__search'), as `/api/tools` lists it.",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "enabled"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Enable or disable one discovered tool",
        "tags": [
          "ops-tools"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "tool_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/update_check": {
      "post": {
        "description": "Poll the package registry now for a newer lmgw release than the one running, regardless of the periodic update-check setting.",
        "operationId": "op_update_check",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write that reports what it did in a sentence: `{\"ok\": true, \"message\": …}`.",
                  "properties": {
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "MessageAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Check whether a newer lmgw release is available",
        "tags": [
          "ops-settings"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "update_check",
        "x-lmgw-writes": false
      }
    },
    "/api/op/upstream_quota_clear": {
      "post": {
        "description": "lmgw remembers an upstream that answered `insufficient_quota` (`quota` on `/api/upstreams`): until its next check, models and aliases on it that have a fallback answer with the fallback (openai egress design §14.6). This forgets it, so the next request goes to the upstream again: the Upstreams page's Check now.",
        "operationId": "op_upstream_quota_clear",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`writer` is who asks: a self-admin tool's move of a keyed row to another\naddress must restate the key (`RowWriter`).\n`upstream_quota_clear { id }`.",
                "properties": {
                  "id": {
                    "description": "Upstream id, from lmgw__upstreams.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "title": "UpstreamQuotaClear",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a routing row that names the row it wrote: `{\"ok\": true, \"id\": …,\n\"message\": …}`. `POST /api/op/upstream_set` and `model_set` answer it, for\nevery action.",
                  "properties": {
                    "fallback_notes": {
                      "description": "A plain alias's write (`model_set`): what the save says about its fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Something to warn about on a row that was saved all the same: an\n`openai` upstream on a host that is not OpenAI's (`UpstreamView::host_note`).\nOnly the dashboard's `upstream_set_full` sets it; left out otherwise.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "RowSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Forget that an upstream is out of quota",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "upstream_quota_clear",
        "x-lmgw-tool": "lmgw__upstream_quota_clear",
        "x-lmgw-writes": true
      }
    },
    "/api/op/upstream_set": {
      "post": {
        "description": "Create, update, delete, enable or disable an upstream provider. Update is partial — pass only the fields to change, everything else is kept. Omit api_key on update to leave the stored key untouched. A call that moves base_url to another address (update, enable or disable) must pass the api_key for that address in the same call when the upstream holds one, or it is refused and nothing changes: a stored key is never sent to a host it was not given for. An upstream that sends extra headers moves on the dashboard only.",
        "operationId": "op_upstream_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Sparse patch for an upstream. `action` selects the verb; the remaining\nfields are the record, all optional (a field left out keeps its value).",
                "properties": {
                  "action": {
                    "default": "",
                    "description": "What to do.",
                    "type": "string"
                  },
                  "api_key": {
                    "default": null,
                    "description": "Provider API key. Write-only.",
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "base_url": {
                    "default": null,
                    "description": "Base URL, e.g. https://api.openai.com/v1. Required on create. Moving it needs api_key in the same call when the upstream holds a key.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "catalog_all_modalities": {
                    "default": null,
                    "description": "Ask the upstream's catalog for every output modality (GET …/models?output_modalities=all), so OpenRouter lists its decision, embedding, rerank, speech, transcription, image and video models as well as its chat models. Default true; only the catalog request of an 'openai_compatible' upstream of kind 'generic' carries it. Some endpoints refuse the parameter: Gemini's OpenAI-compatible one answers 400, so with this on its catalog fails, and the error names this option. Set it false for such an upstream.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "description": "Whether the upstream is usable.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "expose_all": {
                    "default": null,
                    "description": "Pass the upstream's whole catalog through without per-model aliases.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "expose_prefix": {
                    "default": null,
                    "description": "Namespace for passthrough models, e.g. 'groq' -> groq/<model>.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "default": null,
                    "description": "Upstream id. Required for everything except create.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "kind": {
                    "default": null,
                    "description": "Upstream flavour. Default 'generic'. 'llama_server' goes with protocol 'llama_cpp' (or 'anthropic', for llama-server's /v1/messages) and marks the upstream local and free; leave it out with 'llama_cpp'. 'audio_cpp' (an external audio.cpp server) goes with 'openai_compatible'. Protocol 'openai' is always 'generic'. Switching the protocol to openai, openai_compatible or gemini alone makes a llama_server 'generic', and switching it to openai alone makes an audio_cpp row 'generic'.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "default": null,
                    "description": "Display name, unique.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "protocol": {
                    "default": null,
                    "description": "Wire protocol the upstream speaks. Required on create. 'openai' is the OpenAI platform only (api.openai.com or a regional *.api.openai.com host), always kind 'generic': lmgw sends it OpenAI's own dialect, and another host is accepted with a note. 'openai_compatible' is every other OpenAI-shaped provider (OpenRouter, Kilo, Groq, Gemini's OpenAI-compatible endpoint, vLLM, an external audio.cpp server). 'llama_cpp' is llama.cpp's own server (llama-server, ik_llama.cpp) and is always kind 'llama_server'; 'openai' or 'openai_compatible' with kind 'llama_server' is refused, use protocol 'llama_cpp'.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "supports_responses": {
                    "default": null,
                    "description": "The upstream implements OpenAI's /v1/responses itself, so the gateway forwards that route verbatim instead of synthesizing it from /v1/chat/completions. 'openai_compatible' only; default false. Implied on 'openai' (the OpenAI platform forwards it without the flag), and refused on every other protocol: lmgw synthesizes /v1/responses there. Most local servers have no such endpoint.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "timeout_ms": {
                    "default": null,
                    "description": "Timeout in ms of every request to it: its sends and its catalog (models-list) reads wait that long for an answer, and a streamed answer may go that long without an event before lmgw ends it with an error (keep-alives count only before the answer shows and while the model thinks out of sight). 0 means no bound. Default 120000.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "UpstreamPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a routing row that names the row it wrote: `{\"ok\": true, \"id\": …,\n\"message\": …}`. `POST /api/op/upstream_set` and `model_set` answer it, for\nevery action.",
                  "properties": {
                    "fallback_notes": {
                      "description": "A plain alias's write (`model_set`): what the save says about its fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Something to warn about on a row that was saved all the same: an\n`openai` upstream on a host that is not OpenAI's (`UpstreamView::host_note`).\nOnly the dashboard's `upstream_set_full` sets it; left out otherwise.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "RowSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create, update, delete, enable or disable an upstream provider",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "upstream_set",
        "x-lmgw-tool": "lmgw__upstream_set",
        "x-lmgw-writes": true
      }
    },
    "/api/op/upstream_set_full": {
      "post": {
        "description": "Upstream create/update including extra_headers, which the tool-plane patch omits. Secrets follow the house convention: an empty api_key keeps the stored one, and a header value of \"<set>\" round-trips to the stored value for that header name.",
        "operationId": "op_upstream_set_full",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "Upstream create/update including `extra_headers`, which the self-admin\n`upstream_set` tool omits. For secrets, an empty api_key keeps\nthe stored one, and a header value of \"<set>\" round-trips to the stored\nvalue for that header name.",
                "properties": {
                  "action": {
                    "default": "",
                    "type": "string"
                  },
                  "api_key": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "base_url": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "catalog_all_modalities": {
                    "default": null,
                    "description": "Ask the catalog for every output modality\n(`GET …/models?output_modalities=all`). On unless turned off; only an\n`openai_compatible` row of kind `generic` sends it.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "enabled": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "expose_all": {
                    "default": null,
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "expose_prefix": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "extra_headers": {
                    "default": null,
                    "description": "(name, value) pairs, replacing the stored set. A secret as a whole:\nthese are typically the provider's own auth headers.",
                    "items": {
                      "maxItems": 2,
                      "minItems": 2,
                      "prefixItems": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "string"
                        }
                      ],
                      "type": "array"
                    },
                    "type": [
                      "array",
                      "null"
                    ],
                    "x-lmgw-secret": true
                  },
                  "id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "kind": {
                    "default": null,
                    "description": "What the upstream is, tied to its protocol: `openai` is `generic` only;\n`openai_compatible` is `generic` or `audio_cpp` (an external audio.cpp\nserver); `llama_cpp` is `llama_server` only; `anthropic` is `generic` or\n`llama_server`; `gemini` is `generic`. A pairing outside this is refused.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "protocol": {
                    "default": null,
                    "description": "The API the upstream speaks. `openai`: the OpenAI platform (api.openai.com)\nonly. `openai_compatible`: every other OpenAI-shaped provider (OpenRouter,\nvLLM, an external audio.cpp server…). `anthropic`: Anthropic's API.\n`gemini`: Google's Gemini API. `llama_cpp`: llama.cpp's own server.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "supports_responses": {
                    "default": null,
                    "description": "Forward `/v1/responses` natively instead of lmgw's own loop. Applies to\n`openai_compatible` upstreams only; on any other protocol it is refused\nwhen turned on and switched off when the row leaves `openai_compatible`.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "timeout_ms": {
                    "default": null,
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "UpstreamFullPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A write to a routing row that names the row it wrote: `{\"ok\": true, \"id\": …,\n\"message\": …}`. `POST /api/op/upstream_set` and `model_set` answer it, for\nevery action.",
                  "properties": {
                    "fallback_notes": {
                      "description": "A plain alias's write (`model_set`): what the save says about its fallback (openai egress design §14.2):\nwhat a chat fallback lacks or adds, a type lmgw could not check, the\nsame upstream, the references a rename rewrote, the rows a delete\nleaves without a working fallback. Absent when there is nothing to\nsay.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "description": "The row's id: the new row's for `create`.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "message": {
                      "description": "What was done, for a person to read.",
                      "type": "string"
                    },
                    "note": {
                      "description": "Something to warn about on a row that was saved all the same: an\n`openai` upstream on a host that is not OpenAI's (`UpstreamView::host_note`).\nOnly the dashboard's `upstream_set_full` sets it; left out otherwise.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "message"
                  ],
                  "title": "RowSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create or update an upstream provider, including extra headers",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "upstream_set_full",
        "x-lmgw-writes": true
      }
    },
    "/api/op/upstream_test": {
      "post": {
        "description": "Connect to one configured upstream now. It answers `{ok: true}` when the model list came back; a failed connection is an error answer with the upstream's own words.",
        "operationId": "op_upstream_test",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "description": "Upstream id, from /api/upstreams.",
                    "type": "integer"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /api/op/upstream_test`: the upstream answered its model list. A failed\nconnection is an error answer instead, so this one only ever says it worked.",
                  "properties": {
                    "note": {
                      "description": "The row's `host_note` (`UpstreamView::host_note`): it answered, and\nit is an `openai` row on a host that is not OpenAI's.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "description": "Always `true`; a failed test is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "note"
                  ],
                  "title": "UpstreamTested",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Test connectivity to a configured upstream",
        "tags": [
          "ops-routing"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "upstream_test",
        "x-lmgw-writes": false
      }
    },
    "/api/op/voice_generate": {
      "post": {
        "description": "One round of the Voices lab: the alias (any text-to-speech model, local or cloud) is opened once and says the same text as `count` candidates (4 when absent; no cap, rendered one after another), each with a seed of its own — consecutive from `seed`, else drawn — which reaches a local row whose engine reads one (`seeds_sent`). The text is `text`, else the language's sentence (the owner's saved one, else the built-in one). `description` is the voice description or speaking style (the speech route's instructions), `voice` the voice for a model that speaks one it is told; `language` goes to a local row that takes one. A configured fallback answers as for any request, and the round names who answered (answered_by, fallback_reason). The round is kept under <data_dir>/voice-lab/rounds until discarded; each candidate's `url` serves its audio. A failure after the first candidate ends the round there (`stopped`). The same function lmgw__voice_generate and POST /voice-lab/api/rounds call.",
        "operationId": "op_voice_generate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`voice_generate` / `POST /voice-lab/api/rounds`: render candidates.",
                "example": {
                  "alias": "audio/voicedesign",
                  "count": 4,
                  "description": "a warm, calm voice",
                  "language": "en"
                },
                "properties": {
                  "alias": {
                    "description": "The text-to-speech model, e.g. 'audio/qwen3-voicedesign'.",
                    "type": "string"
                  },
                  "count": {
                    "default": null,
                    "description": "How many candidates, rendered one after another. Default 4.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "description": {
                    "default": null,
                    "description": "The voice description (a voice-design model: 'a warm, calm female voice in her forties') or speaking style. Empty: none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "language": {
                    "default": null,
                    "description": "ISO 639-1 code (en, de): picks the sentence and is sent to a local model that takes a language.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "seed": {
                    "default": null,
                    "description": "The first candidate's seed; the next get seed+1, seed+2, … Empty: a random seed each.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "text": {
                    "default": null,
                    "description": "What every candidate says. Empty: the sentence for `language`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "default": null,
                    "description": "The voice for a model that speaks one it is told. Empty: its default.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "alias"
                ],
                "title": "VoiceGenerateArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One round: what was asked, who answered, and its candidates.",
                  "properties": {
                    "alias": {
                      "description": "The alias asked.",
                      "type": "string"
                    },
                    "answered_by": {
                      "description": "The alias that answered: `alias`, or the fallback the GPU hold (or a\nbusy card) handed the round to.",
                      "type": "string"
                    },
                    "asked": {
                      "description": "How many candidates were asked for.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "candidates": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceCandidate"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "description": "RFC 3339, UTC.",
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fallback_reason": {
                      "description": "Why a fallback answered (`hold`, `external_vram`, …).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "The round's id, its directory's name.",
                      "type": "string"
                    },
                    "language": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language_note": {
                      "description": "What happened to the language when it did not reach the model as\nset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "licence": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelLicence"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The licence the answering row's package states, when it states one."
                    },
                    "row": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/VoiceRow"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The lmgw audio row behind the answering route, if it is one."
                    },
                    "seeds_sent": {
                      "description": "Each candidate's seed reached the model.",
                      "type": "boolean"
                    },
                    "sent_text": {
                      "description": "What the engine was sent instead, when lmgw's speech shaping changed\nit (inline tags or characters the engine cannot say): what the\ncandidates say, and the transcript a saved sample gets.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "shaping": {
                      "description": "What lmgw's speech shaping changed in the request\n(`x-lmgw-speech`'s words), when it changed anything.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stopped": {
                      "description": "Why the round ended before `asked` candidates: the first failure,\nor a stop (the page left, Stop, the round discarded).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "text": {
                      "description": "What every candidate was asked to say.",
                      "type": "string"
                    },
                    "upstream": {
                      "description": "The upstream that answered.",
                      "type": "string"
                    },
                    "upstream_model": {
                      "description": "The model name it was sent.",
                      "type": "string"
                    },
                    "voice": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "created_at",
                    "alias",
                    "answered_by",
                    "fallback_reason",
                    "upstream",
                    "upstream_model",
                    "row",
                    "licence",
                    "text",
                    "sent_text",
                    "language",
                    "language_note",
                    "description",
                    "voice",
                    "seeds_sent",
                    "shaping",
                    "asked",
                    "candidates",
                    "stopped"
                  ],
                  "title": "VoiceRound",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Render candidate voice samples with a text-to-speech model (the Voices lab)",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "voice_generate",
        "x-lmgw-tool": "lmgw__voice_generate",
        "x-lmgw-writes": true
      }
    },
    "/api/op/voice_sample_save": {
      "post": {
        "description": "Writes a round's candidate to the voice library (<audio models dir>/voices) as <name>.wav, its leading and trailing silence cut (loudness untouched), with the text it says as its transcript (the library's prompt_text) — so every cloning model can speak with it by name. How it was made (alias, the model that answered, description, voice, seed, text, language, dates, licence when known) is recorded beside it. A name the library already has is refused with `name_taken` and nothing is written, unless `overwrite` is true: then the clip of that name is replaced. The same function lmgw__voice_sample_save and POST /voice-lab/api/samples call.",
        "operationId": "op_voice_sample_save",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`voice_sample_save` / `POST /voice-lab/api/samples`: save a candidate to\nthe voice library.",
                "example": {
                  "candidate": 2,
                  "name": "sample-voice",
                  "round": "20260101-120000-000-abcdef"
                },
                "properties": {
                  "candidate": {
                    "description": "The candidate's number in the round, from 1.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "name": {
                    "description": "The voice name: letters, digits, space, '.', '_' and '-'. A trailing .wav is dropped.",
                    "type": "string"
                  },
                  "overwrite": {
                    "default": false,
                    "description": "Replace a sample of that name. Default false.",
                    "type": "boolean"
                  },
                  "round": {
                    "description": "The round's id, from lmgw__voice_generate.",
                    "type": "string"
                  }
                },
                "required": [
                  "round",
                  "candidate",
                  "name"
                ],
                "title": "VoiceSampleSaveArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`voice_sample_save`'s answer.",
                  "properties": {
                    "clip": {
                      "description": "The clip's file name in the library (`anna.wav`).",
                      "type": "string"
                    },
                    "library_active": {
                      "description": "The class's voice directory is this library, so `voice` names the\nclip on every cloning model; otherwise it is reachable as a\n`voice_ref` path only.",
                      "type": "boolean"
                    },
                    "message": {
                      "description": "The outcome in a sentence.",
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "provenance": {
                      "$ref": "#/components/schemas/VoiceProvenance"
                    },
                    "replaced": {
                      "description": "The library files it replaced (with `overwrite`).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "transcript": {
                      "description": "The transcript recorded for it.",
                      "type": "string"
                    },
                    "voice": {
                      "description": "The voice name a request uses (`anna`).",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "clip",
                    "voice",
                    "replaced",
                    "transcript",
                    "provenance",
                    "library_active",
                    "message"
                  ],
                  "title": "VoiceSampleSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save a Voices lab candidate to the voice library as a sample",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "A sample of the same name is replaced only with overwrite.",
        "x-lmgw-op": "voice_sample_save",
        "x-lmgw-tool": "lmgw__voice_sample_save",
        "x-lmgw-writes": true
      }
    },
    "/api/op/voice_transcribe": {
      "post": {
        "description": "Writes a voice-library clip's transcript (the library's prompt_text, which audio.cpp hands a cloning model as reference_text when a request's voice names the clip): one clip (replaced if it had one), or every clip without one. The model is the alias given, else the setting audio.voice_transcribe_alias; it must be a speech-to-text (asr) model, wherever it runs, and so must the fallback a GPU hold or an outside-VRAM verdict hands the clip to (a configured fallback is always used; asr_required before anything is sent otherwise). The answer names the clips, their transcript lengths and the model that wrote each (a fallback named as one: answered_by, fallback_reason), not the text. The same function lmgw__voice_transcribe calls.",
        "operationId": "op_voice_transcribe",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "example": {
                  "alias": "audio/qwen3-asr"
                },
                "properties": {
                  "alias": {
                    "description": "The speech-to-text model, e.g. 'audio/qwen3-asr'. Empty: the setting audio.voice_transcribe_alias.",
                    "type": "string"
                  },
                  "clip": {
                    "description": "One clip: its file name (me.wav) or voice name (me). Empty: every clip without a transcript.",
                    "type": "string"
                  }
                },
                "required": [],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`voice_transcribe`: the clips a speech-to-text model wrote transcripts\nfor. The answer names clips and lengths, never the text.",
                  "properties": {
                    "already": {
                      "description": "For the run over every untranscribed clip: how many already had a\ntranscript and were left alone. Absent when one clip was named.",
                      "format": "uint",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "description": "The clips that could not be.",
                      "items": {
                        "$ref": "#/components/schemas/VoiceClipFailed"
                      },
                      "type": "array"
                    },
                    "message": {
                      "description": "The outcome in a sentence.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a clip that failed is listed in `failed`.",
                      "type": "boolean"
                    },
                    "transcribed": {
                      "description": "The clips transcribed, with who wrote each.",
                      "items": {
                        "$ref": "#/components/schemas/TranscribedClip"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "ok",
                    "transcribed",
                    "failed",
                    "message"
                  ],
                  "title": "VoiceTranscribed",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Transcribe voice-library clips with a speech-to-text model",
        "tags": [
          "ops-models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-op": "voice_transcribe",
        "x-lmgw-tool": "lmgw__voice_transcribe",
        "x-lmgw-writes": true
      }
    },
    "/api/openapi.json": {
      "get": {
        "description": "This description, generated rather than hand-maintained.",
        "operationId": "get_api_openapi_json",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get the full OpenAPI description",
        "tags": [
          "meta"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/responses": {
      "get": {
        "description": "Every stored /v1/responses conversation chain, most recent first, capped at 200.",
        "operationId": "get_api_responses",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/responses`.",
                  "properties": {
                    "capped": {
                      "description": "True when more chains exist than the 200 shown.",
                      "type": "boolean"
                    },
                    "chains": {
                      "items": {
                        "$ref": "#/components/schemas/ChainRow"
                      },
                      "type": "array"
                    },
                    "max_chains": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "retention_hours": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "rules": {
                      "description": "The eviction rules in one sentence.",
                      "type": "string"
                    },
                    "store_enabled": {
                      "type": "boolean"
                    },
                    "total_chains": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "total_responses": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "chains",
                    "total_chains",
                    "total_responses",
                    "store_enabled",
                    "retention_hours",
                    "max_chains",
                    "rules",
                    "capped"
                  ],
                  "title": "ResponsesIndex",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List stored response chains",
        "tags": [
          "responses"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/responses/chain": {
      "get": {
        "description": "One conversation chain's stored responses, each with its outline, text, pending tool calls and full body.",
        "operationId": "get_api_responses_chain",
        "parameters": [
          {
            "in": "query",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/responses/chain?id=`.",
                  "properties": {
                    "chain_id": {
                      "type": "string"
                    },
                    "responses": {
                      "items": {
                        "$ref": "#/components/schemas/ResponseItem"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "chain_id",
                    "responses"
                  ],
                  "title": "ChainDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a response chain",
        "tags": [
          "responses"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/session": {
      "delete": {
        "description": "Clears the session cookie. Same-origin only; never refused, whatever the session resolves to. The key itself is untouched.",
        "operationId": "delete_api_session",
        "responses": {
          "204": {
            "description": "No content."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Sign out",
        "tags": [
          "session"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-confirm-note": "signs this browser out of the dashboard",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      },
      "get": {
        "description": "The current principal, as the dashboard's load check reads it. Never a 401, whatever credential (or none) the request carried: it answers the question \"am I logged in\", and a refusal would make the answer indistinguishable from a gateway that is down.",
        "operationId": "get_api_session",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What `GET /api/session` answers: the current principal, as the dashboard's\nload check reads it. Never a `401`: `authenticated` is `false` and the\nother two keys are empty when nobody is signed in.",
                  "properties": {
                    "authenticated": {
                      "type": "boolean"
                    },
                    "kind": {
                      "description": "`key`, `agent`, `owner` or `device` (a paired device) — empty when\nnobody is signed in. Present and empty rather than absent, so the\nresponse has one shape.",
                      "type": "string"
                    },
                    "name": {
                      "description": "The name of the API key in use (`owner:dashboard` for the dashboard's\nown), empty when nobody is signed in.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "authenticated",
                    "kind",
                    "name"
                  ],
                  "title": "SessionView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Read the current session",
        "tags": [
          "session"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "The paste fallback, and how the dashboard re-logs itself after rotating owner:dashboard. A token that matches no enabled owner row is 401 login_invalid, not session_required. Same-origin only.",
        "operationId": "post_api_session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "token": {
                    "type": "string",
                    "x-lmgw-secret": true
                  }
                },
                "required": [
                  "token"
                ],
                "title": "SignIn",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "No content."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Sign in",
        "tags": [
          "session"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/api/session/login": {
      "get": {
        "description": "The desktop app's window opens here with ?nonce=; a browser opens it with ?token= (the owner key, in the \"dashboard login\" link lmgw logs at startup). Either match sets the session cookie and redirects to /; anything else redirects to /?login=invalid with no cookie. Same-origin only.",
        "operationId": "get_api_session_login",
        "parameters": [
          {
            "in": "query",
            "name": "nonce",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "token",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "x-lmgw-secret": true
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Log in via a link",
        "tags": [
          "session"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/settings-full": {
      "get": {
        "description": "Every dashboard-editable setting: bind address, self-admin mode + token, secrets (masked), and all three class definitions. Deliberately broader than what the settings_set self-admin tool exposes.",
        "operationId": "get_api_settings_full",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/settings-full`. Secrets never round-trip — only `has_*` flags.",
                  "properties": {
                    "agent_origin_suffix": {
                      "description": "The DNS suffix a service agent's UI is served under,\ndefault `localhost`: `http://<id>.<agent_origin_suffix>:<bind port>/`.",
                      "type": "string"
                    },
                    "agent_origin_suffix_warning": {
                      "description": "Why the **stored** suffix shadows the gateway, when it does. It is validated on write, but\n`bind_addr`, this machine's host\nname and its search domains are the other side of that rule and move\nwithout it: this is the same sentence the boot log carries, so a\ngateway that started shadowing says so where the setting is read rather\nthan only where it was typed. `None` on a gateway that shadows nothing.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "agent_script_image": {
                      "description": "The stock image a manifest's `script` step runs in, default\n`docker.io/library/node:24-alpine`.",
                      "type": "string"
                    },
                    "api_keys": {
                      "items": {
                        "$ref": "#/components/schemas/ApiKeyRow"
                      },
                      "type": "array"
                    },
                    "audio": {
                      "$ref": "#/components/schemas/AudioSettings"
                    },
                    "auth_enabled": {
                      "type": "boolean"
                    },
                    "aux_router": {
                      "$ref": "#/components/schemas/AuxRouterSettings"
                    },
                    "bind_addr": {
                      "type": "string"
                    },
                    "build_update_check_hours": {
                      "description": "How often the build update check runs, in hours. `0` = off.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "builds_dir": {
                      "description": "Where container builds keep their git mirrors, per-run worktrees and\nlogs, as configured. `None` = the default, which\n`builds_dir_effective` spells out.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "builds_dir_effective": {
                      "description": "The directory builds actually use: `builds_dir`, else\n`<data_dir>/builds` (a dev instance: `~/.cache/lmgw-dev/builds`).",
                      "type": "string"
                    },
                    "builds_dir_warning": {
                      "description": "Why builds would refuse to run in `builds_dir_effective` (it is on\ntmpfs, i.e. RAM); `None` when they would not.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "chat_archive_days": {
                      "description": "Archive a Chat thread this many days after its last activity; `0`\ndisables auto-archive. Reversible: a pin, a restore or a message sent\ninto the thread brings it back.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "chat_feed_keepalive_max_s": {
                      "description": "The longest keep-alive a feed may ask for itself (`?keepalive_s=`),\nin seconds (1 to `chat_feed::MAX_KEEPALIVE_S`).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "chat_feed_keepalive_s": {
                      "description": "Seconds between the Chat feed's keep-alive comments (1 to\n`chat_feed_keepalive_max_s`).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "chat_feed_live_buffer": {
                      "description": "Live Chat feed events held for a slow client before it gets a fresh\n`state` instead (≥ 1).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "chat_feed_page_size": {
                      "description": "Records the Chat feed reads per query while a client catches up\n(≥ 1).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "chat_feed_retention_days": {
                      "description": "Days the Chat change feed keeps its records; `0` = all.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "chat_kb_budget_tokens": {
                      "description": "Tokens of knowledge-base excerpts one Chat turn may carry (> 0).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "chat_media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The image and audio tools' default models (`GET\n/chat/api/media/defaults` lists the choices and says which no longer\nresolve); an absent field is no default. A folder and a thread can\noverride each."
                    },
                    "chat_pdf_mode": {
                      "description": "How a text PDF attached in Chat starts out: `text | images | ask`.",
                      "type": "string"
                    },
                    "chat_profile": {
                      "description": "The personality profile new Chat threads start with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "chat_purge_days": {
                      "description": "Delete an archived, unpinned Chat thread this many days after it was\narchived; `0` keeps archived threads forever.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "chat_read_aloud": {
                      "description": "Read Chat replies aloud as they stream.",
                      "type": "boolean"
                    },
                    "chat_speech_style": {
                      "description": "The Chat's speech instructions; empty = `realtime.speech_instructions`.",
                      "type": "string"
                    },
                    "chat_stt_alias": {
                      "description": "The Chat's speech-to-text alias — dictation, realtime mode and audio\nattachments; empty = `realtime.asr_alias`.",
                      "type": "string"
                    },
                    "chat_system_prompt": {
                      "description": "The system prompt new Chat threads start with, as in force: the\nconfigured prompt, or the built-in one when none was written.",
                      "type": "string"
                    },
                    "chat_system_prompt_builtin": {
                      "description": "The built-in default, which saving `chat_system_prompt` as this text\nreturns to.",
                      "type": "string"
                    },
                    "chat_tts_alias": {
                      "description": "The Chat's text-to-speech alias; empty = `realtime.tts_alias`.",
                      "type": "string"
                    },
                    "chat_turn_detection": {
                      "description": "`semantic_vad | server_vad | push_to_talk`.",
                      "type": "string"
                    },
                    "chat_voice": {
                      "description": "The Chat's voice, chosen for the Chat's text-to-speech model; empty =\nnone named, so realtime's chain decides (`realtime.default_voice`,\nthen the model's default). A thread that speaks with another model\ndoes not take it.",
                      "type": "string"
                    },
                    "chat_voice_audio_input": {
                      "description": "`off | on`: whether a voice turn goes to the chat model as audio\nwhen the model that answers it takes audio input, wherever it runs\n(experimental).",
                      "type": "string"
                    },
                    "chat_voice_language": {
                      "description": "The language the user speaks (ISO 639-1), what the speech-to-text\nmodel is told; empty = none.",
                      "type": "string"
                    },
                    "chat_voice_language_notes": {
                      "description": "Where the Chat's own speech models (as saved) do not take their\nlanguage as set — an ASR that detects `chat_voice_language` itself, a\nvoice that cannot speak the reply language; empty without a language.",
                      "items": {
                        "$ref": "#/components/schemas/LanguageNote"
                      },
                      "type": "array"
                    },
                    "chat_voice_reply_language": {
                      "description": "The language replies are in (ISO 639-1): the model answers in it\nand the voice speaks it; empty = `chat_voice_language`.",
                      "type": "string"
                    },
                    "container_prefix": {
                      "description": "Podman container name prefix for the per-model container runtime:\n`<container_prefix>-<class>-\n<slug>-<hash6>`.",
                      "type": "string"
                    },
                    "currency": {
                      "description": "The label every amount on the Usage page is shown under. One currency,\nno conversion — changing it relabels, it never converts.",
                      "type": "string"
                    },
                    "data_dir": {
                      "type": "string"
                    },
                    "devices": {
                      "$ref": "#/components/schemas/DevicesSettings",
                      "description": "The device listener and the bounds of its trust (Settings → Network\n& access → Devices, device link design §9.1)."
                    },
                    "docs_embed_batch": {
                      "description": "Texts per embedding call during ingest and re-embed.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "docs_fetch_delay_ms": {
                      "description": "Politeness pause between two fetches to the same host, ms.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "docs_ingest_reply_tokens": {
                      "description": "Room reserved for one extraction reply.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "docs_rerank_model": {
                      "description": "Alias the rerank stage calls; empty = the aux router's single enabled\nrerank model, and the search trace names the reason when there is none.",
                      "type": "string"
                    },
                    "docs_search": {
                      "$ref": "#/components/schemas/DocsSearchDefaults",
                      "description": "The stage defaults a request that overrides nothing starts from."
                    },
                    "forge_tokens": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Forge API tokens by host. Values are always the\n`<set>` placeholder — a token never round-trips.",
                      "type": "object"
                    },
                    "global_budget_micro": {
                      "description": "Spend ceiling across every key, in currency micro-units. `0` = none.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "global_budget_period": {
                      "description": "`day | month | total`.",
                      "type": "string"
                    },
                    "has_hf_token": {
                      "type": "boolean"
                    },
                    "has_update_token": {
                      "type": "boolean"
                    },
                    "hold": {
                      "$ref": "#/components/schemas/HoldSettingsDto",
                      "description": "The manual GPU hold — orthogonal to `vram`\nabove: a switch on the resolve/start paths, not a capacity policy."
                    },
                    "host_cpu": {
                      "$ref": "#/components/schemas/HostCpu",
                      "description": "This machine's CPUs, read once (a derived fact, never settable): the\nthread count an audio row switched to the CPU runs with when it names\nnone."
                    },
                    "image": {
                      "$ref": "#/components/schemas/ImageSettings",
                      "description": "The stable-diffusion.cpp class."
                    },
                    "jobs_max_rows": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "jobs_retention_days": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "local_reference_alias": {
                      "description": "Alias whose price answers the local-vs-cloud counterfactual; empty =\nthe panel says no reference is configured.",
                      "type": "string"
                    },
                    "max_body_mb": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "mcp": {
                      "$ref": "#/components/schemas/HostSettings",
                      "description": "The device MCP host link's limits (client-apps design §5.1)."
                    },
                    "quota_recheck_seconds": {
                      "description": "Seconds before an upstream remembered out of quota is asked again,\nwhen its answer carried no `Retry-After`; until then a model with a\nfallback on it answers with the fallback.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "realtime": {
                      "$ref": "#/components/schemas/RealtimeSettings",
                      "description": "`GET /v1/realtime`, spoken conversations."
                    },
                    "responses_max_chains": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "responses_max_tool_calls": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "responses_retention_hours": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "responses_store": {
                      "type": "boolean"
                    },
                    "responses_timeout_seconds": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "retention_days": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "retention_max_rows": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "router": {
                      "$ref": "#/components/schemas/RouterSettings"
                    },
                    "sampling_alias": {
                      "type": "string"
                    },
                    "self_admin": {
                      "$ref": "#/components/schemas/AdminLevel",
                      "description": "The gateway's self-admin level: what the `lmgw__*` tools may do, for\nevery caller, a paired device's own level capped by it."
                    },
                    "update_check_enabled": {
                      "type": "boolean"
                    },
                    "usage_retention_months": {
                      "description": "Keep hourly usage rollups this many months; `0` = forever.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "version": {
                      "type": "string"
                    },
                    "vram": {
                      "$ref": "#/components/schemas/VramSettingsDto",
                      "description": "GPU admission control."
                    }
                  },
                  "required": [
                    "bind_addr",
                    "auth_enabled",
                    "retention_days",
                    "retention_max_rows",
                    "jobs_retention_days",
                    "jobs_max_rows",
                    "usage_retention_months",
                    "currency",
                    "local_reference_alias",
                    "global_budget_micro",
                    "global_budget_period",
                    "quota_recheck_seconds",
                    "max_body_mb",
                    "chat_system_prompt",
                    "chat_system_prompt_builtin",
                    "chat_pdf_mode",
                    "chat_stt_alias",
                    "chat_tts_alias",
                    "chat_voice",
                    "chat_speech_style",
                    "chat_voice_language",
                    "chat_voice_reply_language",
                    "chat_voice_language_notes",
                    "chat_read_aloud",
                    "chat_turn_detection",
                    "chat_voice_audio_input",
                    "chat_kb_budget_tokens",
                    "chat_media_defaults",
                    "chat_profile",
                    "chat_archive_days",
                    "chat_purge_days",
                    "chat_feed_retention_days",
                    "chat_feed_keepalive_s",
                    "chat_feed_keepalive_max_s",
                    "chat_feed_page_size",
                    "chat_feed_live_buffer",
                    "self_admin",
                    "sampling_alias",
                    "responses_max_tool_calls",
                    "responses_timeout_seconds",
                    "responses_store",
                    "responses_retention_hours",
                    "responses_max_chains",
                    "docs_ingest_reply_tokens",
                    "docs_embed_batch",
                    "docs_fetch_delay_ms",
                    "docs_rerank_model",
                    "docs_search",
                    "update_check_enabled",
                    "has_update_token",
                    "has_hf_token",
                    "builds_dir",
                    "builds_dir_effective",
                    "builds_dir_warning",
                    "forge_tokens",
                    "build_update_check_hours",
                    "vram",
                    "hold",
                    "container_prefix",
                    "agent_origin_suffix",
                    "agent_origin_suffix_warning",
                    "agent_script_image",
                    "router",
                    "aux_router",
                    "audio",
                    "image",
                    "realtime",
                    "mcp",
                    "devices",
                    "api_keys",
                    "data_dir",
                    "version",
                    "host_cpu"
                  ],
                  "title": "SettingsFull",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get every setting",
        "tags": [
          "settings"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/status": {
      "get": {
        "description": "Gateway health in one call: uptime, live request stats, the per-model container runtime, the GPU ledger, southbound MCP connections, and config-object counts.",
        "operationId": "get_api_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/status` and the `lmgw__status` tool — everything the Overview\nneeds in one call.\n\n`R`, `V` and `M` are the shapes of a runtime row, of the GPU ledger and of\na southbound MCP server's connection: the gateway fills in its own views,\na reader (and the API document) uses `RuntimeStatus`, `VramStatus` and\n`McpStatus`.",
                  "properties": {
                    "auth_enabled": {
                      "type": "boolean"
                    },
                    "bind_addr": {
                      "type": "string"
                    },
                    "candidate_aliases": {
                      "description": "One entry per candidate alias, by name. Absent while none is\nconfigured, so an install without any reads as it did before the key\nexisted: no empty array, no key at all.",
                      "items": {
                        "$ref": "#/components/schemas/CandidateAliasStatus"
                      },
                      "type": "array"
                    },
                    "counts": {
                      "$ref": "#/components/schemas/ObjectCounts"
                    },
                    "devices": {
                      "$ref": "#/components/schemas/DevicesStatus",
                      "description": "The device link: lmgw's device CA and the server certificates issued\nfrom it (device link design §9.2)."
                    },
                    "machine": {
                      "$ref": "#/components/schemas/MachineSummary",
                      "description": "The machine check's verdict (machine-check design §4.1): whether this\ncomputer can run local models. Absent until the check at boot has\nfinished; `POST /api/op/machine_check` has the whole check."
                    },
                    "mcp_servers": {
                      "items": {
                        "$ref": "#/components/schemas/McpStatus"
                      },
                      "type": "array"
                    },
                    "requests": {
                      "$ref": "#/components/schemas/RequestStats"
                    },
                    "runtime": {
                      "description": "One row per model lmgw believes is running (a container is per model, not per class).",
                      "items": {
                        "$ref": "#/components/schemas/RuntimeStatus"
                      },
                      "type": "array"
                    },
                    "self_admin": {
                      "$ref": "#/components/schemas/AdminLevel",
                      "description": "The gateway's self-admin level: what the `lmgw__*` tools may do."
                    },
                    "upstreams_out_of_quota": {
                      "description": "The upstreams lmgw remembers out of quota (openai egress design\n§14.6); empty while none is.",
                      "items": {
                        "$ref": "#/components/schemas/UpstreamQuotaStatus"
                      },
                      "type": "array"
                    },
                    "uptime_seconds": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "version": {
                      "type": "string"
                    },
                    "vram": {
                      "$ref": "#/components/schemas/VramStatus",
                      "description": "The GPU those containers share: what is resident, what it is measured\nto cost, and anything queued behind it. Reported even when admission\nis inactive; `inactive_reason` says why."
                    },
                    "webrtc": {
                      "$ref": "#/components/schemas/WebRtcStatus",
                      "description": "The UDP listener for WebRTC calls: its socket groups, one per HTTP\nlistener (realtime calls design §9)."
                    }
                  },
                  "required": [
                    "version",
                    "uptime_seconds",
                    "bind_addr",
                    "auth_enabled",
                    "self_admin",
                    "requests",
                    "runtime",
                    "vram",
                    "mcp_servers",
                    "counts",
                    "devices",
                    "webrtc",
                    "upstreams_out_of_quota"
                  ],
                  "title": "GatewayStatus",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get gateway status",
        "tags": [
          "status"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/tools": {
      "get": {
        "description": "The whole northbound tool surface: the built-in toolsets and every registered server's tools, each with its source and why it is or is not offered.",
        "operationId": "get_api_tools",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/tools` — every tool this gateway can serve northbound, from the\nbuilt-in toolsets and from the registered servers alike, with the\nper-tool switch and the reason a tool is not currently offered.",
                  "properties": {
                    "sources": {
                      "description": "Group headers. A source with `tool_count: 0` is still here, carrying the\nreason it contributes nothing.",
                      "items": {
                        "$ref": "#/components/schemas/ToolSourceView"
                      },
                      "type": "array"
                    },
                    "tools": {
                      "items": {
                        "$ref": "#/components/schemas/ToolEntryView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "sources",
                    "tools"
                  ],
                  "title": "ToolInventory",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the tool inventory",
        "tags": [
          "tools"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/upstream-models": {
      "get": {
        "description": "One upstream's live model catalog, cached server-side for a short TTL — a round trip to the upstream, so it is its own read rather than part of the upstreams list.",
        "operationId": "get_api_upstream_models",
        "parameters": [
          {
            "in": "query",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/upstream-models?id=` — live catalog of one upstream.",
                  "properties": {
                    "entries": {
                      "description": "The same models, with what the catalog states about each. Defaulted,\nso a gateway older than the field still parses (ids only).",
                      "items": {
                        "$ref": "#/components/schemas/UpstreamModelEntry"
                      },
                      "type": "array"
                    },
                    "models": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "models",
                    "entries"
                  ],
                  "title": "UpstreamModelsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List an upstream's live models",
        "tags": [
          "upstreams"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/upstreams": {
      "get": {
        "description": "Every configured upstream, secrets redacted to has_api_key and extra header values shown as <set>.",
        "operationId": "get_api_upstreams",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/upstreams`. Secrets never round-trip: `has_api_key` says whether\none is stored; header values arrive redacted.",
                  "properties": {
                    "upstreams": {
                      "items": {
                        "$ref": "#/components/schemas/UpstreamView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "upstreams"
                  ],
                  "title": "UpstreamsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List upstreams",
        "tags": [
          "upstreams"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/errors": {
      "get": {
        "description": "Refusals and errors over a time range, grouped by error kind.",
        "operationId": "get_api_usage_errors",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bucket",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/usage/errors` — refusals and errors by kind.\n\nRead from the **raw** request rows, so its range is the log-retention\nwindow rather than the full rollup history. The response says so; a chart\nthat silently showed 30 days where every other chart on the page shows 12\nmonths would read as \"the errors stopped\".",
                  "properties": {
                    "buckets": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "kinds": {
                      "description": "One entry per distinct kind, ordered by total descending.",
                      "items": {
                        "$ref": "#/components/schemas/ErrorKindSeries"
                      },
                      "type": "array"
                    },
                    "retention_days": {
                      "description": "How far back the raw rows actually go — the honest x-axis of this card.",
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "buckets",
                    "kinds",
                    "retention_days"
                  ],
                  "title": "UsageErrorsResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get usage errors by kind",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/export.csv": {
      "get": {
        "description": "The same usage rows as GET /api/usage/series, as a CSV download — one row per (bucket, key, alias, upstream, class, outcome).",
        "operationId": "get_api_usage_export_csv",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export usage as CSV",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/heat": {
      "get": {
        "description": "Cost by hour-of-day × day-of-week, for the usage heatmap.",
        "operationId": "get_api_usage_heat",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/usage/heat` — weekday (0 = Sunday) × hour request counts, local time.",
                  "properties": {
                    "cells": {
                      "items": {
                        "$ref": "#/components/schemas/HeatCell"
                      },
                      "type": "array"
                    },
                    "max": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cells",
                    "max"
                  ],
                  "title": "UsageHeatResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a usage heatmap",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/keys": {
      "get": {
        "description": "Every gateway key with its lifetime and recent spend, scope and last-used time.",
        "operationId": "get_api_usage_keys",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "auth_enabled": {
                      "description": "*Require API key* (Settings → Network & access): off, an anonymous\n`/v1` call is served — what the Devices card warns of, since a\ndevice's scope and budget then bound only its own key.",
                      "type": "boolean"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "global_budget_micro": {
                      "description": "The global budget and what has gone against it this period.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "global_budget_period": {
                      "description": "`day` | `month` | `total` — what \"this period\" means, so a projection\nto the period's end can aim at the right horizon instead of assuming a\ncalendar month.",
                      "type": "string"
                    },
                    "global_spent_micro": {
                      "description": "What the global budget counts this period, the budget floors of\nunpriced requests included, as `KeyRow::spent_micro` counts them.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "global_spent_unknown_requests": {
                      "description": "The unpriced requests of the period, those whose floor\n`global_spent_micro` includes too, as\n`KeyRow::spent_unknown_requests` counts them.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "keys": {
                      "items": {
                        "$ref": "#/components/schemas/KeyRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "keys",
                    "currency",
                    "global_budget_micro",
                    "global_spent_micro",
                    "global_budget_period",
                    "global_spent_unknown_requests",
                    "auth_enabled"
                  ],
                  "title": "KeysResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List keys with their usage",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/local": {
      "get": {
        "description": "The local/cloud spend split and the counterfactual: what the same local traffic would have cost against the configured reference alias.",
        "operationId": "get_api_usage_local",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/usage/local` — the local/cloud split and the counterfactual.",
                  "properties": {
                    "cloud_tokens": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "counterfactual_micro": {
                      "description": "What the local tokens **would** have cost at `reference_alias`'s price.\nNot a saving — nobody would have run all of it there.\n`None` when no reference alias is configured, which the page must say\nrather than quietly picking one.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": "string"
                    },
                    "decode_tok_s": {
                      "description": "Throughput and cache facts for the local models in the window.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "draft_acceptance": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "kv_reuse": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "local_tokens": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "reference_alias": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "local_tokens",
                    "cloud_tokens",
                    "counterfactual_micro",
                    "reference_alias",
                    "currency",
                    "decode_tok_s",
                    "kv_reuse",
                    "draft_acceptance"
                  ],
                  "title": "UsageLocalResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get the local/cloud usage split",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/prices": {
      "get": {
        "description": "Every price row, plus the models seen in traffic that have none — the Prices tab's one read.",
        "operationId": "get_api_usage_prices",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "currency": {
                      "type": "string"
                    },
                    "prices": {
                      "items": {
                        "$ref": "#/components/schemas/PriceRowView"
                      },
                      "type": "array"
                    },
                    "unpriced_hosted_tools": {
                      "description": "Every model whose native answers ran a hosted tool that bills beyond\nits tokens, busiest first: unpriced, since lmgw has no price unit for\nthose fees yet.",
                      "items": {
                        "$ref": "#/components/schemas/UnpricedHostedTool"
                      },
                      "type": "array"
                    },
                    "unpriced_models": {
                      "description": "Every model the gateway serves that no price sheet covers — **including\nthe passthrough models an `expose_all` upstream serves**, which are the\nones a deployment with no configured aliases actually uses. Ordered by the\nrequests each has already spent unpriced.",
                      "items": {
                        "$ref": "#/components/schemas/UnpricedModel"
                      },
                      "type": "array"
                    },
                    "unpriced_tiers": {
                      "description": "Every model that answered at an OpenAI service tier it has no price\nrow for, busiest first: that traffic is unpriced until one is entered.",
                      "items": {
                        "$ref": "#/components/schemas/UnpricedTier"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "prices",
                    "currency",
                    "unpriced_models",
                    "unpriced_tiers",
                    "unpriced_hosted_tools"
                  ],
                  "title": "PricesResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List prices",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/series": {
      "get": {
        "description": "Cost and token series over a time range, bucketed and grouped by class, alias, key or upstream. Series past `limit` (default 6, the chart's colour slots) fold into a server-side \"other\" tail.",
        "operationId": "get_api_usage_series",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bucket",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "group_by",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "description": "Series past this rank (by cost, then tokens) fold into `Other`.\nDefaults to 6, the number of chart colour slots.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/usage/series`",
                  "properties": {
                    "buckets": {
                      "description": "Every bucket label in the window, in order, including empty ones — a\nchart that silently drops quiet days draws a lie about its own x-axis.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "cells": {
                      "items": {
                        "$ref": "#/components/schemas/UsageCell"
                      },
                      "type": "array"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "latency": {
                      "description": "The same four percentiles **per bucket**, aligned with `buckets`, so a\nlatency chart plots a real p50/p95 line rather than a mean. Dividing the\nrollup's sums would give a mean, and one 30-second outlier drags a mean\nfour times above the typical request.",
                      "items": {
                        "$ref": "#/components/schemas/LatencyPoint"
                      },
                      "type": "array"
                    },
                    "p50_total_ms": {
                      "description": "p50 / p95 of total latency and TTFB over the window, in ms. `None` where\nthe window holds no successful request: an empty window has no p95, and\n0 would draw a gateway that got infinitely fast.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "p50_ttfb_ms": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "p95_total_ms": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "p95_ttfb_ms": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "previous": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/UsageCell"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Totals over the immediately preceding window of the same length, for the\ntiles' \"vs previous\" delta. `None` when that window predates the data."
                    },
                    "series": {
                      "items": {
                        "$ref": "#/components/schemas/SeriesMeta"
                      },
                      "type": "array"
                    },
                    "totals": {
                      "$ref": "#/components/schemas/UsageCell"
                    },
                    "units_since": {
                      "description": "When this install started recording the billable quantities\n(`audio_in_ms`, `chars_in`, `images_out`), RFC 3339 UTC. A bucket\nbefore it reads 0 because nothing was recorded, not because nothing\nwas processed: show such a bucket as not recorded rather than as\nzero.\n\nAbsent when the bookkeeping holds no such row.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "buckets",
                    "series",
                    "cells",
                    "totals",
                    "previous",
                    "currency",
                    "p50_total_ms",
                    "p95_total_ms",
                    "p50_ttfb_ms",
                    "p95_ttfb_ms",
                    "latency"
                  ],
                  "title": "UsageSeriesResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a usage time series",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/usage/top": {
      "get": {
        "description": "The ranked rows for one dimension (alias, key, upstream, model) over a time range, by cost then tokens.",
        "operationId": "get_api_usage_top",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "class",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "dim",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "key_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "description": "Truncate the ranked rows to the first N. Absent = every row for `dim`.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "tz",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "upstream_id",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/usage/top` — ranked totals for one dimension.",
                  "properties": {
                    "currency": {
                      "type": "string"
                    },
                    "rows": {
                      "items": {
                        "$ref": "#/components/schemas/UsageCell"
                      },
                      "type": "array"
                    },
                    "series": {
                      "items": {
                        "$ref": "#/components/schemas/SeriesMeta"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "rows",
                    "series",
                    "currency"
                  ],
                  "title": "UsageTopResponse",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get top usage by dimension",
        "tags": [
          "usage"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/version": {
      "get": {
        "description": "The one /api read a page may do before it has a session: the dashboard's footer and its login view print this.",
        "operationId": "get_api_version",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/version` — build identity, also serves as the liveness probe.",
                  "properties": {
                    "version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "version"
                  ],
                  "title": "VersionInfo",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Get the gateway version",
        "tags": [
          "meta"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/vram": {
      "get": {
        "description": "The GPU ledger and the admission queue, freshly measured, and the starts waiting for their engine image's download (downloading, with its bytes) — the same object the vram SSE frame carries, so a page can fetch once and then follow the stream.",
        "operationId": "get_api_vram",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/vram` and the `vram` SSE frame — measured figures and\nestimated ones are separate fields on\npurpose: the UI must be able to say which is which.",
                  "properties": {
                    "active": {
                      "description": "Whether admission is actually arbitrating; false is explained by\n`inactive_reason`.",
                      "type": "boolean"
                    },
                    "benchmark": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/VramBenchmark"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The benchmark run holding the card, if one does: no local model is admitted until it ends."
                    },
                    "capacity_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "devices": {
                      "items": {
                        "$ref": "#/components/schemas/VramDevice"
                      },
                      "type": "array"
                    },
                    "downloading": {
                      "description": "Starts whose model's engine image is still downloading (machine-check\ndesign §5), oldest first: each `phase` is `downloading` with the bytes\nso far. They hold no place in `queue` and nothing on the card; once\nits download is done a start is admitted like any other, and enters\n`queue` if it has to wait for room. Absent from an older gateway's\nframe.",
                      "items": {
                        "$ref": "#/components/schemas/VramWaiter"
                      },
                      "type": "array"
                    },
                    "draining": {
                      "description": "Resident model ids that are busy or still starting while hold is\nactive — visible continuously, not only in the one-shot `hold_set`\nresponse. Empty whenever hold is not active.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "estimated_resident_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "external_trigger_active": {
                      "description": "Whether the outside-VRAM fallback can fire right now.",
                      "type": "boolean"
                    },
                    "external_trigger_reason": {
                      "description": "Why it cannot, when it cannot (the switch, admission, the hold, no\ntelemetry, an unattributable lmgw model).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "free_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "free_measured": {
                      "description": "False when `free_bytes` was derived from the estimate rather than read\nfrom the driver.",
                      "type": "boolean"
                    },
                    "headroom_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "hold_active": {
                      "description": "The `hold.active` setting — hold is a switch on\nthe resolve/start paths, orthogonal to `enabled`/`active` above.",
                      "type": "boolean"
                    },
                    "inactive_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kept_free": {
                      "$ref": "#/components/schemas/VramKeptFree",
                      "description": "What `free_bytes` was lowered by on top of the memory in use, by\nreason. With a measured free figure, `free_bytes` is the capacity's\nmeasured free memory — the devices' free memory, or with\n`vram.budget_mb` the budget less the devices' used memory — less\nthese (never below zero). The devices' total less their used and free\nmemory is in neither: memory the probe reports as not available\n(NVML: the driver's own reserve; an AMD APU: GTT the host's RAM\ncannot back)."
                    },
                    "kv_pools": {
                      "description": "The token ledger of every guarded unified-KV chat model with a request\nin flight or waiting — `vram::VramView`'s\n`kv_pools`. Absent from an older gateway's frame, hence the default.",
                      "items": {
                        "$ref": "#/components/schemas/VramKvPool"
                      },
                      "type": "array"
                    },
                    "lmgw_share_bytes": {
                      "description": "lmgw's own share of the pooled devices' used memory, measured per\nprocess. `None` when it\ncannot be measured — see `external_trigger_reason`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "note": {
                      "type": "string"
                    },
                    "outside_share_bytes": {
                      "description": "Used memory that is not lmgw's — games, the desktop, other apps.\n`None` exactly when `lmgw_share_bytes` is.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "queue": {
                      "items": {
                        "$ref": "#/components/schemas/VramWaiter"
                      },
                      "type": "array"
                    },
                    "resident": {
                      "items": {
                        "$ref": "#/components/schemas/VramResident"
                      },
                      "type": "array"
                    },
                    "telemetry": {
                      "description": "Where the measured numbers come from, verbatim.",
                      "type": "string"
                    },
                    "telemetry_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "enabled",
                    "active",
                    "inactive_reason",
                    "telemetry",
                    "telemetry_ok",
                    "headroom_bytes",
                    "capacity_bytes",
                    "free_bytes",
                    "free_measured",
                    "kept_free",
                    "estimated_resident_bytes",
                    "devices",
                    "resident",
                    "queue",
                    "downloading",
                    "note",
                    "hold_active",
                    "draining",
                    "kv_pools",
                    "lmgw_share_bytes",
                    "outside_share_bytes",
                    "external_trigger_active",
                    "external_trigger_reason",
                    "benchmark"
                  ],
                  "title": "VramStatus",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get the GPU ledger",
        "tags": [
          "status"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/api/wiring": {
      "get": {
        "description": "The signal path per model, composed server-side: which upstream, which container, which fallback — shared verbatim with the Wiring page.",
        "operationId": "get_api_wiring",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /api/wiring` — every link of the chain\n(source → GGUF on disk → exposure → llama-server), joined\nserver-side. The client only picks colors and fix-links from these facts;\nit never cross-references the models/aliases/downloads lists itself.",
                  "properties": {
                    "base_url": {
                      "description": "Gateway base URL without `/v1`.",
                      "type": "string"
                    },
                    "locals": {
                      "items": {
                        "$ref": "#/components/schemas/LocalChain"
                      },
                      "type": "array"
                    },
                    "models_dir": {
                      "description": "Chat models dir, empty when unset — then nothing can be scanned.",
                      "type": "string"
                    },
                    "models_dir_missing": {
                      "type": "boolean"
                    },
                    "orphans": {
                      "description": "GGUFs on disk no local model references (as weights, projector or\ndrafter).",
                      "items": {
                        "$ref": "#/components/schemas/OrphanGguf"
                      },
                      "type": "array"
                    },
                    "upstreams": {
                      "description": "Remote upstreams only (llama-server-kind ones are the local chains).",
                      "items": {
                        "$ref": "#/components/schemas/UpstreamChain"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "locals",
                    "orphans",
                    "upstreams",
                    "models_dir",
                    "models_dir_missing",
                    "base_url"
                  ],
                  "title": "WiringView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get the model wiring diagram",
        "tags": [
          "models"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/alignments": {
      "post": {
        "description": "POST /v1/audio/alignments, dispatched in the gateway (see /audio-lab/api/speech): forced alignment for a model whose task is align, multipart upload only. The body size is not limited. With `group=<id>` (a group POST /audio-lab/api/groups made for this route) the call is kept in the lab store as that group's run: the request as sent (an upload as a summary, its files the group's input artifacts; a part without a filename is a text field only when it has no type of its own but text and is UTF-8), and the answer as it streams to the client, recorded before its last byte arrives. Speech that succeeded is an output artifact, written to its file as it streams; a task's base64 audio (`audio`, `named_audio_outputs[].audio`, an event's `audio`) is an output artifact each, `lab-artifact:<id>` in its place in the kept text; any other answer is its text. A client that stops reading leaves the run as far as it got, error code `stopped`; one that goes while the run is being written does not take it. The group is in flight from the claim to the run. A group that is not the Audio lab's is a 404, one made for another route a 400 `wrong_route`, a request naming another model than the group's (or none) a 400 `wrong_model` naming both, one answered or being answered a 409 `cell_answered`, each before anything is sent. Every failure is the `/v1` route's OpenAI envelope, relayed as it came.",
        "operationId": "post_audio_lab_api_alignments",
        "parameters": [
          {
            "in": "query",
            "name": "group",
            "required": false,
            "schema": {
              "default": null,
              "description": "The group; absent, the request is relayed and nothing is kept.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioAlignmentsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A forced alignment: the submitted transcript and where each of its words\nis spoken in the clip.",
                  "properties": {
                    "language": {
                      "description": "The language as the model reported it (`en`, `de`; the model's own\nspelling). Absent when the model says none.\n\nA model may report the language it assumes rather than the one it was\nasked to align in: CrisperWhisper's aligner answers its default, `en`,\nto any `language` (checked 2026-10-22 with `de`, `german` and none).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sample_rate": {
                      "description": "The rate, in Hz, the `start_sample` and `end_sample` of the words\ncount in: the model's own figure when its answer states one, else\nderived from the words' seconds and samples (they are what the\nsamples count in, even where the engine resampled the clip), else the\nuploaded WAV's header. Absent when none of the three works; the\nseconds are always there.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "text": {
                      "description": "The transcript as the client submitted it (the multipart `text`\nfield), not what the model echoes. `char_start` and `char_end` of the\nwords index into this string.",
                      "type": "string"
                    },
                    "timing": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AudioTiming"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How long the engine took, as it reports it (audio.cpp's `timing`\nobject, which both aligners send). Absent when the answer has none."
                    },
                    "words": {
                      "description": "The words in the order the model answered them, which is the\ntranscript's order.",
                      "items": {
                        "$ref": "#/components/schemas/AlignedWord"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "text",
                    "words"
                  ],
                  "title": "AudioAlignment",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Align audio to text",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "asr",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/groups": {
      "post": {
        "description": "Makes a kept group of one cell in the Audio lab's history, before its request is sent: the model, the route it asks and the page's whole form (every panel, the speech settings, the PCM format a stream is assembled with), so a re-opened group puts the form back as it was. Answers the group with no run; the request goes to that route's hand-off with `group=<id>`, which records it as the run, so the hand-off's body stays the /v1 route's own. 400 for a blank model, 422 for a body that is not an AudioAsk (both answered `{error}`), 500 when the store cannot keep it. The body size is not limited.",
        "operationId": "post_audio_lab_api_groups",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /audio-lab/api/groups`: a kept group of one cell, made before its\nrequest is sent. The request itself goes to the route's lab hand-off with\n`?group=<id>`, which records it as the group's run.",
                "properties": {
                  "form": {
                    "$ref": "#/components/schemas/AudioLabForm"
                  },
                  "model": {
                    "description": "The alias the request names.",
                    "type": "string"
                  },
                  "route": {
                    "$ref": "#/components/schemas/AudioRoute"
                  }
                },
                "required": [
                  "model",
                  "route",
                  "form"
                ],
                "title": "AudioAsk",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What one click in a lab produced, or one item of a set run.",
                  "properties": {
                    "artifacts": {
                      "description": "The group's inputs, in order.",
                      "items": {
                        "$ref": "#/components/schemas/LabArtifactView"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "form": {
                      "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "in_flight": {
                      "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
                      "type": "boolean"
                    },
                    "item": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LabBatchItem"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The set run it is an item of; `null` for a group of the history."
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "override": {
                      "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
                      "items": {
                        "$ref": "#/components/schemas/LabCell"
                      },
                      "type": "array"
                    },
                    "runs": {
                      "description": "The runs so far, in cell order.",
                      "items": {
                        "$ref": "#/components/schemas/LabRunView"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Derived once from the form: the state's first line, a prompt.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "title",
                    "form",
                    "plan",
                    "override",
                    "created_at",
                    "runs",
                    "artifacts",
                    "item",
                    "in_flight"
                  ],
                  "title": "LabGroupView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Keep a group for a hand-off",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": true
      }
    },
    "/audio-lab/api/models": {
      "get": {
        "description": "The enabled audio models with what a form needs to shape itself: `task` decides text-to-speech, speech-to-text or another audio.cpp task, `mode` whether streaming is offered. GET /v1/models flattens every upstream to a few fields and cannot say this. The audio containers' state rides along so a client can say \"not running\" before a request fails, as does where the voice library lives (`voices_dir` on the host, `container_voices_dir` in the container) and whether the audio class's voice directory is that library.",
        "operationId": "get_audio_lab_api_models",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /audio-lab/api/models`. `R` is the shape of a container row: the\ngateway fills in its own runtime view, a reader (and the API document)\nuses `RuntimeStatus`.",
                  "properties": {
                    "container_voices_dir": {
                      "description": "The same directory as the model container sees it: what goes into a\nrequest's `voice_ref`.",
                      "type": "string"
                    },
                    "models": {
                      "description": "The enabled audio models.",
                      "items": {
                        "$ref": "#/components/schemas/AudioLabModel"
                      },
                      "type": "array"
                    },
                    "runtime": {
                      "description": "One row per running or starting audio container, so a client can say\n\"not running\" before a request fails. Matched to a model by `model_id`.",
                      "items": {
                        "$ref": "#/components/schemas/RuntimeStatus"
                      },
                      "type": "array"
                    },
                    "voice_library_active": {
                      "description": "Whether the audio class's voice directory is this library. When it is,\na clip's name (without extension) is also a `voice` every text-to-speech\nmodel answers to; when not, a clip is only a `voice_ref` path.",
                      "type": "boolean"
                    },
                    "voices_dir": {
                      "description": "The voice library's directory on the gateway's host; `null` while no\naudio models directory is set.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "models",
                    "runtime",
                    "voices_dir",
                    "container_voices_dir",
                    "voice_library_active"
                  ],
                  "title": "AudioLabModels",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the audio models",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/refs": {
      "get": {
        "description": "The reference clips stored in the voice library (the `voices` folder of the audio models directory), by file name, each with the path the model container sees (`server_path`: what a request's `voice_ref` takes), the `voice` name it answers to once the audio class's voice directory is this library, and its transcript. Without an audio models directory the answer is a 200 with no clips and an `error` saying so.",
        "operationId": "get_audio_lab_api_refs",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /audio-lab/api/refs`.",
                  "properties": {
                    "clips": {
                      "description": "The library's clips by file name; empty without an audio models\ndirectory.",
                      "items": {
                        "$ref": "#/components/schemas/Clip"
                      },
                      "type": "array"
                    },
                    "error": {
                      "description": "Present, with a 200, when no audio models directory is configured.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "clips"
                  ],
                  "title": "ClipList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the voice library",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Stores one or more clips in the voice library, each written whole or not at all. audio.cpp takes a clone's reference as a path on the server rather than an upload, which is what the library is for: a stored clip reads in the container as /models/voices/<name>. A `transcript` field with exactly one file is written to the library's transcript index. Otherwise, when the audio settings name a transcription model, each clip is transcribed with it: `transcribed` has an entry per clip, either who wrote the transcript or why none was written; the upload stands either way. 400 for a bad file name, a malformed body, no file field or an audio models directory that is not configured; 500 when the disk refuses. A gateway started from a development build whose audio models directory is the installed app's refuses the write (400, code dev_shared_models_dir). The body size is not limited.",
        "operationId": "post_audio_lab_api_refs",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioLabUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /audio-lab/api/refs`.",
                  "properties": {
                    "clips": {
                      "description": "The library after the upload.",
                      "items": {
                        "$ref": "#/components/schemas/Clip"
                      },
                      "type": "array"
                    },
                    "saved": {
                      "description": "The file names stored, in upload order.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "transcribed": {
                      "description": "One entry per stored clip when no transcript was typed for it and the\naudio settings name a transcription model; empty otherwise.",
                      "items": {
                        "$ref": "#/components/schemas/ClipTranscription"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "saved",
                    "transcribed",
                    "clips"
                  ],
                  "title": "ClipsUploaded",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Upload reference clips",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": true
      }
    },
    "/audio-lab/api/refs/{name}": {
      "get": {
        "description": "The stored clip's bytes, with the content type its extension implies, for a player, and Accept-Ranges: bytes. One Range (bytes=a-b, bytes=a- or bytes=-n) answers 206 with Content-Range; the answer carries an ETag made from the file (inode, length, modification time) and X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox; If-Range with that ETag applies the range, any other If-Range serves the whole clip, and so does a Range lmgw does not read; a Range on an empty clip serves it whole (200); 416 range_not_satisfiable (Content-Range: bytes */size, a {code, message} body) for a range that names no byte of it. 400 \"invalid clip\" for a name that is not a plain file name, 404 for a clip that is not there; both answer `{error}`.",
        "operationId": "get_audio_lab_api_refs_name",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/aac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/flac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/ogg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a reference clip",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/refs/{name}/delete": {
      "post": {
        "description": "Deletes the clip and its transcript line; a transcript left behind would attach itself to the next clip uploaded under the name. Answers the library after the change. 400 \"invalid clip\" for a name that is not a plain file name; 500 when the file cannot be removed (a clip that is not there included). A development gateway whose audio models directory is the installed app's refuses (400, code dev_shared_models_dir).",
        "operationId": "post_audio_lab_api_refs_name_delete",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to a change of the library: a delete or a transcript set.",
                  "properties": {
                    "clips": {
                      "description": "The library after the change.",
                      "items": {
                        "$ref": "#/components/schemas/Clip"
                      },
                      "type": "array"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "clips"
                  ],
                  "title": "ClipsAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a reference clip",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": true
      }
    },
    "/audio-lab/api/refs/{name}/text": {
      "post": {
        "description": "Sets, or with an empty string drops, the clip's line in the library's transcript index. This is what makes a library clip a voice and not just a path: when the audio class's voice directory is the library, a request with \"voice\": \"<name>\" clones the clip and the engine reads this line as the reference text the caller did not send. A cloning model without one reads the target text in an unconditioned voice. 404 for a clip that is not there; 400 \"invalid clip\" for a bad name; 422 when the body is not JSON of the shape `{transcript: string}` (answered `{error}` with the reason). A development gateway whose audio models directory is the installed app's refuses (400, code dev_shared_models_dir).",
        "operationId": "post_audio_lab_api_refs_name_text",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /audio-lab/api/refs/{name}/text`'s body.",
                "properties": {
                  "transcript": {
                    "default": "",
                    "description": "The clip's transcript. A newline is stored as a space; empty drops the\nclip's transcript.",
                    "type": "string"
                  }
                },
                "title": "SetRefText",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to a change of the library: a delete or a transcript set.",
                  "properties": {
                    "clips": {
                      "description": "The library after the change.",
                      "items": {
                        "$ref": "#/components/schemas/Clip"
                      },
                      "type": "array"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "clips"
                  ],
                  "title": "ClipsAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Set a clip's transcript",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": true
      }
    },
    "/audio-lab/api/refs/{name}/transcribe": {
      "post": {
        "description": "Has a speech-to-text model write the clip's transcript, replacing one it had. The body is optional; one whose `alias` is not a string is a 422 (answered `{error}` with the reason), not a silent fall back to another model. `name` is the file name or the voice name. The model is the body's `alias`, else the audio settings' clip-transcription model; with neither the answer is a 400 saying so. The model may be local or a cloud alias, and a configured fallback answers as for any request when the GPU hold or an outside process keeps the model off the card: `transcript_source`, `answered_by`, `fallback_reason` and `message` say who wrote it. 400 also when the alias is no speech-to-text model, the clip is unreadable, the model heard no speech, or it failed. Unlike the dashboard's bulk operation (voice_transcribe) this is one clip.",
        "operationId": "post_audio_lab_api_refs_name_transcribe",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /audio-lab/api/refs/{name}/transcribe`'s body.",
                "properties": {
                  "alias": {
                    "default": null,
                    "description": "The speech-to-text alias to use. Blank or absent: the audio settings'\ntranscription model.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "TranscribeRef",
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to `POST /audio-lab/api/refs/{name}/transcribe`.",
                  "properties": {
                    "answered_by": {
                      "description": "The fallback alias that answered in place of the one asked, else `null`.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "by": {
                      "description": "Who wrote it, in a sentence.",
                      "type": "string"
                    },
                    "clip": {
                      "description": "The clip as asked (a file name or a voice name).",
                      "type": "string"
                    },
                    "clips": {
                      "description": "The library after the change.",
                      "items": {
                        "$ref": "#/components/schemas/Clip"
                      },
                      "type": "array"
                    },
                    "fallback_reason": {
                      "description": "Why the fallback answered (`hold`, `external_vram`, ...), else `null`.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "message": {
                      "description": "A sentence saying who transcribed it, a fallback that answered named\nas one.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    },
                    "transcript": {
                      "description": "The transcript recorded: one line, replacing the clip's earlier one.",
                      "type": "string"
                    },
                    "transcript_source": {
                      "description": "`asr:<model>`: the model the transcript came from. When a fallback\nanswered, that model's name.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "clip",
                    "transcript",
                    "clips",
                    "message",
                    "transcript_source",
                    "answered_by",
                    "fallback_reason",
                    "by"
                  ],
                  "title": "ClipTranscribed",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Transcribe a reference clip",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "lab",
        "x-lmgw-writes": true
      }
    },
    "/audio-lab/api/speech": {
      "post": {
        "description": "POST /v1/audio/speech, dispatched in the gateway: the same handler, so alias resolution, the model rewrite, error normalization and logging are the route's own and the call appears in the request log. Only the gateway's key check and the HTTP hop are skipped; the call is the dashboard's and is not budgeted or scoped to a key. The request and the answer are the /v1 route's, relayed verbatim: a WAV or other audio body, or with stream_format an event stream or chunked PCM, and an error in the OpenAI envelope. The body size is not limited. With `group=<id>` (a group POST /audio-lab/api/groups made for this route) the call is kept in the lab store as that group's run: the request as sent (an upload as a summary, its files the group's input artifacts; a part without a filename is a text field only when it has no type of its own but text and is UTF-8), and the answer as it streams to the client, recorded before its last byte arrives. Speech that succeeded is an output artifact, written to its file as it streams; a task's base64 audio (`audio`, `named_audio_outputs[].audio`, an event's `audio`) is an output artifact each, `lab-artifact:<id>` in its place in the kept text; any other answer is its text. A client that stops reading leaves the run as far as it got, error code `stopped`; one that goes while the run is being written does not take it. The group is in flight from the claim to the run. A group that is not the Audio lab's is a 404, one made for another route a 400 `wrong_route`, a request naming another model than the group's (or none) a 400 `wrong_model` naming both, one answered or being answered a 409 `cell_answered`, each before anything is sent. Every failure is the `/v1` route's OpenAI envelope, relayed as it came.",
        "operationId": "post_audio_lab_api_speech",
        "parameters": [
          {
            "in": "query",
            "name": "group",
            "required": false,
            "schema": {
              "default": null,
              "description": "The group; absent, the request is relayed and nothing is kept.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioSpeechRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "audio/aac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/flac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/ogg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/opus": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/pcm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Synthesize speech",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "tts",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/tasks/run": {
      "post": {
        "description": "POST /v1/tasks/run, dispatched in the gateway (see /audio-lab/api/speech): audio.cpp's generic task route, the way to reach the tasks with no OpenAI shape. `stream=1` sends it to /v1/tasks/stream instead, which a streaming-mode model answers with its buffered event list. The answer is the task's own JSON, relayed. The body size is not limited. With `group=<id>` (a group POST /audio-lab/api/groups made for this route) the call is kept in the lab store as that group's run: the request as sent (an upload as a summary, its files the group's input artifacts; a part without a filename is a text field only when it has no type of its own but text and is UTF-8), and the answer as it streams to the client, recorded before its last byte arrives. Speech that succeeded is an output artifact, written to its file as it streams; a task's base64 audio (`audio`, `named_audio_outputs[].audio`, an event's `audio`) is an output artifact each, `lab-artifact:<id>` in its place in the kept text; any other answer is its text. A client that stops reading leaves the run as far as it got, error code `stopped`; one that goes while the run is being written does not take it. The group is in flight from the claim to the run. A group that is not the Audio lab's is a 404, one made for another route a 400 `wrong_route`, a request naming another model than the group's (or none) a 400 `wrong_model` naming both, one answered or being answered a 409 `cell_answered`, each before anything is sent. Every failure is the `/v1` route's OpenAI envelope, relayed as it came.",
        "operationId": "post_audio_lab_api_tasks_run",
        "parameters": [
          {
            "in": "query",
            "name": "group",
            "required": false,
            "schema": {
              "default": null,
              "description": "The kept group (`POST /audio-lab/api/groups`) whose run this request\nis; absent, nothing is kept.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "stream",
            "required": false,
            "schema": {
              "default": false,
              "description": "`1`, `true`, `yes` or `on` selects `/v1/tasks/stream`, which a\nstreaming-mode model answers with its buffered event list.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "x-lmgw-untyped": "audio.cpp's own per-task JSON, relayed verbatim"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Run a generic task",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/transcriptions": {
      "post": {
        "description": "POST /v1/audio/transcriptions, dispatched in the gateway (see /audio-lab/api/speech for what that means), with both of that route's request shapes: a multipart upload, or JSON naming a clip on the model server by path. `details=1` sends the request to /v1/audio/transcriptions/details instead, which also answers with the word timings, segments and speaker turns the model produced; the lab is where to find out whether a model produces any. The body size is not limited. With `group=<id>` (a group POST /audio-lab/api/groups made for this route) the call is kept in the lab store as that group's run: the request as sent (an upload as a summary, its files the group's input artifacts; a part without a filename is a text field only when it has no type of its own but text and is UTF-8), and the answer as it streams to the client, recorded before its last byte arrives. Speech that succeeded is an output artifact, written to its file as it streams; a task's base64 audio (`audio`, `named_audio_outputs[].audio`, an event's `audio`) is an output artifact each, `lab-artifact:<id>` in its place in the kept text; any other answer is its text. A client that stops reading leaves the run as far as it got, error code `stopped`; one that goes while the run is being written does not take it. The group is in flight from the claim to the run. A group that is not the Audio lab's is a 404, one made for another route a 400 `wrong_route`, a request naming another model than the group's (or none) a 400 `wrong_model` naming both, one answered or being answered a 409 `cell_answered`, each before anything is sent. Every failure is the `/v1` route's OpenAI envelope, relayed as it came.",
        "operationId": "post_audio_lab_api_transcriptions",
        "parameters": [
          {
            "in": "query",
            "name": "details",
            "required": false,
            "schema": {
              "default": false,
              "description": "`1`, `true`, `yes` or `on` sends the request to\n`/v1/audio/transcriptions/details` instead, which also answers with the\nword timings, segments and speaker turns the model produced.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "group",
            "required": false,
            "schema": {
              "default": null,
              "description": "The kept group (`POST /audio-lab/api/groups`) whose run this request\nis; absent, nothing is kept.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AudioTranscription"
                    },
                    {
                      "$ref": "#/components/schemas/AudioTranscriptionDetails"
                    }
                  ],
                  "description": "The transcription as /v1/audio/transcriptions answers it; with ?details=1 as /v1/audio/transcriptions/details answers it."
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Transcribe audio",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "asr",
        "x-lmgw-writes": false
      }
    },
    "/audio-lab/api/voices": {
      "get": {
        "description": "The voices of a text-to-speech model, for a voice picker, read the moment a model is selected. A local model is answered from the gateway's own catalog (what GET /v1/audio/voices answers by default): its presets, the voices its package ships, the embeddings of its folder and the voice library's clips, each with a `kind`, the `default` voice, the shipped voices its package lacks on disk (`missing`) and `held`. Nothing is ever started or claimed, so this works while the model is not running and under the GPU hold. When the model's container is already up, the names only its own server reports (a row whose `extra_run_args` mount another voice directory) are added as `engine` entries. Under the GPU hold the catalog is still answered with `held: true`; when the gate would send a request to a fallback alias, `fallback` names it and its provider is not asked for a list. A remote model is asked. An empty list is normal: the model carries no cached voice ids and wants a reference clip. Failures are /v1/audio/voices' own OpenAI envelope.",
        "operationId": "get_audio_lab_api_voices",
        "parameters": [
          {
            "in": "query",
            "name": "model",
            "required": true,
            "schema": {
              "description": "The model alias to list voices for.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to `GET /audio-lab/api/voices`.",
                  "properties": {
                    "default": {
                      "description": "What speaks when a request names no voice.",
                      "type": "string"
                    },
                    "engine_asked": {
                      "description": "Whether a running container was also asked for names the catalog\nlacks. Nothing is ever started for it.",
                      "type": "boolean"
                    },
                    "fallback": {
                      "description": "The fallback alias that would answer a request now, when the gate\nre-routes this model to one (see `held`). The list is still the\nmodel's own catalog; the fallback's provider is never asked for it.",
                      "type": "string"
                    },
                    "held": {
                      "description": "The GPU hold (or a benchmark, or another program's VRAM) keeps this\nmodel from speaking right now; the list is still answered. A request\nnow is refused, or answered by `fallback`.",
                      "type": "boolean"
                    },
                    "missing": {
                      "description": "Voices the model's package names but lacks on disk; the Audio\ncatalog's Download on the package fetches them.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "needs_transcript": {
                      "description": "Whether this model refuses a library clip without a recorded\ntranscript.",
                      "type": "boolean"
                    },
                    "source": {
                      "$ref": "#/components/schemas/LabVoicesSource",
                      "description": "Where the list was read: lmgw's catalog, or a remote upstream."
                    },
                    "voices": {
                      "description": "Every voice name the model answers to, sorted by id.",
                      "items": {
                        "$ref": "#/components/schemas/LabVoice"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "voices",
                    "missing",
                    "needs_transcript",
                    "held",
                    "source",
                    "engine_asked"
                  ],
                  "title": "LabVoices",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a model's voices",
        "tags": [
          "audio-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/attachments/{id}": {
      "get": {
        "description": "The stored file as uploaded, with the media type the bytes were sniffed as (image/png, application/pdf, audio/wav, ...); a text file is served as text/plain; charset=utf-8. The answer carries X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox, so a file opened in a browser cannot run anything, and Accept-Ranges: bytes. One Range (bytes=a-b, bytes=a- or bytes=-n) answers 206 with Content-Range, as a media player resumes or seeks; a Range lmgw does not read (several ranges, another unit), or any If-Range, serves the whole file. 416 range_not_satisfiable, with Content-Range: bytes */size, for a range that names no byte of the file. 404 not_found for an attachment that is not there or not the caller's.",
        "operationId": "get_chat_api_attachments_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read an attachment's bytes",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/attachments/{id}/delete": {
      "post": {
        "description": "Removes an attachment that was not sent yet. 404 not_found for one that is not there or not the caller's; 409 attachment_sent once it was sent with a message (it belongs to that message then).",
        "operationId": "post_chat_api_attachments_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a draft attachment",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/attachments/{id}/media": {
      "post": {
        "description": "Runs one action on a picture of a thread, directly — no chat model is called: reroll draws it again with the same prompt and settings and a new seed (an edit is made again from the picture it started from), vary makes a variation of it on a model without instruction edits and edit changes it by an instruction on a model with them (prompt defaults to the picture's own, strength to its own for vary), upscale runs an ESRGAN upscaler (upscaler: a file stem of the image models dir's upscalers/, the server's first one when omitted; repeats 1 to 4) on a local image model — a resident one that can upscale, preferring the one that made the picture, else that one, else the smallest. The model rows are the caller's. The answer is SSE: `action` first (call_id act-<boot>-<n>, unique across restarts, the action, the model, the source attachment), `progress` frames while it runs (lossy: a newer one supersedes an older), then `done` with the stored picture's attachment metadata and a sentence about it, or `error`. The picture is stored as an attachment of the thread with source action, bound to the source's message, its meta.media naming parent; it is not shown to the thread's model, nor named to it by att:N, unless the user attaches it (a copy as an upload). The action goes on when the stream is closed; a key that is revoked stops it and ends the stream with an `error` frame (code revoked), a gateway that stops ends the stream with code gateway_stopping; a thread deleted or kept as a stored chat while it runs stops it, its `error` code thread_gone, and nothing of it is kept. An upscale whose result would exceed the chosen image model's max_upscale_width/height is refused with too_large, naming the numbers. Refused before any frame: 404 not_found for an attachment that is not there or not the caller's, 422 not_an_image, 409 not_sent for a picture of no message yet (a draft, a reply still being written), 422 no_model, model_unavailable, not_rerollable, source_missing, wrong_action, prompt_required, no_upscaler, no_image_model, unknown_upscaler or bad_request for what the picture or the body lacks.",
        "operationId": "post_chat_api_attachments_id_media",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/attachments/{id}/media` (design §8.3): run one action on\na picture of the thread. Every field but `action` is optional; what a\nfield does not say is the source picture's own (its prompt, its strength)\nor the server's (the upscaler, one repeat).",
                "properties": {
                  "action": {
                    "$ref": "#/components/schemas/MediaAction"
                  },
                  "prompt": {
                    "description": "`vary` and `edit`: the prompt, the source's own when omitted.",
                    "type": "string"
                  },
                  "repeats": {
                    "description": "`upscale`: how many times to run it, 1 to 4 (sd-server's bound).",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "strength": {
                    "description": "`vary`: how far to move from the picture, 0 to 1; the source's own\nwhen omitted, else the row's default.",
                    "format": "double",
                    "type": "number"
                  },
                  "upscaler": {
                    "description": "`upscale`: the upscaler's name (a file stem of the image models dir's\n`upscalers/`); the server's first compatible one when omitted.",
                    "type": "string"
                  }
                },
                "required": [
                  "action"
                ],
                "title": "MediaActionRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "action": {
                "description": "The action stream's first frame (`event: action`): the id the action\nruns under — what its progress frames carry as `call_id`, and what the\nmedia cancel route takes — and the model it runs on.",
                "properties": {
                  "action": {
                    "description": "`reroll`, `vary`, `edit` or `upscale`.",
                    "type": "string"
                  },
                  "call_id": {
                    "description": "`act-<boot>-<n>`: `<boot>` 32 random bits (eight hex digits) drawn\nonce per gateway process, `<n>` a counter, so a later process repeats\nan id only if it draws the same bits.",
                    "type": "string"
                  },
                  "model": {
                    "description": "The model the action runs on (`image/z-image-turbo`); absent for an\nupscale, whose row the gateway picks when it runs (its `done` names\nit).",
                    "type": "string"
                  },
                  "source": {
                    "description": "The attachment the action started from.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "call_id",
                  "action",
                  "source"
                ],
                "title": "MediaActionStarted",
                "type": "object"
              },
              "done": {
                "description": "The action's last frame on success (`event: done`): the picture it made,\nstored as the thread's attachment (`source = \"action\"`, bound to the\nsource's message, `meta.media.parent` the source), and a sentence about\nit.",
                "properties": {
                  "attachment": {
                    "$ref": "#/components/schemas/AttachmentMeta"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "text": {
                    "description": "What happened, in words: `Made image att:58 (1024x1024) with …`.",
                    "type": "string"
                  }
                },
                "required": [
                  "call_id",
                  "attachment",
                  "text"
                ],
                "title": "MediaActionDone",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "progress": {
                "description": "The `progress` event of a `tool` frame: a running image or audio call's\nstage, step and latest preview. Lossy: a reader that falls behind misses\nsome (the next one supersedes them), and they are not in the change\nfeed.",
                "properties": {
                  "call_id": {
                    "description": "The call's id, as its `ready` frame carries it.",
                    "type": "string"
                  },
                  "cancel": {
                    "$ref": "#/components/schemas/CancelKind",
                    "description": "What a cancel would do now, while an image job runs; absent before\nthe job exists (a cancel then just stops the wait) and for audio."
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "elapsed_ms": {
                    "description": "Since the call started.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "free_bytes": {
                    "description": "`waiting_for_room`: the memory free when it was last measured.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image reference being downloaded.",
                    "type": "string"
                  },
                  "model": {
                    "description": "The model the phase is about: the one being unloaded for\n`unloading`, the call's own otherwise.",
                    "type": "string"
                  },
                  "needs_bytes": {
                    "description": "`waiting_for_room`: the memory the model needs, headroom included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "pass": {
                    "description": "The sampling pass (a batch item, a high- or low-noise stage, a hires\npass); a new pass starts its steps again.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "phase": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MediaPhase"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "preview": {
                    "description": "The latest preview as the image server drew it: base64, PNG. Its\npixel size depends on the row's preview mode (a quick sketch is the\nlatent's size, an eighth of the picture's side on the spike's\npipeline).",
                    "type": "string"
                  },
                  "queue_position": {
                    "description": "`queued`: the job's place in the image server's queue.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not (\"size not\nknown — …\").",
                    "type": "string"
                  },
                  "step": {
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent when it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total_steps": {
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "call_id",
                  "phase",
                  "elapsed_ms"
                ],
                "title": "ToolProgressFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Run an image card's action",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/attachments/{id}/mode": {
      "post": {
        "description": "Sets how a PDF whose every page has text goes to the model: mode text sends the extracted text, images sends the pages as images. Drafts only. 400 bad_request for another mode, 404 not_found for an attachment that is not there or not the caller's, 409 attachment_sent once it was sent, 422 mode_not_applicable for any file but a text-class PDF (scanned and hybrid ones, and every other kind, are sent automatically).",
        "operationId": "post_chat_api_attachments_id_mode",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/attachments/{id}/mode`'s body.",
                "properties": {
                  "mode": {
                    "description": "`text` sends the PDF's extracted text, `images` its pages as\nimages.",
                    "enum": [
                      "text",
                      "images"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "mode"
                ],
                "title": "ModeRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to a mode change.",
                  "properties": {
                    "id": {
                      "description": "The attachment.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "mode": {
                      "description": "The mode now set, `text` or `images`.",
                      "type": "string"
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "mode"
                  ],
                  "title": "ModeSet",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Choose how a PDF is sent",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/attachments/{id}/text": {
      "get": {
        "description": "A text file as it is, a PDF's or office file's extracted text, or an audio file's transcript, as text/plain; charset=utf-8, with X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox. 404 not_found for an attachment that is not there or not the caller's, and 404 no_text for an image, or an audio file with no transcript yet.",
        "operationId": "get_chat_api_attachments_id_text",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/plain; charset=utf-8": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read what the model reads of an attachment",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/attachments/{id}/transcribe": {
      "post": {
        "description": "Runs the speech-to-text call again for an audio draft, after it failed at upload or once a model is set, and answers the attachment's new `meta` (the transcript's alias and token estimate in place of `transcript_error`). The body is empty. 404 not_found for an attachment that is not there or not the caller's, 409 attachment_sent once it was sent, 422 not_audio for any other kind, 422 stt_not_set when no speech-to-text model is set for the thread, 422 transcription_failed with the call's own message.",
        "operationId": "post_chat_api_attachments_id_transcribe",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer to a new transcription.",
                  "properties": {
                    "id": {
                      "description": "The attachment.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/AttachmentFacts",
                      "description": "The attachment's `meta` now, the transcript's alias and token\nestimate in place of the earlier `transcript_error`. The same object\nas `AttachmentMeta::meta`."
                    },
                    "ok": {
                      "description": "Always `true`; a refusal is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "meta"
                  ],
                  "title": "Transcribed",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Transcribe an audio draft again",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/export": {
      "get": {
        "description": "A zip with one file per stored thread, in the format asked for (md or json, as for one thread), a directory per folder named after it, and a README.txt. archived=0 takes the active threads, 1 the archived ones, all (the default) both; another value is a 400 bad_request, as is a format other than md, markdown or json. The answer carries Content-Disposition: attachment (lmgw-chats-{date}.zip), Content-Length and Cache-Control: no-store; it is as large as the Chat is and not capped. Temporary threads are not part of a zip. A device key's zip leaves out Admin Chat threads.",
        "operationId": "get_chat_api_export",
        "parameters": [
          {
            "in": "query",
            "name": "archived",
            "required": false,
            "schema": {
              "default": "",
              "description": "Zips only: `0` active threads, `1` archived threads only, `all`\n(default) both.",
              "enum": [
                "0",
                "1",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "",
              "description": "`md` (default; `markdown` is accepted too) for a readable\ntranscript, `json` for the lossless `lmgw.chat.v1` file. A zip holds\none file of this format per thread.",
              "enum": [
                "md",
                "markdown",
                "json"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export every chat",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/feed": {
      "get": {
        "description": "One SSE stream per client. `hello` first: the epoch, the cursor the stream continues from, the keep-alive interval and the retention, who the feed is for, the hold, the turns and voice sessions live now, and open_approvals: every call still waiting for a decision at that cursor in a thread the reader may see (a thread's last reply's open calls), each as approval.requested renders it. For a device, hello also carries its own facts: urls (its row's lmgw URLs, https, in the owner's order: replace the stored list with them), cert ({not_after, notice_after}, RFC 3339 UTC, the dates of its certificate: show the notice from them) and dashboard_url (where the dashboard is, as a URL derived from bind_addr: sent to a device paired as this computer, and to any other only when bind_addr is not loopback; null otherwise). A device's feed also sets TCP_USER_TIMEOUT on its connection to its keep-alive, so a keep-alive a vanished device never acknowledges ends the stream within one more interval. Then stored events (thread.*, folder.*, folder.current, message.*, profile.*, approval.*, task.*, device.revoked), each with an `id:` that is its cursor \"<epoch>:<seq>:<tag>\" (opaque: hand it back as it came), rendered as the thread or folder is when it is delivered (message.added and message.updated carry the thread's id, its title now (thread_title) and the messages the change wrote, whole, as GET /chat/api/threads/{id} lists them now — a user message as stored, a reply once saved (never while it streams), a task result entering the thread, an edit, a continue, a resumed turn, a spoken reply cut to what was heard or annotated, a stored retrieval, a call a reply waits on decided — so a client shows the message or a notification without a fetch; a message gone by delivery is left out, and an event whose messages or thread are all gone is not sent; message.deleted names the ids that went (a delete, the cut of an edit's resend or a regenerate, a spoken reply nobody heard); a thread deleted whole is thread.deleted alone; a profile.* event names the profile's id and name as its write left them; every reader receives it, devices included; approval.requested and approval.decided name a call a turn waits on and its decision, with the call's call_id as the turn's ready, approval and result frames carry it, rendered from the reply (approval.requested with the thread's title now, thread_title, so a client shows it or a notification without a fetch), and are not delivered once the reply is gone (approval.requested neither once its call is decided: the decision follows); task.started names an MCP task a turn's tool call started, task.done its result entering the thread as a message of role tool, both as their write left them; device.revoked names a paired device whose key was deleted, as {kind: device, name}, so a client running work it started (a host of its MCP tasks) may cancel that work — the owner receives every one, a device only one about a device the feed showed it changes of, or that started a task it hosts that was still running; a disable, a rotate or an expiry is no delete and says nothing); and live events (turn.*, voice.*, hold, state, caught_up), which have no id. caught_up {cursor} comes once per stream, when every stored event up to the cursor hello named has been delivered (or passed as not for this reader): right after hello, and the resync and profile list a cursor may owe, when there was nothing to catch up, else right after the catch-up's last event. The approval.* events before it are already reflected in hello.open_approvals; from caught_up on, approval.requested adds to that set and approval.decided removes from it, as does the deletion of its thread or its reply. Every `state` carries open_approvals again, read when it is sent, and replaces that set, matched by approval_request_id (null when lmgw could not read it for a state sent for another reason: keep the set you have; one sent because the set moved ends the stream instead, and the reconnect's hello carries it); the feed sends one after any move of what a device may see, after a thread or folder came into a device's reach (its *.created), and after a resync that passed records — before caught_up when the retention pruned past a stream still catching up, so caught_up hands over the true set. Open the feed first, then load the list: a turn in `hello` may name a thread whose thread.created follows in the catch-up. Resume with ?since=<cursor> or Last-Event-ID (which wins: a browser reconnects with the URL it opened). A cursor the feed cannot honour — another database's, one whose event is not the one the gateway holds at that number now (its data restored from an older copy), older than the retention, newer than the newest — gets `resync` with the reason, then events from now; so does a stream still catching up when the retention prunes past it, and one at an event that cannot be read after a few attempts. Every `resync` is followed by the whole profile list again, as profile.created events without an id. A client that reads live events slower than they happen, past the live buffer, gets `state` instead of the events it missed. Keep-alive comments every keepalive_s seconds: the stream's own when the request asks for one (?keepalive_s=, from 1 to chat_feed_keepalive_max_s, Settings → Chat → Change feed → Longest keep-alive, default 900; outside that a 400 bad_request naming the bound and the setting), else the gateway's chat_feed_keepalive_s; hello.keepalive_s says which. Only the comments follow it: stored events are never held back by a long one. One may carry an `id:` and no data, which only moves the cursor. When the key is disabled, rotated, deleted or expires, `revoked` and the end. When the gateway shuts down, the stream ends without an event: reconnect with the last cursor once it is back. A device key never receives an event about an Admin Chat thread, nor about a folder a device deleted while it held threads the device could not see (until it is shown to devices again); and about a thread or folder with the self-admin toolset (lmgw) attached only while what the device's admin tools may do is above off (hello.self_admin: its level capped by the gateway's self-admin level). The gaps that leaves in the sequence are expected, and a thread in a folder the device does not see is in no folder for it. When a thread or folder leaves a device's reach (the toolset attached), the device receives its deletion, and a fresh `state` when that changed what is live for it; when it comes back (the toolset taken off, the folder shown again), its creation, and the same. When what the device's admin tools may do moves above off (its own level raised, or the gateway's self-admin level raised from off), the threads and folders with the toolset arrive as thread.created and folder.created (and its threads in such a folder as thread.updated), then a fresh `state`; when it moves to off, they go as thread.deleted and folder.deleted, in a delete's order, then a fresh `state`. `state` carries self_admin, what the device's admin tools may do now (its level capped by the gateway's self-admin level), and follows every change of the device's level and every change of the gateway's that moves it, so a connected device learns there that it changed. A device that resumes from a cursor older than a change above off or back gets `resync` at that point instead, and nothing about those threads and folders that it may not see now, or that was written while it could not see them: reload what you show.",
        "operationId": "get_chat_api_feed",
        "parameters": [
          {
            "in": "query",
            "name": "keepalive_s",
            "required": false,
            "schema": {
              "default": null,
              "description": "Seconds between this stream's keep-alive comments, from 1 to\n`chat_feed_keepalive_max_s` (Settings → Chat → Change feed → Longest\nkeep-alive, default 900); a value outside is a 400 `bad_request`\nnaming the bound and the setting. Without it the stream keeps the\ngateway's `chat_feed_keepalive_s`. `hello.keepalive_s` says the value\nthe stream keeps. Only the comments follow it: stored events are\nread at the gateway's own interval whatever this one is. A phone\nholding its feed in the background asks a long one (about 120), so\nits radio wakes less.",
              "format": "int64",
              "minimum": 1,
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "default": null,
              "description": "Resume after this cursor (`\"<epoch>:<seq>:<tag>\"`). A `Last-Event-ID`\nheader wins over it: a browser's `EventSource` reconnects with the\nURL it opened, so its `since` is the old one and the header the new.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "approval.decided": {
                "description": "`approval.decided`: a waiting call was decided — approved or declined\nby a client, or declined because a new message came\n(`chat_approvals::MOVED_ON`).",
                "properties": {
                  "approval_request_id": {
                    "type": "string"
                  },
                  "approve": {
                    "description": "Whether the call was approved — and, once that is known, could run:\n`false` with `not_run` for one approved whose turn could not\nstart.",
                    "type": "boolean"
                  },
                  "by": {
                    "description": "Who decided, as every author is named (\"the dashboard\", \"device\n'phone'\").",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "call_id": {
                    "description": "The call's id, as `approval.requested` has it. Absent from an lmgw\nbefore 2026-10-09.",
                    "type": "string"
                  },
                  "message_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "not_run": {
                    "description": "Approved, but the turn that was to run it could not start (its\nreply moved on, its starter went, its slot was refused), so it never\nran and its result says so. Recorded as a second `approval.decided`\nfor the call; both render this.",
                    "type": "boolean"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "message_id",
                  "approval_request_id",
                  "approve",
                  "by"
                ],
                "title": "ApprovalDecided",
                "type": "object"
              },
              "approval.requested": {
                "description": "`approval.requested`: a turn in the thread stopped on a call that waits\nfor an approval (client-apps design §6.5). Rendered from the reply's\npending state at delivery; a reply gone by then (deleted, regenerated),\nor a call decided by then (its `approval.decided` follows),\nis not delivered. With `thread_title`, `server_label`, `name` and\n`arguments` a client shows it, or a notification, without a fetch. Also\nthe shape of `Hello::open_approvals`' entries.",
                "properties": {
                  "approval_request_id": {
                    "type": "string"
                  },
                  "arguments": {
                    "description": "A JSON string.",
                    "type": "string"
                  },
                  "call_id": {
                    "description": "The call's id, as the turn's `ready`, `approval` and `result` frames\ncarry it. Absent from an lmgw before 2026-10-09.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply that waits.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "name": {
                    "description": "The tool's own name, as `chat_approvals::ApprovalRequest`.",
                    "type": "string"
                  },
                  "server_label": {
                    "type": "string"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "thread_title": {
                    "description": "The thread's title at delivery (in `hello`, at the head it read).",
                    "type": "string"
                  }
                },
                "required": [
                  "thread_id",
                  "thread_title",
                  "message_id",
                  "approval_request_id",
                  "server_label",
                  "name",
                  "arguments"
                ],
                "title": "ApprovalRequested",
                "type": "object"
              },
              "caught_up": {
                "description": "`caught_up`: the stream has delivered, or passed as not for this reader,\nevery stored event up to the head it opened at (`Hello::cursor` when\nthe client gave no cursor). Live, so no `id:`; sent once per stream: right\nafter `hello` (and the `resync` and profile list a cursor may owe) when\nthere was nothing to catch up, else right after the catch-up's last\nevent. From here on every `approval.*` changes `Hello::open_approvals`.",
                "properties": {
                  "cursor": {
                    "description": "Where the stream stands now (`\"<epoch>:<seq>:<tag>\"`): a client may\nresume from it, as from a keep-alive's `id:`.",
                    "type": "string"
                  }
                },
                "required": [
                  "cursor"
                ],
                "title": "CaughtUp",
                "type": "object"
              },
              "device.revoked": {
                "description": "`device.revoked`: a paired device's key was deleted, so the device is\ngone for good; a client that runs work it started — a host of MCP tasks\nwhose `lmgw/caller` named it — may cancel that work now (MCP Tasks\ndesign §4.1; client-apps design §2.2). Its tasks' results still enter\ntheir threads as they end.\n\nReceived by the dashboard and admin keys; by a device the feed showed\nthe deleted device's changes to (a stored event it may see carries the\ndeleted device's `by`), and by a device hosting a task the deleted\ndevice started that was still running. No other device hears of it: it\nnames no device the reader was not shown.\n\nOnly a delete is said: a disabled or expired key can be enabled or\nrenewed again, and its tasks wait meanwhile; a rotated one keeps its\nrow and pairs again under its name; a cleared hosting grant ends the\ndevice's own hosted tasks, each said by its `task.done` (`abandoned`).",
                "properties": {
                  "by": {
                    "description": "Who deleted it (\"the dashboard\").",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "device": {
                    "$ref": "#/components/schemas/FeedPrincipal",
                    "description": "The deleted device, as `Hello::principal` names a device (kind\n`device`, its paired name) and as `lmgw/caller` names it on a\nforwarded call; `FeedPrincipal::by` is the `by` its changes\ncarried."
                  }
                },
                "required": [
                  "device",
                  "by"
                ],
                "title": "DeviceRevoked",
                "type": "object"
              },
              "folder.created": {
                "description": "The folder as GET /chat/api/folders lists it now (its counts as the reader may see them), with `by` beside its fields; or, when the folder is gone by the time the event is delivered, {folder_id, deleted: true, by}. `deleted` tells the two apart.",
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/FolderChanged"
                      },
                      {
                        "not": {
                          "required": [
                            "deleted"
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/FolderGone"
                      },
                      {
                        "properties": {
                          "deleted": {
                            "const": true
                          }
                        },
                        "required": [
                          "deleted"
                        ]
                      }
                    ]
                  }
                ]
              },
              "folder.current": {
                "description": "`folder.current`: an ongoing folder's current thread moved.",
                "properties": {
                  "by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "folder_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "previous_thread_id": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reason": {
                    "description": "Why it moved. To a new thread: `first` (the folder had none the\nreader can reach), `gone` (its thread could no longer be continued\nin it; only the dashboard and admin keys read this reason for a new\nthread), `idle` (no message for the folder's idle minutes) or\n`requested` (a client asked for a new thread, or created one in the\nfolder). To none: `gone` (the thread was deleted, moved out of the\nfolder or archived) or `not_ongoing` (the folder stopped being an\nongoing conversation).",
                    "type": "string"
                  },
                  "thread_id": {
                    "description": "The current thread now; `null` when the folder has none any more.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "folder_id",
                  "thread_id",
                  "previous_thread_id",
                  "reason",
                  "by"
                ],
                "title": "FolderCurrent",
                "type": "object"
              },
              "folder.deleted": {
                "description": "`folder.deleted`, and `folder.created` / `folder.updated` for a folder\nthat is gone by the time the event is delivered.",
                "properties": {
                  "by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "deleted": {
                    "type": "boolean"
                  },
                  "folder_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "folder_id",
                  "deleted",
                  "by"
                ],
                "title": "FolderGone",
                "type": "object"
              },
              "folder.updated": {
                "description": "The folder as GET /chat/api/folders lists it now (its counts as the reader may see them), with `by` beside its fields; or, when the folder is gone by the time the event is delivered, {folder_id, deleted: true, by}. `deleted` tells the two apart.",
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/FolderChanged"
                      },
                      {
                        "not": {
                          "required": [
                            "deleted"
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/FolderGone"
                      },
                      {
                        "properties": {
                          "deleted": {
                            "const": true
                          }
                        },
                        "required": [
                          "deleted"
                        ]
                      }
                    ]
                  }
                ]
              },
              "hello": {
                "description": "The feed's first event.",
                "properties": {
                  "cert": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/HelloCert"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The dates of the certificate the device connected with (§5.3); `null`\non a feed that is not a device's."
                  },
                  "cursor": {
                    "description": "Where the stream continues from: the cursor the client resumed with,\nor the newest record when it gave none (or one the feed answers with\n`resync`).",
                    "type": "string"
                  },
                  "dashboard_url": {
                    "description": "Where the dashboard is, for a client that offers to open it: the\nplain listener's address as a URL (`http://127.0.0.1:8001/`), derived\nfrom `bind_addr`. Sent to a device paired as \"this computer\"\n(`local_only`) and to every other device when `bind_addr` is not\nloopback, since a loopback address reaches nothing from another host.\n`null` otherwise, and on a feed that is not a device's.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "epoch": {
                    "description": "This database's epoch.",
                    "type": "string"
                  },
                  "hold": {
                    "$ref": "#/components/schemas/FeedHold"
                  },
                  "hosts_label": {
                    "description": "The label a device may host MCP tools under; `null` without a\nhosting grant, and on a feed that is not a device's.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "keepalive_s": {
                    "description": "Seconds between keep-alive comments, fixed for this stream: the\n`keepalive_s` the request asked for, else the gateway's\n`chat_feed_keepalive_s`. A client derives its dead-link timeout from\nit. Stored events are never held back for it: the stream reads the\ntable at the gateway's own interval whatever this one is.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "open_approvals": {
                    "description": "Every call still waiting for a decision at `cursor`, in the\nthreads this reader may see, oldest reply first and each reply's\ncalls in the model's order, as `approval.requested` renders it (the\nthread's title as it was then). Read with the head, so it is the open\nset there: the `approval.*` events of the catch-up up to `caught_up`\nare already reflected in it; after `caught_up`, `approval.requested`\nadds to it and `approval.decided` removes from it, as does the\nthread's deletion or its reply's, and every `state` replaces it\n(`LiveState::open_approvals`). A waiting call is one of the\nthread's last message: a reply a later message followed waits no\nmore (a new message declines its calls).",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequested"
                    },
                    "type": "array"
                  },
                  "principal": {
                    "$ref": "#/components/schemas/FeedPrincipal"
                  },
                  "retention_days": {
                    "description": "How many days the feed keeps its records (`chat_feed_retention_days`,\n`0` = all): a client away longer gets a `resync`.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "self_admin": {
                    "$ref": "#/components/schemas/AdminLevel",
                    "description": "What this device's admin tools may do now: `off`, `read_only` (read\nlmgw's configuration and state) or `full` (also change it) — the\nlevel set on the device, capped by the gateway's own self-admin\nlevel. Above `off` the device sees the threads and folders that\ncarry the self-admin toolset (`lmgw`), and at `full` it may attach it\nand change them; at `read_only` it reads them and sends to them only;\nat `off` it sees none of them. When this value moves above `off` or back while\nthe feed is open, whether the device's level or the gateway's moved\nit, those threads and folders arrive (`*.created`) or go\n(`*.deleted`) in order. A `state` with this value follows any change\nof the device's level, and any change of the gateway's that moves\nthis value. When this value moved above `off` or back within what a\nresumed feed catches up, the feed sends `resync` at that point\ninstead: reload what you show. `off` on a feed that is not a\ndevice's."
                  },
                  "turns": {
                    "description": "The turns running now.",
                    "items": {
                      "$ref": "#/components/schemas/LiveTurn"
                    },
                    "type": "array"
                  },
                  "urls": {
                    "description": "A device's lmgw URLs as its row holds them now: `https` base URLs in\nthe owner's order (device link design §7.2). The device replaces its\nlist with them (`lmgw-client`'s `refresh_urls`). Empty on a feed that\nis not a device's.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "voice": {
                    "description": "The realtime sessions bound now.",
                    "items": {
                      "$ref": "#/components/schemas/LiveVoice"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "epoch",
                  "cursor",
                  "keepalive_s",
                  "retention_days",
                  "principal",
                  "hosts_label",
                  "self_admin",
                  "hold",
                  "voice",
                  "turns",
                  "open_approvals",
                  "urls",
                  "cert",
                  "dashboard_url"
                ],
                "title": "Hello",
                "type": "object"
              },
              "hold": {
                "description": "The GPU hold: whether local models are paused. A held model answers with\nits own fallback, where one is set (each thread's model says which). The\n`hold` event and part of `Hello`.",
                "properties": {
                  "active": {
                    "description": "The owner's GPU hold is on: models on the graphics card are paused.",
                    "type": "boolean"
                  },
                  "benchmark": {
                    "description": "A benchmark run holds the graphics card: every local model waits\nuntil it ends, one on the CPU too, or answers with its fallback\n(chat-plane design D6).",
                    "type": "boolean"
                  }
                },
                "required": [
                  "active",
                  "benchmark"
                ],
                "title": "FeedHold",
                "type": "object"
              },
              "message.added": {
                "description": "`message.added` and `message.updated`: messages of a thread were written\n(client-apps design §2.2). Added: a user message as it is stored (typed,\ndictated or spoken in a bound session), a reply as it is saved, a late\nMCP task result entering the thread (role `tool`). Updated in place: an\nedit, a continue, a resumed turn saved onto its reply, a spoken reply\ncut to what was heard or annotated with how it was spoken, a user\nmessage's retrieval stored, a call the reply waits on decided (or\ndeclined by a new message, or closed as not run). A reply still being\ngenerated is in no event until it is saved: its tokens are the send\nstream's.\n\nRendered at delivery, so a catch-up never replays a stale copy: each\nmessage as `GET /chat/api/threads/{id}` lists it now, whole, so a client\nshows it, or a notification, without a fetch. A message gone by then is\nleft out (its `message.deleted` follows), and an event whose messages\nare all gone, or whose thread is, is not delivered. Two events may carry\nthe same state of a message: apply them by id.",
                "properties": {
                  "by": {
                    "description": "Who wrote them: the sender of a user message, the starter of the\nturn whose reply it is, the client that edited one or decided a call,\nthe client whose voice session cut or annotated a spoken reply (that\nsession's, even after another client took the thread over); `null`\nfor the gateway's own (a task result entering the thread, a call\nclosed as not run).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "messages": {
                    "description": "The messages written, oldest first, each as the thread lists it now.",
                    "items": {
                      "$ref": "#/components/schemas/Message"
                    },
                    "type": "array"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "thread_title": {
                    "description": "The thread's title at delivery, so a notification names the\nconversation without a fetch.",
                    "type": "string"
                  }
                },
                "required": [
                  "thread_id",
                  "thread_title",
                  "messages",
                  "by"
                ],
                "title": "MessagesChanged",
                "type": "object"
              },
              "message.deleted": {
                "description": "`message.deleted`: messages of a thread were deleted (client-apps design\n§2.2): one by itself, every one after a point (an edit's resend, a\nregenerate), or a spoken reply nobody heard. Their attachments went with\nthem. A thread deleted whole says so with `thread.deleted` alone.",
                "properties": {
                  "by": {
                    "description": "Who deleted them; `null` for the gateway's own.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "message_ids": {
                    "description": "The messages that went, ascending.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "message_ids",
                  "by"
                ],
                "title": "MessagesDeleted",
                "type": "object"
              },
              "message.updated": {
                "description": "`message.added` and `message.updated`: messages of a thread were written\n(client-apps design §2.2). Added: a user message as it is stored (typed,\ndictated or spoken in a bound session), a reply as it is saved, a late\nMCP task result entering the thread (role `tool`). Updated in place: an\nedit, a continue, a resumed turn saved onto its reply, a spoken reply\ncut to what was heard or annotated with how it was spoken, a user\nmessage's retrieval stored, a call the reply waits on decided (or\ndeclined by a new message, or closed as not run). A reply still being\ngenerated is in no event until it is saved: its tokens are the send\nstream's.\n\nRendered at delivery, so a catch-up never replays a stale copy: each\nmessage as `GET /chat/api/threads/{id}` lists it now, whole, so a client\nshows it, or a notification, without a fetch. A message gone by then is\nleft out (its `message.deleted` follows), and an event whose messages\nare all gone, or whose thread is, is not delivered. Two events may carry\nthe same state of a message: apply them by id.",
                "properties": {
                  "by": {
                    "description": "Who wrote them: the sender of a user message, the starter of the\nturn whose reply it is, the client that edited one or decided a call,\nthe client whose voice session cut or annotated a spoken reply (that\nsession's, even after another client took the thread over); `null`\nfor the gateway's own (a task result entering the thread, a call\nclosed as not run).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "messages": {
                    "description": "The messages written, oldest first, each as the thread lists it now.",
                    "items": {
                      "$ref": "#/components/schemas/Message"
                    },
                    "type": "array"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "thread_title": {
                    "description": "The thread's title at delivery, so a notification names the\nconversation without a fetch.",
                    "type": "string"
                  }
                },
                "required": [
                  "thread_id",
                  "thread_title",
                  "messages",
                  "by"
                ],
                "title": "MessagesChanged",
                "type": "object"
              },
              "profile.created": {
                "description": "`profile.created`, `profile.updated` and `profile.deleted`: a\npersonality profile (`GET /chat/api/profiles`) was created, changed or\ndeleted, named as that write left it. Every reader receives them,\ndevices included. After a `resync` the feed sends the whole list again\nas `profile.created` events (with no `id:`), so a client that keeps the\nnames (a menu of profiles) has them again without a request.",
                "properties": {
                  "by": {
                    "description": "Who made the change; `null` for the gateway's own, and on the list\nrepeated after a `resync`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "description": "The profile's id.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "by"
                ],
                "title": "FeedProfile",
                "type": "object"
              },
              "profile.deleted": {
                "description": "`profile.created`, `profile.updated` and `profile.deleted`: a\npersonality profile (`GET /chat/api/profiles`) was created, changed or\ndeleted, named as that write left it. Every reader receives them,\ndevices included. After a `resync` the feed sends the whole list again\nas `profile.created` events (with no `id:`), so a client that keeps the\nnames (a menu of profiles) has them again without a request.",
                "properties": {
                  "by": {
                    "description": "Who made the change; `null` for the gateway's own, and on the list\nrepeated after a `resync`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "description": "The profile's id.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "by"
                ],
                "title": "FeedProfile",
                "type": "object"
              },
              "profile.updated": {
                "description": "`profile.created`, `profile.updated` and `profile.deleted`: a\npersonality profile (`GET /chat/api/profiles`) was created, changed or\ndeleted, named as that write left it. Every reader receives them,\ndevices included. After a `resync` the feed sends the whole list again\nas `profile.created` events (with no `id:`), so a client that keeps the\nnames (a menu of profiles) has them again without a request.",
                "properties": {
                  "by": {
                    "description": "Who made the change; `null` for the gateway's own, and on the list\nrepeated after a `resync`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "description": "The profile's id.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "by"
                ],
                "title": "FeedProfile",
                "type": "object"
              },
              "resync": {
                "description": "`resync`: the cursor cannot be honoured; reload what you show. The\nstream continues from now.",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "Resync",
                "type": "object"
              },
              "revoked": {
                "description": "`revoked`: the key was disabled, rotated, deleted or expired; the stream\nends after it.",
                "properties": {
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about it, the token a realtime session's 4003\nclose starts its reason with: `key_unknown` means pair the device\nagain. Every event this gateway sends carries it. An event without it\n(an older gateway's) is of an unknown kind, as a close reason without\na token is: tell the user the sentence in `message`."
                  },
                  "message": {
                    "description": "The reason in a sentence: \"device 'phone' was rotated — pair it\nagain\".",
                    "type": "string"
                  },
                  "reason": {
                    "description": "`disabled`, `rotated`, `deleted` or `expired`.",
                    "type": "string"
                  }
                },
                "required": [
                  "reason",
                  "message",
                  "kind"
                ],
                "title": "Revoked",
                "type": "object"
              },
              "state": {
                "description": "`state`: `Hello`'s live part again. Sent when the stream could not\nkeep a client's live events in order — it read slower than they\nhappened past `chat_feed_live_buffer`, or the buffer was resized — and\nto a device when what it may see or do changed: a thread it reaches took\nor lost the self-admin toolset, its own admin-tools level moved, or the\ngateway's self-admin level moved what its admin tools may do. Also after\na `resync` that passed records (the retention pruned past a stream still\ncatching up, which gets it before `caught_up`; a change that could not be\nread, after `caught_up`), and to a device after a thread or folder came\ninto its reach after `caught_up` (its `*.created`), so the open\napprovals in it arrive.\nStored events are never lost; `reason` says what happened and names the\nsetting.",
                "properties": {
                  "hold": {
                    "$ref": "#/components/schemas/FeedHold"
                  },
                  "open_approvals": {
                    "description": "The calls waiting for a decision as they are when this `state` is\nsent, in the threads this reader may see now, as\n`Hello::open_approvals` lists them: they replace the set a client\nkeeps. Read at sending, which may be a little past the stream's\ncursor: match by `approval_request_id`, and an `approval.*` event\nthat follows changes nothing it already says. `null` when lmgw\ncould not read them for a `state` sent for another reason (a lag, a\nresize, a refresh of what is live; said in its log): keep the set\nyou have. A `state` sent because the set may have moved never says\n`null`: lmgw ends the stream instead, and the reconnect's `hello`\ncarries the set.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequested"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "self_admin": {
                    "$ref": "#/components/schemas/AdminLevel",
                    "description": "`Hello::self_admin` as it is now: a device learns here that what\nits admin tools may do moved while the feed is open."
                  },
                  "turns": {
                    "items": {
                      "$ref": "#/components/schemas/LiveTurn"
                    },
                    "type": "array"
                  },
                  "voice": {
                    "items": {
                      "$ref": "#/components/schemas/LiveVoice"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "self_admin",
                  "hold",
                  "voice",
                  "turns",
                  "reason",
                  "open_approvals"
                ],
                "title": "LiveState",
                "type": "object"
              },
              "task.done": {
                "description": "`task.done`: a task's result entered the thread as message `message_id`\n(role `tool`). `by` names who cancelled it, for a cancel lmgw sent;\n`null` otherwise.",
                "properties": {
                  "by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "message_id": {
                    "description": "The result row.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "server_label": {
                    "type": "string"
                  },
                  "status": {
                    "description": "`completed`, `failed`, `cancelled` or `abandoned`.",
                    "enum": [
                      "completed",
                      "failed",
                      "cancelled",
                      "abandoned"
                    ],
                    "type": "string"
                  },
                  "task_id": {
                    "type": "string"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "tool": {
                    "type": "string"
                  }
                },
                "required": [
                  "thread_id",
                  "message_id",
                  "id",
                  "task_id",
                  "server_label",
                  "tool",
                  "status",
                  "by"
                ],
                "title": "TaskDone",
                "type": "object"
              },
              "task.started": {
                "description": "`task.started`: a tool call of a turn in the thread became an MCP task\n(MCP Tasks design §4.1); its result enters the thread later. Named as\nthe write left it, so it renders after the task is gone.",
                "properties": {
                  "by": {
                    "description": "Who started the turn that called it.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "id": {
                    "description": "lmgw's id of the task (the cancel route's `{task}`).",
                    "format": "int64",
                    "type": "integer"
                  },
                  "server_label": {
                    "type": "string"
                  },
                  "task_id": {
                    "description": "The server's id of the task.",
                    "type": "string"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "tool": {
                    "description": "The name the model called.",
                    "type": "string"
                  }
                },
                "required": [
                  "thread_id",
                  "id",
                  "task_id",
                  "server_label",
                  "tool",
                  "by"
                ],
                "title": "TaskStarted",
                "type": "object"
              },
              "thread.created": {
                "description": "The thread as GET /chat/api/threads lists it now, with `by` beside its fields; or, when the thread is gone by the time the event is delivered, {thread_id, deleted: true, by}. `deleted` tells the two apart.",
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/ThreadChanged"
                      },
                      {
                        "not": {
                          "required": [
                            "deleted"
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/ThreadGone"
                      },
                      {
                        "properties": {
                          "deleted": {
                            "const": true
                          }
                        },
                        "required": [
                          "deleted"
                        ]
                      }
                    ]
                  }
                ]
              },
              "thread.deleted": {
                "description": "`thread.deleted`, and `thread.created` / `thread.updated` for a thread\nthat is gone by the time the event is delivered.",
                "properties": {
                  "by": {
                    "description": "Who made the change; `null` for the gateway's own (the sweep).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "deleted": {
                    "type": "boolean"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "deleted",
                  "by"
                ],
                "title": "ThreadGone",
                "type": "object"
              },
              "thread.updated": {
                "description": "The thread as GET /chat/api/threads lists it now, with `by` beside its fields; or, when the thread is gone by the time the event is delivered, {thread_id, deleted: true, by}. `deleted` tells the two apart.",
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/ThreadChanged"
                      },
                      {
                        "not": {
                          "required": [
                            "deleted"
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/ThreadGone"
                      },
                      {
                        "properties": {
                          "deleted": {
                            "const": true
                          }
                        },
                        "required": [
                          "deleted"
                        ]
                      }
                    ]
                  }
                ]
              },
              "transfer.updated": {
                "description": "A transfer, as every route and `transfer.updated` answer it.",
                "properties": {
                  "app_id": {
                    "description": "The app id the offer names; the receiver declared it at pairing.",
                    "type": "string"
                  },
                  "created_at": {
                    "description": "RFC 3339 UTC.",
                    "type": "string"
                  },
                  "end_reason": {
                    "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ended_at": {
                    "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "expires_at": {
                    "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                    "type": "string"
                  },
                  "filename": {
                    "description": "The receiver's name for the file.",
                    "type": "string"
                  },
                  "from": {
                    "$ref": "#/components/schemas/TransferParty"
                  },
                  "id": {
                    "description": "Opaque: 32 random lowercase hex digits.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "The app's own word for what the file is.",
                    "type": "string"
                  },
                  "received": {
                    "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "sha256": {
                    "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                    "type": "string"
                  },
                  "size": {
                    "description": "The file's size in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "state": {
                    "$ref": "#/components/schemas/TransferState"
                  },
                  "title": {
                    "description": "What the card and the receiver show; may be empty.",
                    "type": "string"
                  },
                  "to": {
                    "$ref": "#/components/schemas/TransferParty"
                  }
                },
                "required": [
                  "id",
                  "app_id",
                  "kind",
                  "title",
                  "filename",
                  "size",
                  "sha256",
                  "from",
                  "to",
                  "state",
                  "received",
                  "created_at",
                  "expires_at",
                  "ended_at",
                  "end_reason"
                ],
                "title": "Transfer",
                "type": "object"
              },
              "turn.done": {
                "description": "`turn.done`: how a turn ended.",
                "properties": {
                  "code": {
                    "description": "The code of the last error the turn reported (`superseded`,\n`gpu_hold`, `not_saved`, …); `null` when it reported none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "message_id": {
                    "description": "The reply row it saved or continued; `null` when it saved none.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "saved": {
                    "type": "boolean"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "message_id",
                  "saved",
                  "code"
                ],
                "title": "TurnDone",
                "type": "object"
              },
              "turn.started": {
                "description": "`turn.started`.",
                "properties": {
                  "by": {
                    "type": "string"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "voice": {
                    "description": "A bound realtime session's voice turn.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "thread_id",
                  "by",
                  "voice"
                ],
                "title": "TurnStarted",
                "type": "object"
              },
              "voice.bound": {
                "description": "`voice.bound`: a realtime session bound to the thread.",
                "properties": {
                  "by": {
                    "type": "string"
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "by"
                ],
                "title": "VoiceBound",
                "type": "object"
              },
              "voice.ended": {
                "description": "`voice.ended`: a bound session let its thread go.",
                "properties": {
                  "by": {
                    "description": "Who had bound the session that ended.",
                    "type": "string"
                  },
                  "reason": {
                    "description": "`closed`, `taken_over`, `thread_gone` (its thread was deleted while\nit was bound; a device's feed does not receive this event for a\ndeleted thread, only its `thread.deleted`, as for a thread taken out\nof its reach) or `revoked` (the binder's key was revoked, or the\nthread was taken out of the binding device's reach).",
                    "type": "string"
                  },
                  "taken_over_by": {
                    "description": "Who took it over, for `taken_over`.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "thread_id": {
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "thread_id",
                  "by",
                  "reason",
                  "taken_over_by"
                ],
                "title": "VoiceEnded",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Follow the Chat's changes",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/folders": {
      "get": {
        "description": "Every folder in the list's order: its defaults (what a new thread in it starts with), whether it is one ongoing conversation and which thread is current, its own retention, and its thread counts as the caller may see them. Folder names need not be unique, so a client that looks its folder up by name keeps the id it found.",
        "operationId": "get_chat_api_folders",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/folders`.",
                  "properties": {
                    "folders": {
                      "description": "In the list's order.",
                      "items": {
                        "$ref": "#/components/schemas/Folder"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "folders"
                  ],
                  "title": "FolderList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the Chat's folders",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "A new folder, last in the list, answered as the list carries it. `ongoing` marks it as one ongoing conversation, which needs a model in its defaults: without one the answer is a 400 naming defaults.model_alias. A device key writes only within its own scopes: a tool server or knowledge base its tool scope does not reach is a 403 tool_label_out_of_scope, an alias outside its alias scope a 403 key_scope, and the self-admin toolset (lmgw) is its to attach only when its admin tools are full: below that the answer is a 403 chat_toolset_needs_full, or tool_label_out_of_scope when they are off. A device key only tightens require_approval: a rule that gates fewer calls than the stored one or the owner's last (its floor, which a removed entry keeps) is a 403 approval_loosen_refused, naming the label and the tool; a turn runs each server under the strictest of its entries and that floor. For every caller, two mcp_tools entries that name one server (its tool prefix and its name) or a require_approval of another shape than OpenAI's are a 400 bad_request where the write changed the entry; labels are stored trimmed. A device key cannot set archive_days or purge_days (403 forbidden, naming the fields): a folder's own retention is set from the dashboard.",
        "operationId": "post_chat_api_folders",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/folders`'s body.",
                "properties": {
                  "archive_days": {
                    "description": "Days without activity before one of its threads is archived; absent\nfor the Chat's setting, `0` never. A device key cannot set it (403\nforbidden): a folder's own retention is set from the dashboard.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "defaults": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ThreadDefaultsInput"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "ongoing": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/OngoingInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Marks the folder as one ongoing conversation; its defaults must then\nname a model."
                  },
                  "purge_days": {
                    "description": "Days after archiving before one of its threads is deleted; absent\nfor the Chat's setting, `0` never. A device key cannot set it, as\n`archive_days`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "title": "FolderCreate",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A Chat folder as `GET /chat/api/folders` lists it, with its thread\ncounts as the caller may see them.",
                  "properties": {
                    "archive_days": {
                      "description": "Days without activity before one of its threads is archived; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "defaults": {
                      "$ref": "#/components/schemas/ThreadDefaults"
                    },
                    "devices_hidden": {
                      "description": "Set when a device deleted this folder while it held threads that\ndevice could not see: the folder stays for them, hidden from every\ndevice, until it is shown to devices again from the dashboard. Always\n`false` for a device key, which never sees such a folder.",
                      "type": "boolean"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "name": {
                      "description": "Folder names need not be unique.",
                      "type": "string"
                    },
                    "ongoing": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/FolderOngoing"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "`null` for a folder that is not one ongoing conversation."
                    },
                    "purge_days": {
                      "description": "Days after archiving before one of its threads is deleted; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "sort": {
                      "description": "The folder's place in the list.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "threads_active": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "threads_archived": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "sort",
                    "defaults",
                    "ongoing",
                    "archive_days",
                    "purge_days",
                    "devices_hidden",
                    "created_at",
                    "updated_at",
                    "threads_active",
                    "threads_archived"
                  ],
                  "title": "Folder",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a folder",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/folders/{id}": {
      "post": {
        "description": "A patch: a field left out is unchanged. Answers the folder as the list carries it, with `applied`: for an ongoing-conversation folder whose defaults changed (and apply_to_current not false), the current thread and the settings that reached it, otherwise null. The folder's other threads are never touched. defaults replaces the defaults whole; defaults_patch changes the fields it names (null unsets one) so a client never writes back what another changed meanwhile; both together are a 400 bad_request. ongoing needs a model in the defaults. What reaches the current thread passes the checks of a thread settings write, and a field the thread refuses fails the whole patch. A device key's default mcp_tools pass its tool scope, as on a folder create; it cannot set archive_days or purge_days, nor devices_hidden (403 forbidden). devices_hidden: false shows a folder to devices again that a device's delete hid from them; true is a 400. A folder the caller cannot see is a 404 not_found.",
        "operationId": "post_chat_api_folders_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/folders/{id}`'s body: a **patch**. An absent field is\nunchanged. Unknown fields are a 422 bad_request.",
                "properties": {
                  "apply_to_current": {
                    "description": "For an ongoing folder: also apply the defaults' changes to its\ncurrent thread. Default `true`.",
                    "type": "boolean"
                  },
                  "archive_days": {
                    "description": "The folder's own retention in days before an inactive thread is\narchived; `null` goes back to the Chat's setting, `0` never. A device\nkey cannot set it (403 `forbidden`).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "defaults": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ThreadDefaultsInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Replaces the folder's defaults whole (`{}` clears them). Not beside\n`defaults_patch`."
                  },
                  "defaults_patch": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ThreadDefaultsInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Changes the defaults field by field instead: each field given\nreplaces the stored one (`null` unsets it), the others stay as\nstored, so a save of the fields one client changed never writes back\nwhat another changed meanwhile. `voice` is laid field by field the\nsame way (`voice: null` unsets the whole voice). Not beside\n`defaults`."
                  },
                  "devices_hidden": {
                    "description": "`false` shows a folder that a device's delete hid from devices to\nthem again; the owner's alone. `true` is refused (400): a device's\ndelete is what hides a folder.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "name": {
                    "description": "The new name; names need not be unique.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ongoing": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/OngoingInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "An object marks the folder as one ongoing conversation (or changes\nits idle minutes; its defaults must name a model); `null` ends that."
                  },
                  "purge_days": {
                    "description": "Days after archiving before a thread is deleted; as `archive_days`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "sort": {
                    "description": "The folder's place in the list.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "FolderPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/folders/{id}`'s answer: the folder as the list carries\nit, and what the patch applied to its current thread.",
                  "properties": {
                    "applied": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AppliedToCurrent"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "For an ongoing folder whose defaults changed: the current thread\nand the settings that reached it; `null` otherwise."
                    },
                    "archive_days": {
                      "description": "Days without activity before one of its threads is archived; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "defaults": {
                      "$ref": "#/components/schemas/ThreadDefaults"
                    },
                    "devices_hidden": {
                      "description": "Set when a device deleted this folder while it held threads that\ndevice could not see: the folder stays for them, hidden from every\ndevice, until it is shown to devices again from the dashboard. Always\n`false` for a device key, which never sees such a folder.",
                      "type": "boolean"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "name": {
                      "description": "Folder names need not be unique.",
                      "type": "string"
                    },
                    "ongoing": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/FolderOngoing"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "`null` for a folder that is not one ongoing conversation."
                    },
                    "purge_days": {
                      "description": "Days after archiving before one of its threads is deleted; `null`\nfor the Chat's setting, `0` never. Set from the dashboard: a device\nkey cannot change it.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "sort": {
                      "description": "The folder's place in the list.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "threads_active": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "threads_archived": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "sort",
                    "defaults",
                    "ongoing",
                    "archive_days",
                    "purge_days",
                    "devices_hidden",
                    "created_at",
                    "updated_at",
                    "threads_active",
                    "threads_archived",
                    "applied"
                  ],
                  "title": "FolderPatched",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change a folder",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/folders/{id}/current": {
      "post": {
        "description": "The thread every client of an ongoing-conversation folder continues in. A new one starts when the folder has none the caller can reach (first), when no message came for the folder's idle minutes while no turn runs there (idle), or on new: true (requested) — except that a current thread with no message yet is answered instead, so no empty threads pile up. The body may be left out: it is new: false. A new thread starts from the folder's defaults, and every client hears of it as the feed's folder.current. Two clients asking at once get the same thread. A folder that is not an ongoing conversation is a 409 not_ongoing, one whose defaults name no model a 409 folder_no_model, and one the caller may not see a 404.",
        "operationId": "post_chat_api_folders_id_current",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/folders/{id}/current`'s body.",
                "properties": {
                  "new": {
                    "default": false,
                    "description": "Start a new thread now. A current thread without any message is\nanswered instead, so no empty threads pile up.",
                    "type": "boolean"
                  }
                },
                "title": "CurrentRequest",
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/folders/{id}/current`'s answer.",
                  "properties": {
                    "note": {
                      "description": "The same in a sentence that names the folder setting behind it (the\nidle minutes, for `idle`); `null` when this call did not start it.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reason": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/CurrentReason"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Why this call started it; `null` when it did not."
                    },
                    "rolled_over": {
                      "description": "Whether this call started it.",
                      "type": "boolean"
                    },
                    "thread": {
                      "$ref": "#/components/schemas/Thread",
                      "description": "The current thread, as `GET /chat/api/threads/{id}` answers its\n`thread`."
                    }
                  },
                  "required": [
                    "thread",
                    "rolled_over",
                    "reason",
                    "note"
                  ],
                  "title": "CurrentThread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get an ongoing conversation's current thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/folders/{id}/delete": {
      "post": {
        "description": "threads: keep leaves the folder's threads in no folder, threads: delete deletes them with it; there is no default for destroying conversations. A device key's delete touches only the threads it can see: a folder that also holds Admin Chat or self-admin threads it cannot reach stays for them, hidden from every device from then on, and the answer is the same ok. A folder the caller cannot see is a 404 not_found.",
        "operationId": "post_chat_api_folders_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/folders/{id}/delete`'s body. The choice is required:\nthere is no default for destroying conversations.",
                "properties": {
                  "threads": {
                    "$ref": "#/components/schemas/ThreadsFate"
                  }
                },
                "required": [
                  "threads"
                ],
                "title": "FolderDelete",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a folder",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/folders/{id}/export": {
      "get": {
        "description": "A zip with one file per stored thread of the folder, in the format asked for (md or json, as for one thread), and a README.txt. archived=0 takes the active threads, 1 the archived ones, all (the default) both; another value is a 400 bad_request, as is a format other than md, markdown or json. The answer carries Content-Disposition: attachment (lmgw-folder-{name}-{date}.zip), Content-Length and Cache-Control: no-store; it is as large as the folder is and not capped. Temporary threads are not part of a zip. A device key's zip leaves out Admin Chat threads; a folder that is not there, or not the caller's to see, is a 404 not_found.",
        "operationId": "get_chat_api_folders_id_export",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "archived",
            "required": false,
            "schema": {
              "default": "",
              "description": "Zips only: `0` active threads, `1` archived threads only, `all`\n(default) both.",
              "enum": [
                "0",
                "1",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "",
              "description": "`md` (default; `markdown` is accepted too) for a readable\ntranscript, `json` for the lossless `lmgw.chat.v1` file. A zip holds\none file of this format per thread.",
              "enum": [
                "md",
                "markdown",
                "json"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export a folder",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/knowledge/bases": {
      "get": {
        "description": "Every knowledge base with its file counts and whether its embedding model still resolves (without one a search is by keyword only), for a thread's Knowledge section and the composer's # picker. A thread's bases are its own choice, so a base's MCP visibility does not narrow the list. A device key reads the bases only with kb__search within its tool scope, the tool a thread's base is searched with: without it the answer is 403 tool_label_out_of_scope, naming the tool and no base.",
        "operationId": "get_chat_api_knowledge_bases",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/knowledge/bases`: the knowledge bases a thread may\nsearch, for the Chat's Knowledge section, its `#` picker and its chips.",
                  "properties": {
                    "bases": {
                      "items": {
                        "$ref": "#/components/schemas/ChatKnowledgeBase"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "bases"
                  ],
                  "title": "ChatKnowledgeBases",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the knowledge bases a thread may search",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/knowledge/files/{id}/original": {
      "get": {
        "description": "The uploaded bytes, with the media type they were sniffed as and Content-Disposition: attachment under the file's name (an ASCII fallback plus the RFC 5987 filename*). The owner's: a device key is refused (403 forbidden, said before the file is looked up), since the original carries more than any kb tool hands out; it reads the extracted text. 404 not_found for a file that does not exist or whose original is gone from disk.",
        "operationId": "get_chat_api_knowledge_files_id_original",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Download a knowledge file's original",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/knowledge/files/{id}/text": {
      "get": {
        "description": "The source viewer a citation opens: the file's extracted text (null until it has been ingested once), every chunk's byte range in it, and the chunk named by `chunk` as `highlight`; a citation whose chunk id a re-ingest renamed is found again by its stored span_start, span_end and sha, and `notice` says so. The file is described by what the viewer shows (name, kind, status, pages), without its ingest record; `original` says whether the caller may download the original. A device key reads it only with kb__search and kb__read within its tool scope and kb__read switched on by the owner (403 tool_label_out_of_scope otherwise, said before the file is looked up). 400 op_failed for a file that does not exist.",
        "operationId": "get_chat_api_knowledge_files_id_text",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "chunk",
            "required": false,
            "schema": {
              "default": null,
              "description": "The chunk to highlight (a citation's chunk id).",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "sha",
            "required": false,
            "schema": {
              "default": null,
              "description": "... and the file's sha256 when it was cited.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "span_end",
            "required": false,
            "schema": {
              "default": null,
              "description": "... its end ...",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "span_start",
            "required": false,
            "schema": {
              "default": null,
              "description": "What a citation stored besides the chunk id, for one whose chunk id a\nre-ingest renamed: the passage's start (byte offset into the text) ...",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/knowledge/files/{id}/text`: a cited file's extracted text,\nas the Chat's source viewer shows it. The Knowledge page's own answer\n(`KnowledgeSource`) also carries the file's ingest record — its error,\nits notes, its size and digest — which can name the models and upstreams\nthat ingested it; the Chat's carries what the viewer shows.",
                  "properties": {
                    "chunks": {
                      "description": "Every chunk's span, in file order.",
                      "items": {
                        "$ref": "#/components/schemas/ChunkSpan"
                      },
                      "type": "array"
                    },
                    "file": {
                      "$ref": "#/components/schemas/ChatKnowledgeFile"
                    },
                    "highlight": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ChunkSpan"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The cited chunk (or the one found by the citation's position)."
                    },
                    "kb_name": {
                      "description": "The base the file is in.",
                      "type": "string"
                    },
                    "notice": {
                      "description": "Said when the highlight is not the cited chunk itself: it was found by\nthe citation's stored position because the chunk id no longer exists.",
                      "type": "string"
                    },
                    "original": {
                      "description": "Whether this caller may download the file's original\n(`GET /chat/api/knowledge/files/{id}/original`): the owner may, a\ndevice key not yet.",
                      "type": "boolean"
                    },
                    "text": {
                      "description": "The extracted text; `null` until the file has been ingested once.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "file",
                    "kb_name",
                    "text",
                    "chunks",
                    "highlight",
                    "original"
                  ],
                  "title": "ChatKnowledgeSource",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a knowledge file's extracted text",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/media/defaults": {
      "get": {
        "description": "Which model image__generate, image__edit, audio__speak and audio__transcribe use when a call leaves out `model`, and the voice audio__speak uses when it leaves out `voice`. Three levels, the narrowest that says something winning: a thread's own (its settings' media_defaults), its folder's (the folder defaults' media_defaults, read at each turn rather than copied), Settings → Chat's (chat_media_defaults). In a thread or a folder an absent field inherits and an empty one is no default. The answer has Settings' always, ?folder=<id> adds a folder's and ?thread=<id> a thread's and its folder's; `inherited` is what the narrowest level asked takes from above it, `resolved` what a call uses now, and `choices` every model each tool's `model` enum offers this caller (a device key's alias scope narrows it), with a label and each speech row's voices. A stored default that no longer resolves — its model switched off or deleted, an alias that lost the route, a model outside the caller's key scope, a voice its model does not have — is listed under `unavailable` with the reason and is no default: the tool requires `model` again, and no other model is put in its place. A folder or thread the caller does not reach is 404 not_found.",
        "operationId": "get_chat_api_media_defaults",
        "parameters": [
          {
            "in": "query",
            "name": "folder",
            "required": false,
            "schema": {
              "default": null,
              "description": "A folder: its own defaults, and what it inherits from Settings.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "thread",
            "required": false,
            "schema": {
              "default": null,
              "description": "A thread: its own, its folder's (when it is in one), and what it\ninherits. Wins over `folder`.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/media/defaults`: the media tools' defaults at each level\nasked for, what they resolve to, and what the pickers offer.",
                  "properties": {
                    "choices": {
                      "$ref": "#/components/schemas/MediaChoices",
                      "description": "What each tool can use, for the caller."
                    },
                    "folder": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/MediaDefaults"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The folder's own, when a folder (or a thread in one) was asked for."
                    },
                    "inherited": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "What the narrowest level asked for takes from the levels above it,\nas stored there (a name that no longer resolves included; see\n`unavailable`). For Settings itself, nothing."
                    },
                    "resolved": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "What a call that leaves the argument out uses now at the narrowest\nlevel asked for: a field absent here has no default, and the tool\nrequires the argument."
                    },
                    "settings": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "Settings → Chat's defaults, as stored."
                    },
                    "thread": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/MediaDefaults"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The thread's own, when a thread was asked for."
                    },
                    "unavailable": {
                      "description": "Every stored name in the levels above that does not resolve, with\nthe reason. Never replaced by another model: it is no default until\nit is picked again or the model comes back.",
                      "items": {
                        "$ref": "#/components/schemas/MediaUnavailable"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "choices",
                    "settings",
                    "inherited",
                    "resolved",
                    "unavailable"
                  ],
                  "title": "MediaDefaultsView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "The image and audio tools' default models",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/profiles": {
      "get": {
        "description": "Every personality profile in name order — how a thread's model talks, in text and in voice: a persona, a length rule, example exchanges, the voice turn's block, reasoning on or off, and the speech voice — each with used_by (the threads and folders that use it, as far as the caller may see them), and default_profile_id, the profile new threads start with (null: none). \"Default\" is no profile: a thread with profile_id null. A thread picks one with its settings' profile_id, a folder with its defaults' profile_id. The feed's profile.created, profile.updated and profile.deleted keep this list current.",
        "operationId": "get_chat_api_profiles",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/profiles`.",
                  "properties": {
                    "default_profile_id": {
                      "description": "The profile new threads start with (Settings → Chat), `null` for\nnone.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "profiles": {
                      "description": "In name order.",
                      "items": {
                        "$ref": "#/components/schemas/Profile"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "profiles",
                    "default_profile_id"
                  ],
                  "title": "ProfileList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the personality profiles",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "A new profile from a name and any content fields (an absent one is unset), answered as the list carries it; or {builtin: \"concise\"} alone, which creates that built-in profile again after it was deleted (409 profile_builtin_exists while it exists). A name is unique in any case (409 profile_name_taken) and never \"default\" (400 profile_name_reserved). An example's sides must not be empty. No length or count is bounded; the request's body limit is. A voice.tts_alias must name a text-to-speech model. A device key may list, create, change, reset and delete profiles; a voice.tts_alias it writes must be within its alias scope (403 key_scope), unless the profile already had it. A profile that Admin Chat or the self-admin toolset uses (a thread, or a folder's defaults) is changed, reset or deleted by a device only while the device may use lmgw's admin tools with writes, its own level and the gateway's (403 profile_in_admin_use, which counts the use and names no thread).",
        "operationId": "post_chat_api_profiles",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/profiles`'s body: a `name` with any content fields (an\nabsent one is unset), or a `builtin` key alone to create that built-in\nprofile again after it was deleted (`409` while it exists).",
                "properties": {
                  "builtin": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "examples": {
                    "default": [],
                    "items": {
                      "$ref": "#/components/schemas/Example"
                    },
                    "type": "array"
                  },
                  "length_rule": {
                    "default": "",
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "persona": {
                    "default": "",
                    "type": "string"
                  },
                  "reasoning": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Reasoning"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null
                  },
                  "voice": {
                    "$ref": "#/components/schemas/ProfileVoiceInput",
                    "default": {
                      "speech_style": null,
                      "tts_alias": null,
                      "voice": null
                    }
                  },
                  "voice_block": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "ProfileCreate",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A profile as `GET /chat/api/profiles` lists it.",
                  "properties": {
                    "builtin": {
                      "description": "The built-in profile this row is (`concise`); `null` for one of the\nowner's own. Read only.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "examples": {
                      "description": "Static example exchanges, in order.",
                      "items": {
                        "$ref": "#/components/schemas/Example"
                      },
                      "type": "array"
                    },
                    "follows_builtin": {
                      "description": "The fields a built-in row takes from the built-in text, so they\nfollow its improvements. Read only.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "length_rule": {
                      "description": "How long replies are; empty for none.",
                      "type": "string"
                    },
                    "name": {
                      "description": "Unique in any case; never `default`.",
                      "type": "string"
                    },
                    "persona": {
                      "description": "Who the model is and how it sounds; empty for none. When set, it\ntakes the thread's system prompt's place.",
                      "type": "string"
                    },
                    "reasoning": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Reasoning"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Reasoning on or off; `null` inherits."
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "used_by": {
                      "$ref": "#/components/schemas/UsedBy"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ProfileVoice"
                    },
                    "voice_block": {
                      "description": "The voice turn's block: `null` for the generic one, `\"\"` for none, a\ntext to use as it is.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "builtin",
                    "persona",
                    "length_rule",
                    "examples",
                    "voice_block",
                    "reasoning",
                    "voice",
                    "follows_builtin",
                    "used_by",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "Profile",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a personality profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/preview": {
      "post": {
        "description": "The system messages an unsaved draft assembles to, as a send builds them: the static part (persona or thread prompt, length rule, examples), a text turn's and a voice turn's (with the voice block, the language and the tag hint of the text-to-speech model the draft resolves to). thread_id assembles as that thread would, the draft in place of its own profile; without it, an empty chat thread with Settings' defaults. With model, the three are counted on that alias through the universal token counter (as POST /v1/count_tokens counts), with its approximation flags; counting on a local model loads it. Nothing is stored. A draft is checked as a create's content is (an example's empty side is 400 bad_request).",
        "operationId": "post_chat_api_profiles_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/profiles/preview`'s body.",
                "properties": {
                  "model": {
                    "default": null,
                    "description": "Count the tokens on this alias; absent: no count.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "profile": {
                    "$ref": "#/components/schemas/ProfileDraft",
                    "default": {
                      "examples": [],
                      "length_rule": "",
                      "persona": "",
                      "reasoning": null,
                      "voice": {
                        "speech_style": null,
                        "tts_alias": null,
                        "voice": null
                      },
                      "voice_block": null
                    }
                  },
                  "thread_id": {
                    "default": null,
                    "description": "Assemble as this thread would, with the draft in place of its own\nprofile; absent: an empty thread with Settings' defaults.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "PreviewRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/profiles/preview`'s answer: the system messages the\ndraft assembles to.",
                  "properties": {
                    "static": {
                      "description": "The part that does not depend on the turn: persona or thread prompt,\nlength rule, examples.",
                      "type": "string"
                    },
                    "text_turn": {
                      "type": "string"
                    },
                    "tokens": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/PreviewTokens"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "voice_turn": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "static",
                    "text_turn",
                    "voice_turn",
                    "tokens"
                  ],
                  "title": "PreviewAnswer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview an unsaved profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/speak": {
      "post": {
        "description": "Says text with the voice the draft resolves to (its text-to-speech model, voice and speech style, after the thread's own, before the Chat's settings), through the read-aloud's pipeline, and answers one WAV (PCM16 mono, 24 kHz). Refused before any audio as the Chat's read-aloud refuses, in flat JSON: tts_not_configured, voice_not_found, voice_not_configured, instructions_required; a voice that fails while it speaks is 502 with its code. It writes one text-to-speech row; a thread's seed is used, none is drawn into it.",
        "operationId": "post_chat_api_profiles_speak",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/profiles/speak`'s body: the text spoken with the draft's\nvoice, answered as one WAV.",
                "properties": {
                  "profile": {
                    "$ref": "#/components/schemas/ProfileDraft",
                    "default": {
                      "examples": [],
                      "length_rule": "",
                      "persona": "",
                      "reasoning": null,
                      "voice": {
                        "speech_style": null,
                        "tts_alias": null,
                        "voice": null
                      },
                      "voice_block": null
                    }
                  },
                  "text": {
                    "default": "",
                    "type": "string"
                  },
                  "thread_id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "SpeakRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Speak a sample with an unsaved profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/test": {
      "post": {
        "description": "One model call on model with the system message the draft assembles to (a text turn's, or with voice: true a voice turn's) and text as the user's message: no history, no max_tokens, no tools. The answer carries the system message sent, the reply, its reasoning, the reasoning note, the usage, first_token_ms and reasoning_ms, total_ms, and answered_by when a fallback answered. It writes the call's request row (a device's call is its key's) and stores nothing else. The model's refusals answer with their status and code.",
        "operationId": "post_chat_api_profiles_test",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/profiles/test`'s body: one model call with the draft,\nstoring nothing.",
                "properties": {
                  "model": {
                    "default": "",
                    "type": "string"
                  },
                  "profile": {
                    "$ref": "#/components/schemas/ProfileDraft",
                    "default": {
                      "examples": [],
                      "length_rule": "",
                      "persona": "",
                      "reasoning": null,
                      "voice": {
                        "speech_style": null,
                        "tts_alias": null,
                        "voice": null
                      },
                      "voice_block": null
                    }
                  },
                  "text": {
                    "default": "",
                    "description": "The user's message.",
                    "type": "string"
                  },
                  "thread_id": {
                    "default": null,
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "voice": {
                    "default": false,
                    "description": "Assemble a voice turn rather than a text turn.",
                    "type": "boolean"
                  }
                },
                "title": "TestRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/profiles/test`'s answer.",
                  "properties": {
                    "answered_by": {
                      "description": "The alias that answered, when it was not the one asked (a fallback).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_token_ms": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning": {
                      "description": "The reply's reasoning; empty when it did not reason.",
                      "type": "string"
                    },
                    "reasoning_ms": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_note": {
                      "description": "Why reasoning was or was not asked as it was, in a sentence.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reply": {
                      "type": "string"
                    },
                    "system": {
                      "description": "The system message that was sent.",
                      "type": "string"
                    },
                    "total_ms": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TestUsage"
                    }
                  },
                  "required": [
                    "system",
                    "reply",
                    "reasoning",
                    "reasoning_note",
                    "usage",
                    "first_token_ms",
                    "total_ms",
                    "reasoning_ms",
                    "answered_by"
                  ],
                  "title": "TestAnswer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Test an unsaved profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/{id}": {
      "get": {
        "description": "The profile as the list carries it; 404 not_found when there is none.",
        "operationId": "get_chat_api_profiles_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A profile as `GET /chat/api/profiles` lists it.",
                  "properties": {
                    "builtin": {
                      "description": "The built-in profile this row is (`concise`); `null` for one of the\nowner's own. Read only.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "examples": {
                      "description": "Static example exchanges, in order.",
                      "items": {
                        "$ref": "#/components/schemas/Example"
                      },
                      "type": "array"
                    },
                    "follows_builtin": {
                      "description": "The fields a built-in row takes from the built-in text, so they\nfollow its improvements. Read only.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "length_rule": {
                      "description": "How long replies are; empty for none.",
                      "type": "string"
                    },
                    "name": {
                      "description": "Unique in any case; never `default`.",
                      "type": "string"
                    },
                    "persona": {
                      "description": "Who the model is and how it sounds; empty for none. When set, it\ntakes the thread's system prompt's place.",
                      "type": "string"
                    },
                    "reasoning": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Reasoning"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Reasoning on or off; `null` inherits."
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "used_by": {
                      "$ref": "#/components/schemas/UsedBy"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ProfileVoice"
                    },
                    "voice_block": {
                      "description": "The voice turn's block: `null` for the generic one, `\"\"` for none, a\ntext to use as it is.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "builtin",
                    "persona",
                    "length_rule",
                    "examples",
                    "voice_block",
                    "reasoning",
                    "voice",
                    "follows_builtin",
                    "used_by",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "Profile",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Get a personality profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "The fields to change: an absent field stays, null unsets it, voice is replaced whole. On a built-in profile a field written with the built-in text follows the built-in again (follows_builtin). The change applies from the next turn of every thread using the profile, a bound voice session's included. The same refusals as a create. A device key may list, create, change, reset and delete profiles; a voice.tts_alias it writes must be within its alias scope (403 key_scope), unless the profile already had it. A profile that Admin Chat or the self-admin toolset uses (a thread, or a folder's defaults) is changed, reset or deleted by a device only while the device may use lmgw's admin tools with writes, its own level and the gateway's (403 profile_in_admin_use, which counts the use and names no thread).",
        "operationId": "post_chat_api_profiles_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/profiles/{id}`'s body: the fields to change. An absent\nfield stays as it is; `null` unsets it. On a built-in row, a field\nwritten with the built-in text follows the built-in again.",
                "properties": {
                  "examples": {
                    "items": {
                      "$ref": "#/components/schemas/Example"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "length_rule": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "persona": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reasoning": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Reasoning"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "voice": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ProfileVoiceInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The whole voice object; `null` unsets all three."
                  },
                  "voice_block": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "title": "ProfilePatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A profile as `GET /chat/api/profiles` lists it.",
                  "properties": {
                    "builtin": {
                      "description": "The built-in profile this row is (`concise`); `null` for one of the\nowner's own. Read only.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "examples": {
                      "description": "Static example exchanges, in order.",
                      "items": {
                        "$ref": "#/components/schemas/Example"
                      },
                      "type": "array"
                    },
                    "follows_builtin": {
                      "description": "The fields a built-in row takes from the built-in text, so they\nfollow its improvements. Read only.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "length_rule": {
                      "description": "How long replies are; empty for none.",
                      "type": "string"
                    },
                    "name": {
                      "description": "Unique in any case; never `default`.",
                      "type": "string"
                    },
                    "persona": {
                      "description": "Who the model is and how it sounds; empty for none. When set, it\ntakes the thread's system prompt's place.",
                      "type": "string"
                    },
                    "reasoning": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Reasoning"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Reasoning on or off; `null` inherits."
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "used_by": {
                      "$ref": "#/components/schemas/UsedBy"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ProfileVoice"
                    },
                    "voice_block": {
                      "description": "The voice turn's block: `null` for the generic one, `\"\"` for none, a\ntext to use as it is.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "builtin",
                    "persona",
                    "length_rule",
                    "examples",
                    "voice_block",
                    "reasoning",
                    "voice",
                    "follows_builtin",
                    "used_by",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "Profile",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change a personality profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/{id}/delete": {
      "post": {
        "description": "Deletes the profile and, in the same transaction, sets every thread using it to none, removes it from every folder's defaults, and empties the profile new threads start with when it was that one. The answer says what was cleared (threads and folders as far as the caller may see them). A built-in profile can be created again afterwards. A device key may list, create, change, reset and delete profiles; a voice.tts_alias it writes must be within its alias scope (403 key_scope), unless the profile already had it. A profile that Admin Chat or the self-admin toolset uses (a thread, or a folder's defaults) is changed, reset or deleted by a device only while the device may use lmgw's admin tools with writes, its own level and the gateway's (403 profile_in_admin_use, which counts the use and names no thread).",
        "operationId": "post_chat_api_profiles_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/profiles/{id}/delete`'s answer: what the delete cleared,\nin the one transaction it ran in.",
                  "properties": {
                    "default_cleared": {
                      "description": "Whether it was the profile new threads start with (Settings → Chat),\nwhich is now none.",
                      "type": "boolean"
                    },
                    "deleted": {
                      "description": "The deleted profile's id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "folders_cleared": {
                      "description": "Folders whose defaults named it and no longer do.",
                      "items": {
                        "$ref": "#/components/schemas/FolderRef"
                      },
                      "type": "array"
                    },
                    "threads_cleared": {
                      "description": "Threads that used it and now use none.",
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "deleted",
                    "threads_cleared",
                    "folders_cleared",
                    "default_cleared"
                  ],
                  "title": "ProfileDeleted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a personality profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/profiles/{id}/reset": {
      "post": {
        "description": "Resets a built-in profile to its built-in texts: every content field follows the built-in again (follows_builtin lists them all), so later improvements to it apply, and the voice is unset. The name stays. 400 profile_not_builtin for one of the owner's own profiles, 404 not_found when there is none. Recorded as profile.updated in the feed. A device key may list, create, change, reset and delete profiles; a voice.tts_alias it writes must be within its alias scope (403 key_scope), unless the profile already had it. A profile that Admin Chat or the self-admin toolset uses (a thread, or a folder's defaults) is changed, reset or deleted by a device only while the device may use lmgw's admin tools with writes, its own level and the gateway's (403 profile_in_admin_use, which counts the use and names no thread).",
        "operationId": "post_chat_api_profiles_id_reset",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A profile as `GET /chat/api/profiles` lists it.",
                  "properties": {
                    "builtin": {
                      "description": "The built-in profile this row is (`concise`); `null` for one of the\nowner's own. Read only.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "examples": {
                      "description": "Static example exchanges, in order.",
                      "items": {
                        "$ref": "#/components/schemas/Example"
                      },
                      "type": "array"
                    },
                    "follows_builtin": {
                      "description": "The fields a built-in row takes from the built-in text, so they\nfollow its improvements. Read only.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "length_rule": {
                      "description": "How long replies are; empty for none.",
                      "type": "string"
                    },
                    "name": {
                      "description": "Unique in any case; never `default`.",
                      "type": "string"
                    },
                    "persona": {
                      "description": "Who the model is and how it sounds; empty for none. When set, it\ntakes the thread's system prompt's place.",
                      "type": "string"
                    },
                    "reasoning": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Reasoning"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Reasoning on or off; `null` inherits."
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "used_by": {
                      "$ref": "#/components/schemas/UsedBy"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ProfileVoice"
                    },
                    "voice_block": {
                      "description": "The voice turn's block: `null` for the generic one, `\"\"` for none, a\ntext to use as it is.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "builtin",
                    "persona",
                    "length_rule",
                    "examples",
                    "voice_block",
                    "reasoning",
                    "voice",
                    "follows_builtin",
                    "used_by",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "Profile",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Reset a built-in profile",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/search": {
      "get": {
        "description": "Full-text search over thread titles, message text and the names of sent attachments, in pages of 50 threads, each with up to three of its best hits. Temporary threads are never searched. A device key's search leaves out Admin Chat threads, and names no thread as being in a folder it cannot see. A query shorter than two characters, or archived other than 0, 1 or all, is a 400 bad_request.",
        "operationId": "get_chat_api_search",
        "parameters": [
          {
            "in": "query",
            "name": "archived",
            "required": false,
            "schema": {
              "default": "",
              "description": "`0` (default) active threads, `1` archived only, `all` both.",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "folder",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only threads in this folder.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": null,
              "description": "How many threads to skip: the previous page's `next_offset`.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "default": "",
              "description": "The words to find: at least two characters. Words match as prefixes\nand all must match; a `\"quoted phrase\"` matches as a phrase.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/search`'s answer: one page of matching threads.",
                  "properties": {
                    "next_offset": {
                      "description": "The `offset` of the next page; `null` on the last.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "threads": {
                      "description": "This page's threads, best match first.",
                      "items": {
                        "$ref": "#/components/schemas/SearchThread"
                      },
                      "type": "array"
                    },
                    "total_threads": {
                      "description": "How many threads match in all.",
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total_threads",
                    "threads",
                    "next_offset"
                  ],
                  "title": "SearchPage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Search the Chat",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/settings": {
      "get": {
        "description": "The gateway settings a Chat client reads, and only those: the knowledge excerpt budget a thread without its own uses, the global archive and purge days an ongoing folder's empty fields fall back to, the Chat's and the realtime voice's text-to-speech alias (a thread inherits the first that is not empty), the largest request body (a dictation's recording is one), the seconds between two reads of an MCP task's status, and a realtime session's pre-roll and ping interval. No secret is among them, and every caller reads the same values. They change only through Settings, and a client reads them again when it needs them.",
        "operationId": "get_chat_api_settings",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/settings`: the gateway settings the Chat reads, and only\nthose. None is a secret, and every caller reads the same values.",
                  "properties": {
                    "archive_days": {
                      "description": "Days after its last activity a thread is archived; `0`: never. A\nfolder's own retention overrides it.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "Tokens of knowledge-base excerpts a turn carries when its thread sets\nno budget of its own (Settings → Chat → Knowledge budget).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "max_body_mb": {
                      "description": "The largest request body the gateway reads, in MiB; `0`: no bound.\nA dictation's recording is one such body.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "purge_days": {
                      "description": "Days after it was archived a thread is deleted; `0`: never. A\nfolder's own retention overrides it.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "realtime_ping_interval_s": {
                      "description": "Seconds between the gateway's pings on a realtime session.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "realtime_prefix_padding_ms": {
                      "description": "The audio a realtime session keeps from before speech starts, in\nmilliseconds: push-to-talk's pre-roll.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "realtime_tts_alias": {
                      "description": "The realtime voice's text-to-speech alias.",
                      "type": "string"
                    },
                    "task_poll_interval_s": {
                      "description": "Seconds between two reads of an MCP task's status (Settings → MCP);\n`0`: none is set.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "tts_alias": {
                      "description": "The Chat's text-to-speech alias; empty: `realtime_tts_alias`\nis the one a thread inherits.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "kb_budget_tokens",
                    "archive_days",
                    "purge_days",
                    "tts_alias",
                    "realtime_tts_alias",
                    "max_body_mb",
                    "task_poll_interval_s",
                    "realtime_prefix_padding_ms",
                    "realtime_ping_interval_s"
                  ],
                  "title": "ChatSettings",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read the settings the Chat uses",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/threads": {
      "get": {
        "description": "The stored threads, pinned first and then the most recently active; the temporary threads in a list of their own; how many threads are archived; and every folder with its thread counts. ?archived=1 lists the archived threads instead, the most recently archived first, and ?archived=all both. A device key's lists and counts leave out every Admin Chat thread, and every thread that carries the self-admin toolset (lmgw) unless the device may use lmgw's admin tools. Open the change feed first, then load this list: the feed's thread.* and folder.* events keep it current from then on.",
        "operationId": "get_chat_api_threads",
        "parameters": [
          {
            "in": "query",
            "name": "archived",
            "required": false,
            "schema": {
              "default": "",
              "description": "`1` lists the archived threads instead, the most recently archived\nfirst; `all` lists active and archived threads together, in the\nactive list's order. Absent (or `0`): the active threads.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/threads`.",
                  "properties": {
                    "archived_count": {
                      "description": "How many threads are archived, whichever list was asked for.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "folders": {
                      "description": "Every folder, as `GET /chat/api/folders` lists them.",
                      "items": {
                        "$ref": "#/components/schemas/Folder"
                      },
                      "type": "array"
                    },
                    "temporary": {
                      "description": "Temporary threads, the most recently active first.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadRow"
                      },
                      "type": "array"
                    },
                    "threads": {
                      "description": "Stored threads: pinned first, then the most recently active; with\n`?archived=1` the archived ones, the most recently archived first.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "threads",
                    "archived_count",
                    "temporary",
                    "folders"
                  ],
                  "title": "ThreadList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the Chat's threads",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "A new thread, answered as the thread list carries it, with `voice_resolved`. A plain chat thread starts from the Chat's default system prompt and personality profile; an Admin Chat thread (kind: admin) has its built-in prompt. temporary: true creates a temporary thread kept in memory only, with a negative id; it is a chat thread whatever kind says. folder_id starts the thread from that folder's defaults laid over the Chat's own, and in an ongoing-conversation folder it becomes the current thread. A temporary thread in a folder is a 400 bad_request; a folder the caller cannot see a 404 not_found. A device key cannot create an Admin Chat thread (403 forbidden), and the model alias must be within its alias scope (403 key_scope).",
        "operationId": "post_chat_api_threads",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads`'s body.",
                "properties": {
                  "folder_id": {
                    "default": null,
                    "description": "Create the thread in this folder, starting from the folder's\ndefaults laid over the Chat's own.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "kind": {
                    "default": "",
                    "description": "`chat` (the default) or `admin`, a thread that drives the gateway's\nown configuration (not for a device key: 403 `forbidden`).",
                    "type": "string"
                  },
                  "model_alias": {
                    "default": "",
                    "description": "The alias the thread's turns go to. In a folder, the folder's\ndefaults may name the model instead.",
                    "type": "string"
                  },
                  "temporary": {
                    "default": false,
                    "description": "A temporary chat: kept in memory only, with a negative id, and gone\nat the gateway's next start unless it is kept\n(`POST /chat/api/threads/{id}/persist`). Always a `chat` thread,\nwhatever `kind` says, and not with `folder_id`.",
                    "type": "boolean"
                  }
                },
                "title": "ThreadCreate",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
                  "properties": {
                    "agent_id": {
                      "description": "The agent the thread was opened from, if any.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "archived_at": {
                      "description": "When the thread was archived; `null` while it is active.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "folder_id": {
                      "description": "The folder the thread is in; `null` for none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "frequency_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "Negative for a temporary thread.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb_ids": {
                      "description": "Knowledge bases the thread searches, by id.",
                      "items": {
                        "format": "int64",
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "kb_mode": {
                      "$ref": "#/components/schemas/KbMode"
                    },
                    "kind": {
                      "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
                      "type": "string"
                    },
                    "last_message_at": {
                      "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "max_tokens": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "mcp_tools": {
                      "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadMcp"
                      },
                      "type": "array"
                    },
                    "media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
                    },
                    "min_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "model_alias": {
                      "description": "The alias the thread's turns go to.",
                      "type": "string"
                    },
                    "pinned": {
                      "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
                      "type": "boolean"
                    },
                    "presence_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "profile_id": {
                      "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "purge_at": {
                      "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_budget": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_effort": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_enabled": {
                      "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "repeat_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "seed": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stop": {
                      "description": "Stop sequences; empty leaves the route's default.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "temperature": {
                      "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "temporary": {
                      "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "top_k": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "top_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "description": "Moves with every change to the thread and every new message.",
                      "type": "string"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice"
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "model_alias",
                    "system_prompt",
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "stop",
                    "kind",
                    "mcp_tools",
                    "reasoning_enabled",
                    "reasoning_effort",
                    "reasoning_budget",
                    "agent_id",
                    "pinned",
                    "archived_at",
                    "folder_id",
                    "profile_id",
                    "kb_ids",
                    "kb_mode",
                    "kb_budget_tokens",
                    "voice",
                    "media_defaults",
                    "created_at",
                    "updated_at",
                    "last_message_at",
                    "purge_at",
                    "temporary",
                    "voice_resolved"
                  ],
                  "title": "Thread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Create a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/rows": {
      "get": {
        "description": "The rows of the threads named in `ids` (comma-separated, as 3,7), each exactly as GET /chat/api/threads lists it, active or archived, in the active list's order. For a client that follows the change feed and wants only the rows its message.* events named, instead of the whole list: a message written moved its thread's updated_at and last_message_at and nothing else the list shows, so read these rows and sort the list again. Only stored threads are answered: a temporary id, one that is not there and one out of the caller's reach are left out, so a missing row is never an error. There is no cap on `ids` beyond the 64 KiB a request line may be (about 9,000 ids; more is a 414, and the whole list is then the read to fall back to). A part of `ids` that is not a number is a 400 bad_request. A device key's answer leaves out the threads it may not see, as its list does.",
        "operationId": "get_chat_api_threads_rows",
        "parameters": [
          {
            "in": "query",
            "name": "ids",
            "required": false,
            "schema": {
              "default": "",
              "description": "The thread ids, comma-separated (`3,7`). A temporary id, one that is\nnot there and one out of the caller's reach are left out of the\nanswer; a part that is not a number is a 400.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/threads/rows`.",
                  "properties": {
                    "threads": {
                      "description": "The rows found, each as `GET /chat/api/threads` lists it, in the\nactive list's order.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadRow"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "threads"
                  ],
                  "title": "ThreadRows",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read some of the thread list's rows",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/threads/{id}": {
      "get": {
        "description": "The thread with its settings, `voice_resolved` and `continue` (whether its last reply can be continued), every message oldest first, each with its attachments, the draft attachments that wait for the next message, and the thread's MCP tasks still running or waiting to enter it. A message of a gated turn lists the calls it still waits on as `pending_approvals`; POST /chat/api/threads/{id}/approvals decides them. A thread that is not there, or not the caller's to see, is a 404 not_found; a read that failed a 500 internal, never an empty history. Read the thread again on every change the feed reports.",
        "operationId": "get_chat_api_threads_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/threads/{id}`'s answer: the thread with its whole\nhistory.",
                  "properties": {
                    "draft_attachments": {
                      "description": "Files attached to the next message, not sent yet.",
                      "items": {
                        "$ref": "#/components/schemas/AttachmentMeta"
                      },
                      "type": "array"
                    },
                    "messages": {
                      "description": "Every message, oldest first.",
                      "items": {
                        "$ref": "#/components/schemas/Message"
                      },
                      "type": "array"
                    },
                    "tasks": {
                      "description": "The thread's MCP tasks still running, and the results waiting to\nenter it.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadTask"
                      },
                      "type": "array"
                    },
                    "thread": {
                      "$ref": "#/components/schemas/Thread",
                      "description": "The thread with `voice_resolved` and `continue`: whether its last\nreply can be continued."
                    }
                  },
                  "required": [
                    "thread",
                    "messages",
                    "draft_attachments",
                    "tasks"
                  ],
                  "title": "ThreadDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a thread whole",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/threads/{id}/answer": {
      "post": {
        "description": "A tool whose MCP server runs it as a task (its execution.taskSupport is required) answers the turn at once: its result frame's output is `started, job <task_id>` and carries task {id, task_id, server_label}, and the turn goes on. lmgw follows the task; when it ends, its result enters the thread as a message of role `tool` with task {task_id, server_label, tool, status: completed | failed | cancelled | abandoned, ended_by}, its content the result as text — only while no turn of the thread runs (a turn that runs takes it in when it ends; one that starts, before it reads the history), and not while the thread's last reply waits for approvals or for the turn that runs the calls decided on it. The feed records task.started and task.done. Every later turn sees it as a call of lmgw__job_result and its result, in chronological order: where it is stored among the thread's messages, so a message sent after it follows it; an edit or a regenerate keeps it, and the reply after it answers it again. lmgw starts no turn for a result: this route asks for one, a continuation with no new user message, streaming the frames a send streams; a send answers it too. It needs a result nothing answered yet (a result row with no reply after it, or one waiting to enter the thread), else 409 nothing_to_answer; while a turn of the thread runs it is 409 turn_running (that turn's end lets the results in, and its reply may answer them). It runs on the thread's alias with its configured fallbacks, as every turn does. The body may be empty; speak reads the answer aloud as a send's does. GET /chat/api/threads/{id} lists the thread's tasks still running or waiting to enter it as `tasks` (ThreadTask: id, task_id, server_label, tool, status, status_message, ttl_ms, started_at, by, waiting_for). A temporary thread's calls wait for their task instead, within the server's timeout_ms.",
        "operationId": "post_chat_api_threads_id_answer",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/answer`'s body, which may be empty.",
                "properties": {
                  "speak": {
                    "default": false,
                    "description": "Read the answer aloud as it streams, as a send's `speak`.",
                    "type": "boolean"
                  }
                },
                "title": "AnswerRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Answer a thread's job results",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/approvals": {
      "post": {
        "description": "A thread's MCP tools may wait for an approval (the thread's mcp_tools entry's require_approval: \"never\", \"always\" or {always: {tool_names}, never: {tool_names}}, as OpenAI's; any other shape, read_only included, is refused, and a device key may only tighten it, 403 approval_loosen_refused). A turn that calls one stops: it streams a tool frame {event: approval, approval_request_id, server_label, name, arguments, call_id} for each waiting call (call_id the id the call's ready and result frames carry) and done {pending_approvals}, and saves its reply with them; the other calls of that model turn wait with them. The thread's messages list them as the reply's pending_approvals, and the feed records approval.requested, each with the call_id. This route takes a verdict for every waiting call and resumes the turn as a continuation, streaming the frames a send streams (delta, reasoning, tool, usage, stop, error, done): the declined calls are answered \"The user declined this tool call: <reason>\", the approved ones and the calls that waited with them run, and the model answers; what it adds is appended to the same reply. The resumed turn runs as the principal that started it — its scope, key policy and attribution — whoever approves. The approver is on each approved call's request row (approved_by), in the feed's approval.decided, and in _meta[\"lmgw/approval\"] {decision: approved, by: {kind, name}} of a call forwarded to a device-hosted server; a call nobody approved carries null there. The first decision wins: a call decided already is 409 approval_decided, naming who decided. A body that is not JSON is 400 bad_request, JSON of another shape 422 bad_request. A waiting call without a verdict is 400 approval_missing, naming each; an id nothing waits under 404 approval_not_found; a starter whose key is gone or disabled 409 approval_starter_unavailable, naming it (nothing is decided then; nor when the starter's key is at its concurrency limit, its 429 key_rate); a reply that is no longer the thread's last message 409 approval_moved_on. A device approves only within its own reach: a call its key's tool scope does not admit, or one of lmgw's admin tools unless its own admin tools may do everything (full, capped by the gateway's level), is 403 approval_out_of_scope, naming each, and nothing of the request is decided; declining is open to any client that sees the thread. A decided turn that never starts closes its calls as not run, and the feed's approval.decided says approve: false, not_run: true for an approved one. A new message in the thread declines whatever still waits, \"the user moved on without deciding\", so every call is answered. speak reads the resumed reply aloud as a send's does.",
        "operationId": "post_chat_api_threads_id_approvals",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/approvals`: a verdict for every call the\nthread's last reply waits on.",
                "properties": {
                  "decisions": {
                    "items": {
                      "$ref": "#/components/schemas/ApprovalDecision"
                    },
                    "type": "array"
                  },
                  "speak": {
                    "description": "Read the resumed reply aloud as it streams, as a send's `speak`.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "decisions"
                ],
                "title": "ApprovalsRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Decide the calls a turn waits on",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/archive": {
      "post": {
        "description": "archived: true archives the thread by hand; false restores it. Answers the thread as the list carries it. A temporary thread is discarded, not archived: 409 temporary_thread. A thread the caller cannot reach is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_archive",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/archive`'s body.",
                "properties": {
                  "archived": {
                    "description": "Archive (`true`) the thread by hand, or restore it.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "archived"
                ],
                "title": "ArchiveRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
                  "properties": {
                    "agent_id": {
                      "description": "The agent the thread was opened from, if any.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "archived_at": {
                      "description": "When the thread was archived; `null` while it is active.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "folder_id": {
                      "description": "The folder the thread is in; `null` for none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "frequency_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "Negative for a temporary thread.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb_ids": {
                      "description": "Knowledge bases the thread searches, by id.",
                      "items": {
                        "format": "int64",
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "kb_mode": {
                      "$ref": "#/components/schemas/KbMode"
                    },
                    "kind": {
                      "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
                      "type": "string"
                    },
                    "last_message_at": {
                      "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "max_tokens": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "mcp_tools": {
                      "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadMcp"
                      },
                      "type": "array"
                    },
                    "media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
                    },
                    "min_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "model_alias": {
                      "description": "The alias the thread's turns go to.",
                      "type": "string"
                    },
                    "pinned": {
                      "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
                      "type": "boolean"
                    },
                    "presence_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "profile_id": {
                      "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "purge_at": {
                      "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_budget": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_effort": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_enabled": {
                      "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "repeat_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "seed": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stop": {
                      "description": "Stop sequences; empty leaves the route's default.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "temperature": {
                      "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "temporary": {
                      "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "top_k": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "top_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "description": "Moves with every change to the thread and every new message.",
                      "type": "string"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice"
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "model_alias",
                    "system_prompt",
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "stop",
                    "kind",
                    "mcp_tools",
                    "reasoning_enabled",
                    "reasoning_effort",
                    "reasoning_budget",
                    "agent_id",
                    "pinned",
                    "archived_at",
                    "folder_id",
                    "profile_id",
                    "kb_ids",
                    "kb_mode",
                    "kb_budget_tokens",
                    "voice",
                    "media_defaults",
                    "created_at",
                    "updated_at",
                    "last_message_at",
                    "purge_at",
                    "temporary",
                    "voice_resolved"
                  ],
                  "title": "Thread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Archive or restore a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/attachments": {
      "post": {
        "description": "The body is the file's bytes, not multipart; ?name= is its name. The kind is sniffed from the bytes (image, text, pdf, office, audio), never taken from the name or the Content-Type. The file is stored as a draft of the thread, to be sent with the next message (`attachments` of POST /chat/api/threads/{id}/send), and answered as its metadata, with `blockers` and `hints` saying what the thread's current model cannot take. A PDF is read at upload (text-class, scanned or hybrid in `meta.class`; a text-class one starts with the Chat's PDF mode, or none to ask), an office file likewise, and an audio file is transcribed at once when its model cannot hear it and a speech-to-text model is set (a failure is `meta.transcript_error`, not a refusal). The body is bounded by max_body_mb (413 body_limit naming it, for a declared or a chunked body). 400 empty_attachment for an empty file, 404 not_found for a thread that is not there or not the caller's, 415 unsupported_attachment for bytes of no supported kind, 422 extract_failed (the file could not be read) or tool_missing (the PDF reader is not installed).",
        "operationId": "post_chat_api_threads_id_attachments",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "name",
            "required": true,
            "schema": {
              "description": "The file's name, shown on its chip and kept in an export. The kind\nis sniffed from the bytes, never taken from the name or a content\ntype. Blank is stored as `untitled`.",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One attachment's metadata, never its bytes.",
                  "properties": {
                    "blockers": {
                      "description": "For a draft: why it cannot be sent to the thread's current model.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "call_id": {
                      "description": "The tool call that made a `tool` file, or the card action that made\nan `action` file (its `act-<boot>-<n>` id, the one its stream's\nframes carried); absent for an upload.",
                      "type": "string"
                    },
                    "extracted_tokens": {
                      "description": "The extracted text's token estimate; `null` when there is none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "hints": {
                      "description": "For a draft: what it becomes on the way, sent all the same (an image\nas a placeholder, a PDF's pages as its text) under a fallback that\ncannot see.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "kind": {
                      "description": "`image`, `pdf`, `text`, `audio`, ... as the upload was classified.",
                      "type": "string"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/AttachmentFacts",
                      "description": "What extraction found: pages, text-less pages, class, sheets,\ntranscript alias or error, tokens. `{}` for an image."
                    },
                    "mime": {
                      "type": "string"
                    },
                    "mode": {
                      "description": "A text-class PDF's choice, `text` or `images`; `null` when it does\nnot apply or is not chosen yet.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "size": {
                      "description": "Size in bytes.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "source": {
                      "description": "Where the file came from: `upload` (the user sent it), `tool` (an\nimage or audio tool of a turn made it) or `action` (an image card's\naction made it).",
                      "enum": [
                        "upload",
                        "tool",
                        "action"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "name",
                    "mime",
                    "size",
                    "mode",
                    "meta",
                    "extracted_tokens",
                    "source"
                  ],
                  "title": "AttachmentMeta",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Upload an attachment",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/continue": {
      "post": {
        "description": "The model continues the thread's last reply (an assistant prefill) and streams the continuation only: the delta frames are what is added, done's message_id is the continued reply, and the stored reply's text and reasoning grow by what came (its token counts become this call's). The body is optional (a body that is not JSON is 400 bad_request, JSON of another shape 422 bad_request); with `speak` the continuation is read aloud as it streams, from the clause the reply broke off in. 409 continue_unavailable when the thread's `continue` state says no (its reason is the message): there is no reply yet, the last message is not a reply, the reply ran tools, or the thread's model cannot take a prefill. The same code answers a reply that stopped being the last message meanwhile. A route the request is re-routed to that cannot take a prefill is refused in the stream, with an error frame. 404 not_found, and a device key's own refusals. The frames are those of a send, without the `turn` frame.",
        "operationId": "post_chat_api_threads_id_continue",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "The optional body of a continue and of a regenerate; an empty request is\naccepted.",
                "properties": {
                  "speak": {
                    "description": "Read the answer aloud as it streams.",
                    "type": "boolean"
                  }
                },
                "title": "TurnRequest",
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Continue the thread's last reply",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/delete": {
      "post": {
        "description": "Deletes the thread with its messages and attachments. The owner's delete of a thread that is not there still answers ok; a device key's delete of a thread it cannot reach (gone, or Admin Chat) is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/export": {
      "get": {
        "description": "The thread as one file. format=md (the default) is a readable Markdown transcript, text/markdown; charset=utf-8, with its attachments listed by name; format=json is the lossless lmgw.chat.v1 file, application/json, with every thread column, every message, and each attachment's metadata, extracted text and base64 bytes (the `format` field of the file says lmgw.chat.v1). The answer carries Content-Disposition: attachment with a file name lmgw-chat-{id}-{title}.md or .json (a temporary thread's id reads temp{n}) and Cache-Control: no-store. A temporary thread is exported from memory. A format other than md, markdown or json is a 400 bad_request; a thread that is not there, or not the caller's to see, is a 404 not_found.",
        "operationId": "get_chat_api_threads_id_export",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "archived",
            "required": false,
            "schema": {
              "default": "",
              "description": "Zips only: `0` active threads, `1` archived threads only, `all`\n(default) both.",
              "enum": [
                "0",
                "1",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "",
              "description": "`md` (default; `markdown` is accepted too) for a readable\ntranscript, `json` for the lossless `lmgw.chat.v1` file. A zip holds\none file of this format per thread.",
              "enum": [
                "md",
                "markdown",
                "json"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The `lmgw.chat.v1` file of one thread: every thread column, every\nmessage, and every attachment with its bytes.",
                  "properties": {
                    "draft_attachments": {
                      "description": "The attachments not yet sent with a message.",
                      "items": {
                        "$ref": "#/components/schemas/ExportAttachment"
                      },
                      "type": "array"
                    },
                    "exported_at": {
                      "description": "When the file was written (RFC 3339, UTC).",
                      "type": "string"
                    },
                    "folder": {
                      "$ref": "#/components/schemas/ExportRef",
                      "description": "The thread's folder; absent when it is in none."
                    },
                    "format": {
                      "description": "Always `lmgw.chat.v1`.",
                      "type": "string"
                    },
                    "messages": {
                      "description": "Oldest first.",
                      "items": {
                        "$ref": "#/components/schemas/ExportMessage"
                      },
                      "type": "array"
                    },
                    "profile": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ExportRef"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The thread's personality profile; `null` for none."
                    },
                    "thread": {
                      "$ref": "#/components/schemas/ExportThread"
                    }
                  },
                  "required": [
                    "format",
                    "exported_at",
                    "thread",
                    "profile",
                    "messages",
                    "draft_attachments"
                  ],
                  "title": "ChatExport",
                  "type": "object"
                }
              },
              "text/markdown; charset=utf-8": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/threads/{id}/media/{call_id}/cancel": {
      "post": {
        "description": "Stops the image or audio tool call {call_id} (the call_id of its tool frames) of the turn that runs in the thread, as the turn's Stop stops it, without stopping the turn: the call's result tells the model the picture was not made, and the turn goes on. It also stops a card action of the thread (POST /chat/api/attachments/{id}/media), named by the act-<boot>-<n> id of its stream's action frame; the action's stream then ends with an error frame and nothing is stored. A running image job is cancelled by what its image server can do, which the call's last `progress` frame named as `cancel` and the answer repeats: native, the server's own cancel (the model stays loaded); restart, the server cannot stop a running picture and this call is the model's only request, so lmgw stops its container and the next picture loads it again; abandon, another request uses the model, so the call stops waiting and the picture finishes in the background and is thrown away. An upscale has no job: restart or abandon by the same rule, an abandoned one holding its claim until the image server is done. No `cancel` in the answer: no job ran yet (the call was loading its model or waiting for room, and stops waiting), or an audio call. The body is ignored. A thread the caller does not reach is 404 not_found; a call that is not running, 404 not_running.",
        "operationId": "post_chat_api_threads_id_media_call_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "call_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What `POST /chat/api/threads/{id}/media/{call_id}/cancel` did.",
                  "properties": {
                    "cancel": {
                      "$ref": "#/components/schemas/CancelKind",
                      "description": "What the cancel does to the running image job; absent when no job\nruns yet (the call was still loading its model or waiting for room,\nand stops waiting) and for an audio call."
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "MediaCancelled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a running picture or recording",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/messages/{mid}/delete": {
      "post": {
        "description": "Deletes that one message with its attachments; nothing after it moves. A device key below full admin level changes no message of a thread with lmgw's admin tools (403 chat_toolset_needs_full). A thread or message that is not there is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_messages_mid_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "mid",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The answer of a write that has nothing to report but that it\nhappened: `{\"ok\": true}`.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`; a failure is an error answer instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "title": "Ack",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a message",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/messages/{mid}/edit": {
      "post": {
        "description": "What the answer is depends on the message. A reply is rewritten in place and nothing is sent: its reasoning, token counts and tool record are cleared, since they no longer describe the text, and so are a spoken reply's unheard rest and timing; the answer is JSON, `ok` and the message as the thread lists it. A user message is rewritten in place (its attachments stay bound), every later message is deleted, and it is answered again: the answer is the event stream of a send, opening with a `turn` frame. An empty text is a 400 empty_message unless the message carries files. Its stored knowledge retrieval goes with the old text, so auto mode searches again; kb_refs, when sent, replaces its `#` picks. A dictated message whose text changed becomes a typed one. Everything that can refuse happens before anything is written. Any other role is a 400 bad_request. A device key below full admin level edits no message of a thread with lmgw's admin tools (403 chat_toolset_needs_full); its kb_refs pass its tool scope. A thread or message that is not there is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_messages_mid_edit",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "mid",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/messages/{mid}/edit`'s body.",
                "properties": {
                  "content": {
                    "description": "The new text.",
                    "type": "string"
                  },
                  "kb_refs": {
                    "description": "A user message's knowledge bases for itself (`#`), replacing the\nones it had; absent keeps them. Ignored for a reply.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "origin": {
                    "description": "A user message's new origin (`origin` of a send): where the user\nwrites the edit from. Absent, or blank, keeps the one it had.\nIgnored for a reply.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "speak": {
                    "description": "Read the new answer aloud as it streams. Ignored for a reply, which\nis not answered again.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "content"
                ],
                "title": "MessageEdit",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/messages/{mid}/edit`'s JSON answer, for a\nreply: rewritten in place, nothing sent.",
                  "properties": {
                    "message": {
                      "$ref": "#/components/schemas/Message",
                      "description": "The reply as `GET /chat/api/threads/{id}` lists it."
                    },
                    "ok": {
                      "description": "Always `true`.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "message"
                  ],
                  "title": "ReplyEdited",
                  "type": "object"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "turn": {
                "description": "`turn`: the first frame of a turn that wrote a user message (a send, an\nedit of a user message).",
                "properties": {
                  "user_message_id": {
                    "description": "The user message the answer follows.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "user_message_id"
                ],
                "title": "TurnStarted",
                "type": "object"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Edit a message",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/messages/{mid}/regenerate": {
      "post": {
        "description": "Cuts the thread at the message and streams a new answer. On a reply, it and every later message are deleted and the model answers the history before it, which has to end with a user message (or a job's result): 409 nothing_to_answer otherwise, and nothing is deleted. On a user message, every later message is deleted, it is answered again, and the stream opens with a `turn` frame carrying its id. Any other role is 400 bad_request; 404 not_found for a thread or message that is not there; a device key below full admin level changes no message of a thread with lmgw's admin tools (403 chat_toolset_needs_full). The model's capabilities are read before anything is cut. The body is optional (a body that is not JSON is 400 bad_request, JSON of another shape 422 bad_request); with `speak` the answer is read aloud as it streams. The frames are those of a send.",
        "operationId": "post_chat_api_threads_id_messages_mid_regenerate",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "mid",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "The optional body of a continue and of a regenerate; an empty request is\naccepted.",
                "properties": {
                  "speak": {
                    "description": "Read the answer aloud as it streams.",
                    "type": "boolean"
                  }
                },
                "title": "TurnRequest",
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "turn": {
                "description": "`turn`: the first frame of a turn that wrote a user message (a send, an\nedit of a user message).",
                "properties": {
                  "user_message_id": {
                    "description": "The user message the answer follows.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "user_message_id"
                ],
                "title": "TurnStarted",
                "type": "object"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Answer a message again",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/messages/{mid}/speak": {
      "post": {
        "description": "Reads the reply as it is shown (its content, then a spoken reply's unheard rest) with the thread's text-to-speech model and voice, and streams the audio as it is made: `state` while the speech model is not resident (loading, then ready, fallback, held or failed), `voice` once its route is open, a `speech` frame per clause (seq counting from 0, the text said, pcm: base64 PCM16 little-endian, 24 kHz, mono) and `speech_done` with the totals. A thread that cannot speak (no speech model, no such voice, a voice that needs instructions) and a voice that fails mid-way end with a `speech_error` frame (codes tts_not_configured, voice_not_found, voice_not_configured, instructions_required, or the failure's kind). One speech row is written per call. Closing the stream stops the synthesis at its next step; POST /chat/api/threads/{id}/speech/stop stops every read-aloud of the thread. A device or owner key that is disabled, rotated, deleted or expired while it streams, and a gateway that stops, end the stream with a last `error` frame (code revoked, with `kind`, or gateway_stopping). Refused before any frame: 404 not_found (thread or message), 400 bad_request (the message is not a reply), 400 empty_message (a reply with no text).",
        "operationId": "post_chat_api_threads_id_messages_mid_speak",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "mid",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a stored reply aloud",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/move": {
      "post": {
        "description": "Moves the thread into the folder, or out of any folder with folder_id: null, and answers the thread as the list carries it. The change reaches every client as a thread.updated event. A temporary thread has no folder until it is kept: 409 temporary_thread. A thread or folder the caller cannot reach is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_move",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/move`'s body.",
                "properties": {
                  "folder_id": {
                    "description": "The target folder; `null` takes the thread out of any folder.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "title": "MoveRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
                  "properties": {
                    "agent_id": {
                      "description": "The agent the thread was opened from, if any.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "archived_at": {
                      "description": "When the thread was archived; `null` while it is active.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "folder_id": {
                      "description": "The folder the thread is in; `null` for none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "frequency_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "Negative for a temporary thread.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb_ids": {
                      "description": "Knowledge bases the thread searches, by id.",
                      "items": {
                        "format": "int64",
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "kb_mode": {
                      "$ref": "#/components/schemas/KbMode"
                    },
                    "kind": {
                      "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
                      "type": "string"
                    },
                    "last_message_at": {
                      "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "max_tokens": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "mcp_tools": {
                      "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadMcp"
                      },
                      "type": "array"
                    },
                    "media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
                    },
                    "min_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "model_alias": {
                      "description": "The alias the thread's turns go to.",
                      "type": "string"
                    },
                    "pinned": {
                      "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
                      "type": "boolean"
                    },
                    "presence_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "profile_id": {
                      "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "purge_at": {
                      "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_budget": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_effort": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_enabled": {
                      "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "repeat_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "seed": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stop": {
                      "description": "Stop sequences; empty leaves the route's default.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "temperature": {
                      "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "temporary": {
                      "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "top_k": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "top_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "description": "Moves with every change to the thread and every new message.",
                      "type": "string"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice"
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "model_alias",
                    "system_prompt",
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "stop",
                    "kind",
                    "mcp_tools",
                    "reasoning_enabled",
                    "reasoning_effort",
                    "reasoning_budget",
                    "agent_id",
                    "pinned",
                    "archived_at",
                    "folder_id",
                    "profile_id",
                    "kb_ids",
                    "kb_mode",
                    "kb_budget_tokens",
                    "voice",
                    "media_defaults",
                    "created_at",
                    "updated_at",
                    "last_message_at",
                    "purge_at",
                    "temporary",
                    "voice_resolved"
                  ],
                  "title": "Thread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Move a thread into a folder",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/persist": {
      "post": {
        "description": "Writes a temporary thread (messages, attachments, settings) to the database as an ordinary thread and drops it from memory. Answers the stored thread and its new, positive id; the temporary id is gone. A thread that is already stored is a 409 not_temporary; a keep of the same thread already running a 409 keep_in_progress; a keep while a realtime voice session is bound to the thread a 409 voice_session_active. An unknown temporary thread is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_persist",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/persist`'s answer.",
                  "properties": {
                    "id": {
                      "description": "The stored thread's new, positive id.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "thread": {
                      "$ref": "#/components/schemas/Thread",
                      "description": "The stored thread."
                    }
                  },
                  "required": [
                    "id",
                    "thread"
                  ],
                  "title": "ThreadKept",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Keep a temporary thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/pin": {
      "post": {
        "description": "Pinned threads are listed first and are never archived or deleted by the retention sweep. Pinning an archived thread also restores it. Answers the thread as the list carries it. A temporary thread has nothing to pin until it is kept: 409 temporary_thread. A thread the caller cannot reach is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_pin",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/pin`'s body.",
                "properties": {
                  "pinned": {
                    "description": "Pin (`true`) or unpin the thread. Pinning an archived thread also\nrestores it.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "pinned"
                ],
                "title": "PinRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
                  "properties": {
                    "agent_id": {
                      "description": "The agent the thread was opened from, if any.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "archived_at": {
                      "description": "When the thread was archived; `null` while it is active.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "folder_id": {
                      "description": "The folder the thread is in; `null` for none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "frequency_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "Negative for a temporary thread.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb_ids": {
                      "description": "Knowledge bases the thread searches, by id.",
                      "items": {
                        "format": "int64",
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "kb_mode": {
                      "$ref": "#/components/schemas/KbMode"
                    },
                    "kind": {
                      "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
                      "type": "string"
                    },
                    "last_message_at": {
                      "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "max_tokens": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "mcp_tools": {
                      "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadMcp"
                      },
                      "type": "array"
                    },
                    "media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
                    },
                    "min_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "model_alias": {
                      "description": "The alias the thread's turns go to.",
                      "type": "string"
                    },
                    "pinned": {
                      "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
                      "type": "boolean"
                    },
                    "presence_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "profile_id": {
                      "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "purge_at": {
                      "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_budget": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_effort": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_enabled": {
                      "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "repeat_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "seed": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stop": {
                      "description": "Stop sequences; empty leaves the route's default.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "temperature": {
                      "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "temporary": {
                      "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "top_k": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "top_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "description": "Moves with every change to the thread and every new message.",
                      "type": "string"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice"
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "model_alias",
                    "system_prompt",
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "stop",
                    "kind",
                    "mcp_tools",
                    "reasoning_enabled",
                    "reasoning_effort",
                    "reasoning_budget",
                    "agent_id",
                    "pinned",
                    "archived_at",
                    "folder_id",
                    "profile_id",
                    "kb_ids",
                    "kb_mode",
                    "kb_budget_tokens",
                    "voice",
                    "media_defaults",
                    "created_at",
                    "updated_at",
                    "last_message_at",
                    "purge_at",
                    "temporary",
                    "voice_resolved"
                  ],
                  "title": "Thread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Pin or unpin a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/send": {
      "post": {
        "description": "Writes the user message (with the draft attachments it binds and the knowledge bases it picks) and streams the model's answer. The message is stored before the model is called, so a client that goes away has still recorded what it asked; an untitled thread is titled from it. `content` may be empty when attachments are bound. A dictated message names its origin in `voice` (via: dictation); with `speak`, the reply is read aloud as it streams and the stream also carries voice, speech, speech_done and speech_error frames (the speech frames' audio is base64 PCM16, 24 kHz, mono). The first frame is `turn` with the user message's id. Refused before anything is written: 400 empty_message (no text and no attachment), 400 bad_request (a knowledge base that does not exist), 400 attachment_not_draft (an id that is no draft of the thread), 400 model_no_vision (a new image and a model that cannot see), 422 attachment_blocked (a file the thread's model cannot take, named), 404 not_found and a device key's own refusals (its scope, its budget). A body that is not JSON is 400 bad_request, JSON of another shape (an unknown or mistyped field, `voice` included) 422 bad_request, and a `voice.via` other than dictation (realtime, say) 400 bad_request. 409 attachment_not_draft: a concurrent send took a draft first. A turn that fails after the stream began says so in an error frame. The answer is a server-sent event stream; every frame's data is JSON of the type its event name has below. state: a model stage loading, held, falling back or failing (the thread's model); retrieval: what the knowledge bases found for the user message, before the model answers; delta: a piece of the answer; reasoning: a piece of the model's reasoning; tool: a tool call of the turn, by its `event` (start, args, ready, approval, result); usage: the token counts so far; stop: why the model stopped; stats: a local model's timings; error: a failure, the stream goes on to done — one per MCP label the thread or its folder attached that offers the turn no tools, with its server_label and a code (tool_unreachable: a paired device's tools the caller is not granted, or a server its tool scope keeps out; tool_offline; tool_disabled; tool_unknown; tool_failed), the turn going on without it, as a plain chat turn when every such label is an offline or ungranted device's; done: the end, naming the reply it saved and its token counts, and `pending_approvals` when it stopped on calls that wait for a decision. A turn that is refused before it says anything streams error and done {aborted: true}. A client that closes the stream stops the turn; the partial reply is saved.",
        "operationId": "post_chat_api_threads_id_send",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/send`'s body.",
                "properties": {
                  "attachments": {
                    "description": "Draft attachment ids this message binds, in the order the files are\nread in; a repeated id counts once.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "content": {
                    "description": "The message's text; may be empty when `attachments` is not (a message\ncan be just a file).",
                    "type": "string"
                  },
                  "kb_refs": {
                    "description": "Knowledge bases picked for this message alone, on top of the thread's\nown.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "origin": {
                    "description": "Where the user writes from, in one sentence the client words (a\nbrowser sidebar: \"Typed in Kai's sidebar in Firefox, beside the tab\n“Example” (https://example.org/).\"). Stored on the user message and\nput before its text in the model's input on every turn, marked as\nwhat the client says rather than the user's words; the thread reads\nit back as the message's `origin`. Absent, or blank: the message\nsays nothing of where it was written.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "speak": {
                    "description": "Read the reply aloud as it streams: the stream then carries the\nspeech frames too.",
                    "type": "boolean"
                  },
                  "voice": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/DictatedVoice"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "How a dictated message was dictated, stored on the user message."
                  }
                },
                "required": [
                  "content"
                ],
                "title": "SendRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "delta": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "done": {
                "description": "`done`: the turn's last frame. `aborted` is `true` when the turn ended\nearly (refused, stopped, failed before it said anything); a turn that\nsaved nothing says only that, with no `message_id`.",
                "properties": {
                  "aborted": {
                    "type": "boolean"
                  },
                  "answered_by": {
                    "description": "The alias that answered in its place (a fallback, a candidate\nalias's pick), when one did.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "images_note": {
                    "description": "A fallback that cannot see answered and got the images as\nplaceholders: who, in a sentence. Only when it did.",
                    "type": "string"
                  },
                  "message_id": {
                    "description": "The reply the turn saved or appended to; `0` when it saved none.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "model": {
                    "description": "The thread's model alias.",
                    "type": "string"
                  },
                  "pending_approvals": {
                    "description": "The calls the turn stopped on and waits for a decision about; only\nwhen there are some.",
                    "items": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "type": "array"
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_ignored": {
                    "description": "The thread's reasoning and sampling overrides this route did not send.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "reasoning_note": {
                    "description": "The model reasoned although off was asked, in a sentence.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "saved": {
                    "description": "Whether the reply is stored. `false`: its bubble is not a row, and no\naction on it can work.",
                    "type": "boolean"
                  },
                  "timings": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Timings"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The authoritative final timings of a local model; `null` for a cloud\nupstream."
                  },
                  "total_ms": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "ttfb_ms": {
                    "description": "Milliseconds to the first byte of the upstream's answer.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "aborted"
                ],
                "title": "DoneFrame",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "reasoning": {
                "description": "`delta` (a piece of the answer) and `reasoning` (a piece of the model's\nreasoning, kept apart from the answer).",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "title": "TextFrame",
                "type": "object"
              },
              "retrieval": {
                "description": "`retrieval`: what the knowledge bases found for the user message, before\nthe model answers.",
                "properties": {
                  "budget_tokens": {
                    "description": "The budget the retrieval ran with.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "dropped": {
                    "description": "Excerpts that ranked but did not fit the budget.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "excerpts": {
                    "items": {
                      "$ref": "#/components/schemas/ContextExcerpt"
                    },
                    "type": "array"
                  },
                  "kb_ids": {
                    "description": "The bases asked for: the thread's and the message's, as they were\nthen.",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": "array"
                  },
                  "message_id": {
                    "description": "The user message the retrieval belongs to.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "ms": {
                    "description": "How long the retrieval took.",
                    "format": "double",
                    "type": "number"
                  },
                  "notes": {
                    "description": "Why something was not searched, or not fully: one sentence each.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "query": {
                    "description": "What was searched for.",
                    "type": "string"
                  },
                  "reused": {
                    "description": "The message's stored retrieval was used again instead of searching.",
                    "type": "boolean"
                  },
                  "searched": {
                    "description": "The bases that were searched, by name.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "tokens": {
                    "description": "Tokens the excerpts use, heading paths included.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "excerpts",
                  "tokens",
                  "dropped",
                  "budget_tokens",
                  "notes",
                  "searched",
                  "kb_ids",
                  "query",
                  "ms",
                  "message_id",
                  "reused"
                ],
                "title": "RetrievalFrame",
                "type": "object"
              },
              "speech": {
                "description": "`speech`: one clause as said, with its audio.",
                "properties": {
                  "pcm": {
                    "description": "The clause's audio, base64 of PCM16 little-endian, 24 kHz, mono.",
                    "type": "string"
                  },
                  "seq": {
                    "description": "Counts from 0.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "seq",
                  "text",
                  "pcm"
                ],
                "title": "SpeechFrame",
                "type": "object"
              },
              "speech_done": {
                "description": "`speech_done`: the read-aloud ended, whole or stopped.",
                "properties": {
                  "audio_ms": {
                    "description": "Length of the audio sent.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "chars": {
                    "description": "Characters spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "first_audio_ms": {
                    "description": "From the request's start to the first `speech` frame; `null` when\nnothing was spoken.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stopped": {
                    "description": "Stopped (`POST .../speech/stop`, or the reader went away) before the\ntext ended.",
                    "type": "boolean"
                  },
                  "tts": {
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "chars",
                  "audio_ms",
                  "first_audio_ms",
                  "tts",
                  "tts_answered_by",
                  "stopped"
                ],
                "title": "SpeechDone",
                "type": "object"
              },
              "speech_error": {
                "description": "`speech_error`: the read-aloud cannot speak or failed; it ends the\nspeech. Codes: `tts_not_configured`, `voice_not_found`,\n`voice_not_configured`, `instructions_required`, a device key's own\nrefusals, or the failure's kind.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "title": "SpeechError",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              },
              "stats": {
                "description": "Server-measured prefill and decode timings of a local model: the `stats`\nframe (live per token while it streams) and the `done` frame's final\n`timings`.",
                "properties": {
                  "cache_n": {
                    "description": "Prompt tokens served from the KV cache.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n": {
                    "description": "Draft tokens proposed (speculative or MTP decoding).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "draft_n_accepted": {
                    "description": "Draft tokens accepted.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_ms": {
                    "description": "Milliseconds spent generating; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "predicted_n": {
                    "description": "Tokens generated so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "predicted_per_second": {
                    "description": "Tokens generated per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_ms": {
                    "description": "Milliseconds spent on the prompt; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  },
                  "prompt_n": {
                    "description": "Prompt tokens actually processed this turn (the cache excluded).",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "prompt_per_second": {
                    "description": "Prompt tokens processed per second; absent when llama.cpp gave no finite number.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "required": [
                  "prompt_n",
                  "predicted_n"
                ],
                "title": "Timings",
                "type": "object"
              },
              "stop": {
                "description": "`stop`: why the model stopped, in OpenAI's words (`stop`, `length`,\n`tool_calls`, ...).",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "title": "StopFrame",
                "type": "object"
              },
              "tool": {
                "description": "`tool`: a tool call of the turn, told apart by `event`. `start` and\n`args` while the model writes the call; `ready` when its arguments are\ncomplete (a call that waits for an approval says `needs_approval`);\n`approval` for a call that waits for a decision\n(`POST /chat/api/threads/{id}/approvals`); `result` when it has run. A\nresult's `task` says which MCP task a call started: its output is then\n`started, job <task_id>`, and the result enters the thread later.\n`progress` while an image or audio tool runs: its stage, step and latest\npreview (`ToolProgressFrame`), lossy and not in the change feed; a\nresult's `attachments` are the files the call stored in the thread.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ToolStartFrame",
                    "properties": {
                      "event": {
                        "const": "start",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolArgsFrame",
                    "properties": {
                      "event": {
                        "const": "args",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolReadyFrame",
                    "properties": {
                      "event": {
                        "const": "ready",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ApprovalRequest",
                    "properties": {
                      "event": {
                        "const": "approval",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolResultFrame",
                    "properties": {
                      "event": {
                        "const": "result",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  },
                  {
                    "$ref": "#/components/schemas/ToolProgressFrame",
                    "properties": {
                      "event": {
                        "const": "progress",
                        "type": "string"
                      }
                    },
                    "required": [
                      "event"
                    ],
                    "type": "object"
                  }
                ],
                "title": "ToolFrame"
              },
              "turn": {
                "description": "`turn`: the first frame of a turn that wrote a user message (a send, an\nedit of a user message).",
                "properties": {
                  "user_message_id": {
                    "description": "The user message the answer follows.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "user_message_id"
                ],
                "title": "TurnStarted",
                "type": "object"
              },
              "usage": {
                "description": "`usage`: the tokens the model reported for the turn so far.",
                "properties": {
                  "completion_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prompt_tokens": {
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "prompt_tokens",
                  "completion_tokens"
                ],
                "title": "UsageFrame",
                "type": "object"
              },
              "voice": {
                "description": "`voice` (speech): the read-aloud's route is open.",
                "properties": {
                  "tts": {
                    "description": "The text-to-speech alias.",
                    "type": "string"
                  },
                  "tts_answered_by": {
                    "description": "The alias that answers in the TTS alias's place (a fallback).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "description": "The voice every clause is sent with.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "tts",
                  "voice",
                  "tts_answered_by"
                ],
                "title": "VoiceFrame",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Send a message and stream the answer",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/settings": {
      "post": {
        "description": "A patch: a field left out stays as it is, and for the settings that can be unset, null clears it back to the route's default. Settings that contradict each other (the reasoning and sampling overrides, the knowledge settings, a voice alias that cannot do what it is for) are a 400 bad_request and nothing is written; an unknown profile_id is a 400 unknown_profile. The answer re-judges `continue` under the new settings, and carries the voice as stored and what it resolves to now. A device key's mcp_tools and knowledge bases pass its tool scope first (403 tool_label_out_of_scope), its model and voice aliases its alias scope (403 key_scope); a device below full admin level changes no setting of a thread with lmgw's admin tools (403 chat_toolset_needs_full). A thread that is gone is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_settings",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /chat/api/threads/{id}/settings`'s body: a **patch**. An absent\nfield leaves that setting alone; for the settings that can be unset,\n`null` clears it back to the route's default. The thread's title is not\nhere: it names itself on the first send, and `POST …/title` renames it.",
                "properties": {
                  "frequency_penalty": {
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "kb_budget_tokens": {
                    "description": "The retrieval budget of `auto` mode in tokens; `null` takes the\nChat's setting.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "kb_ids": {
                    "description": "The thread's knowledge bases, as a whole selection (`[]` clears it).",
                    "items": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "kb_mode": {
                    "description": "`auto` or `tool`: how the bases reach the model.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "max_tokens": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "mcp_tools": {
                    "description": "The tool servers the thread uses, as a whole list (`[]` detaches\nall). A device key's labels pass its tool scope first.",
                    "items": {
                      "$ref": "#/components/schemas/ThreadMcpInput"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "media_defaults": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MediaDefaults"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The image and audio tools' default models, as a whole object (`{}`\ninherits everything): a field names a model of the tool's `model`\nenum (`\"\"` for none), or the voice. A name the tool cannot use for\nthis caller is a 400 `bad_request`; one the thread already holds\npasses, so a model switched off since does not block other changes."
                  },
                  "min_p": {
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "model_alias": {
                    "description": "The alias the thread's turns go to.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "presence_penalty": {
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "profile_id": {
                    "description": "The personality profile, an id from `GET /chat/api/profiles`; `null`\nfor none. An unknown id is a 400 `unknown_profile`.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_budget": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "reasoning_effort": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reasoning_enabled": {
                    "description": "Reasoning overrides sent with every turn; `null` clears one.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "repeat_penalty": {
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "seed": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "stop": {
                    "description": "The whole list of stop sequences; `[]` clears it.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "system_prompt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "temperature": {
                    "description": "Sampling overrides sent with every turn: a number sets one, `null`\nclears it.",
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "top_k": {
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "top_p": {
                    "format": "double",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "voice": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ThreadVoice"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The thread's voice overrides as a whole object; `null` clears them.\nAn unknown key or value is a 400 `bad_request`."
                  }
                },
                "title": "SettingsPatch",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/settings`'s answer.",
                  "properties": {
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued under the new settings (a\nmodel switch or a reasoning toggle changes it)."
                    },
                    "ok": {
                      "description": "Always `true`.",
                      "type": "boolean"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice",
                      "description": "The thread's own voice settings as stored now."
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the voice resolves to now, as `voice_resolved` of\n`GET /chat/api/threads/{id}`: `asr` and `tts` (alias, whether it runs\non this machine, what answers for it while the GPU is held), `voice`,\n`speech_style`, `language`, `reply_language`, `language_notes`,\n`read_aloud`, `turn_detection`, `audio_input`, `seed`, the `problems`\nthat block a voice feature now, and `realtime`."
                    }
                  },
                  "required": [
                    "ok",
                    "continue",
                    "voice",
                    "voice_resolved"
                  ],
                  "title": "SettingsAck",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Change a thread's settings",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/speech/stop": {
      "post": {
        "description": "Stops the thread's running read-alouds (a message spoken on request, or a reply read aloud as it streams); `stopped` counts them, 0 when nothing was playing. A thread the caller cannot reach is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_speech_stop",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/speech/stop`'s answer.",
                  "properties": {
                    "ok": {
                      "description": "Always `true`.",
                      "type": "boolean"
                    },
                    "stopped": {
                      "description": "How many read-alouds of the thread were running and are stopped; `0`\nwhen none ran.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "ok",
                    "stopped"
                  ],
                  "title": "SpeechStopped",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Stop a thread's read-aloud",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/tasks": {
      "get": {
        "description": "The thread's MCP tasks still running or waiting to enter it, oldest first, as GET /chat/api/threads/{id} lists them as `tasks` (ThreadTask), without the history: the Chat page's strip re-reads them at mcp.task_poll_interval_s. A thread the caller does not reach is 404 not_found, as everywhere in Chat; a temporary thread has none (an empty list).",
        "operationId": "get_chat_api_threads_id_tasks",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ThreadTask"
                  },
                  "title": "Array_of_ThreadTask",
                  "type": "array"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a thread's jobs",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/threads/{id}/tasks/{task}/cancel": {
      "post": {
        "description": "Cancels task {task} (ThreadTask.id, the feed's task.started id) of the thread: lmgw sends tasks/cancel. The answer is the task as the cancel left it, whether its result is in the thread now, and what happened: the server cancelled it (its result says `cancelled by <who>`), it finished before the cancel (its real result), or the server was not connected (it ends cancelled at once and the server is told when it connects), or the server was asked and has not ended it yet (it is followed until it says it ended). The body is ignored. A thread the caller does not reach is 404 not_found; a task of another thread, or one whose result entered the thread already (it is gone then), 404 task_not_found; one that ended and whose result waits to enter the thread 409 task_ended; a server that does not declare tasks.cancel 409 task_cancel_unsupported, one that answers the cancel with an error 502 task_cancel_refused — the task goes on in both. Deleting the thread cancels its running tasks too.",
        "operationId": "post_chat_api_threads_id_tasks_task_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "task",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/tasks/{task}/cancel`'s answer.",
                  "properties": {
                    "delivered": {
                      "description": "Its result is in the thread now (a message of role `tool`); `false`\nwhile it waits for a turn that runs, or while the server has not\nended the task yet.",
                      "type": "boolean"
                    },
                    "note": {
                      "description": "What happened, in a sentence.",
                      "type": "string"
                    },
                    "task": {
                      "$ref": "#/components/schemas/ThreadTask",
                      "description": "The task as the cancel left it."
                    }
                  },
                  "required": [
                    "task",
                    "delivered",
                    "note"
                  ],
                  "title": "TaskCancelled",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a thread's job",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/title": {
      "post": {
        "description": "Sets the thread's title, trimmed, and answers the thread as the list carries it. The change reaches every client as a thread.updated event. A thread named this way keeps its title: the first send names only a thread still called \"New chat\". An empty title is a 400 bad_request. A temporary thread has no stored title to set until it is kept: 409 temporary_thread. A thread the caller cannot reach is a 404 not_found.",
        "operationId": "post_chat_api_threads_id_title",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/threads/{id}/title`'s body.",
                "properties": {
                  "title": {
                    "description": "The new title. Trimmed; empty after that is a 400. A thread named\nthis way is never named again by its first send.",
                    "type": "string"
                  }
                },
                "required": [
                  "title"
                ],
                "title": "TitleRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One Chat thread with what an open thread shows: its list row, what its\nvoice resolves to now, and (where it is read whole) whether its last\nreply can be continued.",
                  "properties": {
                    "agent_id": {
                      "description": "The agent the thread was opened from, if any.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "archived_at": {
                      "description": "When the thread was archived; `null` while it is active.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "continue": {
                      "$ref": "#/components/schemas/ContinueState",
                      "description": "Whether the last reply can be continued. Present where the thread\nis read whole, as `POST /chat/api/folders/{id}/current` answers it."
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "folder_id": {
                      "description": "The folder the thread is in; `null` for none.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "frequency_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "Negative for a temporary thread.",
                      "format": "int64",
                      "type": "integer"
                    },
                    "kb_budget_tokens": {
                      "description": "The retrieval budget of `auto` mode in tokens; `null` for the Chat's\nsetting.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "kb_ids": {
                      "description": "Knowledge bases the thread searches, by id.",
                      "items": {
                        "format": "int64",
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "kb_mode": {
                      "$ref": "#/components/schemas/KbMode"
                    },
                    "kind": {
                      "description": "`chat`, or `admin` for a thread that drives the gateway's own\nconfiguration (never listed for a device key).",
                      "type": "string"
                    },
                    "last_message_at": {
                      "description": "When its newest message was written, in unix seconds; `null` for a\nthread without messages. An ongoing folder's idle rollover is\nmeasured from it: a client that shows when the conversation moves\non reads it here rather than timing the turns it saw.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "max_tokens": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "mcp_tools": {
                      "description": "The tool servers the thread's turns use; empty for a plain chat. A\nthread with `lmgw` (the self-admin toolset) among them is listed for a\ndevice key only when the device may use lmgw's admin tools.",
                      "items": {
                        "$ref": "#/components/schemas/ThreadMcp"
                      },
                      "type": "array"
                    },
                    "media_defaults": {
                      "$ref": "#/components/schemas/MediaDefaults",
                      "description": "The thread's own default models of the image and audio tools; an\nabsent field inherits its folder's, then Settings → Chat's, and an\nempty one is no default (`GET /chat/api/media/defaults` says what\nthey resolve to)."
                    },
                    "min_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "model_alias": {
                      "description": "The alias the thread's turns go to.",
                      "type": "string"
                    },
                    "pinned": {
                      "description": "Pinned threads are listed first and are never archived or deleted\nby the sweep.",
                      "type": "boolean"
                    },
                    "presence_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "profile_id": {
                      "description": "The personality profile the thread talks with\n(`GET /chat/api/profiles`); `null` for none (\"Default\").",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "purge_at": {
                      "description": "When an archived thread will be deleted; `null` while it is active,\npinned, or when deleting is switched off.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_budget": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reasoning_effort": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_enabled": {
                      "description": "Reasoning overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "repeat_penalty": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "seed": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "stop": {
                      "description": "Stop sequences; empty leaves the route's default.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "temperature": {
                      "description": "Sampling overrides sent with every turn; `null` leaves the route's\ndefault.",
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "temporary": {
                      "description": "The thread lives in memory only and is gone at the gateway's next\nstart unless it is kept.",
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "top_k": {
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "top_p": {
                      "format": "double",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "description": "Moves with every change to the thread and every new message.",
                      "type": "string"
                    },
                    "voice": {
                      "$ref": "#/components/schemas/ThreadVoice"
                    },
                    "voice_resolved": {
                      "$ref": "#/components/schemas/VoiceResolved",
                      "description": "What the thread's voice resolves to now, field by field with the\nlevel each value comes from (the thread, the Chat's settings, the\nrealtime settings): the speech-to-text and text-to-speech stages\n(`asr`, `tts`: alias, whether it runs on this machine, what answers\nfor it while the GPU is held), `voice`, `speech_style`, `language`,\n`reply_language`, `read_aloud`, `turn_detection`, `audio_input`,\n`seed`, the `problems` that block a voice feature now, and\n`realtime`: whether voice mode can bind the thread."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "model_alias",
                    "system_prompt",
                    "temperature",
                    "max_tokens",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "stop",
                    "kind",
                    "mcp_tools",
                    "reasoning_enabled",
                    "reasoning_effort",
                    "reasoning_budget",
                    "agent_id",
                    "pinned",
                    "archived_at",
                    "folder_id",
                    "profile_id",
                    "kb_ids",
                    "kb_mode",
                    "kb_budget_tokens",
                    "voice",
                    "media_defaults",
                    "created_at",
                    "updated_at",
                    "last_message_at",
                    "purge_at",
                    "temporary",
                    "voice_resolved"
                  ],
                  "title": "Thread",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Rename a thread",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/transcribe": {
      "post": {
        "description": "The body is a recording, its container named by Content-Type: audio/wav (also audio/wave, audio/x-wav, audio/vnd.wave, none, application/octet-stream), audio/webm, audio/ogg (audio/opus), audio/mpeg (audio/mp3), audio/mp4 (audio/m4a, audio/x-m4a) or audio/flac (audio/x-flac); another is 415 unsupported_media_type. It is transcribed by the thread's speech-to-text model and written nowhere: dictation, and a spoken answer to an approval, which must stay out of the conversation (a new message declines a waiting call). The answer names the alias, the one that answered in its place (a GPU-hold or outside-VRAM fallback, also in x-lmgw-fallback), the call's time, the recording's length (WAV only) and the language heard. The body is bounded by max_body_mb (413 body_limit naming it). 400 empty_audio, 422 asr_not_configured, 503 gpu_hold, and a device key's own refusals. A failure of the transcription itself names the fallback that had the audio in x-lmgw-fallback: the audio may have left this machine although nothing came back.",
        "operationId": "post_chat_api_threads_id_transcribe",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "audio/wav": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /chat/api/threads/{id}/transcribe`'s answer (chat-voice design\n§5): a recording transcribed by the thread's speech-to-text model —\ndictation, and a voice answer to an approval that must stay out of the\nconversation (client-apps design §6.4).",
                  "properties": {
                    "alias": {
                      "description": "The speech-to-text alias the thread resolves to.",
                      "type": "string"
                    },
                    "asr_answered_by": {
                      "description": "The alias that answered in its place (a GPU-hold or outside-VRAM\nfallback); `null` when it answered itself.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "asr_ms": {
                      "description": "The transcription call, admission included.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "audio_ms": {
                      "description": "The recording's length, from its WAV header; `null` for any other\ncontainer.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "language": {
                      "description": "What the model says it heard, in its own spelling, else the language\nthe thread's user speaks; `null` when neither is known.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "text",
                    "alias",
                    "asr_answered_by",
                    "asr_ms",
                    "audio_ms",
                    "language"
                  ],
                  "title": "Dictation",
                  "type": "object"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Transcribe a recording",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/threads/{id}/voice/warm": {
      "post": {
        "description": "A press of the microphone (or the start of a call) warms the models the voice turn will use before the request it announces. `stages` names them (asr, tts, chat: the thread's own model), each once; they are the thread's resolved aliases, warmed as one group through the request admission, so the warm may evict idle models exactly as the request would, and a group that does not fit together is warmed without evicting. The stream sends one `state` frame per change of each stage (loading, then ready with the time it took, or held, fallback, skipped, failed), then `done` with no fields once every stage has settled. A device or owner key that is disabled, rotated, deleted or expired while it streams, and a gateway that stops, end the stream with an `error` frame (code revoked, with `kind`, or gateway_stopping) instead of `done`. Closing the stream drops what still waits for admission; a container start already in flight finishes. Refused before anything is warmed: 404 not_found, 400 bad_request (no stages, or an unknown name), 422 asr_not_configured or tts_not_configured (no alias for the stage at any level), and, for a device key, its own refusal (scope, budget) for a stage whose alias it may not use — nothing starts then.",
        "operationId": "post_chat_api_threads_id_voice_warm",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /chat/api/threads/{id}/voice/warm`'s body. Unknown fields are\nrefused.",
                "properties": {
                  "stages": {
                    "description": "The stages to warm, each named once and in this order: `asr`, `tts`\nand `chat` (the thread's own model). Empty or an unknown name is\n400 bad_request.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "stages"
                ],
                "title": "WarmRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "done": {
                "additionalProperties": false,
                "description": "`done` of a voice warm-up: every stage has settled. No fields.",
                "title": "WarmDone",
                "type": "object"
              },
              "error": {
                "description": "`error`: something went wrong; the stream goes on to `done`. `code` is\nwhat a client branches on (`gpu_hold`, `context_length_exceeded`,\n`vram_queue_timeout`, `not_saved`, `superseded`, ...); a failure that has\nnone sends only the message. A stream whose key was disabled, rotated,\ndeleted or expired, or whose gateway stops, ends with a last `error`\nframe instead of `done`: `revoked` (with `kind`) or `gateway_stopping`.\nAn MCP label the thread or its folder attached that offers the turn no\ntools gets one frame each, with `server_label` and a `LabelCode`\n(`tool_unreachable`, `tool_offline`, `tool_disabled`, `tool_unknown`,\n`tool_failed`), and the turn goes on without it.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "kind": {
                    "$ref": "#/components/schemas/RevokeKind",
                    "description": "What a client does about a `revoked` frame, the token a realtime\nsession's 4003 close starts its reason with (`key_unknown` means pair\nthe device again). Sent with `revoked` only."
                  },
                  "message": {
                    "type": "string"
                  },
                  "server_label": {
                    "description": "The MCP label the frame is about, as the thread or folder attached\nit; sent with a `LabelCode` only.",
                    "type": "string"
                  }
                },
                "required": [
                  "message"
                ],
                "title": "ErrorFrame",
                "type": "object"
              },
              "state": {
                "description": "A voice stage's model state: a chat stream's `state` frame and a bound\nrealtime session's `lmgw.model.state` event.\nRead leniently: a field a client does not know of is ignored, a missing\none is empty. Written as the gateway sends it: `ms` always, the other\noptional facts only when the state has them.",
                "properties": {
                  "alias": {
                    "type": "string"
                  },
                  "answered_by": {
                    "description": "`fallback`: the alias that answers in its place.",
                    "type": "string"
                  },
                  "capacity_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the group could have together,\nin bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cause": {
                    "description": "`held`: `gpu_hold` or `benchmark`.",
                    "type": "string"
                  },
                  "done_bytes": {
                    "description": "`downloading`: compressed bytes downloaded so far.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "image": {
                    "description": "`downloading`: the image the model runs in, being downloaded before\nits first start (machine-check design §5). A client says the\ndownload in plain words; the reference is a detail.",
                    "type": "string"
                  },
                  "message": {
                    "description": "The sentence a client shows.",
                    "type": "string"
                  },
                  "ms": {
                    "description": "How long the load took, for `ready`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "needed_bytes": {
                    "description": "`skipped` with `does_not_fit`: what the stage's group needs on the\ncard, in bytes.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reason": {
                    "description": "`skipped`: `full`, `does_not_fit` or `cannot_speak`.",
                    "type": "string"
                  },
                  "size_note": {
                    "description": "`downloading`: why the size is not known, when it is not.",
                    "type": "string"
                  },
                  "stage": {
                    "description": "`asr`, `chat` or `tts`.",
                    "type": "string"
                  },
                  "state": {
                    "description": "`loading`, `downloading`, `ready`, `held`, `fallback`, `skipped` or\n`failed`.",
                    "type": "string"
                  },
                  "total_bytes": {
                    "description": "`downloading`: the download's whole size; absent while it is not\nknown.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "stage",
                  "alias",
                  "state",
                  "ms"
                ],
                "title": "ModelState",
                "type": "object"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Warm a thread's speech models",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/chat/api/tools": {
      "get": {
        "description": "For a thread's tool picker: lmgw's built-in toolsets first (lmgw, docs, kb, image, audio, in that order), each with its tools, then the registered MCP servers and service agents by label, each with its connection's status and how many of its tools, as last listed, the caller may tick. Connects nothing; GET /chat/api/tools/{label} lists a server's tools. Under the caller's tool scope: the owner is listed every built-in toolset, one that offers nothing now with the reason (status unavailable), and every enabled server; a device key is listed what GET /v1/mcp/servers lists it — the toolsets that offer it tools and the enabled servers its scope reaches — and the self-admin toolset (lmgw) only while its admin tools are at full, since below that a device uses the threads that carry it and attaches it to none. A tool the owner switched off is never listed or counted.",
        "operationId": "get_chat_api_tools",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/tools`: the toolsets the caller may attach to a thread,\nfor the Chat's tool picker. Built-in toolsets first, in a fixed order,\nthen the registered servers and service agents by label.",
                  "properties": {
                    "sources": {
                      "items": {
                        "$ref": "#/components/schemas/ChatToolSource"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "sources"
                  ],
                  "title": "ChatToolList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the toolsets a thread may attach",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/chat/api/tools/{label}": {
      "get": {
        "description": "The tools a thread attaching `label` alone gets, under their exposed names (the spelling a thread's allowed_tools and require_approval store), the owner's switched-off tools and those outside the caller's tool scope left out — the same resolution a turn runs. Connects that one server when it is not up, but starts no service agent: one whose app is not running is a 502 mcp_list_tools_failed saying so, and a turn that attaches it starts it. A label the caller may not attach (unknown, disabled, outside its scope, or lmgw for a device below full) is a 404 not_found in the resolver's words; a server that cannot be listed a 502 mcp_list_tools_failed.",
        "operationId": "get_chat_api_tools_label",
        "parameters": [
          {
            "in": "path",
            "name": "label",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /chat/api/tools/{label}`: one toolset's tools the caller may tick.",
                  "properties": {
                    "server_label": {
                      "type": "string"
                    },
                    "tools": {
                      "items": {
                        "$ref": "#/components/schemas/ChatTool"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "server_label",
                    "tools"
                  ],
                  "title": "ChatToolDetail",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List one toolset's tools",
        "tags": [
          "chat"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/batches": {
      "get": {
        "description": "Every set run, newest first: the set as run, the model, the file's name, the mapping, the concurrency and the progress (`done` items with a run of `total`, `failed` runs that are no 2xx, `unreadable` 2xx runs that do not read as an answer to every question, `labelled` items). `status` is running while its job runs (`job_id` the live job), done once every item has a run, canceled, interrupted when its job ended with items left (a gateway restart marks the job failed with `job_error` interrupted by shutdown; lmgw refusing an item before asking the model, such as the GPU hold, admission or the container's start, ends the job failed with that reason and leaves the item without a run; a pruned job row reads the same), or not_started. The job is found by its key, the newest row of it. `cancel_requested` is true while the job running it was already asked to cancel: the next Cancel aborts the calls in flight.",
        "operationId": "get_decision_lab_api_batches",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /decision-lab/api/batches`: every set run, newest first.",
                  "properties": {
                    "batches": {
                      "items": {
                        "$ref": "#/components/schemas/BatchView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "batches"
                  ],
                  "title": "BatchList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the set runs",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Runs a question set over every row of a CSV or JSONL file as a job (kind lab_batch, key lab-batch:<id>, one live job per run). The set is a saved one (`preset_id`, whose body becomes the run's snapshot and takes \"Use as threshold\") or one sent whole (`set`), not both; `model` blank asks the set's default model. The mapping names the state column (sent as text, or as JSON in json mode), optionally a `key` column whose value each item keeps and both exports carry, and per question the column of its expected answer: an option's name (choice); yes, no, true, false, 1 or 0, any case (noul); a level's exact text or its index from 0 (score), as the whole column reads: texts when every value is a level's text, indices when every value is an index, and refused when both fit with different meanings or the column mixes them, until `score_labels` says which; an empty value is no label. Every problem refuses the whole file, none is dropped: a 400 bad_input naming each row, line, column and value. The run and its items (each a lab group of one cell, its form the set with the item's state, its labels kept as the option's name, the level's index or yes and no) are written in several short write transactions, the run not ready (not run, listed or counted) until the last; a boot deletes one a crash left half written. Then the job answers the items through the same path as a lab cell, `concurrency` at once (1 when absent; admission and the model's slots are the only other bound). 400 bad_request for a set that does not check or a concurrency of 0, 404 not_found for a preset the lab does not have or a model that answers no /v1/systemone, 409 batch_deleted when a Clear took the run while it was written. The body size is not limited.",
        "operationId": "post_decision_lab_api_batches",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/batches`: run a set over a file.",
                "properties": {
                  "concurrency": {
                    "default": null,
                    "description": "How many items are asked at once; absent, 1. Admission and the\nmodel's slots are the only other bound.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "format": {
                    "$ref": "#/components/schemas/BatchFormat",
                    "default": "csv"
                  },
                  "mapping": {
                    "$ref": "#/components/schemas/BatchMappingInput",
                    "default": {
                      "key": null,
                      "labels": {},
                      "score_labels": {},
                      "state": "",
                      "state_mode": "text"
                    }
                  },
                  "model": {
                    "default": "",
                    "description": "The model to ask; blank asks the set's default model.",
                    "type": "string"
                  },
                  "preset_id": {
                    "default": null,
                    "description": "A saved set to run (its body is the run's snapshot, and \"Use as\nthreshold\" writes into it).",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "set": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/QuestionSetInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "An unsaved set to run instead: one of the two."
                  },
                  "source_name": {
                    "default": "",
                    "description": "The file's name, kept as the run's source.",
                    "type": "string"
                  },
                  "text": {
                    "default": "",
                    "description": "The file's text.",
                    "type": "string"
                  }
                },
                "title": "BatchStart",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A set run.",
                  "properties": {
                    "cancel_requested": {
                      "description": "A Cancel already went to the job that runs it now: the next Cancel\naborts the calls in flight (their answers are not kept). False when\nno job runs it.",
                      "type": "boolean"
                    },
                    "concurrency": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "done": {
                      "description": "Items with a run, whatever it answered: the progress.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "description": "Of those, the runs the route did not answer with a 2xx.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job_error": {
                      "description": "That job's error when it failed (`interrupted by shutdown` after a\nrestart).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "job_id": {
                      "description": "The last job that ran it (no longer listed once pruned): the live\none while it runs.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "labelled": {
                      "description": "Items with at least one expected answer.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "mapping": {
                      "$ref": "#/components/schemas/BatchMapping"
                    },
                    "model": {
                      "type": "string"
                    },
                    "preset_id": {
                      "description": "The saved set it ran; `null` for an unsaved set, or one deleted\nsince.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "preset_name": {
                      "description": "The saved set's name, when it is still there.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "set": {
                      "$ref": "#/components/schemas/QuestionSet",
                      "description": "The set as run: later edits of the saved set do not change it."
                    },
                    "source_name": {
                      "description": "The uploaded file's name.",
                      "type": "string"
                    },
                    "status": {
                      "$ref": "#/components/schemas/BatchStatus"
                    },
                    "total": {
                      "description": "Items in all.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unreadable": {
                      "description": "Of those, the 2xx runs that do not read as an answer to every\nquestion of the set (the metrics count them per question as\n`unreadable`).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "preset_id",
                    "preset_name",
                    "set",
                    "model",
                    "source_name",
                    "mapping",
                    "concurrency",
                    "status",
                    "total",
                    "done",
                    "failed",
                    "unreadable",
                    "labelled",
                    "job_id",
                    "job_error",
                    "cancel_requested",
                    "created_at"
                  ],
                  "title": "BatchView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Start a set run",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-model-task": "decision",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/batches/from-agent": {
      "post": {
        "description": "Copies a batch agent's finished apply run (`job_id`, required, not queued or running) into a set run that is not run yet (status not_started, no job; Resume runs it). The labels are the rows the apply job received, the checked rows with the reviewer's edits: each item's state is the prompt the row's classify call sent (as text), its expected answer the row's output field, its key the row's id (source name `agent run <job id> of <agent id>`, mapping state `prompt`, key `id`). Answered in `skipped`, with the reason: a row the model was never asked about (its fetch failed, or it has no id: no state), and a row whose call failed with its output still the fallback (no answer, no label). The set is the one stamped on the rows (each row's `set`: the question set that classified it), or `preset_id` as an explicit override; rows of several sets, or stamped rows beside rows the model call classified, are a 400 mixed_sets naming each set's rows. Its question of the output field must be a choice, and its default model asks; each item's form, and the run's set, is the set restricted to that question, the request the agent sends. `set_changed` says the set was edited since its rows were classified. A label that is no option of that question refuses the save, a 400 bad_input naming each row and value (add the option to the set). 400 bad_request for a run that is no apply run, an agent whose output is no single field, rows no set classified without `preset_id`, a set that does not check, has no such question, asks it as another type or names no model, or a run none of whose rows has an answer or a label; 422 for a body without `job_id`; 404 not_found for an agent run, agent or preset that is not there, or a model that answers no /v1/systemone; 409 run_live while the run applies, 409 batch_deleted when a Clear took the run while it was written.",
        "operationId": "post_decision_lab_api_batches_from_agent",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/batches/from-agent`: save a finished apply run's\nrows as a labelled set run.",
                "properties": {
                  "job_id": {
                    "description": "The apply job whose received rows are the labels. Required.",
                    "format": "int64",
                    "type": "integer"
                  },
                  "preset_id": {
                    "default": null,
                    "description": "An explicit override: the question set the run is of, whatever set\nclassified the rows. Absent, the set stamped on the rows\n(`AgentRowSet`), which must be one set.",
                    "format": "int64",
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "job_id"
                ],
                "title": "BatchFromAgent",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a save from an agent run made.",
                  "properties": {
                    "batch": {
                      "$ref": "#/components/schemas/BatchView",
                      "description": "The new set run, `not_started`; `preset_name` names its set."
                    },
                    "set_changed": {
                      "description": "The set was edited since its rows were classified (a row's stamp\nnames an older `updated_at`): the set run asks the set as it is now.",
                      "type": "boolean"
                    },
                    "skipped": {
                      "description": "The rows that are no item, each with why.",
                      "items": {
                        "$ref": "#/components/schemas/BatchFromAgentSkipped"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "batch",
                    "skipped",
                    "set_changed"
                  ],
                  "title": "BatchFromAgentSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save an agent run as a labelled set",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-model-task": "decision",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/batches/preview": {
      "post": {
        "description": "Reads `text` as `format` (csv: RFC 4180 with a header row; jsonl: one JSON object per line, its columns its top-level keys in the order first met) and answers the columns (each with `json`: every non-empty value is a JSON object or array, which the state's json mode fits), the number of rows and the first `sample` rows (20 when absent). With a `mapping` and the set's `questions`, every row is checked as a start checks it and `problems` lists each refusal with its row, line, column and value: a mapping that names no state column or a column with an empty name (a column whose header is empty cannot be mapped), a mapped column the file lacks or names twice, an empty state, a state that is no JSON in json mode, a label that is no answer of its question, a score's label column that reads both as level texts and as indices with different meanings or mixes the two (set `score_labels`). Each problem's `kind` says which of these it is (file, mapping, state, label, score_labels_needed) and `question` the question it is about, so a client can act on a problem without reading its message. Without a mapping, `problems` holds the file's own (a line that does not read). Nothing is stored; the body size is not limited.",
        "operationId": "post_decision_lab_api_batches_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/batches/preview`: read a file, show its top, and\nwith `mapping` check every row as a start would.",
                "properties": {
                  "format": {
                    "$ref": "#/components/schemas/BatchFormat",
                    "default": "csv"
                  },
                  "mapping": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/BatchMappingInput"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "default": null,
                    "description": "When given, every row is checked against it and `problems` lists\neach refusal."
                  },
                  "questions": {
                    "default": [],
                    "description": "The set's questions, which `mapping`'s labels are checked against.",
                    "items": {
                      "$ref": "#/components/schemas/QuestionDraftInput"
                    },
                    "type": "array"
                  },
                  "sample": {
                    "default": null,
                    "description": "How many rows to answer from the top; absent, `PREVIEW_ROWS`.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "text": {
                    "default": "",
                    "description": "The file's text, as read by the page.",
                    "type": "string"
                  }
                },
                "title": "BatchPreview",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a preview read.",
                  "properties": {
                    "columns": {
                      "description": "In the file's order (a CSV's header; the keys of a JSONL file in the\norder first met).",
                      "items": {
                        "$ref": "#/components/schemas/BatchColumn"
                      },
                      "type": "array"
                    },
                    "problems": {
                      "description": "Each problem: the file's own, and with a mapping every row's.",
                      "items": {
                        "$ref": "#/components/schemas/BatchProblem"
                      },
                      "type": "array"
                    },
                    "rows": {
                      "description": "Every row the file holds.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sample": {
                      "description": "The first rows, each a value per column in `columns`' order; a JSONL\nrow without a key, or with `null`, has an empty value there.",
                      "items": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "columns",
                    "rows",
                    "sample",
                    "problems"
                  ],
                  "title": "BatchPreviewed",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Preview a set run's file",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/batches/{id}": {
      "get": {
        "description": "One set run as in the list. 404 not_found for a run that is not there.",
        "operationId": "get_decision_lab_api_batches_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A set run.",
                  "properties": {
                    "cancel_requested": {
                      "description": "A Cancel already went to the job that runs it now: the next Cancel\naborts the calls in flight (their answers are not kept). False when\nno job runs it.",
                      "type": "boolean"
                    },
                    "concurrency": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "done": {
                      "description": "Items with a run, whatever it answered: the progress.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "description": "Of those, the runs the route did not answer with a 2xx.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job_error": {
                      "description": "That job's error when it failed (`interrupted by shutdown` after a\nrestart).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "job_id": {
                      "description": "The last job that ran it (no longer listed once pruned): the live\none while it runs.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "labelled": {
                      "description": "Items with at least one expected answer.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "mapping": {
                      "$ref": "#/components/schemas/BatchMapping"
                    },
                    "model": {
                      "type": "string"
                    },
                    "preset_id": {
                      "description": "The saved set it ran; `null` for an unsaved set, or one deleted\nsince.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "preset_name": {
                      "description": "The saved set's name, when it is still there.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "set": {
                      "$ref": "#/components/schemas/QuestionSet",
                      "description": "The set as run: later edits of the saved set do not change it."
                    },
                    "source_name": {
                      "description": "The uploaded file's name.",
                      "type": "string"
                    },
                    "status": {
                      "$ref": "#/components/schemas/BatchStatus"
                    },
                    "total": {
                      "description": "Items in all.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unreadable": {
                      "description": "Of those, the 2xx runs that do not read as an answer to every\nquestion of the set (the metrics count them per question as\n`unreadable`).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "preset_id",
                    "preset_name",
                    "set",
                    "model",
                    "source_name",
                    "mapping",
                    "concurrency",
                    "status",
                    "total",
                    "done",
                    "failed",
                    "unreadable",
                    "labelled",
                    "job_id",
                    "job_error",
                    "cancel_requested",
                    "created_at"
                  ],
                  "title": "BatchView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a set run",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/batches/{id}/cancel": {
      "post": {
        "description": "Asks the run's job to stop: no new item is taken, the calls in flight finish and are kept, then the run reads canceled and Resume runs the rest. A second Cancel while the job still runs drops the calls in flight (a call may hang): the request log keeps their 499 rows as for any client gone, and their items stay without a run. Answers the run, whose `cancel_requested` says the next Cancel aborts. 404 not_found for a run that is not there, 409 batch_not_running when no job runs it.",
        "operationId": "post_decision_lab_api_batches_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A set run.",
                  "properties": {
                    "cancel_requested": {
                      "description": "A Cancel already went to the job that runs it now: the next Cancel\naborts the calls in flight (their answers are not kept). False when\nno job runs it.",
                      "type": "boolean"
                    },
                    "concurrency": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "done": {
                      "description": "Items with a run, whatever it answered: the progress.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "description": "Of those, the runs the route did not answer with a 2xx.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job_error": {
                      "description": "That job's error when it failed (`interrupted by shutdown` after a\nrestart).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "job_id": {
                      "description": "The last job that ran it (no longer listed once pruned): the live\none while it runs.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "labelled": {
                      "description": "Items with at least one expected answer.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "mapping": {
                      "$ref": "#/components/schemas/BatchMapping"
                    },
                    "model": {
                      "type": "string"
                    },
                    "preset_id": {
                      "description": "The saved set it ran; `null` for an unsaved set, or one deleted\nsince.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "preset_name": {
                      "description": "The saved set's name, when it is still there.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "set": {
                      "$ref": "#/components/schemas/QuestionSet",
                      "description": "The set as run: later edits of the saved set do not change it."
                    },
                    "source_name": {
                      "description": "The uploaded file's name.",
                      "type": "string"
                    },
                    "status": {
                      "$ref": "#/components/schemas/BatchStatus"
                    },
                    "total": {
                      "description": "Items in all.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unreadable": {
                      "description": "Of those, the 2xx runs that do not read as an answer to every\nquestion of the set (the metrics count them per question as\n`unreadable`).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "preset_id",
                    "preset_name",
                    "set",
                    "model",
                    "source_name",
                    "mapping",
                    "concurrency",
                    "status",
                    "total",
                    "done",
                    "failed",
                    "unreadable",
                    "labelled",
                    "job_id",
                    "job_error",
                    "cancel_requested",
                    "created_at"
                  ],
                  "title": "BatchView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a set run",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/batches/{id}/delete": {
      "post": {
        "description": "Stops a running job and drops its calls in flight (499 rows in the request log, as for any client gone), then deletes the run, its items, their runs and artifact rows, and the files no other row names. The saved set it ran stays. Answers the lab's usage after it. 404 not_found for a run that is not there.",
        "operationId": "post_decision_lab_api_batches_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab keeps, and the artifacts directory's files no row names.",
                  "properties": {
                    "artifact_bytes": {
                      "description": "The size of the distinct files the lab's rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifact_files": {
                      "description": "The distinct files those rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifacts": {
                      "description": "Artifact rows: each input of a group and output of a run.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "batches": {
                      "description": "The set runs; their items are among `groups`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "groups": {
                      "description": "Every group: the history's and the set runs' items.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "orphan_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "orphan_files": {
                      "description": "Files in the artifacts directory that no row of any lab names (left\nby a crash between a write and its commit); removable with\n`POST /labs/api/{lab}/orphans/delete`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "runs": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text_bytes": {
                      "description": "The stored text: each group's title, form, plan, override and\nexpected answers, each run's request, response and headers, each set\nrun's set and mapping, in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "lab",
                    "groups",
                    "batches",
                    "runs",
                    "artifacts",
                    "artifact_files",
                    "text_bytes",
                    "artifact_bytes",
                    "orphan_files",
                    "orphan_bytes"
                  ],
                  "title": "LabUsage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a set run",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "The run, its items and their answers are deleted.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/batches/{id}/items": {
      "get": {
        "description": "One page of the run's items in file order, each a lab group with its `item` (the run, its index and its expected answers) and its run once answered. `after` takes the items after that index (the next page), `limit` the page's size (absent, every item left: the server sets no maximum). `total` counts every item; `next_after` is the cursor of the next page, the page's last index, null when no item follows. 404 not_found for a run that is not there.",
        "operationId": "get_decision_lab_api_batches_id_items",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only items after this index (the next page).",
              "format": "uint64",
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "description": "How many items the page holds. Absent, every item left: the server\nsets no maximum.",
              "format": "uint32",
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One page of a set run's items, in item order: each a group with its\n`item` and its run once answered.",
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/LabGroupView"
                      },
                      "type": "array"
                    },
                    "next_after": {
                      "description": "The next page's cursor: this page's last `item_ix`, to send as\n`after`; `null` when no item follows.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "total": {
                      "description": "Items in all.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "total",
                    "next_after"
                  ],
                  "title": "BatchItemPage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a set run's items",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/batches/{id}/metrics": {
      "get": {
        "description": "Computed from the stored runs, per question of the set as run (`question` one of them): items, answered, failed (a run that is no 2xx), unreadable (a 2xx without a readable answer of the question's type), labelled and scored (answered and labelled) counts; accuracy, the winner (choice), P(yes) at or above 0.5 (noul) or the nearest level (score) equal to the label, and for a score the mean absolute distance in levels between its expected level and the label; the confusion matrix, labels by predictions in `classes` order (the options, the levels' indices, yes and no); the reliability diagram of the labelled answers over `bins` equal-width bins of the predicted probability (the winner's, the nearest level's, P(yes) for noul), only the bins that hold an answer, each with its index, edges (index / bins to (index + 1) / bins, the values an answer is placed by), count, mean prediction and `observed`, the rate of the winner or level being right (for noul, of the label being yes); 10 bins when absent, at least 1, no maximum (a 400 bad_request for 0), any number costing what the answers do; and the full threshold curve, a point per distinct confidence (certainty max(p, 1 − p) for noul) with the answered items at or above it, their share of all answered, the labelled among them and how many of those are right. 404 not_found for a run or question that is not there.",
        "operationId": "get_decision_lab_api_batches_id_metrics",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "bins",
            "required": false,
            "schema": {
              "default": null,
              "description": "How many equal-width reliability bins over 0 to 1; absent,\n`DEFAULT_BINS`. At least 1, no maximum: only the bins that hold an\nanswer are answered, so any number costs what the answers do.",
              "format": "uint32",
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "question",
            "required": false,
            "schema": {
              "default": null,
              "description": "One question's id; absent, every question of the set.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What `GET /decision-lab/api/batches/{id}/metrics` answers.",
                  "properties": {
                    "batch_id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "bins": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "questions": {
                      "description": "In the set's order.",
                      "items": {
                        "$ref": "#/components/schemas/QuestionMetrics"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "batch_id",
                    "bins",
                    "questions"
                  ],
                  "title": "BatchMetrics",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a set run's metrics",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/batches/{id}/resume": {
      "post": {
        "description": "A new job for the items that have no run, after a cancel, a restart, a refusal or a failure, at `concurrency` when given (kept as the run's), else the run's. With `retry_failed` the items whose run failed (no 2xx) are asked again too, each new run replacing the failed one. Answers the run. 404 not_found for a run that is not there, 409 batch_running while a job runs it, 409 batch_done when every item has a run (and, with retry_failed, none failed), 400 bad_request for a concurrency of 0.",
        "operationId": "post_decision_lab_api_batches_id_resume",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/batches/{id}/resume`: a new job for the items\nwithout a run.",
                "properties": {
                  "concurrency": {
                    "default": null,
                    "description": "A new concurrency for the run; absent, the one it had.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "retry_failed": {
                    "default": false,
                    "description": "Ask the items whose run failed (no 2xx) again too: each failed run is\nreplaced by the new one. False when absent.",
                    "type": "boolean"
                  }
                },
                "title": "BatchResume",
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A set run.",
                  "properties": {
                    "cancel_requested": {
                      "description": "A Cancel already went to the job that runs it now: the next Cancel\naborts the calls in flight (their answers are not kept). False when\nno job runs it.",
                      "type": "boolean"
                    },
                    "concurrency": {
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "done": {
                      "description": "Items with a run, whatever it answered: the progress.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "description": "Of those, the runs the route did not answer with a 2xx.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "job_error": {
                      "description": "That job's error when it failed (`interrupted by shutdown` after a\nrestart).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "job_id": {
                      "description": "The last job that ran it (no longer listed once pruned): the live\none while it runs.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "labelled": {
                      "description": "Items with at least one expected answer.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "mapping": {
                      "$ref": "#/components/schemas/BatchMapping"
                    },
                    "model": {
                      "type": "string"
                    },
                    "preset_id": {
                      "description": "The saved set it ran; `null` for an unsaved set, or one deleted\nsince.",
                      "format": "int64",
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "preset_name": {
                      "description": "The saved set's name, when it is still there.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "set": {
                      "$ref": "#/components/schemas/QuestionSet",
                      "description": "The set as run: later edits of the saved set do not change it."
                    },
                    "source_name": {
                      "description": "The uploaded file's name.",
                      "type": "string"
                    },
                    "status": {
                      "$ref": "#/components/schemas/BatchStatus"
                    },
                    "total": {
                      "description": "Items in all.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "unreadable": {
                      "description": "Of those, the 2xx runs that do not read as an answer to every\nquestion of the set (the metrics count them per question as\n`unreadable`).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "preset_id",
                    "preset_name",
                    "set",
                    "model",
                    "source_name",
                    "mapping",
                    "concurrency",
                    "status",
                    "total",
                    "done",
                    "failed",
                    "unreadable",
                    "labelled",
                    "job_id",
                    "job_error",
                    "cancel_requested",
                    "created_at"
                  ],
                  "title": "BatchView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Resume a set run",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/batches/{id}/threshold": {
      "post": {
        "description": "Measures the cut at `value` for `question` on this run (coverage of the answered items, accuracy and count of the labelled ones at or above it) and writes the value with that measurement into the saved set the run ran. Answers the set. 400 bad_request for a value outside 0 to 1, 404 not_found for a run or question that is not there, 409 set_deleted when the run ran an unsaved set or the set is deleted, 409 set_changed when the set's question differs from the one the run asked (or the set changed while measuring), 409 no_labels when no labelled answer lies at or above the cut. The body size is not limited.",
        "operationId": "post_decision_lab_api_batches_id_threshold",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/batches/{id}/threshold`: \"Use as threshold\".",
                "properties": {
                  "question": {
                    "default": "",
                    "description": "The question's id.",
                    "type": "string"
                  },
                  "value": {
                    "default": 0.0,
                    "description": "The cut, from 0 to 1.",
                    "format": "double",
                    "type": "number"
                  }
                },
                "title": "ThresholdWrite",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A kept preset.",
                  "oneOf": [
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/QuestionSet"
                        },
                        "kind": {
                          "const": "question_set",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/ImageGenForm"
                        },
                        "kind": {
                          "const": "image_prompt",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/AudioSettings2"
                        },
                        "kind": {
                          "const": "audio_settings",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    }
                  ],
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "name": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "name",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "LabPresetView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Use as threshold",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/count": {
      "post": {
        "description": "Counts the form on `model`'s resolved route, in the gateway, as /v1/count_tokens counts: the state, each question (its instructions and its options, levels or criteria) and each choice question's options alone, and sets the estimates (the state plus the largest question, or the largest option span) against the model's limits; `over` is a warning, nothing is refused. The numbers are approximate: `approx` always holds flattened (llama.cpp's template wraps the pieces), media_omitted with images, tokenizer_guess where a cloud model has no counter of its own. What is judged is the route the count would hit, after the hold's swap: a held row with a cloud fallback is counted there (`answered_by` names it), and a local model that is not ready is counted only with `load`, which starts its container; without it `not_counted` says so, as it does for a count that failed. A count that starts a model writes a request log row, a cheap one none. 404 not_found for a model that answers no /v1/systemone; the body size is not limited.",
        "operationId": "post_decision_lab_api_count",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/count`: count the form's pieces on `model`.",
                "properties": {
                  "form": {
                    "$ref": "#/components/schemas/DecisionForm",
                    "default": {
                      "images": [],
                      "questions": [],
                      "state": "",
                      "state_mode": "text"
                    }
                  },
                  "load": {
                    "default": false,
                    "description": "Count even when that starts a container: a local model the count\nwould hit (after the hold's swap) that is not ready is otherwise not\ncounted (`not_counted` says so).",
                    "type": "boolean"
                  },
                  "model": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "DecisionCount",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a count found.",
                  "properties": {
                    "answered_by": {
                      "description": "The fallback that counted instead (`x-lmgw-fallback`).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "approx": {
                      "description": "Why the numbers are approximate: always `flattened` (llama.cpp's\ntemplate wraps the pieces and is not counted), `media_omitted` with\nimages, `tokenizer_guess` on a cloud model without a counter of its\nown.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "estimates": {
                      "items": {
                        "$ref": "#/components/schemas/DecisionEstimate"
                      },
                      "type": "array"
                    },
                    "model": {
                      "type": "string"
                    },
                    "not_counted": {
                      "description": "Why nothing was counted (\"decide/kev-4b is not loaded\", or the\ncount's own failure); everything below but `answered_by` is empty\nthen.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "questions": {
                      "items": {
                        "$ref": "#/components/schemas/QuestionTokens"
                      },
                      "type": "array"
                    },
                    "state": {
                      "description": "The state's tokens.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "model",
                    "not_counted",
                    "state",
                    "questions",
                    "approx",
                    "estimates",
                    "answered_by"
                  ],
                  "title": "DecisionCounted",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Count a form's tokens",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-model-task": "decision",
        "x-lmgw-writes": false
      }
    },
    "/decision-lab/api/groups": {
      "post": {
        "description": "Stores what one Ask will run and answers the group with its plan and no runs yet; the page then posts its cells one at a time. The plan is the models × (as_written, then each of `variants`), models outer: no_descriptions sends every choice description as null and no noul criteria, reversed each choice question's options in reverse. The form is checked first (a state, valid JSON in json mode, at least one question, unique ids, a choice with unique named options, a score with 2 to 10 levels: a 400 bad_request naming the field). An `override` is sent instead of the form, with only `model` rewritten per model; its only check is that it is a JSON object, and a perturbation with an override is a 400 (perturbations rewrite the form). The form's images (data URLs, or artifact ids of a re-opened form) and the override's data URLs are stored as the group's input artifacts and named by id in the stored form and override. The body size is not limited.",
        "operationId": "post_decision_lab_api_groups",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /decision-lab/api/groups`: the form, the models to ask, the\nperturbations to add, and the override when one is in effect.",
                "properties": {
                  "form": {
                    "$ref": "#/components/schemas/DecisionForm",
                    "default": {
                      "images": [],
                      "questions": [],
                      "state": "",
                      "state_mode": "text"
                    }
                  },
                  "models": {
                    "default": [],
                    "description": "The head model first, then the compared ones.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "override": {
                    "default": null,
                    "description": "The request override, as typed: sent instead of the form, with only\n`model` rewritten per model.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "variants": {
                    "default": [],
                    "description": "The checked perturbations; every model is also asked as written,\nfirst.",
                    "items": {
                      "$ref": "#/components/schemas/Variant"
                    },
                    "type": "array"
                  }
                },
                "title": "DecisionAsk",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What one click in a lab produced, or one item of a set run.",
                  "properties": {
                    "artifacts": {
                      "description": "The group's inputs, in order.",
                      "items": {
                        "$ref": "#/components/schemas/LabArtifactView"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "form": {
                      "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "in_flight": {
                      "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
                      "type": "boolean"
                    },
                    "item": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LabBatchItem"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The set run it is an item of; `null` for a group of the history."
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "override": {
                      "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
                      "items": {
                        "$ref": "#/components/schemas/LabCell"
                      },
                      "type": "array"
                    },
                    "runs": {
                      "description": "The runs so far, in cell order.",
                      "items": {
                        "$ref": "#/components/schemas/LabRunView"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Derived once from the form: the state's first line, a prompt.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "title",
                    "form",
                    "plan",
                    "override",
                    "created_at",
                    "runs",
                    "artifacts",
                    "item",
                    "in_flight"
                  ],
                  "title": "LabGroupView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Ask: store a group and its plan",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/groups/{id}/cells/{cell}": {
      "post": {
        "description": "Builds the cell's request (DecisionForm's body, or the override with `model` rewritten, its images as data URLs), hands it to /v1/systemone's handler in the gateway — the hold, admission, fallbacks and the systemone request log row are real; only auth and the HTTP hop are skipped, and max_body_mb still bounds the bytes — and records the run. It answers 200 whatever the route said: the run carries `http_status`, `error_code` (the envelope's lmgw_code, else its code or type), `error_message`, the response verbatim, `answered_by` (x-lmgw-fallback, else the model asked) with `fallback_reason`, and the stored request with each image as lab-artifact:<id>. When the store cannot keep the run, the answer is the route's all the same: the run has no `id` and `store_error` says why. No body. 404 not_found for a group or cell that is not there, 409 cell_answered for a cell that has a run or is being answered, without a dispatch (a re-ask is a new group).",
        "operationId": "post_decision_lab_api_groups_id_cells_cell",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "cell",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab's cell answers: its run, whatever the route said, and why it\nwas not kept when the store failed.",
                  "properties": {
                    "run": {
                      "$ref": "#/components/schemas/LabRunView"
                    },
                    "store_error": {
                      "description": "Why the run was not kept (a full disk, a lock held too long). The\nanswer is the route's all the same.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "run",
                    "store_error"
                  ],
                  "title": "LabCellResult",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Run one cell",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/decision-lab/api/models": {
      "get": {
        "description": "Every model that answers /v1/systemone, as GET /v1/models publishes it: the local decide/* rows and every cloud alias or catalog entry of task decision. A local row also carries `facts`: from its GGUF header the decision type, decision.max_head_tokens and the shape (non_causal, causal_head, label_logits); from the row the ctx_size, the ubatch and batch in effect with their source (llama.cpp lowers the ubatch to the batch, embedding mode the batch to the ubatch), CPU or GPU and the thread count; from its running container's /props n_ctx_slot. `state` is its container's (null: not running), `held` whether the GPU hold pauses it now and `fallback` the model or alias that answers for it then. `reads_images` is the running server's vision, else an image among its input modalities. `limits` says what a request must fit in how many tokens: the ubatch for a non-causal type, the option span and the context for a causal type with a head, the context for a label-logits type, the catalog's context for a cloud model. No per-type option limit is given: llama.cpp's 400 names it. `price` names what prices a request to it, as the gateway's own lookup does for its primary route: `local` (free whatever rows exist), else per unit the one row that prices that unit (the alias's manual row, the alias's catalog row, the upstream model's manual row, then its catalog row; a row without a usable rate is none), empty when no row covers it and Usage records its cost as unknown; `unresolved` says why a name has no one route. `currency` is the rows'.",
        "operationId": "get_decision_lab_api_models",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The model list.",
                  "properties": {
                    "currency": {
                      "description": "The currency of every price row (the gateway's setting).",
                      "type": "string"
                    },
                    "hold": {
                      "description": "The GPU hold is on.",
                      "type": "boolean"
                    },
                    "models": {
                      "items": {
                        "$ref": "#/components/schemas/DecisionLabModel"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "models",
                    "hold",
                    "currency"
                  ],
                  "title": "DecisionLabModels",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the decision models",
        "tags": [
          "decision-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/devices/enrol": {
      "post": {
        "description": "A device sends the pairing link's one-time token with its public key (an EC P-256 key as its DER SubjectPublicKeyInfo, standard base64) and the client it is, over TLS 1.3 pinned to the link's fp and without a client certificate (one presented anyway, and any credential header, is ignored: the token decides). It gets its certificate (clientAuth, for that key, valid devices.client_cert_days), lmgw's device CA, the dates, its URLs and the confirmation code of its key, 201 Created. Every request of the device is then refused 403 device_unconfirmed until the owner confirms that code on the Devices card. The same key presenting the same token again while it lives (devices.token_minutes from its minting, unless the owner ended it) gets the same answer; another key gets 410 pairing_token_used and the device is marked contested. Refusals: 400 bad_request (not this shape), 400 public_key_unsupported (not a canonical EC P-256 SubjectPublicKeyInfo), 401 pairing_token_unknown, 401 device_disabled (the token stays unused), 409 public_key_in_use (another device enrolled the key), 410 pairing_token_used, 410 pairing_token_expired (lapsed or ended; the message says which and names devices.token_minutes), 413 body_too_large (over 16 KiB), 429 pairing_rate_limited with Retry-After (failed enrolments from the address, an IPv6 address by its /64, past devices.enrol_refuse_per_min in a minute), 503 devices_ca_unavailable. Served on the device listener only: the plain listener answers it 404. While no token lives, the device listener's handshake requires a client certificate, so a device without one meets the TLS alert certificate_required instead (lmgw-client: this pairing link has ended).",
        "operationId": "post_devices_enrol",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /devices/enrol`'s body.",
                "properties": {
                  "app_id": {
                    "description": "The app this install is, as a lowercase reverse-DNS name\n(`dev.example.storyplayer`, `transfer::APP_ID_RULE`):\nwhat other devices of the same app offer files to (device transfers\ndesign §2). Optional; a device without one receives no transfer. A\nmalformed one is refused 400 `bad_request` before the token is used.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "client": {
                    "description": "Free text naming the client, shown on the Devices card\n(\"Kai mobile 0.1.0 (Android 16)\"). Optional, and never trusted for\nanything.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "device_name": {
                    "description": "The device's own name, as its user chose it on the device (\"Anna's\nphone\"): free text, shown on the Devices card beside the name the\nowner gave the link (*added 2026-10-23*). Named `device_name` here,\nas the card's field is, because the answer's `device.name` is the\nowner's name for the link. Optional, and never trusted for anything.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "public_key": {
                    "description": "The device's public key: standard base64 (RFC 4648 §4, padded) of its\nDER SubjectPublicKeyInfo, an EC P-256 key.",
                    "type": "string"
                  },
                  "token": {
                    "description": "The link's `token`: `lmgw-enrol-` and 32 lowercase hex digits. Secret\nuntil used.",
                    "type": "string",
                    "x-lmgw-secret": true
                  }
                },
                "required": [
                  "token",
                  "public_key"
                ],
                "title": "EnrolRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`POST /devices/enrol`'s `201 Created`: the device's certificate for the\nkey it sent, and what it keeps beside it. The same key presenting the\nsame used token again within its life gets this answer again (§3.3).",
                  "properties": {
                    "ca_certificate": {
                      "description": "lmgw's device CA certificate: standard base64 of its DER. Its\nSubjectPublicKeyInfo hashes to the link's `fp`; a client keeps it only\nthen.",
                      "type": "string"
                    },
                    "certificate": {
                      "description": "The device's certificate: standard base64 of its DER. `clientAuth`\nonly, issued by the device CA for the key the body sent.",
                      "type": "string"
                    },
                    "confirm_code": {
                      "description": "The confirmation code (`confirm_code`): the device shows it, and\nthe owner confirms the same code on the Devices card (§3.5).",
                      "type": "string"
                    },
                    "confirmed": {
                      "description": "Whether the owner confirmed this enrolment already (an answer asked\nagain after the Confirm). Until then every request of the device is\nrefused 403 `code::DEVICE_UNCONFIRMED`.",
                      "type": "boolean"
                    },
                    "device": {
                      "$ref": "#/components/schemas/EnrolledDevice",
                      "description": "The device row the token belongs to."
                    },
                    "not_after": {
                      "description": "When the certificate lapses (RFC 3339, UTC).",
                      "type": "string"
                    },
                    "notice_after": {
                      "description": "From when the client says \"this device's certificate lapses on\n`<date>`; pair it again before then\": the issue plus two thirds of the\nvalidity (RFC 3339, UTC; §2.3).",
                      "type": "string"
                    },
                    "urls": {
                      "description": "The device's lmgw URLs, `https`, in the owner's order (§3.1).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "device",
                    "certificate",
                    "ca_certificate",
                    "not_after",
                    "notice_after",
                    "urls",
                    "confirm_code",
                    "confirmed"
                  ],
                  "title": "Enrolment",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {}
        ],
        "summary": "Enrol a device's key with a pairing token",
        "tags": [
          "devices"
        ],
        "x-lmgw-capability": "public",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/image-lab/api/groups": {
      "post": {
        "description": "The dashboard's structured form, checked to build the exact /v1/images/generations body and kept in the lab store as a group of one cell (variant `generate`), answered with no run yet: nothing is sent. The page then runs it (/image-lab/api/groups/{id}/run), so it holds the group, in flight, before the request goes out. The form's fields are the strings the inputs hold (an empty one says nothing about that setting); everything the OpenAI route does not read goes into sd.cpp's <sd_cpp_extra_args> block appended to the prompt. A form that is no request at all (no prompt, no model, a malformed number, only half of the size, a prompt carrying sd.cpp's own delimiters) is a 400 with code image_lab_form; a store that cannot keep the group a 500 with code lab_store. The body size is not limited.",
        "operationId": "post_image_lab_api_groups",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "Everything the lab's two panels collect, as typed. Numbers travel as the\nstrings the inputs hold: an empty field means \"say nothing about this\", not\nzero, and a malformed one has to be reportable as a message rather than\nsilently become a default.",
                "properties": {
                  "cfg_scale": {
                    "default": "",
                    "type": "string"
                  },
                  "height": {
                    "default": "",
                    "type": "string"
                  },
                  "loras": {
                    "default": [],
                    "items": {
                      "$ref": "#/components/schemas/ImageLoraRowInput"
                    },
                    "type": "array"
                  },
                  "model": {
                    "default": "",
                    "description": "The public alias — `image/<id>` for a local row, the alias for a cloud\none. Rewritten to the concrete upstream id by the route itself.",
                    "type": "string"
                  },
                  "n": {
                    "default": "",
                    "type": "string"
                  },
                  "negative_prompt": {
                    "default": "",
                    "type": "string"
                  },
                  "output_compression": {
                    "default": "",
                    "type": "string"
                  },
                  "output_format": {
                    "default": "",
                    "type": "string"
                  },
                  "prompt": {
                    "default": "",
                    "type": "string"
                  },
                  "sampler": {
                    "default": "",
                    "type": "string"
                  },
                  "scheduler": {
                    "default": "",
                    "type": "string"
                  },
                  "seed": {
                    "default": "",
                    "description": "Blank says nothing (sd-server's own default is a fixed 42); `-1` is its\nspelling for \"random each run\".",
                    "type": "string"
                  },
                  "steps": {
                    "default": "",
                    "type": "string"
                  },
                  "width": {
                    "default": "",
                    "type": "string"
                  }
                },
                "title": "ImageGenForm",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What one click in a lab produced, or one item of a set run.",
                  "properties": {
                    "artifacts": {
                      "description": "The group's inputs, in order.",
                      "items": {
                        "$ref": "#/components/schemas/LabArtifactView"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "form": {
                      "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "in_flight": {
                      "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
                      "type": "boolean"
                    },
                    "item": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LabBatchItem"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The set run it is an item of; `null` for a group of the history."
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "override": {
                      "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
                      "items": {
                        "$ref": "#/components/schemas/LabCell"
                      },
                      "type": "array"
                    },
                    "runs": {
                      "description": "The runs so far, in cell order.",
                      "items": {
                        "$ref": "#/components/schemas/LabRunView"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Derived once from the form: the state's first line, a prompt.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "title",
                    "form",
                    "plan",
                    "override",
                    "created_at",
                    "runs",
                    "artifacts",
                    "item",
                    "in_flight"
                  ],
                  "title": "LabGroupView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Keep a generation's form as a group",
        "tags": [
          "image-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "image_generation",
        "x-lmgw-writes": true
      }
    },
    "/image-lab/api/groups/edit": {
      "post": {
        "description": "As /image-lab/api/groups, for an edit (variant `edit`): the form and the pictures as parts of one multipart upload (`form` as JSON, `image`, optionally `mask`). The picture and the mask are the group's input artifacts; the form may name kept ones instead of uploading them (`image`, `mask`: {id, name}, a picture the store keeps, sent under the kept file's own name). A missing `form` or picture, a ref the store does not keep, a ref to an artifact that is no picture (its type named), a form that is no edit and a malformed upload are the same 400 as for a generation. Nothing is sent. The body size is not limited.",
        "operationId": "post_image_lab_api_groups_edit",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImageLabEditRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What one click in a lab produced, or one item of a set run.",
                  "properties": {
                    "artifacts": {
                      "description": "The group's inputs, in order.",
                      "items": {
                        "$ref": "#/components/schemas/LabArtifactView"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "form": {
                      "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "in_flight": {
                      "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
                      "type": "boolean"
                    },
                    "item": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LabBatchItem"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The set run it is an item of; `null` for a group of the history."
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "override": {
                      "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
                      "items": {
                        "$ref": "#/components/schemas/LabCell"
                      },
                      "type": "array"
                    },
                    "runs": {
                      "description": "The runs so far, in cell order.",
                      "items": {
                        "$ref": "#/components/schemas/LabRunView"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Derived once from the form: the state's first line, a prompt.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "title",
                    "form",
                    "plan",
                    "override",
                    "created_at",
                    "runs",
                    "artifacts",
                    "item",
                    "in_flight"
                  ],
                  "title": "LabGroupView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Keep an edit's form and pictures as a group",
        "tags": [
          "image-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "image_edit",
        "x-lmgw-writes": true
      }
    },
    "/image-lab/api/groups/{id}/run": {
      "post": {
        "description": "The group's one cell: claimed (the group is in flight until its run is in), its request built from the stored form (an edit's multipart from its kept picture and mask, `model` among the fields) and handed to /v1/images/generations' or /v1/images/edits' handler in the gateway: the same guards, GPU hold, admission, model rewrite and logging, and the call appears in the request log. The answer is 200 whatever the route said: the group, its run inside with the request as `request` (a generation's body as sent; an edit's text fields as sent and each file part by name, file name, content type, size and kept file `lab-artifact:<id>`), the route's status, code and message, its x-lmgw-* headers (a hold fallback names itself there) and its answer as text, each `b64_json` picture replaced by `lab-artifact:<id>`, the output artifact /labs/api/artifacts/{id} serves. The answer is kept even when the client goes away once the route has answered; a client that goes away before leaves the group with no run. `store_error` says why a run was not kept (a full disk, the group deleted meanwhile): it is then there with no id, its pictures inline. No body. 404 not_found for a group that is not the Image lab's, 409 cell_answered for one that has its run or is being answered (a re-ask is a new group), 500 cell_unbuilt for a stored form that no longer builds a request, 404 file_missing for a kept picture whose file is gone.",
        "operationId": "post_image_lab_api_groups_id_run",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What `POST /image-lab/api/groups/{id}/run` answers once the request was\ndispatched, whatever the route said (labs-store Decision 20): the kept\ngroup with its run, the route's status, code and message and its answer\ninside the run. Only the lab's own refusals (a group that is not there or\nis answered already, a stored form that no longer builds a request) keep\ntheir status.",
                  "properties": {
                    "group": {
                      "$ref": "#/components/schemas/LabGroupView",
                      "description": "The group, its one run inside. A run the store could not keep is\nthere with no `id` and its pictures still inline as `b64_json`."
                    },
                    "store_error": {
                      "description": "Why the run was not kept (a full disk, a lock held too long). The\nanswer is the route's all the same.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "group",
                    "store_error"
                  ],
                  "title": "ImageLabAnswer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Run a kept group",
        "tags": [
          "image-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-writes": true
      }
    },
    "/image-lab/api/models": {
      "get": {
        "description": "Everything that can answer an image request, with what the form needs to shape itself: the enabled local `image/<id>` rows and every cloud alias whose upstream catalog says it generates images, exactly as GET /v1/models publishes them (`edit` says whether the model serves /v1/images/edits). A local row also carries the flags its container is started with, which are the form's size, step and CFG defaults (the lab invents none), its container's state, and, once the container has been probed, the capabilities it reported: the sampler and scheduler lists, the real size bounds and the LoRAs on disk. `hold` says the GPU hold is on.",
        "operationId": "get_image_lab_api_models",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /image-lab/api/models`.",
                  "properties": {
                    "hold": {
                      "description": "The GPU hold is on: local image models are paused.",
                      "type": "boolean"
                    },
                    "models": {
                      "items": {
                        "$ref": "#/components/schemas/ImageLabModel"
                      },
                      "type": "array"
                    },
                    "models_dir": {
                      "description": "The image models directory on the gateway's host.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "models",
                    "models_dir",
                    "hold"
                  ],
                  "title": "ImageLabModels",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the image models",
        "tags": [
          "image-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/labs/api/artifacts/{id}": {
      "get": {
        "description": "The file as stored, streamed from lmgw's disk, with the media type sniffed from its bytes, X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox, so a file opened in a browser runs nothing; Accept-Ranges: bytes and ETag \"sha256:<hex>\". One Range (bytes=a-b, bytes=a- or bytes=-n) answers 206 with Content-Range, as a media player resumes or seeks; If-Range with the ETag applies it, any other If-Range serves the whole file, and so does a Range lmgw does not read (several ranges, another unit). 416 range_not_satisfiable, with Content-Range: bytes */size, for a range that names no byte of the file. 404 not_found for an artifact that is not there, 404 file_missing when its row is there and its file is not.",
        "operationId": "get_labs_api_artifacts_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read an artifact's bytes",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/labs/api/{lab}/clear": {
      "post": {
        "description": "Deletes every group and set run of the lab as their deletes do (a running set run's job drops its calls in flight first), then the files no remaining row names. Answers the lab's usage after it, which then counts nothing. The lab's presets stay. Nothing is deleted by age or count otherwise: the lab store has no retention rule.",
        "operationId": "post_labs_api_lab_clear",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab keeps, and the artifacts directory's files no row names.",
                  "properties": {
                    "artifact_bytes": {
                      "description": "The size of the distinct files the lab's rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifact_files": {
                      "description": "The distinct files those rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifacts": {
                      "description": "Artifact rows: each input of a group and output of a run.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "batches": {
                      "description": "The set runs; their items are among `groups`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "groups": {
                      "description": "Every group: the history's and the set runs' items.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "orphan_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "orphan_files": {
                      "description": "Files in the artifacts directory that no row of any lab names (left\nby a crash between a write and its commit); removable with\n`POST /labs/api/{lab}/orphans/delete`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "runs": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text_bytes": {
                      "description": "The stored text: each group's title, form, plan, override and\nexpected answers, each run's request, response and headers, each set\nrun's set and mapping, in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "lab",
                    "groups",
                    "batches",
                    "runs",
                    "artifacts",
                    "artifact_files",
                    "text_bytes",
                    "artifact_bytes",
                    "orphan_files",
                    "orphan_bytes"
                  ],
                  "title": "LabUsage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Clear a lab",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "Every group and set run of the lab is deleted, with its runs and files.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/export": {
      "get": {
        "description": "The scope as one file with Content-Disposition: attachment (lmgw-lab-{lab}-{date}, with -group-{id}, -batch-{id} or -{model} for a scope) and Cache-Control: no-store. No scope is the whole lab, the history and every set run's items; `group` one group (404 not_found when the lab has none by that id); `batch` one set run's items in file order (404 not_found likewise); `model`, `from` and `to` (RFC 3339, `to` exclusive; another spelling is a 400 bad_request) a filter. format=jsonl, the default, is lossless: one lmgw.lab.v1 line per group, oldest first, its runs inside with `request` and `response` as the exact texts and a set run's item with its `item` (its expected answers among it), application/x-ndjson; when the scope has artifacts the file is a zip of that JSONL and artifacts/<sha256>.<ext>, and each artifact's `href` is its path inside the zip (a file missing from the data dir is named in a MISSING.txt). format=csv is the lab's flat table, text/csv: the Decision lab's has a row per run and question (group_id, batch_id, item_ix, item_key, run_id, created_at, model_asked, answered_by, upstream_model, variant, http_status, error_message, latency_ms, input_tokens, question_id, question_type, answer, expected, correct, confidence, probabilities, state), a failed run of the history one row with the question columns empty. A set run's item names its run, its index in the file and its key (the three are empty for the history), and has a row per question of its set whatever its run answered: `expected` its label for the question, `correct` whether the answer matches it (true or false), empty without a label and, for `correct`, when the run failed or did not answer the question readably. The Image and Audio labs' tables have a row per run (group_id, run_id, created_at, endpoint, model_asked, answered_by, fallback_reason, http_status, error_code, error_message, latency_ms, response_type), then the Image lab's prompt, negative_prompt, size, n, steps, seed, output_format, images, image_bytes and artifact_ids, the Audio lab's task, input, voice, language, text (a transcription's), files, file_bytes and artifact_ids; a group with no run has no row. format=files, the Image and Audio labs' only (the Decision lab makes no files: 400 bad_request), is the files the runs made, to keep and play: each named <group id, six digits>-<model>-<voice or task>-<first words of the text>.<ext>, lower case, anything but letters, digits, `.` and `_` a dash, a run with several outputs adding each one's id or place, a name taken twice `-2`, `-3`; a picture or an audio file as kept, a streamed or raw PCM speech answer as a WAV (the form's PCM format, the x-lmgw-sample-rate it was answered with winning), a transcription's or a task's text answer as a .txt. `group` naming a group whose runs made one file answers that file as it is, typed as it is; anything else is a zip (lmgw-lab-{lab}…zip) of the files, oldest group first, and manifest.jsonl, one lmgw.lab.files.v1 line (LabFilesManifestLine) per file: its name, kind (output, wav, transcript), group, run, time, route, model asked and answering, task, voice, the text it was given, the request's parameters as sent, type, size, its artifact and the group's inputs, which the zip does not carry (the JSONL export does). A file missing from the data dir is named in a MISSING.txt and has `missing` true. As large as the scope is, and not capped.",
        "operationId": "get_labs_api_lab_export",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "batch",
            "required": false,
            "schema": {
              "default": null,
              "description": "One set run's items, in item order.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LabExportFormat",
              "default": "jsonl"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only groups created at or after this time (RFC 3339).",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "group",
            "required": false,
            "schema": {
              "default": null,
              "description": "One group, by id.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only groups whose plan asks this model.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only groups created before this time (RFC 3339).",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "description": "One line of a JSONL export: a group with its runs and artifacts.",
                  "properties": {
                    "format": {
                      "description": "Always `lmgw.lab.v1`.",
                      "type": "string"
                    },
                    "group": {
                      "$ref": "#/components/schemas/LabGroupView"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    }
                  },
                  "required": [
                    "format",
                    "lab",
                    "group"
                  ],
                  "title": "LabExportLine",
                  "type": "object"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string",
                  "x-lmgw-zip-manifest": {
                    "$ref": "#/components/schemas/LabFilesManifestLine"
                  }
                }
              },
              "audio/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv; charset=utf-8": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain; charset=utf-8": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Export a lab",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/labs/api/{lab}/groups": {
      "get": {
        "description": "One page of what the lab kept, newest first: each group (one click: the form, the plan of cells, the override) with its runs in cell order and its artifacts. A set run's items are not the history's: they are read by their run. `{lab}` is decision, image or audio; any other is a 404 not_found. `before` takes the groups older than that id (the next page), `limit` the page's size (absent, every group left: the server sets no maximum), `model` only the groups whose plan asks that model. `total` counts every group the filter takes, `older` those older than the page's last. `in_flight` says a cell of the group is being answered now; a group with fewer runs than cells that is not in flight was stopped. A run's `request` and `response` are the texts that went and came, never re-serialized; an image sent as a data URL is `lab-artifact:<id>` in the stored request, and an artifact's `href` is where its bytes are.",
        "operationId": "get_labs_api_lab_groups",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only groups older than this one (its id): the next page.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": null,
              "description": "How many groups the page holds. Absent, the page is every group\nleft: the server sets no maximum.",
              "format": "uint32",
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "default": null,
              "description": "Only groups whose plan asks this model.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One page of a lab's history.",
                  "properties": {
                    "groups": {
                      "description": "Newest first.",
                      "items": {
                        "$ref": "#/components/schemas/LabGroupView"
                      },
                      "type": "array"
                    },
                    "older": {
                      "description": "The groups the filter matches that are older than this page's last.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total": {
                      "description": "Every group the filter matches, this page's included.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "groups",
                    "total",
                    "older"
                  ],
                  "title": "LabGroupPage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a lab's history",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/labs/api/{lab}/groups/{id}": {
      "get": {
        "description": "One group with its runs and artifacts, as in the history; a set run's item too, with its `item`. 404 not_found for a lab that is none, or a group that is not there or is another lab's.",
        "operationId": "get_labs_api_lab_groups_id",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What one click in a lab produced, or one item of a set run.",
                  "properties": {
                    "artifacts": {
                      "description": "The group's inputs, in order.",
                      "items": {
                        "$ref": "#/components/schemas/LabArtifactView"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "form": {
                      "description": "The lab's form as the lab held it (the Decision lab's\n`DecisionForm`), with its media as the group's input artifacts."
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "in_flight": {
                      "description": "A cell of it is being answered now: its request is out and its run\nnot in yet. A group with no run that is not in flight was stopped.\nDeleting a group in flight is the 409 `in_flight`.",
                      "type": "boolean"
                    },
                    "item": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LabBatchItem"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The set run it is an item of; `null` for a group of the history."
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "override": {
                      "description": "The request override, as typed (its image data URLs as\n`lab-artifact:<id>`), when one was in effect.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "description": "The cells, in run order. A group with fewer runs than cells was\nstopped.",
                      "items": {
                        "$ref": "#/components/schemas/LabCell"
                      },
                      "type": "array"
                    },
                    "runs": {
                      "description": "The runs so far, in cell order.",
                      "items": {
                        "$ref": "#/components/schemas/LabRunView"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Derived once from the form: the state's first line, a prompt.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "title",
                    "form",
                    "plan",
                    "override",
                    "created_at",
                    "runs",
                    "artifacts",
                    "item",
                    "in_flight"
                  ],
                  "title": "LabGroupView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read one group",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/labs/api/{lab}/groups/{id}/delete": {
      "post": {
        "description": "Deletes the group, its runs and its artifact rows, then the files no other row names. Answers the lab's usage after it. 404 not_found for a group that is not there or is another lab's, 409 batch_item for a set run's item, which goes with its run, 409 in_flight for a group whose run is on its way (stop it, or delete it once its run is in; Clear is not refused, and a run that lands after it is answered as not kept).",
        "operationId": "post_labs_api_lab_groups_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab keeps, and the artifacts directory's files no row names.",
                  "properties": {
                    "artifact_bytes": {
                      "description": "The size of the distinct files the lab's rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifact_files": {
                      "description": "The distinct files those rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifacts": {
                      "description": "Artifact rows: each input of a group and output of a run.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "batches": {
                      "description": "The set runs; their items are among `groups`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "groups": {
                      "description": "Every group: the history's and the set runs' items.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "orphan_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "orphan_files": {
                      "description": "Files in the artifacts directory that no row of any lab names (left\nby a crash between a write and its commit); removable with\n`POST /labs/api/{lab}/orphans/delete`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "runs": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text_bytes": {
                      "description": "The stored text: each group's title, form, plan, override and\nexpected answers, each run's request, response and headers, each set\nrun's set and mapping, in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "lab",
                    "groups",
                    "batches",
                    "runs",
                    "artifacts",
                    "artifact_files",
                    "text_bytes",
                    "artifact_bytes",
                    "orphan_files",
                    "orphan_bytes"
                  ],
                  "title": "LabUsage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a group",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "The group's runs and files are deleted, not archived.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/orphans/delete": {
      "post": {
        "description": "Removes every file in the artifacts directory that no row of any lab names, and answers the lab's usage after it. Nothing removes them on its own.",
        "operationId": "post_labs_api_lab_orphans_delete",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab keeps, and the artifacts directory's files no row names.",
                  "properties": {
                    "artifact_bytes": {
                      "description": "The size of the distinct files the lab's rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifact_files": {
                      "description": "The distinct files those rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifacts": {
                      "description": "Artifact rows: each input of a group and output of a run.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "batches": {
                      "description": "The set runs; their items are among `groups`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "groups": {
                      "description": "Every group: the history's and the set runs' items.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "orphan_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "orphan_files": {
                      "description": "Files in the artifacts directory that no row of any lab names (left\nby a crash between a write and its commit); removable with\n`POST /labs/api/{lab}/orphans/delete`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "runs": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text_bytes": {
                      "description": "The stored text: each group's title, form, plan, override and\nexpected answers, each run's request, response and headers, each set\nrun's set and mapping, in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "lab",
                    "groups",
                    "batches",
                    "runs",
                    "artifacts",
                    "artifact_files",
                    "text_bytes",
                    "artifact_bytes",
                    "orphan_files",
                    "orphan_bytes"
                  ],
                  "title": "LabUsage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Remove the orphan files",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/presets": {
      "get": {
        "description": "The lab's presets by name, of `kind` only when given: each its name, its `kind` and its `body`, the kind's type (a question_set is the Decision lab's questions, the model it picks and a threshold per question with where it was measured). 404 not_found for a lab that is none.",
        "operationId": "get_labs_api_lab_presets",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/LabPresetKind"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Only presets of this kind."
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A lab's presets, by name.",
                  "properties": {
                    "presets": {
                      "items": {
                        "$ref": "#/components/schemas/LabPresetView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "presets"
                  ],
                  "title": "LabPresetList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List a lab's presets",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Saves a named preset and answers it. 400 bad_request for a kind of another lab, a blank name or a body that does not check (a question set's questions as the form's: ids, options, levels; each threshold naming one of its questions, between 0 and 1); 409 name_taken when the lab has a preset of that kind by that name. The body size is not limited.",
        "operationId": "post_labs_api_lab_presets",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /labs/api/{lab}/presets`: a preset to save, whole.",
                "oneOf": [
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/QuestionSetInput"
                      },
                      "kind": {
                        "const": "question_set",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/ImageGenFormInput"
                      },
                      "kind": {
                        "const": "image_prompt",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/AudioSettings2Input"
                      },
                      "kind": {
                        "const": "audio_settings",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  }
                ],
                "properties": {
                  "name": {
                    "description": "Unique among the lab's presets of its kind.",
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "title": "LabPresetWrite",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A kept preset.",
                  "oneOf": [
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/QuestionSet"
                        },
                        "kind": {
                          "const": "question_set",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/ImageGenForm"
                        },
                        "kind": {
                          "const": "image_prompt",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/AudioSettings2"
                        },
                        "kind": {
                          "const": "audio_settings",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    }
                  ],
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "name": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "name",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "LabPresetView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save a preset",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/presets/{id}": {
      "get": {
        "description": "One preset. 404 not_found for one that is not there or is another lab's.",
        "operationId": "get_labs_api_lab_presets_id",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A kept preset.",
                  "oneOf": [
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/QuestionSet"
                        },
                        "kind": {
                          "const": "question_set",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/ImageGenForm"
                        },
                        "kind": {
                          "const": "image_prompt",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/AudioSettings2"
                        },
                        "kind": {
                          "const": "audio_settings",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    }
                  ],
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "name": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "name",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "LabPresetView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a preset",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Rewrites the preset whole, as a save checks it, and answers it, if it is still the one read: `updated_at` is the preset's as read, and 409 set_changed answers when it moved since (another edit, a threshold written; every write moves it). A question set's question the update changes (its type, options or levels, its text) loses its threshold's measurement, the value staying, not measured. The set runs that ran it keep their snapshot. 404 not_found for one that is not there, 400 bad_request and 409 name_taken as for a save. The body size is not limited.",
        "operationId": "post_labs_api_lab_presets_id",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /labs/api/{lab}/presets/{id}`: the preset rewritten whole, if it\nis still the one read.",
                "oneOf": [
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/QuestionSetInput"
                      },
                      "kind": {
                        "const": "question_set",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/ImageGenFormInput"
                      },
                      "kind": {
                        "const": "image_prompt",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "body": {
                        "$ref": "#/components/schemas/AudioSettings2Input"
                      },
                      "kind": {
                        "const": "audio_settings",
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "body"
                    ],
                    "type": "object"
                  }
                ],
                "properties": {
                  "name": {
                    "description": "Unique among the lab's presets of its kind.",
                    "type": "string"
                  },
                  "updated_at": {
                    "description": "The preset's `updated_at` as read: when it has moved since (another\nedit, a threshold written), the update is a 409 `set_changed`.",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "updated_at"
                ],
                "title": "LabPresetUpdate",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A kept preset.",
                  "oneOf": [
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/QuestionSet"
                        },
                        "kind": {
                          "const": "question_set",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/ImageGenForm"
                        },
                        "kind": {
                          "const": "image_prompt",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "body": {
                          "$ref": "#/components/schemas/AudioSettings2"
                        },
                        "kind": {
                          "const": "audio_settings",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "body"
                      ],
                      "type": "object"
                    }
                  ],
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "name": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "lab",
                    "name",
                    "created_at",
                    "updated_at"
                  ],
                  "title": "LabPresetView",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Update a preset",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/presets/{id}/delete": {
      "post": {
        "description": "Deletes the preset and answers the lab's presets after it. The set runs that ran it keep their snapshot and their results. 404 not_found for one that is not there or is another lab's.",
        "operationId": "post_labs_api_lab_presets_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A lab's presets, by name.",
                  "properties": {
                    "presets": {
                      "items": {
                        "$ref": "#/components/schemas/LabPresetView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "presets"
                  ],
                  "title": "LabPresetList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Delete a preset",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "The set runs that ran it keep their own copy.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/labs/api/{lab}/usage": {
      "get": {
        "description": "The counts of the lab's groups (the history's and the set runs' items), set runs, runs and artifact rows, the distinct files those rows name, the stored text's size (titles, forms, plans, overrides, expected answers, requests, responses and headers, the set runs' sets and mappings, in bytes) and the files' size. `orphan_files` and `orphan_bytes` count the artifacts directory's files that no row of any lab names, left by a crash between a write and its commit or a commit and its unlink.",
        "operationId": "get_labs_api_lab_usage",
        "parameters": [
          {
            "in": "path",
            "name": "lab",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a lab keeps, and the artifacts directory's files no row names.",
                  "properties": {
                    "artifact_bytes": {
                      "description": "The size of the distinct files the lab's rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifact_files": {
                      "description": "The distinct files those rows name.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "artifacts": {
                      "description": "Artifact rows: each input of a group and output of a run.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "batches": {
                      "description": "The set runs; their items are among `groups`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "groups": {
                      "description": "Every group: the history's and the set runs' items.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lab": {
                      "$ref": "#/components/schemas/LabKind"
                    },
                    "orphan_bytes": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "orphan_files": {
                      "description": "Files in the artifacts directory that no row of any lab names (left\nby a crash between a write and its commit); removable with\n`POST /labs/api/{lab}/orphans/delete`.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "runs": {
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "text_bytes": {
                      "description": "The stored text: each group's title, form, plan, override and\nexpected answers, each run's request, response and headers, each set\nrun's set and mapping, in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "lab",
                    "groups",
                    "batches",
                    "runs",
                    "artifacts",
                    "artifact_files",
                    "text_bytes",
                    "artifact_bytes",
                    "orphan_files",
                    "orphan_bytes"
                  ],
                  "title": "LabUsage",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read what a lab keeps",
        "tags": [
          "labs"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/mcp": {
      "delete": {
        "description": "Ends a session.",
        "operationId": "delete_mcp",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "End an MCP session",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": true
      },
      "get": {
        "description": "Opens the server→client notification stream for a valid session (a session-less GET is 400/404): pushes notifications/tools/list_changed and notifications/resources/list_changed when the aggregate's composition changes, and notifications/resources/list_changed when a server says its resources changed. The stream ends, without a frame (MCP has no notification for it), when the API key that opened it is disabled, rotated, deleted or expires.",
        "operationId": "get_mcp",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "notification": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Open the MCP notification stream",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "MCP Streamable HTTP: single JSON-RPC request/notification/response per POST, no batching. initialize negotiates MCP-Protocol-Version and assigns Mcp-Session-Id, which every later request on the session must carry; a notification answers 202 with no body. tools/list and tools/call reach the registered southbound MCP servers' tools, namespaced <prefix>__. resources/list, resources/templates/list (one page; a cursor is -32602) and resources/read pass their resources through, a prefixed server's URIs namespaced before the authority (ui://weather/card from prefix p is ui://p__weather/card) — in tools' _meta.ui.resourceUri and in tool results' resource links too; a read of a URI no server has, or of a server the caller's tool scope does not reach, is -32002. initialize advertises resources {listChanged} and the MCP Apps extension io.modelcontextprotocol/ui (mimeTypes [text/html;profile=mcp-app]); every tool is listed with its _meta, and app-only ones (_meta.ui.visibility without \"model\") only to a session whose initialize declared that extension. Every tool of a registered server also carries _meta[\"lmgw/server\"] {label, name, tool}: the server's label (its tool prefix, else its name), its name, and the tool's name as the server lists it — so a host routes a view's call of its server's tool to the listed name, also one a name collision moved to <server name>__<tool> or the owner renamed; lmgw sets it, replacing anything the server put there.",
        "operationId": "post_mcp",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest",
                "example": {
                  "id": 1,
                  "jsonrpc": "2.0",
                  "method": "initialize",
                  "params": {
                    "capabilities": {},
                    "clientInfo": {
                      "name": "example-client",
                      "version": "0.1.0"
                    },
                    "protocolVersion": "2025-11-25"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Call the aggregate MCP endpoint",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": true
      }
    },
    "/mcp/admin": {
      "delete": {
        "description": "As DELETE /mcp, on the self-admin plane's own session.",
        "operationId": "delete_mcp_admin",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "End a self-admin MCP session",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": true
      },
      "get": {
        "description": "As GET /mcp, on the self-admin plane's own session.",
        "operationId": "get_mcp_admin",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "An event stream.",
            "x-lmgw-sse-events": {
              "notification": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Open the self-admin MCP notification stream",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "The self-admin plane: the built-in lmgw__* tools and nothing else, a much narrower grant than /mcp, gated on an owner credential rather than any gateway key. Also accepts the x-lmgw-admin-token header as a third bearer spelling (adminToken security scheme), which is how MCP client configs that dial this plane authenticate.",
        "operationId": "post_mcp_admin",
        "parameters": [
          {
            "description": "MCP Streamable HTTP requires the client accept both JSON and server-sent events.",
            "example": "application/json, text/event-stream",
            "in": "header",
            "name": "Accept",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest",
                "example": {
                  "id": 2,
                  "jsonrpc": "2.0",
                  "method": "tools/call",
                  "params": {
                    "arguments": {},
                    "name": "lmgw__status"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {
            "adminToken": []
          }
        ],
        "summary": "Call the self-admin MCP endpoint",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "jsonrpc",
        "x-lmgw-writes": true
      }
    },
    "/mcp/host": {
      "get": {
        "description": "A paired device offers its own MCP server over this WebSocket, and lmgw lists its tools under the device's hosting label (<label>__<tool>) while the link is open, as it lists a registered server's. Needs a device key with a hosting grant (403 host_not_granted otherwise) and no Origin header (403 cross_origin_refused: a browser page never hosts tools). Every tools/call lmgw forwards carries _meta with lmgw/caller ({kind: owner | gateway | device | key | agent, name}: who the call runs as), lmgw/approval (null, or {decision: approved, by}) and lmgw/timeout_ms (the row's timeout_ms, when lmgw stops waiting). lmgw sends notifications/cancelled {requestId, reason} for every call it stops waiting on: at the timeout, when its caller stops waiting, and before it closes the link. Tasks (MCP 2025-11-25): a tool whose execution.taskSupport is required, on a device that declares capabilities.tasks.requests.tools.call, is called with task: {} and _meta lmgw/task ({delivery: thread | wait, thread_id}); lmgw/timeout_ms then bounds the wait for the CreateTaskResult only. lmgw follows the task with tasks/get at its pollInterval (else mcp.task_poll_interval_s), acts on notifications/tasks/status, fetches tasks/result, and sends tasks/cancel (never notifications/cancelled) for a task; a link drop ends no task, and -32602 for its id ends it abandoned. A device's notifications/tools/list_changed makes lmgw list again. Sampling requests are refused -32601. Pings every mcp.host_ping_interval_s seconds; a missed pong closes 1011 naming the setting. A frame or message over mcp.host_max_frame_mb / mcp.host_max_message_mb closes 1009 naming the setting; a binary frame, a batch or text that is no JSON-RPC message closes 1002. A second link of the same device takes over: the older one closes 4000 (\"another connection of device '<name>' took over\"). The key's revocation closes 4003 with the realtime session's token and sentence (device_disabled, key_expired, key_unknown); the hosting grant cleared or the row switched off closes 1000; a stopping gateway closes 1001. Who may call the hosted tools: the owner, the gateway's own runs, the device itself, keys and devices whose policy's device_tools grants the label (their tool scope then filtering its tools as any server's), and agents whose manifest names it — never an anonymous caller, and never a key through its tool scope alone.",
        "operationId": "get_mcp_host",
        "responses": {
          "101": {
            "description": "Switching Protocols: the connection is now a WebSocket. Each frame is one JSON-RPC 2.0 message as text, no batches. The roles are reversed at the message level: lmgw is the MCP client and the device the server. lmgw sends initialize, the device answers, lmgw sends notifications/initialized and pages through tools/list."
          },
          "426": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Upgrade Required: the request carried no WebSocket upgrade headers."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error, before the upgrade."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Host a device's MCP tools",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "chat",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/tokenize": {
      "post": {
        "description": "llama.cpp's own /tokenize, for llama.cpp clients: the client object is forwarded to the backend's own /tokenize with model rewritten, and the answer — token ids, or {id,piece} with with_pieces — comes back verbatim, the backend's own errors included (but an upstream 401/403 is a 502: that is lmgw's credential). The body is read as JSON whatever its Content-Type, as llama-server reads it. 501 not_supported_error on any backend that is not a real llama-server: an id from a tokenizer the backend does not run would be a hidden approximation. Enforces the key's alias scope (a logged 403 key_scope); no budget applies. Errors are llama.cpp-shaped, except the shared /v1 layers' own: the gate's 401, 403 and 429, and the 413 for a declared Content-Length over max_body_mb, which are OpenAI-shaped.",
        "operationId": "post_tokenize",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenizeRequest",
                "example": {
                  "content": "Hello, world!",
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenizeResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlamaCppError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Tokenize text",
        "tags": [
          "llamacpp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "llamacpp",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/transfers/api/targets": {
      "get": {
        "description": "A device's: its other devices that declared app_id at pairing and can receive now (enabled, confirmed, not past their key's expiry), never itself, each with whether it holds its Chat feed open (online) and when it was last seen; with free_bytes, the largest offer lmgw takes now (the free space of its data directory less what uploads in progress still need, the only size bound), and expiry_days, how long an offer made now lasts (devices.transfer_expiry_days). 400 bad_request for an app_id that is no lowercase reverse-DNS name; 403 transfer_device_only for the owner.",
        "operationId": "get_transfers_api_targets",
        "parameters": [
          {
            "in": "query",
            "name": "app_id",
            "required": true,
            "schema": {
              "description": "The app id the offer will name (`APP_ID_RULE`).",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /transfers/api/targets`' answer.",
                  "properties": {
                    "expiry_days": {
                      "description": "Days an offer made now lasts (`devices.transfer_expiry_days`).",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "free_bytes": {
                      "description": "The largest offer lmgw takes now, in bytes: the data directory's\nfree space less what the uploads in progress still need. The only\nsize bound there is.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "targets": {
                      "description": "The caller's other devices that declared the app id and can receive\nnow (enabled, confirmed, not expired); never the caller.",
                      "items": {
                        "$ref": "#/components/schemas/Target"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "targets",
                    "free_bytes",
                    "expiry_days"
                  ],
                  "title": "Targets",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Who this device can offer a file to",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/transfers/api/transfers": {
      "get": {
        "description": "Newest first, the ended ones included for chat_feed_retention_days after they ended. A device lists its outgoing ones (role=outgoing), the incoming ones it was offered (role=incoming, from ready on), or both; the owner every one, without role (400 bad_request with one). A receiver lists its pending offers at its start and follows the Chat feed's transfer.updated for the rest. stored_bytes is what the files of transfers in progress hold, free_bytes the largest offer lmgw takes now.",
        "operationId": "get_transfers_api_transfers",
        "parameters": [
          {
            "in": "query",
            "name": "role",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TransferRole"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "A device's: only its incoming or its outgoing transfers; both\nwithout. The owner is no party, and is refused one."
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /transfers/api/transfers`' answer.",
                  "properties": {
                    "free_bytes": {
                      "description": "The largest offer lmgw takes now (`Targets::free_bytes`).",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "stored_bytes": {
                      "description": "Bytes the files of the transfers in progress hold on disk now.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "transfers": {
                      "description": "Newest first, the ended ones included for as long as\n`chat_feed_retention_days` keeps them.",
                      "items": {
                        "$ref": "#/components/schemas/Transfer"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "transfers",
                    "stored_bytes",
                    "free_bytes"
                  ],
                  "title": "TransferList",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List transfers",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "A device offers a file to to_device, a target for app_id: 201 Created with the transfer, uploading and nothing received; upload its bytes next. The receiver does not see it until every byte is there and matched sha256. It lasts devices.transfer_expiry_days (expires_at). 400 bad_request for a malformed field (kind required, filename without '/', '\\' or control characters, size at least 1, sha256 64 lowercase hex digits), 403 transfer_device_only for the owner, 413 body_too_large over 16 KiB, 422 transfer_target_invalid when to_device is no target for app_id (the message says which part failed), 507 transfer_storage_full with free_bytes when size is above the space left for new offers. A sender disabled or deleted while its offer was read is answered as the device listener answers its next request: 401 device_disabled or 401 device_key_unknown.",
        "operationId": "post_transfers_api_transfers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /transfers/api/transfers`' body.",
                "properties": {
                  "app_id": {
                    "description": "The app id the receiver declared (`APP_ID_RULE`).",
                    "type": "string"
                  },
                  "filename": {
                    "description": "The receiver's name for the file: no `/`, `\\`, control or invisible\ncharacters, not `.` or `..`.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "The app's own word for what the file is (required; no control or\ninvisible characters).",
                    "type": "string"
                  },
                  "sha256": {
                    "description": "The file's sha256: 64 lowercase hex digits.",
                    "type": "string"
                  },
                  "size": {
                    "description": "The file's size in bytes: at least 1, at most `free_bytes`.",
                    "format": "uint64",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "title": {
                    "default": "",
                    "description": "What the card and the receiver show (may be empty).",
                    "type": "string"
                  },
                  "to_device": {
                    "description": "The receiver: a target's `device_id` for `app_id`.",
                    "format": "int64",
                    "type": "integer"
                  }
                },
                "required": [
                  "to_device",
                  "app_id",
                  "kind",
                  "filename",
                  "size",
                  "sha256"
                ],
                "title": "TransferCreate",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A transfer, as every route and `transfer.updated` answer it.",
                  "properties": {
                    "app_id": {
                      "description": "The app id the offer names; the receiver declared it at pairing.",
                      "type": "string"
                    },
                    "created_at": {
                      "description": "RFC 3339 UTC.",
                      "type": "string"
                    },
                    "end_reason": {
                      "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ended_at": {
                      "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                      "type": "string"
                    },
                    "filename": {
                      "description": "The receiver's name for the file.",
                      "type": "string"
                    },
                    "from": {
                      "$ref": "#/components/schemas/TransferParty"
                    },
                    "id": {
                      "description": "Opaque: 32 random lowercase hex digits.",
                      "type": "string"
                    },
                    "kind": {
                      "description": "The app's own word for what the file is.",
                      "type": "string"
                    },
                    "received": {
                      "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                      "type": "string"
                    },
                    "size": {
                      "description": "The file's size in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState"
                    },
                    "title": {
                      "description": "What the card and the receiver show; may be empty.",
                      "type": "string"
                    },
                    "to": {
                      "$ref": "#/components/schemas/TransferParty"
                    }
                  },
                  "required": [
                    "id",
                    "app_id",
                    "kind",
                    "title",
                    "filename",
                    "size",
                    "sha256",
                    "from",
                    "to",
                    "state",
                    "received",
                    "created_at",
                    "expires_at",
                    "ended_at",
                    "end_reason"
                  ],
                  "title": "Transfer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Offer a file to another device",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/transfers/api/transfers/{id}": {
      "get": {
        "description": "The transfer as it is now: while it uploads, received is the resume point (the bytes lmgw holds, which the next upload's range starts at). 404 transfer_not_found for no such transfer and for a device that is neither its sender nor its receiver (a receiver lists it and hears of it from ready on, and reads it by id from the offer on).",
        "operationId": "get_transfers_api_transfers_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A transfer, as every route and `transfer.updated` answer it.",
                  "properties": {
                    "app_id": {
                      "description": "The app id the offer names; the receiver declared it at pairing.",
                      "type": "string"
                    },
                    "created_at": {
                      "description": "RFC 3339 UTC.",
                      "type": "string"
                    },
                    "end_reason": {
                      "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ended_at": {
                      "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                      "type": "string"
                    },
                    "filename": {
                      "description": "The receiver's name for the file.",
                      "type": "string"
                    },
                    "from": {
                      "$ref": "#/components/schemas/TransferParty"
                    },
                    "id": {
                      "description": "Opaque: 32 random lowercase hex digits.",
                      "type": "string"
                    },
                    "kind": {
                      "description": "The app's own word for what the file is.",
                      "type": "string"
                    },
                    "received": {
                      "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                      "type": "string"
                    },
                    "size": {
                      "description": "The file's size in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState"
                    },
                    "title": {
                      "description": "What the card and the receiver show; may be empty.",
                      "type": "string"
                    },
                    "to": {
                      "$ref": "#/components/schemas/TransferParty"
                    }
                  },
                  "required": [
                    "id",
                    "app_id",
                    "kind",
                    "title",
                    "filename",
                    "size",
                    "sha256",
                    "from",
                    "to",
                    "state",
                    "received",
                    "created_at",
                    "expires_at",
                    "ended_at",
                    "end_reason"
                  ],
                  "title": "Transfer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Read a transfer",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/transfers/api/transfers/{id}/cancel": {
      "post": {
        "description": "The sender's and the owner's, while the transfer is uploading or ready: it is canceled, an upload in progress stops (answered 409 transfer_state, canceled), a download in progress breaks off, lmgw deletes its bytes, and both devices hear it on the feed. 404 transfer_not_found for any other device; 409 transfer_state with state once it ended.",
        "operationId": "post_transfers_api_transfers_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A transfer, as every route and `transfer.updated` answer it.",
                  "properties": {
                    "app_id": {
                      "description": "The app id the offer names; the receiver declared it at pairing.",
                      "type": "string"
                    },
                    "created_at": {
                      "description": "RFC 3339 UTC.",
                      "type": "string"
                    },
                    "end_reason": {
                      "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ended_at": {
                      "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                      "type": "string"
                    },
                    "filename": {
                      "description": "The receiver's name for the file.",
                      "type": "string"
                    },
                    "from": {
                      "$ref": "#/components/schemas/TransferParty"
                    },
                    "id": {
                      "description": "Opaque: 32 random lowercase hex digits.",
                      "type": "string"
                    },
                    "kind": {
                      "description": "The app's own word for what the file is.",
                      "type": "string"
                    },
                    "received": {
                      "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                      "type": "string"
                    },
                    "size": {
                      "description": "The file's size in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState"
                    },
                    "title": {
                      "description": "What the card and the receiver show; may be empty.",
                      "type": "string"
                    },
                    "to": {
                      "$ref": "#/components/schemas/TransferParty"
                    }
                  },
                  "required": [
                    "id",
                    "app_id",
                    "kind",
                    "title",
                    "filename",
                    "size",
                    "sha256",
                    "from",
                    "to",
                    "state",
                    "received",
                    "created_at",
                    "expires_at",
                    "ended_at",
                    "end_reason"
                  ],
                  "title": "Transfer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Cancel a transfer",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-confirm-note": "The transfer ends and lmgw deletes its bytes.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/transfers/api/transfers/{id}/content": {
      "get": {
        "description": "The receiver's, while the transfer is ready: the file, streamed from lmgw's disk, with Accept-Ranges: bytes, ETag \"sha256:<hex>\" and Content-Disposition naming its filename. One Range (bytes=a-b, bytes=a- or bytes=-n) answers 206 with Content-Range; If-Range with the ETag serves the range, with anything else the whole file. A Range lmgw does not read (another unit, several ranges, an invalid one) is ignored: the whole file, 200. 416 range_not_satisfiable, with Content-Range: bytes */size, for a range that names no byte of the file (it starts at or past the end, or asks the last 0 bytes). 404 transfer_not_found but for the receiver; 409 transfer_state with state when it is not ready. A transfer that ends while its bytes stream (a cancel, an expiry, a device's end) breaks the body off short of its length. HEAD answers the same head without the body. After its own hash check the receiver sends …/received.",
        "operationId": "get_transfers_api_transfers_id_content",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Download a transfer's bytes",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "put": {
        "description": "The sender's, while the transfer is uploading. Content-Range: bytes a-b/size is required, size the offer's and a the transfer's received; the body is the range's raw bytes (any Content-Type), streamed to lmgw's disk. Chunks are any size; a body that breaks off keeps every byte that arrived, so received (read the transfer) is where to go on. A newer upload of the same transfer stops one still being read. Answers {received, state}; the last byte has the file's sha256 checked: state ready (offered to the receiver), or 422 transfer_hash_mismatch, the transfer failed and its bytes deleted. When lmgw already holds every byte (the last range's answer was lost), any upload of it completes it the same, whatever range it names; Content-Range: bytes */size with no body is the form that asks only that: where the upload stands, and its completion when it is whole. 400 bad_request for a missing or malformed Content-Range, another total, a Content-Length that is not b-a+1, or a body shorter or longer than its range when that was not the last byte (what arrived of the range is kept); 404 transfer_not_found but for the sender; 409 transfer_offset with received when a is not it (or a newer upload stopped this one); 409 transfer_state with state once it is not uploading, also for an upload a cancel, an expiry or a device's end stopped (ready: it is done); 507 transfer_storage_full with free_bytes when the disk filled.",
        "operationId": "put_transfers_api_transfers_id_content",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`PUT /transfers/api/transfers/{id}/content`'s answer.",
                  "properties": {
                    "received": {
                      "description": "Bytes lmgw holds now: where the next range starts.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`uploading`, or `ready` once the last byte arrived and matched."
                    }
                  },
                  "required": [
                    "received",
                    "state"
                  ],
                  "title": "ContentReceived",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A `/transfers/api` refusal: the flat `{code, message}` with the extra\nfield its code names (`code`).",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "free_bytes": {
                      "description": "`code::TRANSFER_STORAGE_FULL`'s: the space left for new offers.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "received": {
                      "description": "`code::TRANSFER_OFFSET`'s: the resume point.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState",
                      "description": "`code::TRANSFER_STATE`'s: the state the transfer is in."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "title": "TransferRefusal",
                  "type": "object"
                }
              }
            },
            "description": "Error, with this body rather than the default one."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Upload a transfer's bytes",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/transfers/api/transfers/{id}/decline": {
      "post": {
        "description": "The receiver's: the transfer is declined and lmgw deletes its bytes; the sender hears it on the feed. 404 transfer_not_found but for the receiver; 409 transfer_state with state when it is not ready.",
        "operationId": "post_transfers_api_transfers_id_decline",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A transfer, as every route and `transfer.updated` answer it.",
                  "properties": {
                    "app_id": {
                      "description": "The app id the offer names; the receiver declared it at pairing.",
                      "type": "string"
                    },
                    "created_at": {
                      "description": "RFC 3339 UTC.",
                      "type": "string"
                    },
                    "end_reason": {
                      "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ended_at": {
                      "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                      "type": "string"
                    },
                    "filename": {
                      "description": "The receiver's name for the file.",
                      "type": "string"
                    },
                    "from": {
                      "$ref": "#/components/schemas/TransferParty"
                    },
                    "id": {
                      "description": "Opaque: 32 random lowercase hex digits.",
                      "type": "string"
                    },
                    "kind": {
                      "description": "The app's own word for what the file is.",
                      "type": "string"
                    },
                    "received": {
                      "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                      "type": "string"
                    },
                    "size": {
                      "description": "The file's size in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState"
                    },
                    "title": {
                      "description": "What the card and the receiver show; may be empty.",
                      "type": "string"
                    },
                    "to": {
                      "$ref": "#/components/schemas/TransferParty"
                    }
                  },
                  "required": [
                    "id",
                    "app_id",
                    "kind",
                    "title",
                    "filename",
                    "size",
                    "sha256",
                    "from",
                    "to",
                    "state",
                    "received",
                    "created_at",
                    "expires_at",
                    "ended_at",
                    "end_reason"
                  ],
                  "title": "Transfer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Decline a transfer",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/transfers/api/transfers/{id}/received": {
      "post": {
        "description": "The receiver's, after its own check of the bytes: the transfer is delivered and lmgw deletes its bytes; the sender hears it on the feed. 404 transfer_not_found but for the receiver; 409 transfer_state with state when it is not ready.",
        "operationId": "post_transfers_api_transfers_id_received",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A transfer, as every route and `transfer.updated` answer it.",
                  "properties": {
                    "app_id": {
                      "description": "The app id the offer names; the receiver declared it at pairing.",
                      "type": "string"
                    },
                    "created_at": {
                      "description": "RFC 3339 UTC.",
                      "type": "string"
                    },
                    "end_reason": {
                      "description": "Why it ended, a sentence for people (\"not delivered within 7 days of\nthe offer\", \"canceled by device 'phone'\"), naming no setting and no\nraw time; `null` while in progress and once delivered. `state` is\nwhat a client acts on.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ended_at": {
                      "description": "When it ended (RFC 3339 UTC); `null` while in progress.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "description": "When it expires unless delivered first (RFC 3339 UTC):\n`devices.transfer_expiry_days` after the offer.",
                      "type": "string"
                    },
                    "filename": {
                      "description": "The receiver's name for the file.",
                      "type": "string"
                    },
                    "from": {
                      "$ref": "#/components/schemas/TransferParty"
                    },
                    "id": {
                      "description": "Opaque: 32 random lowercase hex digits.",
                      "type": "string"
                    },
                    "kind": {
                      "description": "The app's own word for what the file is.",
                      "type": "string"
                    },
                    "received": {
                      "description": "Bytes lmgw holds: the resume point while `uploading` (the next\nupload's range starts here), `size` from `ready` on, and how far it\ngot for one that ended before.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "description": "The file's sha256, 64 lowercase hex digits; checked when the last\nbyte arrives.",
                      "type": "string"
                    },
                    "size": {
                      "description": "The file's size in bytes.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "state": {
                      "$ref": "#/components/schemas/TransferState"
                    },
                    "title": {
                      "description": "What the card and the receiver show; may be empty.",
                      "type": "string"
                    },
                    "to": {
                      "$ref": "#/components/schemas/TransferParty"
                    }
                  },
                  "required": [
                    "id",
                    "app_id",
                    "kind",
                    "title",
                    "filename",
                    "size",
                    "sha256",
                    "from",
                    "to",
                    "state",
                    "received",
                    "created_at",
                    "expires_at",
                    "ended_at",
                    "end_reason"
                  ],
                  "title": "Transfer",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Say a transfer arrived",
        "tags": [
          "transfers"
        ],
        "x-lmgw-capability": "transfer",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/v1/audio/alignments": {
      "post": {
        "description": "Forced alignment against a task: \"align\" row — lmgw's own route, multipart/form-data only. Every family answers the same shape: the words with their seconds, samples where known, and their character span in the submitted text; a model whose answer has no word timings lmgw can read is a 502 naming its family.",
        "operationId": "post_v1_audio_alignments",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioAlignmentsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A forced alignment: the submitted transcript and where each of its words\nis spoken in the clip.",
                  "properties": {
                    "language": {
                      "description": "The language as the model reported it (`en`, `de`; the model's own\nspelling). Absent when the model says none.\n\nA model may report the language it assumes rather than the one it was\nasked to align in: CrisperWhisper's aligner answers its default, `en`,\nto any `language` (checked 2026-10-22 with `de`, `german` and none).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sample_rate": {
                      "description": "The rate, in Hz, the `start_sample` and `end_sample` of the words\ncount in: the model's own figure when its answer states one, else\nderived from the words' seconds and samples (they are what the\nsamples count in, even where the engine resampled the clip), else the\nuploaded WAV's header. Absent when none of the three works; the\nseconds are always there.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "text": {
                      "description": "The transcript as the client submitted it (the multipart `text`\nfield), not what the model echoes. `char_start` and `char_end` of the\nwords index into this string.",
                      "type": "string"
                    },
                    "timing": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/AudioTiming"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How long the engine took, as it reports it (audio.cpp's `timing`\nobject, which both aligners send). Absent when the answer has none."
                    },
                    "words": {
                      "description": "The words in the order the model answered them, which is the\ntranscript's order.",
                      "items": {
                        "$ref": "#/components/schemas/AlignedWord"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "text",
                    "words"
                  ],
                  "title": "AudioAlignment",
                  "type": "object"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Align audio to text",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/audio/speech": {
      "post": {
        "description": "OpenAI's TTS shape plus audio.cpp's own request options, forwarded verbatim (model rewritten); a row's configured voice presets apply on top.",
        "operationId": "post_v1_audio_speech",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioSpeechRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "audio/aac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/flac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/ogg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/opus": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/pcm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-sample-rate": {
                "description": "On a streamed POST /v1/audio/speech (stream_format sse or audio) to a local audio model, the sample rate of its PCM16 in Hz; the stream has no header of its own. lmgw learns it from the model's last WAV answer (it is also capabilities.speech.sample_rate) and omits it until the model has answered one since lmgw started.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-sample-rate": {
                "description": "On a streamed POST /v1/audio/speech (stream_format sse or audio) to a local audio model, the sample rate of its PCM16 in Hz; the stream has no header of its own. lmgw learns it from the model's last WAV answer (it is also capabilities.speech.sample_rate) and omits it until the model has answered one since lmgw started.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Generate speech",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "tts",
        "x-lmgw-writes": false
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "description": "multipart/form-data upload (also accepts application/json); byte-level passthrough to an OpenAI-protocol upstream only.",
        "operationId": "post_v1_audio_transcriptions",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscription"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Transcribe audio",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "asr",
        "x-lmgw-writes": false
      }
    },
    "/v1/audio/transcriptions/details": {
      "post": {
        "description": "The same request as /v1/audio/transcriptions, with the transcript detail arrays (words, segments, speaker turns) the plain route leaves out — an lmgw route, not an OpenAI one.",
        "operationId": "post_v1_audio_transcriptions_details",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionDetails"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Transcribe audio with detail",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "asr",
        "x-lmgw-writes": false
      }
    },
    "/v1/audio/voices": {
      "get": {
        "description": "Every voice name a TTS model answers to — lmgw's own route. A local audio model is answered from lmgw's catalog (presets, the voices its package ships, its embeddings, the voice library) without starting it; ?probe=engine asks its own server instead, starting it if it is down. A remote model is asked.",
        "operationId": "get_v1_audio_voices",
        "parameters": [
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "default": "",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "probe",
            "required": false,
            "schema": {
              "default": null,
              "description": "Where the list comes from. Absent or `config`: a local audio model is\nanswered from lmgw's own catalog (its presets, the voices its package\nships, its embeddings and the voice library) without starting it.\n`engine`: ask the model's own server — a local model's container is\nstarted if it is down. A remote model is always asked.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioVoices"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-voices-source": {
                "description": "On GET /v1/audio/voices, where the list came from. config: a local audio model answered from lmgw's own catalog (its presets, the voices its package ships, its embeddings and the voice library) without being started. engine: the model's own server answered, either a remote upstream or a local container with ?probe=engine, which starts the container if it is down.",
                "schema": {
                  "enum": [
                    "config",
                    "engine"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-voices-source": {
                "description": "On GET /v1/audio/voices, where the list came from. config: a local audio model answered from lmgw's own catalog (its presets, the voices its package ships, its embeddings and the voice library) without being started. engine: the model's own server answered, either a remote upstream or a local container with ?probe=engine, which starts the container if it is down.",
                "schema": {
                  "enum": [
                    "config",
                    "engine"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "List a model's voices",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "tts",
        "x-lmgw-writes": false
      }
    },
    "/v1/chat/completions": {
      "post": {
        "description": "The chat-completions API, plus lmgw's own reasoning controls and chat_template_kwargs passthrough. `model` may be an alias, a local model id, a candidate alias, or an exposed upstream's `prefix/…` id. An anthropic-beta header is forwarded when the route is an Anthropic upstream.",
        "operationId": "post_v1_chat_completions",
        "parameters": [
          {
            "description": "on|off: per-request thinking switch; it wins over body fields. On a cloud model, off goes out in the form the model takes: no reasoning control where the model has none, its lowest level where it cannot stop (x-lmgw-reasoning-ignored then lists enabled), thinking type between_tools on an Anthropic model whose catalog says it takes that type and not disabled. An off never ends in an error: a refused one is retried with what the refusal names and, failing that, with no reasoning control, so a model that cannot run without reasoning answers with its default reasoning. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "An effort level (see capabilities.reasoning.levels of the model); 'none' turns reasoning off. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-effort",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "Integer thinking-token budget; 0 turns reasoning off. Expressible on llama.cpp, Gemini and budget-style Anthropic models only. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-budget",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest",
                "example": {
                  "messages": [
                    {
                      "content": "Say hello in one short sentence.",
                      "role": "user"
                    }
                  ],
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-images-omitted": {
                "description": "Sent next to x-lmgw-fallback: the number of the request's images that went to the answering fallback as text placeholders because its capabilities say it cannot see ('[image/png image, N base64 bytes — omitted: the answering model cannot see images]'). The model reads the placeholder; the client reads this count. On /v1/responses it counts the images the run opened with. Absent when every image was sent, and on a route the client named itself, which always gets its images.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-clamped": {
                "description": "The max_tokens value lmgw lowered the request's cap to, because the n_predict of a ladder rung, or of a guarded shared-KV-pool model, is a ceiling every request on it must respect. Absent when nothing was lowered: a missing max_tokens is filled, not clamped, and a value already under the ceiling is kept exactly.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-defaulted": {
                "description": "The max_tokens value lmgw chose because the request set none and the route (an Anthropic upstream) requires one: the catalog's published maximum when streaming, 4096 when not streaming (the provider refuses non-streamed requests that could run too long).",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-raised": {
                "description": "The max_tokens value lmgw raised the request's cap to, because the requested thinking budget would not fit underneath it.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-params-ignored": {
                "description": "Comma-separated list of the request's sampling parameters (top_k, min_p, repeat_penalty, presence_penalty, frequency_penalty, seed) the answering model's provider does not take, so lmgw did not send them: the OpenAI platform takes no top_k, min_p or repeat_penalty; Anthropic none of the six but top_k; Gemini no min_p, repeat_penalty or penalties. llama.cpp and OpenAI-compatible providers are sent all of them. Also context_management and compaction, a /v1/messages request's Anthropic context management and on-demand compaction, which only an Anthropic model's route takes (both sent on as written), and thinking.display, which goes only to an Anthropic model, beside a thinking type that takes it (adaptive or enabled). Also content.<type>, a /v1/messages request's content block lmgw does not model (redacted_thinking, a type newer than lmgw), which only an Anthropic model's route is sent, and answer.<type>, such a block in an Anthropic model's whole answer, which a Chat Completions or Responses client is not given (a streamed answer's headers leave before it). On an Anthropic model's route, content.thinking and content.<type> name a thinking or other Anthropic block lmgw recorded from an answer at another provider's address (a stored /v1/responses chain), which this provider cannot read and is not sent. answer.citations and content.citations name an Anthropic text block's citations, which only a /v1/messages client and an Anthropic model's route are given (citations lmgw recorded from an answer only at that provider's address, and a citation with no text not at all). Request fields lmgw does not model are sent as they came and never listed. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "context_management",
                    "compaction",
                    "thinking.display"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-params-refused": {
                "description": "Comma-separated list of the request's sampling parameters the answering model refused, which lmgw left out of the send (stop is not left out; its refusal reaches the client). A 400 whose words refuse exactly one parameter the request carried (Anthropic '`temperature` is deprecated for this model.', OpenAI 'Unsupported parameter: 'temperature' is not supported with this model.' or 'Unsupported value: 'temperature' does not support 0 with this model.') is retried once without exactly that parameter, the refused attempt logged with a note naming it, and when the retry answers the parameter is left out of that model's later requests too, each saying so here. Nothing is left out without a refusal on record. On a streamed /v1/responses run the header names what was on record when the stream opened. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "temperature",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-reasoning-ignored": {
                "description": "Comma-separated list of the reasoning controls (enabled, effort, budget) the route could not express. enabled is also listed when an off went out as no control or as the model's lowest level, either because the model cannot take the off itself or because the provider refused every form of off and the model answered with its default reasoning. An off sent to an Anthropic model as thinking type between_tools (its own lowest setting, when it takes no disabled) is not listed. between_tools: a /v1/messages request's thinking type between_tools went to a model of another provider as that provider's off. Absent when every control was applied.",
                "schema": {
                  "enum": [
                    "enabled",
                    "effort",
                    "budget",
                    "between_tools"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-rung": {
                "description": "On a ladder model, the rung that answered (or refused) the request, as '<k>/<n>; ctx=<per-slot context>; gguf=<weights file>', counted from 1 (the gguf part is left off when the file name cannot be a header value). A request whose prompt plus max output does not fit the running rung makes the model climb to the smallest rung that fits before it answers. On /v1/responses it names the rung running when the run opened; a unary answer one of whose turns the fallback answered carries x-lmgw-fallback instead, and a stream's headers are sent before its turns run. Absent on models without a ladder and on responses a fallback answered.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-lmgw-sse-events": {
              "chunk": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ChatCompletionChunk"
                  },
                  {
                    "$ref": "#/components/schemas/ChatCompletionStreamError"
                  }
                ]
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Create a chat completion",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/completions": {
      "post": {
        "description": "The legacy text-completions shape. Refuses a non-OpenAI-protocol upstream with 400 rather than sending it a request its own API cannot answer. A missing model is a 400 (missing 'model'), as on every other ingress.",
        "operationId": "post_v1_completions",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompletionRequest",
                "example": {
                  "model": "<pick a model>",
                  "prompt": "Once upon a time"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-max-tokens-clamped": {
                "description": "The max_tokens value lmgw lowered the request's cap to, because the n_predict of a ladder rung, or of a guarded shared-KV-pool model, is a ceiling every request on it must respect. Absent when nothing was lowered: a missing max_tokens is filled, not clamped, and a value already under the ceiling is kept exactly.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-rung": {
                "description": "On a ladder model, the rung that answered (or refused) the request, as '<k>/<n>; ctx=<per-slot context>; gguf=<weights file>', counted from 1 (the gguf part is left off when the file name cannot be a header value). A request whose prompt plus max output does not fit the running rung makes the model climb to the smallest rung that fits before it answers. On /v1/responses it names the rung running when the run opened; a unary answer one of whose turns the fallback answered carries x-lmgw-fallback instead, and a stream's headers are sent before its turns run. Absent on models without a ladder and on responses a fallback answered.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-lmgw-sse-events": {
              "chunk": {
                "$ref": "#/components/schemas/TextCompletionChunk"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Create a legacy text completion",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/count_tokens": {
      "post": {
        "description": "lmgw's own universal token counter: routed by model exactly like the chat endpoints, so counting on a cold local model starts its container. x-lmgw-count-approximate explains tokenizer_guess (an OpenAI-protocol upstream tiktoken cannot identify) and message_framing (an Anthropic/Gemini upstream counts messages, so the text went as one user turn).",
        "operationId": "post_v1_count_tokens",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CountTokensRequest",
                "example": {
                  "input": "How many tokens is this?",
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountTokensResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Count tokens (universal)",
        "tags": [
          "lmgw-inference"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/embeddings": {
      "post": {
        "description": "dimensions is forwarded in the upstream's own spelling, and a route that ignores it (llama-server) is a 400, not full-length vectors. encoding_format base64 is encoded by the gateway for every upstream.",
        "operationId": "post_v1_embeddings",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsRequest",
                "example": {
                  "input": "lmgw is a gateway.",
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingsResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Create embeddings",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "embedding",
        "x-lmgw-writes": false
      }
    },
    "/v1/images/edits": {
      "post": {
        "description": "multipart/form-data upload; refused unless the resolved row's edit pipeline flag is set.",
        "operationId": "post_v1_images_edits",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImageEditsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationsResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Edit an image",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "image_edit",
        "x-lmgw-writes": false
      }
    },
    "/v1/images/generations": {
      "post": {
        "description": "OpenAI's images shape; sd.cpp CLI arguments may ride along in a trailing <sd_cpp_extra_args>{…}</sd_cpp_extra_args> block on prompt (the dashboard's Image lab builds this block and is the reference for its contents). Answers base64 only (b64_json), never a URL.",
        "operationId": "post_v1_images_generations",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationsRequest",
                "example": {
                  "model": "<pick a model>",
                  "n": 1,
                  "prompt": "A red bicycle in a park."
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationsResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Generate an image",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "image_generation",
        "x-lmgw-writes": false
      }
    },
    "/v1/mcp/servers": {
      "get": {
        "description": "The labels this caller may put into a {\"type\": \"mcp\", \"server_label\"} tool on /v1/realtime or /v1/responses, for a tool picker. Connects nothing: read from the configuration under the caller's tool scope — enabled servers only, and the lmgw self-admin toolset only for an owner credential or a device allowed lmgw's admin tools, while the self-admin tools are on.",
        "operationId": "get_v1_mcp_servers",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerList"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "List the MCP labels",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/mcp/servers/{label}": {
      "get": {
        "description": "One label's tools, exactly as a /v1/realtime session's mcp_list_tools item lists them (the server's own tool names, description always a string), under the caller's tool scope and the per-tool switches. Connects that one server if it is not up (up to the lazy-list budget). 404 for a label this caller may not use, naming the available ones; 502 when the server cannot be listed.",
        "operationId": "get_v1_mcp_servers_label",
        "parameters": [
          {
            "in": "path",
            "name": "label",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerDetail"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "List one MCP label's tools",
        "tags": [
          "mcp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/messages": {
      "post": {
        "description": "The Anthropic Messages API. A server tool (no input_schema) is refused with 400. A content block lmgw does not model (redacted_thinking, the provider's own tool blocks, a type newer than lmgw) goes between client and an Anthropic upstream as written, whole and streamed, where it stood; any other upstream is sent none of it (x-lmgw-params-ignored: content.<type>), and a Chat Completions or Responses client is given none (a whole answer's x-lmgw-params-ignored: answer.<type>). Thinking blocks keep their signature. A block without a type is refused with 400. A missing max_tokens is filled in rather than refused (x-lmgw-max-tokens-defaulted). anthropic-beta reaches an Anthropic upstream as one header, merged with the upstream row's own; other protocols have no equivalent and are sent none. context_management and the top-level compaction go to an Anthropic upstream as written and its answer's context_management comes back; any other upstream is sent neither, and x-lmgw-params-ignored names them. A compaction block (in the answer, streamed, or sent back in messages) goes between client and an Anthropic upstream as Anthropic wrote it, with stop_reason compaction and usage.iterations; any other upstream is sent the summary as text where the block stood and nothing before it, as Anthropic itself drops that history. thinking: {type: between_tools} and thinking.display go to an Anthropic upstream as written; elsewhere the off is that provider's own (x-lmgw-reasoning-ignored: between_tools) and display is named in x-lmgw-params-ignored. An unknown thinking type is refused with 400.",
        "operationId": "post_v1_messages",
        "parameters": [
          {
            "description": "on|off: per-request thinking switch; it wins over body fields. On a cloud model, off goes out in the form the model takes: no reasoning control where the model has none, its lowest level where it cannot stop (x-lmgw-reasoning-ignored then lists enabled), thinking type between_tools on an Anthropic model whose catalog says it takes that type and not disabled. An off never ends in an error: a refused one is retried with what the refusal names and, failing that, with no reasoning control, so a model that cannot run without reasoning answers with its default reasoning. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "An effort level (see capabilities.reasoning.levels of the model); 'none' turns reasoning off. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-effort",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "Integer thinking-token budget; 0 turns reasoning off. Expressible on llama.cpp, Gemini and budget-style Anthropic models only. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-budget",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "The Anthropic SDK's protocol version header. lmgw does not validate its value or vary its behaviour on it; egress to a real Anthropic upstream sends its own.",
            "example": "2023-06-01",
            "in": "header",
            "name": "anthropic-version",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest",
                "example": {
                  "max_tokens": 256,
                  "messages": [
                    {
                      "content": "Say hello in one short sentence.",
                      "role": "user"
                    }
                  ],
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessage"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-images-omitted": {
                "description": "Sent next to x-lmgw-fallback: the number of the request's images that went to the answering fallback as text placeholders because its capabilities say it cannot see ('[image/png image, N base64 bytes — omitted: the answering model cannot see images]'). The model reads the placeholder; the client reads this count. On /v1/responses it counts the images the run opened with. Absent when every image was sent, and on a route the client named itself, which always gets its images.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-clamped": {
                "description": "The max_tokens value lmgw lowered the request's cap to, because the n_predict of a ladder rung, or of a guarded shared-KV-pool model, is a ceiling every request on it must respect. Absent when nothing was lowered: a missing max_tokens is filled, not clamped, and a value already under the ceiling is kept exactly.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-defaulted": {
                "description": "The max_tokens value lmgw chose because the request set none and the route (an Anthropic upstream) requires one: the catalog's published maximum when streaming, 4096 when not streaming (the provider refuses non-streamed requests that could run too long).",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-raised": {
                "description": "The max_tokens value lmgw raised the request's cap to, because the requested thinking budget would not fit underneath it.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-params-ignored": {
                "description": "Comma-separated list of the request's sampling parameters (top_k, min_p, repeat_penalty, presence_penalty, frequency_penalty, seed) the answering model's provider does not take, so lmgw did not send them: the OpenAI platform takes no top_k, min_p or repeat_penalty; Anthropic none of the six but top_k; Gemini no min_p, repeat_penalty or penalties. llama.cpp and OpenAI-compatible providers are sent all of them. Also context_management and compaction, a /v1/messages request's Anthropic context management and on-demand compaction, which only an Anthropic model's route takes (both sent on as written), and thinking.display, which goes only to an Anthropic model, beside a thinking type that takes it (adaptive or enabled). Also content.<type>, a /v1/messages request's content block lmgw does not model (redacted_thinking, a type newer than lmgw), which only an Anthropic model's route is sent, and answer.<type>, such a block in an Anthropic model's whole answer, which a Chat Completions or Responses client is not given (a streamed answer's headers leave before it). On an Anthropic model's route, content.thinking and content.<type> name a thinking or other Anthropic block lmgw recorded from an answer at another provider's address (a stored /v1/responses chain), which this provider cannot read and is not sent. answer.citations and content.citations name an Anthropic text block's citations, which only a /v1/messages client and an Anthropic model's route are given (citations lmgw recorded from an answer only at that provider's address, and a citation with no text not at all). Request fields lmgw does not model are sent as they came and never listed. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "context_management",
                    "compaction",
                    "thinking.display"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-params-refused": {
                "description": "Comma-separated list of the request's sampling parameters the answering model refused, which lmgw left out of the send (stop is not left out; its refusal reaches the client). A 400 whose words refuse exactly one parameter the request carried (Anthropic '`temperature` is deprecated for this model.', OpenAI 'Unsupported parameter: 'temperature' is not supported with this model.' or 'Unsupported value: 'temperature' does not support 0 with this model.') is retried once without exactly that parameter, the refused attempt logged with a note naming it, and when the retry answers the parameter is left out of that model's later requests too, each saying so here. Nothing is left out without a refusal on record. On a streamed /v1/responses run the header names what was on record when the stream opened. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "temperature",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-reasoning-ignored": {
                "description": "Comma-separated list of the reasoning controls (enabled, effort, budget) the route could not express. enabled is also listed when an off went out as no control or as the model's lowest level, either because the model cannot take the off itself or because the provider refused every form of off and the model answered with its default reasoning. An off sent to an Anthropic model as thinking type between_tools (its own lowest setting, when it takes no disabled) is not listed. between_tools: a /v1/messages request's thinking type between_tools went to a model of another provider as that provider's off. Absent when every control was applied.",
                "schema": {
                  "enum": [
                    "enabled",
                    "effort",
                    "budget",
                    "between_tools"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-rung": {
                "description": "On a ladder model, the rung that answered (or refused) the request, as '<k>/<n>; ctx=<per-slot context>; gguf=<weights file>', counted from 1 (the gguf part is left off when the file name cannot be a header value). A request whose prompt plus max output does not fit the running rung makes the model climb to the smallest rung that fits before it answers. On /v1/responses it names the rung running when the run opened; a unary answer one of whose turns the fallback answered carries x-lmgw-fallback instead, and a stream's headers are sent before its turns run. Absent on models without a ladder and on responses a fallback answered.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-lmgw-sse-events": {
              "message": {
                "$ref": "#/components/schemas/AnthropicStreamEvent"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Create a message",
        "tags": [
          "anthropic"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "anthropic",
        "x-lmgw-endpoints": [
          "anthropic"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "description": "The Anthropic SDKs' messages.count_tokens(): on an Anthropic-protocol upstream, the client body is sent through verbatim (only model replaced, and a Gemini thought signature in a tool id dropped), with its anthropic-beta flags, so server tools and new fields count exactly; Anthropic's context_management answer (original_input_tokens) comes back beside input_tokens. x-lmgw-count-approximate explains any other route's approximation. Enforces the key's alias scope like every other counter (a refusal is a logged 403 key_scope, a success is not logged); no budget applies, the key's or the gateway's, since a count costs nothing.",
        "operationId": "post_v1_messages_count_tokens",
        "parameters": [
          {
            "description": "on|off: per-request thinking switch; it wins over body fields. On a cloud model, off goes out in the form the model takes: no reasoning control where the model has none, its lowest level where it cannot stop (x-lmgw-reasoning-ignored then lists enabled), thinking type between_tools on an Anthropic model whose catalog says it takes that type and not disabled. An off never ends in an error: a refused one is retried with what the refusal names and, failing that, with no reasoning control, so a model that cannot run without reasoning answers with its default reasoning. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "An effort level (see capabilities.reasoning.levels of the model); 'none' turns reasoning off. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-effort",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "Integer thinking-token budget; 0 turns reasoning off. Expressible on llama.cpp, Gemini and budget-style Anthropic models only. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-budget",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          },
          {
            "description": "The Anthropic SDK's protocol version header. lmgw does not validate its value or vary its behaviour on it; egress to a real Anthropic upstream sends its own.",
            "example": "2023-06-01",
            "in": "header",
            "name": "anthropic-version",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-prefill": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicCountTokensRequest",
                "example": {
                  "messages": [
                    {
                      "content": "Say hello in one short sentence.",
                      "role": "user"
                    }
                  ],
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicCountTokensResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Count tokens for a message",
        "tags": [
          "anthropic"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "anthropic",
        "x-lmgw-endpoints": [
          "anthropic"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/models": {
      "get": {
        "description": "Aggregates enabled aliases, public local models and expose-all upstream catalogs. Served OpenAI-shaped unless the caller sends anthropic-version, in which case the Anthropic SDK's own shape. This document names the OpenAI error dialect as default; an Anthropic-dialect caller gets an Anthropic-shaped error body in practice.",
        "operationId": "get_v1_models",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "List models",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai",
          "anthropic"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/models/{id}": {
      "get": {
        "description": "The id may contain '/' (a passthrough id carries its upstream prefix and the provider's own slashes), hence the wildcard path parameter. Same dual-dialect note as GET /v1/models.",
        "operationId": "get_v1_models_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-lmgw-wildcard": true
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelById"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Retrieve a model",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai",
          "anthropic"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/openapi.json": {
      "get": {
        "description": "This description, filtered to the inference plane.",
        "operationId": "get_v1_openapi_json",
        "parameters": [
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Get the inference-plane OpenAPI description",
        "tags": [
          "lmgw-inference"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/realtime": {
      "get": {
        "description": "OpenAI's GA Realtime protocol over a WebSocket (ws://<host>/v1/realtime), answered by a cascade of this gateway's own aliases: voice activity and end-of-turn detection inside lmgw (Silero VAD; Smart Turn for semantic_vad), speech to text with realtime.asr_alias, the chat model, and text to speech with realtime.tts_alias — local models first, any of them a cloud alias if so configured (Settings → Realtime, which also shows what the cascade holds on the GPU). `model` is resolved in this order: a realtime.model_map name, an OpenAI Realtime name (gpt-realtime*, never taken as an alias), which realtime.default_model answers, or a chat alias; it may be left out and named in the first session.update instead. What a name resolved to is echoed in session.lmgw.resolved. Implemented: conversation sessions (session.type realtime) with audio or text output, PCM16 at 24 kHz in and out, server_vad, semantic_vad and manual turns, barge-in with a word check, session.update, input_audio_buffer.append/commit/clear, conversation.item.create/retrieve/truncate/delete, response.create and response.cancel, client-side function tools, and MCP tools the gateway runs itself on a session not bound to a Chat thread. An MCP session tool {\"type\": \"mcp\", \"server_label\"} names one of this gateway's own MCP servers (by its tool prefix or name) or a built-in toolset (docs, kb, and lmgw for an owner credential or a device allowed lmgw's admin tools, while the self-admin tools are on), resolved as on /v1/responses under the key's tool scope; GET /v1/mcp/servers lists the labels a caller may use and GET /v1/mcp/servers/{label} one label's tools. server_url, connector_id, headers, authorization and server_description are accepted and never used: lmgw dials no URL a client names, and echoes authorization and header values as [redacted]. allowed_tools takes a name list or {tool_names}; read_only and a require_approval that would gate a tool are refused (approvals are not built here yet: leave it out or send \"never\"); one entry per server_label. The session lists a label's tools as an mcp_list_tools item (mcp_list_tools.in_progress, then .completed or .failed — a failed label also gets an error with code mcp_list_tools_failed saying why, and a later session.update naming it lists it again), and a response waits for the listings in flight. A model's call to one of those tools is an mcp_call item (server_label, name — the server's own tool name — arguments, output, error, always present), streamed as response.mcp_call_arguments.delta and .done, then run by the gateway before response.done (response.mcp_call.in_progress, then .completed with the output or .failed with a tool_execution_error). The call ends the response: the client sends response.create for the answer, as OpenAI's Realtime API has it (@openai/agents does so by itself, once per response). A cancel or barge-in abandons a running call, which then fails saying it may or may not have run. A response's tools may narrow to a label the session has listed, and tool_choice takes {\"type\": \"mcp\", \"server_label\"} with an optional name. A client may replay mcp_call items as history; mcp_list_tools and the approval items are refused. Each call writes a realtime-tool usage row. Refused with an error naming what is missing: transcription sessions, G.711 formats, output_audio_buffer.clear (a WebRTC call's) and an input_audio item without its transcript. Accepted and echoed but not applied: noise_reduction, and truncation (lmgw.resolved.truncation says \"disabled\"; an overflow is an error). WebRTC is served at POST /v1/realtime/calls. Not served at all: the sideband connection to a call (call_id, refused with 400 sideband_unsupported rather than opening an unrelated session), SIP, ephemeral client secrets, live partial transcripts and out-of-band responses. Credentials as on every /v1 route; a browser, which cannot set headers on a WebSocket, may offer its key as the subprotocol `openai-insecure-api-key.<key>` alongside `realtime` — accepted on this route only. A paired device's key is refused before the upgrade with 401 device_key_unknown when it matches no device (pair it again), 401 device_disabled while the device is disabled, and 401 key_expired past its expiry date, as on every Chat route. A beta client (OpenAI-Beta: realtime=v1) is refused with 400 beta_protocol_unsupported, and with Require API key off an anonymous upgrade from another page's Origin is refused with 403. Chat models list this route in their capabilities.endpoints on GET /v1/models once an ASR and a TTS alias are configured, and /v1/realtime/calls beside it while the WebRTC UDP socket of the listener asked is bound. The TTS gets lmgw's speech instructions — session.lmgw.speech_instructions, a response.create's response.lmgw.speech_instructions, else realtime.speech_instructions — as a style, or as the description a voice-design (vdes) model designs its voice from; session.lmgw.resolved.speech says what is in effect, and the transcript leaves out the inline tags ([laughter]) the voice renders. Markdown a voice cannot read is not spoken: fenced code blocks and tables (lines that start with |, from one that ends with | or is followed by a delimiter row) are skipped — the transcript leaves them out, and the model's history keeps them. On a style or passthrough TTS that renders no tags (Qwen3 CustomVoice, Auk, MOSS-TTS; a cloud TTS only when its alias's capabilities.speech override declares instructions 'style'), the tags that open a sentence, or a part of one spoken on its own, are a delivery cue instead ([laughing]): sent after the style as the instructions until that sentence ends, best effort, never read out (resolved.speech.cues). A voice mode binds a session to a Chat thread with chat_thread=<id> (negative for a temporary chat): the chat capability only — the dashboard's cookie, an owner key or a paired device's key; refused before the upgrade, in the OpenAI error shape ({\"error\": {code, message, type, param}}) and checked in this order, with 403 chat_thread_not_allowed, 400 owned_by_thread beside model, 404 chat_thread_not_found (also an Admin Chat thread a device names, and a thread with the self-admin toolset a device not allowed lmgw's admin tools names: for that device they do not exist), 409 chat_thread_admin for an Admin Chat thread the owner names (no voice mode there), and, with takeover=never, 409 chat_thread_bound while another session is bound to the thread (\"voice is in use on device 'phone'\"; nothing is taken over), whose error.held_by names the holder as the Chat feed's voice.bound.by does (\"device 'phone'\", \"the dashboard\") so a client shows it without reading the message; no other refusal carries held_by. A session bound with the same key, or one that is already ending (after its 1001, a revocation or its close, while it writes its last turns), does not count: takeover=never takes it over, so a client's rebind after a restart or a dropped link is not refused in its own name. A device binds as its key: the thread's chat, speech-to-text and text-to-speech aliases pass its scope and budget before the upgrade (refused as an unbound session's aliases are, 403 key_scope or key_budget; the speech aliases' missing price, budget_unpriced, too), while the chat alias's price check comes at the first turn, as an error event, not before the upgrade; every model call of the session is checked and counted against it as an unbound session's, and each refusal writes its request row. session.created then names the thread in session.lmgw.resolved.chat_thread ({id, title, temporary, admin_tools}) and its turn mode in session.lmgw.turn_mode (below), and the connect warm loads the thread's chat, speech-to-text and text-to-speech models as one group, which may evict idle models as the requests it announces would, whatever realtime.warm_on_connect says (that setting is for unbound sessions). chat_folder=<id> binds an ongoing folder's current thread instead, decided by the rules of POST /chat/api/folders/{id}/current and bound in one step under the folder's lock, so no other client moves the folder in between: the current thread, or a new one from the folder's defaults when there is none, when it is out of the caller's reach, when it idled past the folder's idle minutes, or with new=true unless it has no message yet; a new thread is recorded as folder.current on the Chat feed with its reason, and the thread bound is reported in session.lmgw.resolved.chat_thread as for chat_thread. It is refused beside chat_thread (400 invalid_value) and model (400 owned_by_thread), new without chat_folder and takeover with neither parameter are 400 invalid_value, then come 404 chat_folder_not_found (a folder the caller cannot see), 409 not_ongoing and 409 folder_no_model, then the thread's own refusals, checked on the thread the decision picks before a new one is made. takeover=ask is a WebRTC call's and 400 invalid_value here. A bound session carries session.lmgw.turn_mode, automatic or push_to_talk, resolved from the thread's turn detection at the bind (push_to_talk there is push_to_talk, anything else automatic), and lmgw sets audio.input.turn_detection to match: the thread's rule (server_vad or semantic_vad, semantic_vad where it names none) in automatic mode, null in push_to_talk; session.created echoes both. A session.update naming turn_mode switches it and gets the turn detection it implies (the mode in effect named again leaves the detection as it is); one that also names audio.input.turn_detection must agree with it (null with push_to_talk, a rule with automatic), as an echo of the whole session does, else invalid_value; turn detection named alone still works and turn_mode follows it. A change of the thread's turn detection applies at the next bind. An unbound session has no turn_mode, and refuses one with invalid_value. The thread then owns the chat model, prompt, tools, speech models, voice, speech style, language, seed and conversation: a session.update that changes one of them, a response.create that overrides one, and conversation.item.create or .delete are refused with owned_by_thread (an echoed value is accepted). Each response is the thread's own chat turn — its model, prompt with the spoken-style instructions after it, sampling, attachments, knowledge bases and MCP tools, which never become function_call items — written to the thread's history: the user turn with how it was spoken, the reply cut to what was heard (the unheard rest kept beside it, a reply nobody heard deleted unless it ran tools), never over a turn another window started meanwhile. Code blocks and tables are announced rather than skipped silently (\"Code block, rust.\", \"Table.\"; in the thread's language for en, de, fr, es and it), and the dashboard's read-aloud of a reply speaks the same way. No audio is stored: a spoken turn is kept as text. With chat_voice_audio_input on (Settings, or the thread's voice.audio_input), a turn whose answering model takes audio input — the thread's chat model, or the fallback a GPU hold, a benchmark run, an outside-VRAM verdict or a candidate alias hands it to, wherever it runs — goes to it as audio at the commit, while the speech-to-text model transcribes it beside (a model that does not take audio input, one whose capabilities lmgw cannot read, or one lmgw cannot send audio to, such as an Anthropic upstream, is refused it before anything is sent, and the turn goes again as its transcript); the reply is held until the transcript is in, then plays (a thread with no speech-to-text model that resolves always goes as its transcript: only the transcript tells words from noise). A turn that came back without words ends the response quietly as response.done {cancelled, reason no_words}, with no error and nothing written; a failed transcription of a turn the model heard (it answered from the audio) plays the reply and marks the user message (voice.transcript_error) instead of sending transcription.failed, while one no model heard yet, or a turn never transcribed at all (no speech-to-text model, the key's policy, the session's end), is said as with the setting off and ends the response quietly as response.done {cancelled, reason transcription_failed}. A new turn cuts a held reply whatever interrupt_response says, and a held reply's tools run only once its user message is written (a turn that came back without words runs none). A model's server that refuses the audio gets the transcript once, and the session's later turns to that model go as text when the refusal names the audio or the transcript retry answered (a server that went away under the audio is not retried, and its later turns go as text too). One session per thread: a second bind takes the thread over, and the older session gets error chat_thread_taken_over and the close 4000, both naming who bound it (\"voice mode moved to device 'phone'\", \"… to the dashboard\") — unless the second bind gives takeover=never, which a client uses for its own automatic rebinds so it never takes the voice from another device; a user's explicit choice to talk binds without it. A bound session — and no other — also sends lmgw's own events: lmgw.chat.frame ({response_id, event, data}: the chat turn's frames verbatim — turn, retrieval, delta, reasoning, tool, usage, stats, stop, state, error, done; a tool frame's ready and result carry call_id, server_label and ui_resource (the namespaced MCP Apps UI resource the tool links to, for resources/read on /mcp; null when none), ready needs_approval, and result structured_content (the MCP result's structuredContent; null when none) and content (its content blocks as the server sent them), and approval the waiting call's approval_request_id, server_label, name, arguments and call_id (the id its ready frame carried); reasoning is shown, stored with the reply and never spoken, and done's reasoning_note says in a sentence when the model reasoned although the turn asked for reasoning off — a voice turn does unless the thread sets reasoning; no off ends in an error — and its images_note when a fallback that cannot see answered and got the turn's images as placeholders), lmgw.chat.user ({message_id, content, voice (a MessageVoice), response_id}: response_id when that response heard the turn as audio, whose user message is written once the turn is transcribed, after the reply may have started — the page puts it before that reply), lmgw.chat.input ({response_id, input: audio or transcript, why}: how a response's turns reach the chat model and why the transcript, sent at each launch, when an audio attempt was refused, and when a llama-server that went away under the audio sends the session's later turns to it as text; never with chat_voice_audio_input off), lmgw.chat.reply (the ChatReply type: {message_id, content, unheard, voice (a MessageVoice)}, {message_id, removed: true} or {message_id, skipped, voice}: the reply as stored once its response ended, cut to what lmgw knew was heard; a conversation.item.truncate that arrives after that cuts it again at the position the client heard, and sends a second lmgw.chat.reply for the same message_id, which replaces the first), lmgw.model.state ({stage, alias, state, ms, …}: the connect warm's and each turn's model loading), lmgw.chat.thread ({chat_thread: {id, title, temporary, admin_tools}}: the thread as a response re-read it, when that differs from session.lmgw.resolved.chat_thread — a title the first spoken turn named, the admin tools switched on or off) and lmgw.response.timing (a VoiceTiming, flat: {response_id, message_id, end_of_turn_ms, asr_ms, first_token_ms, reasoning_ms, first_clause_ms, first_audio_ms, total_ms, to_first_audio_ms, cold, models: {asr, chat, tts}, input, input_why, transcript_wait_ms}: the timing log line as data, each stage measured from the one before, reasoning_ms the part of first_token_ms the model reasoned (absent when it did not), cold naming the stages that loaded, input whether the chat model heard the turn as audio or read its transcript, input_why why the transcript, transcript_wait_ms how long the first output was held for the transcript (the three absent with chat_voice_audio_input off, transcript_wait_ms on the transcript path), each model with the alias that answered when a fallback did, first_clause: \"announcement\" when the first clause said was one; sent once the reply is written, message_id null when nothing was saved, and stored with the reply), lmgw.approval.decided ({approval_request_id, approve, by}: a call whose mcp_approval_request item the session showed was decided by another client, `by` naming who as the feed names authors; approve false and by null for one whose reply was edited or deleted) and lmgw.task.done ({thread_id, message_id, id, task_id, server_label, tool, status, by}: a late MCP task result entered the thread as message message_id of role tool — the feed's task.done facts; it enters only while no turn of the thread runs, so one that ended during a response is said once that response's turn ended; one said while a response runs entered at that response's start, and that response answers it). Three more lmgw events belong to a WebRTC call bound to a Chat thread and are never sent or read on this WebSocket, whose closes say the same with their codes: lmgw.session.bind_pending ({held_by}: under takeover=ask the thread was held when the call's channel opened; no session runs until the client sends lmgw.session.take_over ({}) to take it, the holder ends and the call binds by itself, or the wait of one realtime.ping_interval_s runs out; a holder that changes brings another), and lmgw.session.closed ({kind, by, message}: the bound call's last event, kind one of taken_over, revoked, out_of_reach, shutting_down, closed and thread_bound, by the new binder, the holder or who hung up and otherwise null, message the sentence a WebSocket close's reason carries, led by the revocation token for revoked). by and held_by name a client as voice.bound.by does. lmgw starts no response for a result: the client's own response.create with no new words and no turn the client committed before it, while the thread holds results no reply answered (said in this session, or there before the bind), is a continuation that answers them, as POST /chat/api/threads/{id}/answer does (turn detection's automatic response to a turn without words stays empty_turn, and so does a push-to-talk commit of silence and its response.create; a continuation a cough cut before any of it was heard runs again after the cough) — it never cancels a turn of the thread (response.done failed with turn_running while one runs), and is empty_turn when a turn of another window answered the results meanwhile. A bound turn's call that waits for an approval (the thread's require_approval) is OpenAI's mcp_approval_request item (conversation.item.added and .done; its id is the approval id; OpenAI's shape, so no call id: the lmgw.chat.frame relaying the turn's approval frame, sent right after the item, carries call_id beside the same approval_request_id) and its response ends; the client answers with conversation.item.create of {type: mcp_approval_response, approval_request_id, approve, reason?} — the one item a bound session takes — then response.create, and that response resumes the thread's turn as POST /chat/api/threads/{id}/approvals does, the session's principal the approver: the approved calls run and the answer comes in that one response. A refusal of the answers fails the response with the route's code (approval_missing, approval_not_found, approval_decided, approval_starter_unavailable, approval_moved_on, approval_out_of_scope, key_rate). A committed turn with words is a new message, which declines what waits: a response that answers one runs as ever. Keep a spoken answer out of the session (transcribe it with POST /chat/api/threads/{id}/transcribe). A refusal mid-session is an error event; its codes: owned_by_thread (a client event changing what the thread owns), empty_turn (a response that would answer no turn and no job result), turn_running (a continuation while a turn of the thread runs), superseded and not_saved (another turn took the thread, or the reply could not be saved; its speech stops), chat_thread_not_found and chat_thread_admin, tts_not_configured, voice_not_configured, voice_not_found, instructions_required, voice_needs_transcript and speech_unavailable (the thread's speech, judged per response after response.created), chat_history_write_failed (the store refused the spoken turn; its words lead the next user message), and chat_thread_taken_over before the takeover's close. A session opened with a key ends when the key is revoked — disabled, rotated or deleted on the Keys page, or past its expires_at — with the close 4003 (any key's session, a device's or not). Its reason starts with a token saying what to do, then a colon and the sentence: device_disabled (a paired device was disabled), key_expired (a paired device's key expired), key_unknown (a paired device's key was replaced or deleted: pair it again), certificate_expired (a paired device's client certificate passed its notAfter: pair it again) or revoked (any other kind of key), e.g. \"device_disabled: device 'desktop' was disabled\"; reconnecting with the same key is refused. A device's session bound to a thread that leaves the device's reach — the self-admin toolset attached to it, or what the device's admin tools may do set to off — closes with 4004 and the neutral reason \"chat thread <id> is out of reach for this key\": the key is still good, and a client asks for its current thread again. Another client binding the thread closes the session with 4000. Every session closes with 1001 (\"lmgw is stopping or restarting\") when the gateway stops or restarts.",
        "operationId": "get_v1_realtime",
        "parameters": [
          {
            "in": "query",
            "name": "call_id",
            "required": false,
            "schema": {
              "default": null,
              "description": "OpenAI's sideband connection: a server-side WebSocket attached to a\nWebRTC call's session. lmgw serves none, so it is refused, 400\nsideband_unsupported, rather than opening an unrelated session.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "chat_folder",
            "required": false,
            "schema": {
              "default": null,
              "description": "A voice mode bound to an ongoing folder's current thread: the bind\ndecides the thread by the rules of `POST\n/chat/api/folders/{id}/current` and binds it in one step, under the\nfolder's lock — the current thread, or a new one from the folder's\ndefaults when there is none, when it is out of the caller's reach,\nwhen it idled past the folder's idle minutes, or with `new=true`\n(unless it has no message yet). A new thread is recorded as\n`folder.current` on the Chat feed with its reason. The thread bound\nis reported in `session.lmgw.resolved.chat_thread`, and is then as\nwith `chat_thread`. Refused beside `chat_thread` (400 invalid_value)\nand beside `model` (400 owned_by_thread); 404 chat_folder_not_found\nfor a folder the caller cannot see, 409 not_ongoing for one that is\nno ongoing conversation, 409 folder_no_model for one whose defaults\nname no model, then the thread's own refusals.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "chat_thread",
            "required": false,
            "schema": {
              "default": null,
              "description": "A voice mode bound to a Chat thread: bind the session to this thread\n(negative for a temporary one). The thread then owns the chat model,\nprompt, tools, speech models, voice and conversation, and the session\nsends lmgw's `lmgw.*` extension events. Needs the chat capability\n(the dashboard's cookie, an owner key or a paired device's key),\nrefused beside `model`, and refused for an Admin Chat thread (a\ndevice is told there is no such thread). A device binds as its key:\nthe thread's aliases pass its scope and budget first.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "default": null,
              "description": "The chat model: a `realtime.model_map` name, an OpenAI Realtime name\nanswered by `realtime.default_model`, or a chat alias — in that\norder. Optional — a session may name its model in its first\n`session.update` instead.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "new",
            "required": false,
            "schema": {
              "default": null,
              "description": "With `chat_folder`: start a new conversation — a new thread unless\nthe folder's current one has no message yet. Refused without\n`chat_folder` (400 invalid_value).",
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "takeover",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Takeover"
                },
                {
                  "type": "null"
                }
              ],
              "description": "With `chat_thread` or `chat_folder`: whether this bind may take the\nthread from a session already bound to it. Left out, it does — the\nother session closes (a WebSocket with 4000), naming who took it.\n`never`: it does not — while another session is bound to the thread\nthe request is refused, 409 chat_thread_bound naming who holds it\n(\"voice is in use on device 'phone'\", and as `error.held_by`), and\nnothing is taken over; a WebRTC call whose thread is taken between\nits POST and its channel's open ends with lmgw.session.closed\n{kind: thread_bound}. For a client's own automatic rebinds (after a\nconversation moved to a new thread), so it never takes the voice\nfrom another device that followed the same move; a user's explicit\nchoice to talk binds without it. `ask` is a WebRTC call's own (POST\n/v1/realtime/calls): a thread held when the call's channel opens is\nasked about, lmgw.session.bind_pending; on GET /v1/realtime it is\n400 invalid_value. Without `chat_thread` or `chat_folder`, 400\ninvalid_value."
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "101": {
            "description": "Switching Protocols: the connection is now a WebSocket. Each frame is one JSON text event of OpenAI's GA Realtime protocol: client events in, server events (each with a server-minted event_id) out. session.created arrives first.",
            "headers": {
              "Sec-WebSocket-Protocol": {
                "description": "The subprotocol selected, present when the client offered it.",
                "schema": {
                  "enum": [
                    "realtime"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "426": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Upgrade Required: the request carried no WebSocket upgrade headers."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error, before the upgrade."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Open a realtime voice session",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/realtime/calls": {
      "post": {
        "description": "OpenAI's WebRTC transport for the Realtime API. The client POSTs its SDP offer — audio with Opus, and the data channel oai-events created before createOffer — as application/sdp, or as multipart/form-data with the part sdp and an optional session part: a JSON object, the session as session.update takes it. The answer is 201 Created with the SDP answer (application/sdp: ICE-lite, one UDP host candidate — the local address this POST arrived on, on the WebRTC UDP port: realtime.webrtc_port, by default the HTTP port's number, or on the device listener its own port — Opus only, with RED when the offer carries it) and Location: /v1/realtime/calls/{call_id}, the call's id rtc_ and 24 hex digits. Behind it runs the session GET /v1/realtime runs — the same cascade, binding and policy — its events as JSON text on oai-events and its audio on RTP. lmgw's audio is one Opus stream for the call's whole life, a frame every 20 ms (realtime.webrtc_output_kbps, capped by the offer's maxaveragebitrate; DTX only when the offer's Opus format says usedtx=1; in-band FEC following the client's receiver reports), silence between answers; the client's audio is heard from its first frame after DTLS connects, what it sent before oai-events opened included, and an input_audio_buffer.commit takes the frames captured up to realtime.webrtc_commit_window_ms after it arrived. oai-events carries no audio: no response.output_audio.delta, input_audio_buffer.append is answered invalid_event, and session.lmgw.output_lead_ms is 0. Every call hears OpenAI's output_audio_buffer.started ({response_id}) with an answer's first frame, and .stopped right after the response.done of one that played out, or .cleared after the response.done of one that was cut (a barge-in, a cancel, a clear, a stop); output_audio_buffer.clear cancels the answer whose audio plays and is silent with none. An event over the client's max-message-size (or realtime.max_message_mb below it) arrives on an unbound call with its largest fields emptied, each followed by an error event_too_large naming the field's path. A call bound to a Chat thread also hears lmgw.output_audio.starved ({response_id, starved}) when an answer's audio runs dry and when it comes again, and may report its playout with lmgw.output_audio.playout ({playout_ntp_ms?, jitter_buffer_ms?}), which the answer's end follows; it stops with lmgw.response.stop ({playout_ntp_ms?}: the open response, the one owed and a held response.create cancelled, heard cut at the client's playout position when it sends one and what was sent otherwise, as on an audio-only call, where libwebrtc does not fill estimatedPlayoutTimestamp (calls design Q5); nothing with nothing open); an event over the limit travels both ways as lmgw.event.part ({id, index, count, data}, back to back, id the event's event_id), joined by the receiver, a client's up to realtime.max_message_mb. An unbound call answers these lmgw events invalid_event. The session starts when oai-events opens: session.created, then the session part applied as the session's first update (session.updated, or an error as for any update; on a call bound to a Chat thread it may change only what a bound session's client owns). Credentials, model resolution and the key's scope, budget and concurrency slot are /v1/realtime's — the slot held from this POST until the call ends — the subprotocol key aside; with Require API key off, an anonymous call from another page's Origin is refused with 403 cross_origin_refused. The query is /v1/realtime's: model, chat_thread or chat_folder with new, and takeover. A call bound to a Chat thread or folder only checks at this POST — nothing is bound and no thread is made — and binds when oai-events opens, checking again: takeover left out takes the thread over (its holder closes as taken over); never ends the call with lmgw.session.closed {kind: thread_bound, by} when the thread is held then, and is the 409 chat_thread_bound, the holder in error.held_by, when it is held at this POST; ask, this route's own, makes the call wait with lmgw.session.bind_pending ({held_by}): the client's lmgw.session.take_over ({}) takes the thread, a holder that ends lets the call bind by itself, a third client taking the thread brings another bind_pending, every other event meanwhile is answered with error bind_pending and the audio is discarded, and one realtime.ping_interval_s after the latest bind_pending the call ends with thread_bound (no bound at 0). A take_over that crosses the bind is ignored. A bound call's last event before lmgw ends it is lmgw.session.closed ({kind, by, message}: kind taken_over, revoked, out_of_reach, shutting_down, closed or thread_bound; by the new binder, the holder or who hung up, else null; message the sentence a WebSocket close's reason carries, led by the revocation token for revoked). A refusal when oai-events opens is that event — out_of_reach for a thread or folder out of the caller's reach, revoked for a key revoked since this POST, closed after an error carrying the refusal's code otherwise. by and held_by name a client as the Chat feed's voice.bound.by does. An unbound call sends no lmgw event and closes with nothing in band, as OpenAI's do. A call whose ICE, DTLS or data channel never comes up ends one realtime.ping_interval_s after its answer, binding nothing. Refused before the answer: 400 invalid_value (the query, a parameter rule, or a session part that is no JSON object or is over realtime.max_message_mb, which bounds a session event on either transport), 400 bad_request (a multipart body that does not parse), 400 sideband_unsupported (call_id), 400 owned_by_thread, 400 missing_sdp (a multipart body without sdp), 400 invalid_sdp (the offer does not parse; the reason quoted), 400 unsupported_offer (no Opus audio, or no data channel), 400 beta_protocol_unsupported, 403 cross_origin_refused, the bind's refusals (403 chat_thread_not_allowed, 404 chat_thread_not_found and chat_folder_not_found, 409 not_ongoing, folder_no_model, chat_thread_admin and chat_thread_bound), the key's 401, 403 and 429, 413 over max_body_mb, 415 unsupported_media_type, and 503 webrtc_unavailable when realtime.webrtc_enabled was off at lmgw's start, or the listener's UDP sockets failed to bind or are not bound (the message names the setting or the error), and, with a Retry-After header, while the device listener's group moves with it or when the POST's connection belongs to an earlier start of it. The device listener's UDP sockets follow its addresses and port: a change of the device listener ends its calls, a bound call's last event lmgw.session.closed {kind: shutting_down}, and leaves the plain listener's running. Not served: the sideband WebSocket, SIP's accept, reject and refer, and ephemeral client secrets.",
        "operationId": "post_v1_realtime_calls",
        "parameters": [
          {
            "in": "query",
            "name": "call_id",
            "required": false,
            "schema": {
              "default": null,
              "description": "OpenAI's sideband connection: a server-side WebSocket attached to a\nWebRTC call's session. lmgw serves none, so it is refused, 400\nsideband_unsupported, rather than opening an unrelated session.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "chat_folder",
            "required": false,
            "schema": {
              "default": null,
              "description": "A voice mode bound to an ongoing folder's current thread: the bind\ndecides the thread by the rules of `POST\n/chat/api/folders/{id}/current` and binds it in one step, under the\nfolder's lock — the current thread, or a new one from the folder's\ndefaults when there is none, when it is out of the caller's reach,\nwhen it idled past the folder's idle minutes, or with `new=true`\n(unless it has no message yet). A new thread is recorded as\n`folder.current` on the Chat feed with its reason. The thread bound\nis reported in `session.lmgw.resolved.chat_thread`, and is then as\nwith `chat_thread`. Refused beside `chat_thread` (400 invalid_value)\nand beside `model` (400 owned_by_thread); 404 chat_folder_not_found\nfor a folder the caller cannot see, 409 not_ongoing for one that is\nno ongoing conversation, 409 folder_no_model for one whose defaults\nname no model, then the thread's own refusals.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "chat_thread",
            "required": false,
            "schema": {
              "default": null,
              "description": "A voice mode bound to a Chat thread: bind the session to this thread\n(negative for a temporary one). The thread then owns the chat model,\nprompt, tools, speech models, voice and conversation, and the session\nsends lmgw's `lmgw.*` extension events. Needs the chat capability\n(the dashboard's cookie, an owner key or a paired device's key),\nrefused beside `model`, and refused for an Admin Chat thread (a\ndevice is told there is no such thread). A device binds as its key:\nthe thread's aliases pass its scope and budget first.",
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "model",
            "required": false,
            "schema": {
              "default": null,
              "description": "The chat model: a `realtime.model_map` name, an OpenAI Realtime name\nanswered by `realtime.default_model`, or a chat alias — in that\norder. Optional — a session may name its model in its first\n`session.update` instead.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "new",
            "required": false,
            "schema": {
              "default": null,
              "description": "With `chat_folder`: start a new conversation — a new thread unless\nthe folder's current one has no message yet. Refused without\n`chat_folder` (400 invalid_value).",
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "takeover",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Takeover"
                },
                {
                  "type": "null"
                }
              ],
              "description": "With `chat_thread` or `chat_folder`: whether this bind may take the\nthread from a session already bound to it. Left out, it does — the\nother session closes (a WebSocket with 4000), naming who took it.\n`never`: it does not — while another session is bound to the thread\nthe request is refused, 409 chat_thread_bound naming who holds it\n(\"voice is in use on device 'phone'\", and as `error.held_by`), and\nnothing is taken over; a WebRTC call whose thread is taken between\nits POST and its channel's open ends with lmgw.session.closed\n{kind: thread_bound}. For a client's own automatic rebinds (after a\nconversation moved to a new thread), so it never takes the voice\nfrom another device that followed the same move; a user's explicit\nchoice to talk binds without it. `ask` is a WebRTC call's own (POST\n/v1/realtime/calls): a thread held when the call's channel opens is\nasked about, lmgw.session.bind_pending; on GET /v1/realtime it is\n400 invalid_value. Without `chat_thread` or `chat_folder`, 400\ninvalid_value."
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/sdp": {
              "schema": {
                "type": "string"
              }
            },
            "multipart/form-data": {
              "schema": {
                "description": "`POST /v1/realtime/calls` as `multipart/form-data` (calls design §2.1),\nOpenAI's shape: the parts. The offer may come alone instead, as an\n`application/sdp` body.",
                "properties": {
                  "sdp": {
                    "description": "The SDP offer (`application/sdp`): audio with Opus, and the data\nchannel `oai-events`, created before `createOffer`.",
                    "type": "string"
                  },
                  "session": {
                    "additionalProperties": true,
                    "description": "The session (`application/json`): a JSON object, the session as\n`session.update` takes it — OpenAI's GA session object. Not checked\nbefore the answer: the session applies it as its first update, right\nafter `session.created` and before any event of the client's, and\nanswers it as any update, `session.updated` or an `error`. On a call\nbound to a Chat thread only what the client owns applies (turn\ndetection or `lmgw.turn_mode`, `lmgw.half_duplex`, `lmgw.echo_tail_ms`).",
                    "type": "object"
                  }
                },
                "required": [
                  "sdp"
                ],
                "title": "CallRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/sdp": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Created.",
            "headers": {
              "Location": {
                "description": "The call's path, /v1/realtime/calls/{call_id}: its last segment is the call id the hangup takes.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Start a realtime call (WebRTC)",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-writes": true
      }
    },
    "/v1/realtime/calls/{call_id}/hangup": {
      "post": {
        "description": "Ends a call: its session ends as if the client had closed it, a bound call's last event being lmgw.session.closed {kind: closed, by} naming who hung up. Answered 200 with an empty body once the call has let go — its Chat thread's binding marked as ending and its concurrency slot back — so a call posted right after it is neither refused (takeover=never) nor left pending (takeover=ask) by the call it ended. A call whose session or bind has not let go 10 s after the hangup (the bound a stopping server gives its sessions) is closed by force and answered 200 then; its binding is marked as ending only once its session notices, so a takeover=never call right after such a 200 may still be refused by it for that moment. A call that has let go but still waits for its last events' delivery (closing) is closed at once, without them, and answered 200. Takes no concurrency slot and counts no request, so a key at its limit can still hang up. Allowed for the key that made the call and for the owner; anyone else, and a call that has ended, gets 404 call_not_found.",
        "operationId": "post_v1_realtime_calls_call_id_hangup",
        "parameters": [
          {
            "in": "path",
            "name": "call_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Hang up a realtime call",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-writes": true
      }
    },
    "/v1/rerank": {
      "post": {
        "description": "Jina and TEI request shapes both work (documents or texts); an embedding-only row is refused. Answers Jina's results shape either way.",
        "operationId": "post_v1_rerank",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RerankRequest",
                "example": {
                  "documents": [
                    "An LLM gateway.",
                    "A city in France."
                  ],
                  "model": "<pick a model>",
                  "query": "What is lmgw?"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerankResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Rerank documents",
        "tags": [
          "lmgw-inference"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-model-task": "rerank",
        "x-lmgw-writes": false
      }
    },
    "/v1/responses": {
      "post": {
        "description": "lmgw's own Responses API implementation; llama-server has none. MCP tools run server-side on lmgw's registered MCP servers. An upstream that implements the Responses API itself (the OpenAI platform, a compatible row flagged for it) gets the body as sent, hosted tools, item references and truncation:\"auto\" included, unless only lmgw's loop can serve the request; the loop refuses those rather than approximating them. background:true is refused on every path. An anthropic-beta header is forwarded when the route is an Anthropic upstream.",
        "operationId": "post_v1_responses",
        "parameters": [
          {
            "description": "on|off: per-request thinking switch; it wins over body fields. On a cloud model, off goes out in the form the model takes: no reasoning control where the model has none, its lowest level where it cannot stop (x-lmgw-reasoning-ignored then lists enabled), thinking type between_tools on an Anthropic model whose catalog says it takes that type and not disabled. An off never ends in an error: a refused one is retried with what the refusal names and, failing that, with no reasoning control, so a model that cannot run without reasoning answers with its default reasoning. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "An effort level (see capabilities.reasoning.levels of the model); 'none' turns reasoning off. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-effort",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "Integer thinking-token budget; 0 turns reasoning off. Expressible on llama.cpp, Gemini and budget-style Anthropic models only. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-budget",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest",
                "example": {
                  "input": "Say hello in one short sentence.",
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-images-omitted": {
                "description": "Sent next to x-lmgw-fallback: the number of the request's images that went to the answering fallback as text placeholders because its capabilities say it cannot see ('[image/png image, N base64 bytes — omitted: the answering model cannot see images]'). The model reads the placeholder; the client reads this count. On /v1/responses it counts the images the run opened with. Absent when every image was sent, and on a route the client named itself, which always gets its images.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-clamped": {
                "description": "The max_tokens value lmgw lowered the request's cap to, because the n_predict of a ladder rung, or of a guarded shared-KV-pool model, is a ceiling every request on it must respect. Absent when nothing was lowered: a missing max_tokens is filled, not clamped, and a value already under the ceiling is kept exactly.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-defaulted": {
                "description": "The max_tokens value lmgw chose because the request set none and the route (an Anthropic upstream) requires one: the catalog's published maximum when streaming, 4096 when not streaming (the provider refuses non-streamed requests that could run too long).",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-max-tokens-raised": {
                "description": "The max_tokens value lmgw raised the request's cap to, because the requested thinking budget would not fit underneath it.",
                "schema": {
                  "type": "integer"
                }
              },
              "x-lmgw-params-ignored": {
                "description": "Comma-separated list of the request's sampling parameters (top_k, min_p, repeat_penalty, presence_penalty, frequency_penalty, seed) the answering model's provider does not take, so lmgw did not send them: the OpenAI platform takes no top_k, min_p or repeat_penalty; Anthropic none of the six but top_k; Gemini no min_p, repeat_penalty or penalties. llama.cpp and OpenAI-compatible providers are sent all of them. Also context_management and compaction, a /v1/messages request's Anthropic context management and on-demand compaction, which only an Anthropic model's route takes (both sent on as written), and thinking.display, which goes only to an Anthropic model, beside a thinking type that takes it (adaptive or enabled). Also content.<type>, a /v1/messages request's content block lmgw does not model (redacted_thinking, a type newer than lmgw), which only an Anthropic model's route is sent, and answer.<type>, such a block in an Anthropic model's whole answer, which a Chat Completions or Responses client is not given (a streamed answer's headers leave before it). On an Anthropic model's route, content.thinking and content.<type> name a thinking or other Anthropic block lmgw recorded from an answer at another provider's address (a stored /v1/responses chain), which this provider cannot read and is not sent. answer.citations and content.citations name an Anthropic text block's citations, which only a /v1/messages client and an Anthropic model's route are given (citations lmgw recorded from an answer only at that provider's address, and a citation with no text not at all). Request fields lmgw does not model are sent as they came and never listed. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed",
                    "context_management",
                    "compaction",
                    "thinking.display"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-params-refused": {
                "description": "Comma-separated list of the request's sampling parameters the answering model refused, which lmgw left out of the send (stop is not left out; its refusal reaches the client). A 400 whose words refuse exactly one parameter the request carried (Anthropic '`temperature` is deprecated for this model.', OpenAI 'Unsupported parameter: 'temperature' is not supported with this model.' or 'Unsupported value: 'temperature' does not support 0 with this model.') is retried once without exactly that parameter, the refused attempt logged with a note naming it, and when the retry answers the parameter is left out of that model's later requests too, each saying so here. Nothing is left out without a refusal on record. On a streamed /v1/responses run the header names what was on record when the stream opened. Absent when every parameter was sent.",
                "schema": {
                  "enum": [
                    "temperature",
                    "top_p",
                    "top_k",
                    "min_p",
                    "repeat_penalty",
                    "presence_penalty",
                    "frequency_penalty",
                    "seed"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-reasoning-ignored": {
                "description": "Comma-separated list of the reasoning controls (enabled, effort, budget) the route could not express. enabled is also listed when an off went out as no control or as the model's lowest level, either because the model cannot take the off itself or because the provider refused every form of off and the model answered with its default reasoning. An off sent to an Anthropic model as thinking type between_tools (its own lowest setting, when it takes no disabled) is not listed. between_tools: a /v1/messages request's thinking type between_tools went to a model of another provider as that provider's off. Absent when every control was applied.",
                "schema": {
                  "enum": [
                    "enabled",
                    "effort",
                    "budget",
                    "between_tools"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-rung": {
                "description": "On a ladder model, the rung that answered (or refused) the request, as '<k>/<n>; ctx=<per-slot context>; gguf=<weights file>', counted from 1 (the gguf part is left off when the file name cannot be a header value). A request whose prompt plus max output does not fit the running rung makes the model climb to the smallest rung that fits before it answers. On /v1/responses it names the rung running when the run opened; a unary answer one of whose turns the fallback answered carries x-lmgw-fallback instead, and a stream's headers are sent before its turns run. Absent on models without a ladder and on responses a fallback answered.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-lmgw-sse-events": {
              "response": {
                "$ref": "#/components/schemas/ResponseStreamEvent"
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Create a response",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": true
      }
    },
    "/v1/responses/input_tokens": {
      "post": {
        "description": "The OpenAI SDKs' responses.input_tokens.count(): the body a Responses create would send (input, instructions, function tools, a previous_response_id's stored conversation in front), counted on the route the model resolves to as the other counters count — exact on an Anthropic upstream (the Messages body the send would render, on Anthropic's own counter), a Gemini upstream and a local llama.cpp chat row; otherwise flattened, which x-lmgw-count-approximate says. mcp tools' definitions are not counted yet (tools_omitted), and what only an upstream's own Responses API serves is refused by name. Enforces the key's alias scope like every other counter; no budget applies.",
        "operationId": "post_v1_responses_input_tokens",
        "parameters": [
          {
            "description": "on|off: per-request thinking switch; it wins over body fields. On a cloud model, off goes out in the form the model takes: no reasoning control where the model has none, its lowest level where it cannot stop (x-lmgw-reasoning-ignored then lists enabled), thinking type between_tools on an Anthropic model whose catalog says it takes that type and not disabled. An off never ends in an error: a refused one is retried with what the refusal names and, failing that, with no reasoning control, so a model that cannot run without reasoning answers with its default reasoning. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "An effort level (see capabilities.reasoning.levels of the model); 'none' turns reasoning off. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-effort",
            "required": false,
            "schema": {
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "Integer thinking-token budget; 0 turns reasoning off. Expressible on llama.cpp, Gemini and budget-style Anthropic models only. Accepted on /v1/chat/completions, /v1/messages, /v1/messages/count_tokens, /v1/responses and /v1/responses/input_tokens.",
            "in": "header",
            "name": "x-lmgw-reasoning-budget",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest",
                "example": {
                  "input": "Say hello in one short sentence.",
                  "model": "<pick a model>"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseInputTokens"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-count-approximate": {
                "description": "On the token counters, why the number is not exactly what the backend would count for this request; a comma-separated list. flattened: the request's structure was counted as plain text, so chat template, tool-definition and per-message overhead are not included and the real prompt is larger. tokenizer_guess: the backend's tokenizer is unknown, so the count uses tiktoken o200k_base. media_bound: images are counted at the model's per-image upper bound. media_omitted: image or audio parts are not in the number. message_framing: on /v1/count_tokens, the backend counts messages, so the text was counted as one user message, framing included. tools_omitted: on /v1/responses/input_tokens, the mcp tools' definitions (listed from their servers when a run starts) are not in the number. pending_calls_omitted: on /v1/responses/input_tokens, the stored response being continued is waiting on calls, whose results are not in the number. Absent when the count is exact.",
                "schema": {
                  "enum": [
                    "flattened",
                    "tokenizer_guess",
                    "media_bound",
                    "media_omitted",
                    "message_framing",
                    "tools_omitted",
                    "pending_calls_omitted"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Count a response's input tokens",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "openai"
        ],
        "x-lmgw-model-task": "chat",
        "x-lmgw-writes": false
      }
    },
    "/v1/responses/{id}": {
      "delete": {
        "description": "Deletes a stored response, or has the upstream that made a native one delete it. Read as GET is: another key's response is a 404.",
        "operationId": "delete_v1_responses_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDeleted"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Delete a response",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": true
      },
      "get": {
        "description": "A stored response, exactly as it was served. It is present only when lmgw stored it — the creating call left store on (the default) while the gateway's response store was on — and only until retention evicts its conversation as a whole: by default 168 hours after the conversation's last activity, or once it falls outside the 500 most recently active conversations. A response an upstream that implements the Responses API made itself (created with store left on) is fetched from that upstream, query string included, and relayed as it answers, for as long as the same retention keeps lmgw's record of it. A client key reads only the responses it made, an owner key every one; another key's response is a 404 like an unknown id. 404 otherwise.",
        "operationId": "get_v1_responses_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Retrieve a response",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/responses/{id}/input_items": {
      "get": {
        "description": "This turn's `input` array as it was sent, for a stored response; for a native one, the upstream's answer with the query string forwarded. Read as GET is.",
        "operationId": "get_v1_responses_id_input_items",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseInputItems"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "List a response's input items",
        "tags": [
          "openai"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/systemone": {
      "post": {
        "description": "TypeSafe's System One API as llama.cpp serves it: a state and a map of typed questions (choice, score, noul), answered with calibrated probabilities and no generated text. The client object is forwarded with only model rewritten, members in the order sent (a choice question's criteria order is its option order), and the answer comes back verbatim, its model included: the id that answered upstream, not the name asked for (x-lmgw-fallback names a fallback alias). The body is read as JSON whatever its Content-Type. Routes to a local decision model (an aux row of kind decision) or to an openai_compatible or llama_cpp upstream whose catalog does not rule the model out; any other model is 501 not_supported_error before a container starts. A local row whose image predates the route is a 501 too, once its container is up and answers the route 404. The upstream's own errors are relayed as sent (llama.cpp's 500 for a prompt over the ubatch included), except a 401/403, which is lmgw's credential and a 502. The key's alias scope and budgets apply; the row is priced from lmgw's own price rows, input tokens and, where the price row charges them, output tokens (Jev's does not). Errors lmgw answers itself are llama.cpp-shaped, except the shared /v1 layers' own: the gate's 401, 403 and 429, and the 413 for a declared Content-Length over max_body_mb, which are OpenAI-shaped.",
        "operationId": "post_v1_systemone",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "`POST /v1/systemone`'s body: a state and the questions to answer about it.\n\nlmgw reads only `model` from a client's body and forwards the rest as it\ncame; the upstream validates its own wire (TypeSafe answers a malformed\nquestion with 422, llama.cpp with 400).",
                "example": {
                  "model": "<pick a model>",
                  "questions": {
                    "department": {
                      "criteria": {
                        "billing": "payments, invoices, refunds, plan charges",
                        "sales": "new purchases, upgrades, quotes",
                        "technical": "bugs, outages, errors in the product",
                        "unsure": null
                      },
                      "instructions": "Which team should handle this ticket?",
                      "type": "choice"
                    },
                    "mood": {
                      "instructions": "The customer is upset.",
                      "type": "noul"
                    },
                    "urgency": {
                      "criteria": [
                        "not urgent",
                        "normal",
                        "urgent",
                        "critical"
                      ],
                      "instructions": "How urgent is this ticket?",
                      "type": "score"
                    }
                  },
                  "state": "Hi, my invoice from last month charged me twice for the Pro plan. Can you refund one of the charges?"
                },
                "properties": {
                  "files": {
                    "description": "llama.cpp's extension: files as data URLs (`images` is its alias).",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "images": {
                    "description": "llama.cpp's extension: images as data URLs, for a model started with a\nprojector and a type that reads images (501 otherwise). An alias of\n`files`. TypeSafe takes text only.",
                    "items": {
                      "type": "string"
                    },
                    "type": [
                      "array",
                      "null"
                    ]
                  },
                  "model": {
                    "description": "Required: lmgw routes by it, as TypeSafe requires it and llama-server's\nrouter mode needs it. Rewritten to the route's upstream model on the\nway out; nothing else is.",
                    "type": "string"
                  },
                  "questions": {
                    "additionalProperties": {
                      "$ref": "#/components/schemas/SystemOneQuestion"
                    },
                    "description": "The questions, keyed by ids the caller picks; the answers come back\nunder the same keys.",
                    "type": "object"
                  },
                  "state": {
                    "description": "What the questions are about: a string, or an object or array (a chat\nlog, a record), which llama.cpp gives the model as JSON text. `null`\nonly for the types that take none (LiquidAI's d1 models); llama.cpp\nrefuses it on the others."
                  }
                },
                "required": [
                  "model",
                  "state",
                  "questions"
                ],
                "title": "SystemOneRequest",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemOneResponse"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlamaCppError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Ask a decision model",
        "tags": [
          "llamacpp"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "llamacpp",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-model-task": "decision",
        "x-lmgw-writes": false
      }
    },
    "/v1/tasks/run": {
      "post": {
        "description": "audio.cpp's own generic task route; request is relayed to the backend untouched, but for its text on a local model whose engine refuses a character its package lacks (Supertonic): that is fitted as speech's input is (x-lmgw-speech says how), and a text left with nothing to say is 400 empty_input.",
        "operationId": "post_v1_tasks_run",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "x-lmgw-untyped": "audio.cpp's own per-task JSON, relayed verbatim"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Run a generic task",
        "tags": [
          "lmgw-inference"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/v1/tasks/stream": {
      "post": {
        "description": "The streaming-mode sibling of /v1/tasks/run.",
        "operationId": "post_v1_tasks_stream",
        "parameters": [
          {
            "description": "on|off: run this one request as background work, for speculative or prefetching clients. On a local model it uses the model only when that disturbs nobody: it joins the model if it is loaded and no foreground request is waiting for room, or starts it into free GPU memory (evicting only idle background-started models), and never evicts, waits for or climbs a model foreground work uses. Otherwise the model's configured fallback answers (x-lmgw-fallback, x-lmgw-fallback-reason: background), or the request is refused with 503 gpu_deferred: retry later. Foreground work never interrupts a background request that has started; close the request to cancel it. On a candidate alias it makes the alias walk as a background alias. A cloud model and a model running on the CPU are unaffected. Absent or off: an ordinary request. Any other value is a 400.",
            "in": "header",
            "name": "x-lmgw-background",
            "required": false,
            "schema": {
              "enum": [
                "on",
                "off"
              ],
              "type": "string"
            },
            "x-lmgw-audience": "client"
          },
          {
            "description": "The job id of the live agent run to attribute this request's cost, tokens and call count to. Only an agent token may attribute, and only to its own runs. An id that names no live run, a run that belongs to another agent, or a caller without an agent token is ignored with a log line and never refused.",
            "in": "header",
            "name": "x-lmgw-run",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "x-lmgw-audience": "agent"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "x-lmgw-untyped": "audio.cpp's own per-task stream, relayed verbatim"
                }
              }
            },
            "description": "OK.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error.",
            "headers": {
              "x-lmgw-candidate": {
                "description": "On a candidate alias, the id of the local model that answered (or refused) the request. Never sent next to x-lmgw-fallback. The body's model field still names the requested alias.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback": {
                "description": "The model or alias that answered instead of the one requested: the last hop of its chain of fallbacks (each model and alias has its own, and a fallback can have one in turn); the answer still names the requested model. On the chat routes, a fallback whose capabilities say it cannot see receives the request's images as text placeholders, and x-lmgw-images-omitted gives the count.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-chain": {
                "description": "Every hop a fallback-served answer was handed to, in order, each with the reason it was handed on, as an RFC 8941 list: \"m2\";reason=hold, \"cloud\";reason=hold. Sent on every answer a fallback served, next to x-lmgw-fallback (the last name) and x-lmgw-fallback-reason (the last reason), so a client reads one header whatever the chain's length. A name that cannot be an sf-string (a byte outside 0x20–0x7E) is left empty, the reason kept. A streamed /v1/responses run names the hops of its first turn only: its headers left with the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-lmgw-fallback-reason": {
                "description": "Why x-lmgw-fallback answered (the last hop's reason; x-lmgw-fallback-chain has every hop's); always sent next to it. hold: the GPU hold pauses local models. benchmark: a benchmark run has the GPU to itself until it ends. external_vram: GPU memory used outside lmgw by another program left too little room to load the model, so the fallback answered at once instead of waiting. background: a background job's model could not load without disturbing foreground work (any request that is not background traffic: a background candidate alias's, or one sent with x-lmgw-background: on). unavailable: a candidate alias's primary cannot be used at all (missing, disabled, or lacking a capability the alias enables) and none of its other models is loaded. quota: the upstream answered that its account's quota is exhausted (insufficient_quota), or lmgw remembers it so until its next check; nothing was charged for the refused attempt. unreachable: the upstream could not be connected to, so nothing reached it. disabled: the model or alias asked for is disabled, or its upstream is. gpu_setup: the local model could not start on the graphics card, and lmgw's machine check names why (the card, its driver, or the piece that lets models use it, not ready on the computer lmgw runs on); while that check still describes the machine, the fallback answers without a start being tried. engine_download: the engine the local model runs in is not on the computer yet, and downloading it failed or cannot be done.",
                "schema": {
                  "enum": [
                    "hold",
                    "external_vram",
                    "background",
                    "unavailable",
                    "benchmark",
                    "quota",
                    "unreachable",
                    "disabled",
                    "gpu_setup",
                    "engine_download"
                  ],
                  "type": "string"
                }
              },
              "x-lmgw-speech": {
                "description": "On POST /v1/audio/speech (and on /v1/tasks/run and /v1/tasks/stream, for their chars part), what lmgw changed in the request so the model understands it; a '; '-separated list. voice=options.voice_id: a voice the model ships, which this family (MagpieTTS) reads from options.voice_id. voice=preset->options.voice_id: the same for a preset's voice id. voice=<name>: a shipped voice sent in the model's own spelling. language=<asked>-><sent>: the language in the model's own vocabulary, e.g. de->german for Qwen3-TTS, en->en-us for Kokoro. instructions=options.instruct: instructions moved to where the family reads them. instructions=also:options.instruct or instructions=also:options.instruction: the model's default request options describe the voice under that other key, which the engine would merge in beside the request's and refuse as conflicting, so the request's text went there too and replaces the default. instructions=dropped: the model reads none (capabilities.speech.instructions is none). tags=mapped:<n>,stripped:<n>: inline tags in input were rewritten into the model's spelling, or removed so they are never read out. chars=replaced:<U+XXXX/...>,dropped:<U+XXXX/...>: characters of input the model's engine has no entry for in its package's vocabulary (Supertonic refuses the whole request over one), replaced by an equivalent it has (a typographic quote by a plain one, a dash by -) or removed (an emoji). Each list names at most 64 codepoints and then ends in +<n> more; lmgw's log has the full list. An input left with nothing to say is 400 empty_input, which carries the header too. The voice, language and chars parts apply to local audio models only. Absent when the request went as it came; input changes only for its inline tags and those characters.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          },
          {}
        ],
        "summary": "Run a generic task (streaming)",
        "tags": [
          "lmgw-inference"
        ],
        "x-lmgw-capability": "inference",
        "x-lmgw-dialect": "openai",
        "x-lmgw-endpoints": [
          "other"
        ],
        "x-lmgw-writes": false
      }
    },
    "/voice-lab/api/clone-check": {
      "post": {
        "description": "Has a cloning text-to-speech model say a short line (the body's, else the language's check line) with a saved sample as its reference, through the same handler as POST /v1/audio/speech, whose answer is relayed as it came: the audio, x-lmgw-fallback when a fallback answered, or the route's OpenAI error envelope. With the class's voice directory on the library the sample is named as `voice`, as a realtime session names it; otherwise it goes as a voice_ref path with its transcript as reference_text. The check's own refusals (no alias, no line, no such sample) use the same envelope.",
        "operationId": "post_voice_lab_api_clone_check",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /voice-lab/api/clone-check`: speak a test line with a saved sample\nas the reference voice. The answer is the speech route's own: audio, or\nits error envelope.",
                "properties": {
                  "alias": {
                    "description": "The cloning text-to-speech alias.",
                    "type": "string"
                  },
                  "language": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sample": {
                    "description": "The sample: its voice name (`anna`) or file name (`anna.wav`).",
                    "type": "string"
                  },
                  "text": {
                    "default": null,
                    "description": "What to say; absent or blank: the language's check line.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "alias",
                  "sample"
                ],
                "title": "VoiceCloneCheck",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/aac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/flac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/ogg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Speak a test line with a sample",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "openai",
        "x-lmgw-model-task": "tts",
        "x-lmgw-writes": false
      }
    },
    "/voice-lab/api/model": {
      "get": {
        "description": "What the Voices lab's form offers for a text-to-speech alias, read from lmgw's own catalog and starting nothing: what a voice description does (none, a speaking style, the voice it designs, passed through) and whether the model needs one, whether it speaks a voice it is told, whether a seed reaches it, the languages it declares and what happens to the form's language, whether it clones a voice-library clip (for the cloning check), whether the GPU hold pauses it now and which alias answers in its place, and the licence its package states. A cloud alias's facts come from its capabilities.speech override; lmgw sends it no seed and no language. 400 for a blank alias or a language that is no language code, 404 for an unknown alias, 501 for one that is no OpenAI-shaped audio route (openai, openai_compatible or llama_cpp).",
        "operationId": "get_voice_lab_api_model",
        "parameters": [
          {
            "in": "query",
            "name": "alias",
            "required": true,
            "schema": {
              "description": "The text-to-speech alias.",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "language",
            "required": false,
            "schema": {
              "default": null,
              "description": "The language the form is set to, for `language_note`.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "voice",
            "required": false,
            "schema": {
              "default": null,
              "description": "The voice the form names, for `language_note` (some families speak\nthe language of their voice).",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/model`: what the Voices lab's form offers for a\ntext-to-speech alias — read from lmgw's catalog, starting nothing.",
                  "properties": {
                    "alias": {
                      "type": "string"
                    },
                    "clone_note": {
                      "description": "Why it would not, or how, in a sentence.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "clones": {
                      "description": "The model clones a voice-library clip (the cloning check's pick).",
                      "type": "boolean"
                    },
                    "default_voice": {
                      "description": "What speaks when no voice is named, when lmgw knows.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "$ref": "#/components/schemas/VoiceDescriptionMode",
                      "description": "What a voice description does."
                    },
                    "description_default": {
                      "description": "The row has a default description of its own, which a request\nwithout one gets.",
                      "type": "boolean"
                    },
                    "description_required": {
                      "description": "The model speaks only with a description, and the row has no\ndefault one.",
                      "type": "boolean"
                    },
                    "fallback": {
                      "description": "The alias that answers in its place now, when one does.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "held": {
                      "description": "The GPU hold (or a benchmark's lease) pauses the row now.",
                      "type": "boolean"
                    },
                    "language_note": {
                      "description": "What happens to the asked language, when it does not reach the model\nas set (\"does not speak German (de) — not sent\").",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "languages": {
                      "description": "ISO 639-1 codes the model declares it speaks; empty when it declares\nnone.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "licence": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelLicence"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The licence the row's package states, when it states one.\nInformation only: never a filter."
                    },
                    "local": {
                      "description": "An lmgw audio row (`row` names it); otherwise a cloud alias.",
                      "type": "boolean"
                    },
                    "reads_seed": {
                      "description": "A seed reaches the model: each candidate is drawn from its own.\n`false` for a cloud model (lmgw sends it none) and for an engine that\ntakes none.",
                      "type": "boolean"
                    },
                    "row": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/VoiceRow"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "row_pins_seed": {
                      "description": "The row pins a seed of its own (its default request options): the\ncandidates' seeds are sent, and what the engine does with both is\nits own.",
                      "type": "boolean"
                    },
                    "takes_voice": {
                      "description": "The model speaks a voice it is told (a preset, a shipped voice, a\nlibrary clip); `false` for one that designs its voice instead.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "alias",
                    "local",
                    "row",
                    "description",
                    "description_required",
                    "description_default",
                    "takes_voice",
                    "default_voice",
                    "reads_seed",
                    "row_pins_seed",
                    "languages",
                    "language_note",
                    "clones",
                    "clone_note",
                    "held",
                    "fallback",
                    "licence"
                  ],
                  "title": "VoiceModelFacts",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "What a text-to-speech model takes",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-model-task": "tts",
        "x-lmgw-writes": false
      }
    },
    "/voice-lab/api/rounds": {
      "get": {
        "description": "Every round kept under <data_dir>/voice-lab/rounds, newest first, with their candidates and what their audio takes on disk. Rounds stay until they are discarded; samples saved from them are copies and stay in the library.",
        "operationId": "get_voice_lab_api_rounds",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/rounds`: every kept round, newest first.",
                  "properties": {
                    "bytes": {
                      "description": "What the rounds' audio takes on disk.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "dir": {
                      "description": "Where they are kept.",
                      "type": "string"
                    },
                    "rounds": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceRound"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "rounds",
                    "bytes",
                    "dir"
                  ],
                  "title": "VoiceRounds",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the kept rounds",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "The voice_generate op as a route: the alias is opened once and says the text as `count` candidates (4 when absent, no cap), each with its own seed where the engine reads one; a configured fallback answers as for any request, and the round names who answered. The answer is the round as kept, each candidate with its seed, length and the path that plays it. Failures before the first candidate are the speech route's (the GPU hold with no fallback 503 gpu_hold, a voice-design model without a description 400 instructions_required, the engine's own error) with their status and code; a failure after it ends the round there (`stopped`). A caller that goes away (the request aborted, an MCP client hanging up) stops the round: the candidate in flight ends, the round keeps what it made with `stopped` set, and its request_logs row is a 200 canceled. The body size is not limited.",
        "operationId": "post_voice_lab_api_rounds",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`voice_generate` / `POST /voice-lab/api/rounds`: render candidates.",
                "properties": {
                  "alias": {
                    "description": "The text-to-speech alias, local or cloud.",
                    "type": "string"
                  },
                  "count": {
                    "default": null,
                    "description": "How many candidates; 4 when absent. Rendered one after the other.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "description": {
                    "default": null,
                    "description": "The voice description (or speaking style) for a model that reads one.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "language": {
                    "default": null,
                    "description": "ISO 639-1 code: picks the sentence, and is sent to a local row that\ntakes a language, in its own spelling.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "seed": {
                    "default": null,
                    "description": "The first candidate's seed; the next get `seed + 1`, `seed + 2`, …\nAbsent: a random seed per candidate.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "text": {
                    "default": null,
                    "description": "What every candidate says. Absent or blank: the language's sentence\n(the owner's saved one, else the built-in one).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "voice": {
                    "default": null,
                    "description": "The voice for a model that speaks a voice it is told.",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "alias"
                ],
                "title": "VoiceGenerateArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "One round: what was asked, who answered, and its candidates.",
                  "properties": {
                    "alias": {
                      "description": "The alias asked.",
                      "type": "string"
                    },
                    "answered_by": {
                      "description": "The alias that answered: `alias`, or the fallback the GPU hold (or a\nbusy card) handed the round to.",
                      "type": "string"
                    },
                    "asked": {
                      "description": "How many candidates were asked for.",
                      "format": "uint32",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "candidates": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceCandidate"
                      },
                      "type": "array"
                    },
                    "created_at": {
                      "description": "RFC 3339, UTC.",
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fallback_reason": {
                      "description": "Why a fallback answered (`hold`, `external_vram`, …).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "description": "The round's id, its directory's name.",
                      "type": "string"
                    },
                    "language": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language_note": {
                      "description": "What happened to the language when it did not reach the model as\nset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "licence": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ModelLicence"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The licence the answering row's package states, when it states one."
                    },
                    "row": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/VoiceRow"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The lmgw audio row behind the answering route, if it is one."
                    },
                    "seeds_sent": {
                      "description": "Each candidate's seed reached the model.",
                      "type": "boolean"
                    },
                    "sent_text": {
                      "description": "What the engine was sent instead, when lmgw's speech shaping changed\nit (inline tags or characters the engine cannot say): what the\ncandidates say, and the transcript a saved sample gets.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "shaping": {
                      "description": "What lmgw's speech shaping changed in the request\n(`x-lmgw-speech`'s words), when it changed anything.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stopped": {
                      "description": "Why the round ended before `asked` candidates: the first failure,\nor a stop (the page left, Stop, the round discarded).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "text": {
                      "description": "What every candidate was asked to say.",
                      "type": "string"
                    },
                    "upstream": {
                      "description": "The upstream that answered.",
                      "type": "string"
                    },
                    "upstream_model": {
                      "description": "The model name it was sent.",
                      "type": "string"
                    },
                    "voice": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "created_at",
                    "alias",
                    "answered_by",
                    "fallback_reason",
                    "upstream",
                    "upstream_model",
                    "row",
                    "licence",
                    "text",
                    "sent_text",
                    "language",
                    "language_note",
                    "description",
                    "voice",
                    "seeds_sent",
                    "shaping",
                    "asked",
                    "candidates",
                    "stopped"
                  ],
                  "title": "VoiceRound",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Render a round of candidates",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-model-task": "tts",
        "x-lmgw-tool": "lmgw__voice_generate",
        "x-lmgw-writes": true
      }
    },
    "/voice-lab/api/rounds/clear": {
      "post": {
        "description": "Deletes every kept round and its candidates' audio, and every directory under the rounds' that is no readable round (counted in `bytes`). A round still rendering is stopped and waited for first. Saved samples are copies in the voice library and stay. Answers the (empty) list.",
        "operationId": "post_voice_lab_api_rounds_clear",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/rounds`: every kept round, newest first.",
                  "properties": {
                    "bytes": {
                      "description": "What the rounds' audio takes on disk.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "dir": {
                      "description": "Where they are kept.",
                      "type": "string"
                    },
                    "rounds": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceRound"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "rounds",
                    "bytes",
                    "dir"
                  ],
                  "title": "VoiceRounds",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Discard every round",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/voice-lab/api/rounds/{id}/candidates/{n}": {
      "get": {
        "description": "The candidate's audio as the model answered it (a WAV for every local model), with its content type and Accept-Ranges: bytes. One Range (bytes=a-b, bytes=a- or bytes=-n) answers 206 with Content-Range; the answer carries an ETag made from the file (inode, length, modification time), and If-Range with it applies the range, any other If-Range serves the whole file, and so does a Range lmgw does not read; 416 range_not_satisfiable (Content-Range: bytes */size) for a range that names no byte of it. 404 for a round or candidate that is not there.",
        "operationId": "get_voice_lab_api_rounds_id_candidates_n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/aac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/flac": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/ogg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "audio/wav": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Play a candidate",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      }
    },
    "/voice-lab/api/rounds/{id}/delete": {
      "post": {
        "description": "Deletes the round and its candidates' audio; answers the rounds left. A round still rendering is stopped and waited for first, so nothing it writes after brings it back. 404 for a round that is not there, 400 for an id that is no round id.",
        "operationId": "post_voice_lab_api_rounds_id_delete",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/rounds`: every kept round, newest first.",
                  "properties": {
                    "bytes": {
                      "description": "What the rounds' audio takes on disk.",
                      "format": "uint64",
                      "minimum": 0,
                      "type": "integer"
                    },
                    "dir": {
                      "description": "Where they are kept.",
                      "type": "string"
                    },
                    "rounds": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceRound"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "rounds",
                    "bytes",
                    "dir"
                  ],
                  "title": "VoiceRounds",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Discard a round",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    },
    "/voice-lab/api/samples": {
      "get": {
        "description": "The voice library's clips (the Audio lab's), each with the Voices lab's record of how it was made when it made it: alias, the model that answered, description, voice, seed, text, language, dates and licence. `provenance_current` is false for a clip replaced since (its SHA-256 no longer matches). Without an audio models directory the answer is a 200 with no samples and an `error` saying so; a samples.json lmgw cannot read leaves every record out and `records_error` says why.",
        "operationId": "get_voice_lab_api_samples",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/samples`: the voice library.",
                  "properties": {
                    "error": {
                      "description": "Why there is no library (no audio models directory).",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "library_active": {
                      "description": "The class's voice directory is this library: a clip's name is a\nvoice on every cloning model.",
                      "type": "boolean"
                    },
                    "records_error": {
                      "description": "Why no sample shows its record: the records' file (`samples.json`)\nis there and cannot be read. lmgw never writes over it; saving a\nsample is refused until it is fixed or moved.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "samples": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceSample"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "samples",
                    "library_active",
                    "error",
                    "records_error"
                  ],
                  "title": "VoiceSamples",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the voice library with how each sample was made",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "The voice_sample_save op as a route: the candidate goes to the voice library as <name>.wav, leading and trailing silence cut and loudness untouched, with the text the engine was sent as its transcript, and how it was made is recorded. 409 name_taken when the library has an audio clip of that name and `overwrite` is not set (nothing is written); 409 unreadable_file when samples.json is no JSON lmgw can read (nothing is written); 404 for a round or candidate that is not there; 400 for a bad name or no audio models directory. A development gateway whose audio models directory is the installed app's refuses (400, code dev_shared_models_dir).",
        "operationId": "post_voice_lab_api_samples",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`voice_sample_save` / `POST /voice-lab/api/samples`: save a candidate to\nthe voice library.",
                "properties": {
                  "candidate": {
                    "description": "The candidate's number in it, from 1.",
                    "format": "uint32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "name": {
                    "description": "The voice name it is saved under: what a request's `voice` names.\nLetters, digits, space, `.`, `_` and `-`; a trailing `.wav` is\ndropped.",
                    "type": "string"
                  },
                  "overwrite": {
                    "default": false,
                    "description": "Replace a sample or clip of that name. Without it, a taken name is\nrefused (`409 name_taken`) and nothing is written.",
                    "type": "boolean"
                  },
                  "round": {
                    "description": "The round's id.",
                    "type": "string"
                  }
                },
                "required": [
                  "round",
                  "candidate",
                  "name"
                ],
                "title": "VoiceSampleSaveArgs",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`voice_sample_save`'s answer.",
                  "properties": {
                    "clip": {
                      "description": "The clip's file name in the library (`anna.wav`).",
                      "type": "string"
                    },
                    "library_active": {
                      "description": "The class's voice directory is this library, so `voice` names the\nclip on every cloning model; otherwise it is reachable as a\n`voice_ref` path only.",
                      "type": "boolean"
                    },
                    "message": {
                      "description": "The outcome in a sentence.",
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "provenance": {
                      "$ref": "#/components/schemas/VoiceProvenance"
                    },
                    "replaced": {
                      "description": "The library files it replaced (with `overwrite`).",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "transcript": {
                      "description": "The transcript recorded for it.",
                      "type": "string"
                    },
                    "voice": {
                      "description": "The voice name a request uses (`anna`).",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "clip",
                    "voice",
                    "replaced",
                    "transcript",
                    "provenance",
                    "library_active",
                    "message"
                  ],
                  "title": "VoiceSampleSaved",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save a candidate as a sample",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-confirm-note": "A sample of the same name is replaced only with overwrite.",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-tool": "lmgw__voice_sample_save",
        "x-lmgw-writes": true
      }
    },
    "/voice-lab/api/sentences": {
      "get": {
        "description": "The sentence a round's candidates say, per language: the built-in one (the first two sentences of \"The North Wind and the Sun\", a phonetically rich passage) and the owner's saved one when there is one, which is what `text` holds then; and the line the cloning check says. A language the table lacks is listed once the owner saved a sentence for it.",
        "operationId": "get_voice_lab_api_sentences",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/sentences`: every language with a built-in or a saved\nsentence, by code.",
                  "properties": {
                    "error": {
                      "description": "Why the owner's saved sentences are not in the list: their file\n(`sentences.json`) is there and cannot be read. lmgw never writes\nover it; saving a sentence is refused until it is fixed or moved.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "languages": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceSentence"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "languages",
                    "error"
                  ],
                  "title": "VoiceSentences",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "List the sentence per language",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": false
      },
      "post": {
        "description": "Saves the sentence for the language, kept across restarts (<data_dir>/voice-lab/sentences.json), so it is the prefill from now on; an empty text drops it and the built-in sentence is the prefill again. Answers the whole table. 400 for a language that is no language code; 409 unreadable_file when sentences.json is there and is no JSON lmgw can read (it is never written over: nothing is saved until it is fixed or moved).",
        "operationId": "post_voice_lab_api_sentences",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "description": "`POST /voice-lab/api/sentences`: save the owner's sentence for a\nlanguage. An empty `text` drops the saved one, so the built-in sentence\nis the prefill again.",
                "properties": {
                  "language": {
                    "description": "ISO 639-1 code (`de`).",
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "language",
                  "text"
                ],
                "title": "VoiceSentenceSet",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "`GET /voice-lab/api/sentences`: every language with a built-in or a saved\nsentence, by code.",
                  "properties": {
                    "error": {
                      "description": "Why the owner's saved sentences are not in the list: their file\n(`sentences.json`) is there and cannot be read. lmgw never writes\nover it; saving a sentence is refused until it is fixed or moved.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "languages": {
                      "items": {
                        "$ref": "#/components/schemas/VoiceSentence"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "languages",
                    "error"
                  ],
                  "title": "VoiceSentences",
                  "type": "object"
                }
              }
            },
            "description": "OK."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            },
            "description": "Error."
          }
        },
        "security": [
          {
            "bearer": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "session": []
          }
        ],
        "summary": "Save the owner's sentence for a language",
        "tags": [
          "voice-lab"
        ],
        "x-lmgw-capability": "admin",
        "x-lmgw-dialect": "dashboard",
        "x-lmgw-writes": true
      }
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "tags": [
    {
      "description": "OpenAI-compatible",
      "name": "openai",
      "x-displayName": "OpenAI-compatible",
      "x-lmgw-group": "Inference"
    },
    {
      "description": "Anthropic-compatible",
      "name": "anthropic",
      "x-displayName": "Anthropic-compatible",
      "x-lmgw-group": "Inference"
    },
    {
      "description": "llama.cpp-compatible",
      "name": "llamacpp",
      "x-displayName": "llama.cpp-compatible",
      "x-lmgw-group": "Inference"
    },
    {
      "description": "lmgw extensions",
      "name": "lmgw-inference",
      "x-displayName": "lmgw extensions",
      "x-lmgw-group": "Inference"
    },
    {
      "description": "MCP",
      "name": "mcp",
      "x-displayName": "MCP",
      "x-lmgw-group": "Inference"
    },
    {
      "description": "API description",
      "name": "meta",
      "x-displayName": "API description",
      "x-lmgw-group": "Gateway"
    },
    {
      "description": "Session",
      "name": "session",
      "x-displayName": "Session",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Status & live feed",
      "name": "status",
      "x-displayName": "Status & live feed",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Models",
      "name": "models",
      "x-displayName": "Models",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Upstreams",
      "name": "upstreams",
      "x-displayName": "Upstreams",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "MCP servers & tools",
      "name": "tools",
      "x-displayName": "MCP servers & tools",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Downloads",
      "name": "downloads",
      "x-displayName": "Downloads",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Settings",
      "name": "settings",
      "x-displayName": "Settings",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Stored responses",
      "name": "responses",
      "x-displayName": "Stored responses",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Usage",
      "name": "usage",
      "x-displayName": "Usage",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Doc corpora",
      "name": "docs",
      "x-displayName": "Doc corpora",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Named collections of your own documents: create a base, upload files, follow the background job that reads and embeds them, view a file's text and search across bases. Uploading and changing a base's model or chunk size start jobs (kinds kb_ingest and kb_reembed, key kb:<id>) that answer at once; watch them on the jobs routes and the event stream.",
      "name": "knowledge",
      "x-displayName": "Knowledge bases",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "The dashboard's audio playground: the audio models and their voices, the library of reference clips a voice-cloning model reads (upload, preview, transcripts, delete), and the synthesis, transcription, alignment and generic-task routes that run a request through the same handlers as /v1/audio/* and /v1/tasks/*.",
      "name": "audio-lab",
      "x-displayName": "Audio lab",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "The dashboard's image playground: the models that can draw, and the generate and edit routes that turn a form into a /v1/images/* request and run it through the same handlers.",
      "name": "image-lab",
      "x-displayName": "Image lab",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "The dashboard's System One playground: the models that answer /v1/systemone with their header facts and token limits, the token gauge, and Ask, which stores a group (models × variants) whose cells run one at a time through the same handler as /v1/systemone and are kept in the lab store.",
      "name": "decision-lab",
      "x-displayName": "Decision lab",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "The dashboard's voice sample generator: fixed voices for the cloning text-to-speech models. A text-to-speech model renders rounds of candidates of a phonetically rich sentence; the chosen one is saved to the voice library with its exact transcript and how it was made, and a cloning model can speak a test line with it.",
      "name": "voice-lab",
      "x-displayName": "Voices lab",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "What the labs keep, one store for all three: each lab's history of groups (one click: the form, the plan, the override) and runs (one dispatch: the request and answer as the texts that went and came), the artifact files they name, the size it all takes, deleting a group or a whole lab, and the JSONL, zip or CSV export. Nothing is deleted by age or count.",
      "name": "labs",
      "x-displayName": "Lab store",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "Agents",
      "name": "agents",
      "x-displayName": "Agents",
      "x-lmgw-group": "Dashboard API"
    },
    {
      "description": "The Chat API a client app uses as a paired device (the `chat` capability), with its client certificate on the device listener: the threads and folders it follows, an ongoing conversation's current thread, and the change feed that keeps them current. Every route here refuses a device with 401 device_key_unknown once its key opens no device (it was replaced or deleted: pair the device again), 403 device_unconfirmed until the owner confirms its enrolment, 401 device_disabled while the device is disabled, 401 device_certificate_expired past its certificate's notAfter, and 401 key_expired past its expiry date. What is open when that happens ends: the feed with `revoked`, a turn's stream with an `error` event whose code is revoked. Both carry `kind`, what to do: device_disabled and key_expired wait for the gateway's side, key_unknown and certificate_expired mean pair the device again, and revoked is any other kind of key's revocation.",
      "name": "chat",
      "x-displayName": "Chat",
      "x-lmgw-group": "Device API"
    },
    {
      "description": "Files between paired devices of one app (device transfers design): a device offers a file to another device that declared the same app id at pairing, uploads it to lmgw in ranges it can resume, and the other device is offered it once every byte matched its sha256, downloads it with ranges and says it arrived; lmgw then deletes the bytes. The transfer capability: paired devices (on the device listener) send and receive; the owner lists every transfer and cancels any; a client key or an agent token is refused 403 transfer_device_only. A refusal is the flat {code, message}, with free_bytes, received or state where its code names one. JSON bodies are at most 16 KiB (16384 bytes), refused 413 body_too_large; the only bound on a file is the free space of lmgw's data directory. The Chat feed's transfer.updated says each offer, ready and end to the sender, to the receiver from ready on, and to the owner.",
      "name": "transfers",
      "x-displayName": "Transfers",
      "x-lmgw-group": "Device API"
    },
    {
      "description": "The device listener's own routes (device link design §4.6): served on the device listener only, over TLS 1.3, and the 404 an unknown path is on the plain listener. Their bodies are at most 16 KiB (16384 bytes), refused 413 body_too_large naming it, not max_body_mb. Every answer carries Connection: close.",
      "name": "devices",
      "x-displayName": "Devices",
      "x-lmgw-group": "Device API"
    },
    {
      "description": "Routing ops",
      "name": "ops-routing",
      "x-displayName": "Routing ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Model ops",
      "name": "ops-models",
      "x-displayName": "Model ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Runtime ops",
      "name": "ops-runtime",
      "x-displayName": "Runtime ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Download ops",
      "name": "ops-downloads",
      "x-displayName": "Download ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Settings ops",
      "name": "ops-settings",
      "x-displayName": "Settings ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Tool ops",
      "name": "ops-tools",
      "x-displayName": "Tool ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Key ops",
      "name": "ops-keys",
      "x-displayName": "Key ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Usage & pricing ops",
      "name": "ops-usage",
      "x-displayName": "Usage & pricing ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Stored-response ops",
      "name": "ops-responses",
      "x-displayName": "Stored-response ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Backends & build ops",
      "name": "ops-builds",
      "x-displayName": "Backends & build ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Benchmark ops",
      "name": "ops-bench",
      "x-displayName": "Benchmark ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "Agent ops",
      "name": "ops-agents",
      "x-displayName": "Agent ops",
      "x-lmgw-group": "Ops"
    },
    {
      "description": "The routes an agent container calls with its own token: reading its own definition and runs, and opening and driving a run.",
      "name": "agent-runtime",
      "x-displayName": "Agent runtime",
      "x-lmgw-group": "Agent runtime"
    }
  ],
  "x-lmgw-principals": {
    "agent": [
      "public",
      "inference",
      "ledger",
      "agent-self"
    ],
    "anonymous": [
      "public"
    ],
    "anonymous_auth_off": [
      "public",
      "inference"
    ],
    "device": [
      "public",
      "inference",
      "chat",
      "transfer"
    ],
    "key": [
      "public",
      "inference"
    ],
    "owner": [
      "public",
      "inference",
      "chat",
      "transfer",
      "agent-self",
      "admin"
    ]
  },
  "x-lmgw-undocumented": [
    {
      "method": "*",
      "path": "/agents/{id}/app",
      "reason": "The old mount of an agent's app: redirects to the agent's own origin. The app is the agent's, not lmgw's API."
    },
    {
      "method": "*",
      "path": "/agents/{id}/app/",
      "reason": "The old mount of an agent's app: redirects to the agent's own origin. The app is the agent's, not lmgw's API."
    },
    {
      "method": "*",
      "path": "/agents/{id}/app/{*rest}",
      "reason": "The old mount of an agent's app: redirects to the agent's own origin. The app is the agent's, not lmgw's API."
    },
    {
      "method": "*",
      "path": "/agents/{id}/mcp",
      "reason": "An agent container's own MCP face, reverse-proxied. Its surface is the agent's (see its manifest)."
    },
    {
      "method": "*",
      "path": "/agents/{id}/mcp/{*rest}",
      "reason": "An agent container's own MCP face, reverse-proxied. Its surface is the agent's (see its manifest)."
    },
    {
      "method": "GET",
      "path": "/",
      "reason": "The dashboard SPA and its bundle."
    },
    {
      "method": "GET",
      "path": "/{*path}",
      "reason": "The dashboard SPA and its bundle."
    },
    {
      "method": "GET",
      "path": "/ui",
      "reason": "Legacy redirects to the SPA."
    },
    {
      "method": "GET",
      "path": "/ui/",
      "reason": "Legacy redirects to the SPA."
    },
    {
      "method": "GET",
      "path": "/ui/{*path}",
      "reason": "Legacy redirects to the SPA."
    }
  ]
}
