{"openapi":"3.1.0","info":{"title":"BlizGPT","version":"0.1.0","description":"Local AI for BlizCloud apps: language models on BlizCloud's own hardware behind an OpenAI-compatible API. An app's server asks with its key (`<app-id>.<secret>`) for an alias (`fast`, `smart`, `vision`, `ultra`, `code`, `rogue`, `rogue-code`, `embed`) or a model by id. Nothing an app sends is written anywhere, and a key of class `private` is only ever served by nodes inside the cluster. The API is reachable inside the cluster only: through the public address every key gets `403 private_route_required` (there is only the admin page, behind BlizSSO). An OpenAI client library works with this service's `/v1` inside the cluster as its base URL."},"servers":[{"url":"/","description":"This service, at its address inside the cluster. The public address does not answer the API."}],"security":[{"key":[]}],"tags":[{"name":"Models"},{"name":"Asking"},{"name":"Anthropic","description":"Anthropic's Messages API on the same models, queue, limits and privacy, so Claude Code can be pointed here (`ANTHROPIC_BASE_URL` is the service's address without `/v1`)."},{"name":"Speech","description":"Sound to text. A recording in one request, or a stream as it is spoken."},{"name":"Jobs"},{"name":"Learning","description":"Each app's own learning layer: knowledge it puts there, memory about one of its users (by the app's own id for them), and lessons from feedback. Never seen by another app; memory only ever for its own subject. Switched on per app by the service's owner (`403 learning_off` otherwise)."},{"name":"The app's own"},{"name":"Service"}],"paths":{"/v1/health":{"get":{"tags":["Service"],"summary":"Whether the service is up","security":[],"responses":{"200":{"description":"Up","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"ok"}}}}}}}}},"/openapi.json":{"get":{"tags":["Service"],"summary":"This document","security":[],"responses":{"200":{"description":"The API"}}}},"/docs":{"get":{"tags":["Service"],"summary":"How to use the service, for people","security":[],"responses":{"200":{"description":"A page"}}}},"/v1/models":{"get":{"tags":["Models"],"summary":"The aliases and models this key may use","description":"OpenAI's list shape. Each entry has a `blizai` object saying what an alias means now for this key, what the model can do, and whether it is loaded.","responses":{"200":{"description":"The list","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models/{id}":{"get":{"tags":["Models"],"summary":"One alias or model","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/chat/completions":{"post":{"tags":["Asking"],"summary":"OpenAI's chat completions","description":"Honoured: `model`, `messages`, `stream`, `stream_options.include_usage`, `temperature`, `top_p`, `max_tokens` / `max_completion_tokens`, `stop`, `seed`, `presence_penalty`, `frequency_penalty`, `tools`, `tool_choice`, `parallel_tool_calls`, `response_format`, `reasoning_effort` (default `none`: the model answers without thinking first). `n` is 1. `user` is dropped. Unknown fields are ignored. A picture is only taken as a `data:` URL. With `stream: true` the answer is server-sent events as OpenAI's; while the request waits, comment lines say where it is (`: queued 3`, `: loading`), and an error after the stream began is a last `data: {\"error\":…}`. Closing the connection cancels.","parameters":[{"name":"X-BlizAI-Priority","in":"header","schema":{"type":"string","enum":["interactive","batch"],"default":"interactive"},"description":"`batch`: work that can wait; it runs when nobody waits for an answer."},{"name":"X-BlizAI-Max-Wait","in":"header","schema":{"type":"integer","minimum":0,"maximum":86400},"description":"Seconds the request may wait in the queue before `503 queue_timeout`. Default 120 (interactive) or 3600 (batch)."},{"name":"X-BlizAI-Privacy","in":"header","schema":{"type":"string","enum":["private"]},"description":"Makes this one request cluster-only, for a key of class `standard`. Nothing makes a request less private than its key."},{"name":"X-Request-Id","in":"header","schema":{"type":"string","maxLength":64},"description":"Echoed in the answer; made up if missing."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"The answer (JSON, or `text/event-stream` when streaming)","headers":{"x-request-id":{"description":"The request's id (the caller's own, or made up).","schema":{"type":"string"}},"x-blizai-model":{"description":"The model that answered.","schema":{"type":"string"}},"x-blizai-served-by":{"description":"Where it was answered.","schema":{"type":"string","enum":["cluster","remote"]}},"x-blizai-queue-ms":{"description":"Milliseconds the request waited before a model took it.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatAnswer"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"`invalid_request`: The request is not valid. `context_length_exceeded`: The messages are longer than the model's context. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages":{"post":{"tags":["Anthropic"],"summary":"Anthropic's Messages (for Claude Code)","description":"The same engine as chat completions, in Anthropic's shape. The key comes as `x-api-key` or `Authorization: Bearer`; the door is the same (through the public address: `403 private_route_required`). Honoured: `model` (an alias or a model id; a `claude-…` name means the service's `BLIZAI_CLAUDE_MODEL`, `fast` unless set), `max_tokens` (required), `system` (text or text blocks), `messages` (`user`, `assistant`, and `system` in the middle of a conversation, read as the user's; blocks `text`, `image` with base64 data, `document` with text, `tool_use`, `tool_result` with `is_error`; `thinking` and `redacted_thinking` are dropped), `tools` (`input_schema`; tools that run at Anthropic are dropped), `tool_choice` (`auto`, `any`, `tool`, `none`, `disable_parallel_tool_use`), `temperature`, `top_p`, `stop_sequences`, `stream`, `thinking` (`enabled` with `budget_tokens`, `adaptive`, `disabled`: mapped onto `reasoning_effort`; off when left out). `metadata`, `cache_control`, `top_k` and unknown fields are ignored. The answer is a `message` with `text`, `tool_use` and `thinking` blocks, `stop_reason` (`end_turn`, `max_tokens`, `tool_use`, `stop_sequence`) and `usage`. With `stream: true`: Anthropic's events (`message_start`, `content_block_start`, `content_block_delta` with `text_delta`, `input_json_delta` (a tool's whole arguments in one piece) or `thinking_delta`, `content_block_stop`, `message_delta`, `message_stop`), `ping` while nothing else is said, the comment lines of a waiting request, and an `error` event when it fails after it began.","parameters":[{"name":"X-BlizAI-Priority","in":"header","schema":{"type":"string","enum":["interactive","batch"],"default":"interactive"},"description":"`batch`: work that can wait; it runs when nobody waits for an answer."},{"name":"X-BlizAI-Max-Wait","in":"header","schema":{"type":"integer","minimum":0,"maximum":86400},"description":"Seconds the request may wait in the queue before `503 queue_timeout`. Default 120 (interactive) or 3600 (batch)."},{"name":"X-BlizAI-Privacy","in":"header","schema":{"type":"string","enum":["private"]},"description":"Makes this one request cluster-only, for a key of class `standard`. Nothing makes a request less private than its key."},{"name":"X-Request-Id","in":"header","schema":{"type":"string","maxLength":64},"description":"Echoed in the answer; made up if missing."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesRequest"}}}},"responses":{"200":{"description":"The message (JSON, or `text/event-stream` when streaming)","headers":{"x-request-id":{"description":"The request's id (the caller's own, or made up).","schema":{"type":"string"}},"x-blizai-model":{"description":"The model that answered.","schema":{"type":"string"}},"x-blizai-served-by":{"description":"Where it was answered.","schema":{"type":"string","enum":["cluster","remote"]}},"x-blizai-queue-ms":{"description":"Milliseconds the request waited before a model took it.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicMessage"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"`invalid_request`: The request is not valid. `context_length_exceeded`: The messages are longer than the model's context. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"503":{"description":"`no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}}}}},"/v1/messages/count_tokens":{"post":{"tags":["Anthropic"],"summary":"An estimate of a request's tokens","description":"The body of `/v1/messages`, `max_tokens` not needed. No model is asked: a token per four characters, four per message and 280 per picture; the runtime alone counts the real ones (`usage` in an answer). It refuses what asking would refuse (a model the key may not use, or one that cannot do it).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesRequest"}}}},"responses":{"200":{"description":"The estimate","content":{"application/json":{"schema":{"type":"object","properties":{"input_tokens":{"type":"integer"}},"required":["input_tokens"]}}}},"400":{"description":"`invalid_request`: The request is not valid. `context_length_exceeded`: The messages are longer than the model's context. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}},"503":{"description":"`no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}}}}},"/v1/embeddings":{"post":{"tags":["Asking"],"summary":"OpenAI's embeddings","description":"Vectors of two models cannot be compared: keep the answer's `model` with an index, and make the index again when it changes (or ask for the model by id instead of `embed`).","parameters":[{"name":"X-BlizAI-Priority","in":"header","schema":{"type":"string","enum":["interactive","batch"],"default":"interactive"},"description":"`batch`: work that can wait; it runs when nobody waits for an answer."},{"name":"X-BlizAI-Max-Wait","in":"header","schema":{"type":"integer","minimum":0,"maximum":86400},"description":"Seconds the request may wait in the queue before `503 queue_timeout`. Default 120 (interactive) or 3600 (batch)."},{"name":"X-BlizAI-Privacy","in":"header","schema":{"type":"string","enum":["private"]},"description":"Makes this one request cluster-only, for a key of class `standard`. Nothing makes a request less private than its key."},{"name":"X-Request-Id","in":"header","schema":{"type":"string","maxLength":64},"description":"Echoed in the answer; made up if missing."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingsRequest"}}}},"responses":{"200":{"description":"The vectors","headers":{"x-request-id":{"description":"The request's id (the caller's own, or made up).","schema":{"type":"string"}},"x-blizai-model":{"description":"The model that answered.","schema":{"type":"string"}},"x-blizai-served-by":{"description":"Where it was answered.","schema":{"type":"string","enum":["cluster","remote"]}},"x-blizai-queue-ms":{"description":"Milliseconds the request waited before a model took it.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingsAnswer"}}}},"400":{"description":"`invalid_request`: The request is not valid. `context_length_exceeded`: The messages are longer than the model's context. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/audio/transcriptions":{"post":{"tags":["Speech"],"summary":"A recording to text (OpenAI's transcriptions)","description":"A form (`multipart/form-data`): `file` a WAV file of 16-bit PCM, mono or stereo, 8 to 48 kHz (16 kHz mono is what the model hears, so send that), at most 25 MB and 15 minutes; `model` (`transcribe`, or a speech model by id); `language` (`da`; left out, the model hears which it is); `prompt` (names and words to expect, at most 1000 characters); `response_format` `json` (default), `verbose_json` (with `language`, `duration` and `segments`) or `text`; `temperature`. The sound is held in memory while it is turned into text and nowhere after; what is counted is its seconds.","parameters":[{"name":"X-BlizAI-Priority","in":"header","schema":{"type":"string","enum":["interactive","batch"],"default":"interactive"},"description":"`batch`: work that can wait; it runs when nobody waits for an answer."},{"name":"X-BlizAI-Max-Wait","in":"header","schema":{"type":"integer","minimum":0,"maximum":86400},"description":"Seconds the request may wait in the queue before `503 queue_timeout`. Default 120 (interactive) or 3600 (batch)."},{"name":"X-BlizAI-Privacy","in":"header","schema":{"type":"string","enum":["private"]},"description":"Makes this one request cluster-only, for a key of class `standard`. Nothing makes a request less private than its key."},{"name":"X-Request-Id","in":"header","schema":{"type":"string","maxLength":64},"description":"Echoed in the answer; made up if missing."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/TranscriptionRequest"}}}},"responses":{"200":{"description":"The text","headers":{"x-request-id":{"description":"The request's id (the caller's own, or made up).","schema":{"type":"string"}},"x-blizai-model":{"description":"The model that answered.","schema":{"type":"string"}},"x-blizai-served-by":{"description":"Where it was answered.","schema":{"type":"string","enum":["cluster","remote"]}},"x-blizai-queue-ms":{"description":"Milliseconds the request waited before a model took it.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transcription"}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"`invalid_request`: The request is not valid. `context_length_exceeded`: The messages are longer than the model's context. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"`unsupported_audio`: The sound must be a WAV file of 16-bit PCM.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/audio/stream":{"get":{"tags":["Speech"],"summary":"Sound as it is spoken, text as it is understood (a WebSocket)","description":"A WebSocket. First message, JSON: `{\"type\":\"start\",\"model\":\"transcribe\",\"language\":\"da\",\"prompt\":\"…\",\"sample_rate\":16000}`. Then binary messages of 16 kHz mono 16-bit little-endian PCM, in pieces of any length (a tenth to half a second each is good), and `{\"type\":\"stop\"}` at the end. The service answers `{\"type\":\"ready\"}`, then `{\"type\":\"partial\",\"text\":\"…\"}` (what the unfinished stretch sounds like so far; each replaces the one before), `{\"type\":\"final\",\"text\":\"…\",\"start\":s,\"end\":s}` when the speaker pauses or the stretch has grown to 20 seconds (it does not change after), `{\"type\":\"done\",\"seconds\":n}` after a stop, or `{\"type\":\"error\",\"error\":{…}}`, and closes. A stream nothing comes on for a minute is closed.","responses":{"101":{"description":"The stream"},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs":{"post":{"tags":["Jobs"],"summary":"Hand over work that can wait","description":"Up to 1000 requests and 16 MB, run as `batch` work now or in the service's night window. Every request is checked before anything runs. A job and its answers are in memory only: gone 24 hours after it finished, when deleted, and when the service restarts. A job must be safe to send twice.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobRequest"}}}},"responses":{"200":{"description":"The job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"`invalid_request`: The request is not valid. `capability_not_supported`: The model cannot do what the request asks of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`model_not_found`: No such model or alias.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Jobs"],"summary":"A job's state","responses":{"200":{"description":"The job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`job_not_found`: No such job. Jobs are kept in memory only: send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Jobs"],"summary":"Cancel a job and forget it and its answers","responses":{"200":{"description":"Gone","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"const":true}}}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`job_not_found`: No such job. Jobs are kept in memory only: send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs/{id}/results":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Jobs"],"summary":"A job's answers so far","responses":{"200":{"description":"The answers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResults"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`job_not_found`: No such job. Jobs are kept in memory only: send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/queue":{"get":{"tags":["The app's own"],"summary":"This app's own requests: how many run and wait, and each waiting one's place","responses":{"200":{"description":"The queue as this app sees it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/usage":{"get":{"tags":["The app's own"],"summary":"This app's own counts, this hour and today","description":"Requests and tokens, in all and by model. Counts only: nothing of what was asked or answered is kept.","responses":{"200":{"description":"The counts","content":{"application/json":{"schema":{"type":"object","properties":{"hour":{"$ref":"#/components/schemas/Counts"},"today":{"$ref":"#/components/schemas/Counts"}}}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `model_not_allowed`: This key may not use that model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/learning/items":{"get":{"tags":["Learning"],"summary":"This app's learning items","description":"Newest first. Without `subject`: the app's own `knowledge` and `lesson` items. With `subject`: only that subject's `memory` (`kind` may then only be `memory`); `kind=memory` without `subject` is `400`.","parameters":[{"name":"kind","in":"query","schema":{"type":"string","enum":["knowledge","memory","lesson"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","pending","rejected"]}},{"name":"subject","in":"query","schema":{"type":"string","maxLength":200},"description":"The app's own id for one of its users."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"after","in":"query","schema":{"type":"string"},"description":"The `next` of the page before."}],"responses":{"200":{"description":"A page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningList"}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}},"post":{"tags":["Learning"],"summary":"Put an item in this app's learning layer","description":"`knowledge` (for all the app's users), `memory` (about one user: `subject` required) or `lesson` (an instruction for all). Its status is `active` unless `status` says `pending`. At most 4,000 characters, 5,000 items an app and 200 memory items a subject (`409 learning_full`).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningItemRequest"}}}},"responses":{"200":{"description":"The item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningItem"}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}}},"/v1/learning/items/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"subject","in":"query","schema":{"type":"string","maxLength":200},"description":"Required for a memory item, and must be its own; must be left out for any other item. Otherwise `404 learning_item_not_found`."}],"get":{"tags":["Learning"],"summary":"One item","responses":{"200":{"description":"The item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningItem"}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}},"patch":{"tags":["Learning"],"summary":"Change an item's text, tags or status","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","maxLength":4000},"tags":{"type":"array","maxItems":10,"items":{"type":"string","maxLength":40}},"status":{"type":"string","enum":["active","pending","rejected"]}}}}}},"responses":{"200":{"description":"The item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningItem"}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}},"delete":{"tags":["Learning"],"summary":"Delete an item","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"learning.item"},"deleted":{"const":true}}}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}}},"/v1/learning/subjects/{subject}":{"delete":{"tags":["Learning"],"summary":"Forget everything about one of the app's users","parameters":[{"name":"subject","in":"path","required":true,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"How many items went","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"learning.subject"},"deleted":{"type":"integer"}}}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}}},"/v1/learning/search":{"post":{"tags":["Learning"],"summary":"The app's active items nearest to a text","description":"The app's active knowledge and lessons, and with `subject` that subject's memory, by the `embed` model's vectors (and shared words); by shared words alone when no vector can be made.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","maxLength":4000},"subject":{"type":"string","maxLength":200},"k":{"type":"integer","minimum":1,"maximum":20,"default":5},"min_score":{"type":"number","minimum":0,"maximum":1,"default":0.3}}}}}},"responses":{"200":{"description":"The items with their score","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/LearningItem"},{"type":"object","properties":{"score":{"type":"number"}}}]}}}}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}}}}},"/v1/learning/feedback":{"post":{"tags":["Learning"],"summary":"Feedback on an answer, made into at most one lesson","description":"A model (`smart`, without thinking) turns the exchange, the rating and the note into one short, generic instruction with no personal data, or none. It is dropped when it holds numbers, an address, a link or a quote, or a second model finds personal data in it. Kept as `pending` when the app's mode is `approve`, `active` when it is `auto`. The messages are used for this only and are not kept.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}}},"responses":{"200":{"description":"The lesson, or none","content":{"application/json":{"schema":{"type":"object","properties":{"lesson":{"oneOf":[{"$ref":"#/components/schemas/LearningItem"},{"type":"null"}]},"result":{"type":"string","enum":["active","pending","none","dropped","duplicate"]}}}}}},"400":{"description":"`invalid_request`: The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: A valid key is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`private_route_required`: The API is only reachable inside the cluster, not through the public address. `https_required`: Plain http is not accepted. `learning_off`: The learning layer is switched off for this app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`learning_item_not_found`: No such learning item for this app (and subject). `not_found`: Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`learning_full`: The learning layer's limit is reached: delete items first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`request_too_large`: The request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: The app's requests a minute are used up. `queue_full`: Too many requests are waiting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"500":{"description":"`internal_error`: Something went wrong in the service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"`upstream_error`: The model's runtime failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`learning_unavailable`: The learning layer is not set up here, or its store cannot be reached now. `no_capacity`: No node can run this model now. `no_private_capacity`: No node inside the cluster can run this model now, and the request is private. `queue_timeout`: The request waited too long in the queue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds until it is worth asking again.","schema":{"type":"integer"}}}},"504":{"description":"`timeout`: The model did not finish in time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"key":{"type":"http","scheme":"bearer","description":"The app's key, `<app-id>.<secret>`. It belongs in a server or a headless node, never in a phone or a web page. Answered inside the cluster only. Anthropic's clients may send it as `x-api-key` instead."}},"schemas":{"TranscriptionRequest":{"type":"object","required":["file","model"],"properties":{"file":{"type":"string","format":"binary","description":"A WAV file of 16-bit PCM."},"model":{"type":"string","examples":["transcribe"]},"language":{"type":"string","examples":["da"]},"prompt":{"type":"string","maxLength":1000},"response_format":{"type":"string","enum":["json","verbose_json","text"],"default":"json"},"temperature":{"type":"number","minimum":0,"maximum":1}}},"Transcription":{"type":"object","properties":{"text":{"type":"string"},"model":{"type":"string","description":"The model that answered."},"usage":{"type":"object","properties":{"type":{"const":"duration"},"seconds":{"type":"integer"}}},"language":{"type":["string","null"],"description":"With `verbose_json`."},"duration":{"type":"number","description":"Seconds of sound. With `verbose_json`."},"segments":{"type":"array","description":"With `verbose_json`.","items":{"type":"object","properties":{"id":{"type":"integer"},"start":{"type":"number"},"end":{"type":"number"},"text":{"type":"string"}}}}}},"Error":{"type":"object","description":"OpenAI's error shape. The message never repeats anything from the request.","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string","enum":["invalid_request","context_length_exceeded","capability_not_supported","unauthorized","https_required","private_route_required","model_not_allowed","sealed_required","scope_not_allowed","forbidden","learning_off","model_not_found","job_not_found","learning_item_not_found","not_found","method_not_allowed","learning_full","request_too_large","unsupported_audio","device_rate_limited","rate_limited","queue_full","internal_error","upstream_error","no_capacity","no_private_capacity","queue_timeout","learning_unavailable","timeout"]},"param":{"type":["string","null"]}},"required":["message","type","code"]}},"required":["error"]},"AnthropicError":{"type":"object","description":"Anthropic's error shape, with the service's own code beside it. The message never repeats anything from the request; for `context_length_exceeded` it begins \"prompt is too long\", by which Claude Code knows to make the conversation shorter.","properties":{"type":{"const":"error"},"error":{"type":"object","properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","request_too_large","rate_limit_error","api_error","overloaded_error","timeout_error"]},"message":{"type":"string"},"code":{"type":"string","enum":["invalid_request","context_length_exceeded","capability_not_supported","unauthorized","https_required","private_route_required","model_not_allowed","sealed_required","scope_not_allowed","forbidden","learning_off","model_not_found","job_not_found","learning_item_not_found","not_found","method_not_allowed","learning_full","request_too_large","unsupported_audio","device_rate_limited","rate_limited","queue_full","internal_error","upstream_error","no_capacity","no_private_capacity","queue_timeout","learning_unavailable","timeout"]}},"required":["type","message","code"]}},"required":["type","error"]},"MessagesRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","examples":["code","smart"]},"max_tokens":{"type":"integer","minimum":1,"description":"Required on `/v1/messages`."},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"const":"text"},"text":{"type":"string"}}}}]},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","document","tool_use","tool_result","thinking","redacted_thinking"]}},"required":["type"]}}]}}}},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"input_schema":{"type":"object"}},"required":["name"]}},"tool_choice":{"type":"object","properties":{"type":{"type":"string","enum":["auto","any","tool","none"]},"name":{"type":"string"},"disable_parallel_tool_use":{"type":"boolean"}}},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"stop_sequences":{"type":"array","maxItems":4,"items":{"type":"string"}},"stream":{"type":"boolean"},"thinking":{"type":"object","properties":{"type":{"type":"string","enum":["enabled","adaptive","disabled"]},"budget_tokens":{"type":"integer"}}}}},"AnthropicMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"const":"message"},"role":{"const":"assistant"},"model":{"type":"string","description":"The model that answered."},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","tool_use","thinking"]},"text":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object"},"thinking":{"type":"string"}}}},"stop_reason":{"type":"string","enum":["end_turn","max_tokens","tool_use","stop_sequence"]},"stop_sequence":{"type":["string","null"]},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"cache_creation_input_tokens":{"type":"integer"},"cache_read_input_tokens":{"type":"integer","description":"Tokens the runtime read from its cache, where it says."}}}}},"Model":{"type":"object","properties":{"id":{"type":"string","description":"An alias or a model's id."},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"const":"blizai"},"blizai":{"type":"object","properties":{"kind":{"type":"string","enum":["chat","embedding","transcription"]},"alias_of":{"type":["string","null"],"description":"For an alias: the model it means for this key now."},"capabilities":{"type":"array","items":{"type":"string","enum":["tools","json","vision"]}},"context":{"type":"integer","description":"Tokens of context served."},"dimensions":{"type":["integer","null"],"description":"Embeddings: the length of a vector."},"state":{"type":"string","enum":["ready","loading","cold","unavailable"]},"served_by":{"type":["string","null"],"enum":["cluster","remote",null]}}}}},"Message":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"description":"Text, or parts: `{type:\"text\",text}` and `{type:\"image_url\",image_url:{url:\"data:image/…;base64,…\"}}`.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}},{"type":"null"}]},"tool_calls":{"type":"array","items":{"type":"object"}},"tool_call_id":{"type":"string"},"name":{"type":"string"}},"required":["role"]},"ChatRequest":{"type":"object","properties":{"model":{"type":"string","description":"An alias (`fast`, `smart`, `vision`, `ultra`, `code`, `rogue`, `rogue-code`) or a model's id.","examples":["smart"]},"messages":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Message"}},"stream":{"type":"boolean"},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}}},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"max_tokens":{"type":"integer","minimum":1},"max_completion_tokens":{"type":"integer","minimum":1},"stop":{"oneOf":[{"type":"string"},{"type":"array","maxItems":4,"items":{"type":"string"}}]},"seed":{"type":"integer"},"presence_penalty":{"type":"number","minimum":-2,"maximum":2},"frequency_penalty":{"type":"number","minimum":-2,"maximum":2},"tools":{"type":"array","maxItems":128,"items":{"type":"object"}},"tool_choice":{"oneOf":[{"type":"string","enum":["auto","none","required"]},{"type":"object"}]},"parallel_tool_calls":{"type":"boolean"},"reasoning_effort":{"type":"string","enum":["none","minimal","low","medium","high"],"default":"none","description":"How much the model may think before it answers. `none` is the default here: the answer starts at once. With thinking, the answer also has `reasoning_content`, and the thoughts count toward `max_tokens`."},"response_format":{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]},"json_schema":{"type":"object"}}},"blizai":{"type":"object","description":"The service's own options; never passed on to the model. `learning`: `true`, or `{subject, k}`, puts the app's active knowledge and lessons nearest to the last user message, and with `subject` that user's memory, in one system message first (joined to the app's own system message when there is one). Answer header `x-blizai-learning`: how many items were used, `off` (the app's learning is off) or `unavailable` (no store, or it failed); the answer comes either way. Not used in jobs.","properties":{"learning":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"subject":{"type":"string","maxLength":200},"k":{"type":"integer","minimum":1,"maximum":20,"default":5}}}]}}}},"required":["model","messages"]},"LearningItem":{"type":"object","properties":{"object":{"const":"learning.item"},"id":{"type":"string","examples":["li_3kT9yQx2b7Lm0pZsW1aE"]},"kind":{"type":"string","enum":["knowledge","memory","lesson"]},"status":{"type":"string","enum":["active","pending","rejected"],"description":"Only `active` items are used in answers and found by search."},"text":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":"string","enum":["app","feedback"]},"created":{"type":"integer","description":"Milliseconds since 1970."},"updated":{"type":"integer","description":"Milliseconds since 1970."}}},"LearningItemRequest":{"type":"object","required":["kind","text"],"properties":{"kind":{"type":"string","enum":["knowledge","memory","lesson"]},"text":{"type":"string","maxLength":4000},"subject":{"type":"string","maxLength":200,"description":"The app's own id for one of its users: required for `memory`, refused for the others. It is not kept, only an HMAC of it."},"tags":{"type":"array","maxItems":10,"items":{"type":"string","maxLength":40}},"status":{"type":"string","enum":["active","pending","rejected"],"default":"active"}}},"LearningList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/LearningItem"}},"has_more":{"type":"boolean"},"next":{"type":["string","null"],"description":"`after` for the next page."}}},"FeedbackRequest":{"type":"object","required":["rating","messages"],"properties":{"rating":{"type":"string","enum":["good","bad"]},"messages":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array"}]}}}},"note":{"type":"string","maxLength":2000,"description":"What was good or wrong, in the user's or the app's words."},"subject":{"type":"string","maxLength":200,"description":"Accepted and not used: a lesson belongs to the whole app."}}},"ChatAnswer":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"chat.completion"},"created":{"type":"integer"},"model":{"type":"string","description":"The model that answered, whatever alias was asked for."},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"$ref":"#/components/schemas/Message"},"finish_reason":{"type":"string"}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}}}},"EmbeddingsRequest":{"type":"object","properties":{"model":{"type":"string","examples":["embed"]},"input":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":256,"items":{"type":"string"}}]},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float"},"dimensions":{"type":"integer","description":"Only where the model can make vectors of that length."}},"required":["model","input"]},"EmbeddingsAnswer":{"type":"object","properties":{"object":{"const":"list"},"model":{"type":"string","description":"The model that made the vectors: keep it with an index."},"data":{"type":"array","items":{"type":"object","properties":{"object":{"const":"embedding"},"index":{"type":"integer"},"embedding":{"oneOf":[{"type":"array","items":{"type":"number"}},{"type":"string","description":"base64 of little-endian 32-bit floats"}]}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}}}},"JobRequest":{"type":"object","properties":{"requests":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","properties":{"custom_id":{"type":"string","maxLength":64},"url":{"type":"string","enum":["/v1/chat/completions","/v1/embeddings"]},"body":{"type":"object"}},"required":["custom_id","url","body"]}},"when":{"type":"string","enum":["now","night"],"default":"now"}},"required":["requests"]},"Job":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","running","done","cancelled"]},"when":{"type":"string","enum":["now","night"]},"counts":{"type":"object","properties":{"total":{"type":"integer"},"done":{"type":"integer"},"failed":{"type":"integer"}}},"created":{"type":"integer","description":"Seconds since 1970."},"expires":{"type":["integer","null"],"description":"When the job and its answers are forgotten; null until it is done."}}},"JobResults":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"custom_id":{"type":"string"},"status":{"type":"integer"},"body":{"type":"object"},"error":{"type":"object"}},"required":["custom_id"]}}}},"Queue":{"type":"object","properties":{"running":{"type":"integer"},"waiting":{"type":"array","items":{"type":"object","properties":{"request_id":{"type":"string"},"model":{"type":"string"},"priority":{"type":"string","enum":["interactive","batch"]},"state":{"type":"string","enum":["queued","loading"]},"position":{"type":["integer","null"]},"waited_ms":{"type":"integer"}}}}}},"Counts":{"type":"object","properties":{"requests":{"type":"integer"},"failed":{"type":"integer"},"tokens_in":{"type":"integer"},"tokens_out":{"type":"integer"},"audio_seconds":{"type":"integer","description":"Seconds of sound turned into text."},"by_model":{"type":"array","items":{"type":"object","properties":{"model":{"type":"string"},"requests":{"type":"integer"},"failed":{"type":"integer"},"tokens_in":{"type":"integer"},"tokens_out":{"type":"integer"}}}}}}}}}