{"openapi":"3.1.0","info":{"title":"SocketLLM","version":"0.1.0","description":"An AI gateway: OpenAI's Chat Completions and Anthropic's Messages in front of many providers, with keys, budgets, rate limits, usage, people's own keys, and an MCP door. The chat endpoints follow their providers' published API references; this document says what's SocketLLM's own."},"tags":[{"name":"calls"},{"name":"admin"},{"name":"prompts"},{"name":"orgs"},{"name":"connect"},{"name":"mcp"},{"name":"health"},{"name":"runtime","description":"Running a platform's agents (Harpora's design/nod.md §14): sessions with the agent's own token, its calls to its product, and its model calls, whose over-budget nods SocketLLM asks the platform's person for."}],"components":{"securitySchemes":{"gatewayKey":{"type":"http","scheme":"bearer","description":"A gateway key (from the config, or issued through the admin API)."},"anthropicKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"The same gateway key, as Anthropic's SDK sends it."},"admin":{"type":"oauth2","description":"A Harpora access token for the admin audience. An org role adds scopes on the org's keys only (docs/orgs.md): deployer keys:read usage:read budgets:read limits:read; admin and owner also keys:write budgets:write limits:write. The orgs routes take any admin token and decide by org role.","flows":{"clientCredentials":{"tokenUrl":"https://auth.example/{realm}/token","scopes":{"keys:read":"list keys, read MCP calls","keys:write":"issue and revoke keys","budgets:read":"read budgets","budgets:write":"set budgets","limits:read":"read rate limits","limits:write":"set rate limits","usage:read":"read usage across keys","orgs:write":"create, replace and delete orgs","prompts:read":"read stored prompts (org roles: deployer and up)","prompts:write":"save prompts and move labels (org roles: admin and up)","logs:content":"read the content of calls on keys that log it (logs.content): what people wrote and were answered","routes:write":"set how models choose their routes (quality routing)","providers:write":"add, change and remove providers at run time (on the config's admin.provider_hosts)"}}}},"person":{"type":"oauth2","description":"A person's Harpora access token for the connect audience.","flows":{"authorizationCode":{"authorizationUrl":"https://auth.example/{realm}/authorize","tokenUrl":"https://auth.example/{realm}/token","scopes":{"ai:connect":"connect your own AI keys"}}}},"mcp":{"type":"oauth2","description":"A Harpora access token for the MCP server (RFC 9728 metadata says where).","flows":{"authorizationCode":{"authorizationUrl":"https://auth.example/{realm}/authorize","tokenUrl":"https://auth.example/{realm}/token","scopes":{}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"}}}}}},"responses":{"Refused":{"description":"refused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/healthz":{"get":{"summary":"The process runs","responses":{"200":{"description":"ok"}},"security":[],"tags":["health"]}},"/readyz":{"get":{"summary":"The store answers","responses":{"200":{"description":"ready"},"503":{"description":"the store isn't answering"}},"security":[],"tags":["health"]}},"/v1/chat/completions":{"post":{"summary":"A chat completion (OpenAI's shape)","responses":{"200":{"description":"the completion, or server-sent events with stream: true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`)"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"Answers carry `x-request-id`; a W3C `traceparent` is carried on to the provider. `prompt` renders a stored prompt (model, messages and parameters may then be left out).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"OpenAI's Chat Completions request; `user` names the end user, the `x-socketllm-feature` header the feature","properties":{"prompt":{"type":"object","description":"A stored prompt to render into this call (docs/gateway.md, Prompts): {id, version | label (default production), variables}. The prompt's messages come first, then the request's own; the request's model and parameters win. A missing, extra or wrongly typed variable is 400; no such prompt, version or label is 404.","required":["id"],"properties":{"id":{"type":"string"},"version":{"type":"integer","minimum":1},"label":{"type":"string"},"variables":{"type":"object"},"from":{"type":"string","enum":["org","key"],"description":"Whose prompt: org (the key's org's; the default for a key in one) or key (the key's own). A key in an org uses its own only when the call says so."}}},"preset":{"description":"A stored preset (docs/gateway.md, Prompts): its name (its latest version) or {name, version}. Its model and parameters fill what the call leaves out; with a prompt, it stands in for the prompt version's preset.","oneOf":[{"type":"string"},{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"version":{"type":"integer","minimum":1},"from":{"type":"string","enum":["org","key"],"description":"Whose preset, as for prompts."}}}]}}}}}},"tags":["calls"]}},"/v1/embeddings":{"post":{"summary":"Embeddings (OpenAI's shape)","responses":{"200":{"description":"`{object: \"list\", data: [{object: \"embedding\", index, embedding}], model, usage: {prompt_tokens, total_tokens}}`; `embedding` is floats, or a base64 string with `encoding_format: base64`"},"400":{"description":"a bad request, or a chat model (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For models declared `kind: \"embedding\"` in the config; the same keys, rate limits, budgets (input tokens only), usage records (`kind: \"embeddings\"`), fallbacks, response cache and input guardrails as chat. Answers carry `x-request-id`; a cached answer says `x-socketllm-cache`. Past a used-up budget it answers as chat does (429, or with `admin.nod` on the 403 spend-nod challenge and a single-use approval).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"an embedding model's name"},"input":{"oneOf":[{"type":"string","minLength":1},{"type":"array","minItems":1,"maxItems":2048,"items":{"type":"string","minLength":1}},{"type":"array","minItems":1,"maxItems":8192,"items":{"type":"integer","minimum":0},"description":"one input, as token numbers"},{"type":"array","minItems":1,"maxItems":2048,"items":{"type":"array","minItems":1,"maxItems":8192,"items":{"type":"integer","minimum":0}},"description":"inputs, each as token numbers"}]},"encoding_format":{"type":"string","enum":["float","base64"]},"dimensions":{"type":"integer","minimum":1},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"tags":["calls"]}},"/v1/rerank":{"post":{"summary":"Rerank (Cohere's and Jina's shape)","responses":{"200":{"description":"`{object: \"list\", results: [{index, relevance_score, document?: {text}}], model, usage: {prompt_tokens, total_tokens}}`: the most relevant first, the first `top_n`, each document's text when `return_documents` is true"},"400":{"description":"a bad request, or a chat or embedding model (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For models declared `kind: \"rerank\"` in the config, on openai-kind providers whose base serves `/rerank` (Cohere, Jina, vLLM and others) or the mock; the same keys, rate limits, budgets (input tokens only), usage records (`kind: \"rerank\"`), fallbacks, response cache and input guardrails (the query and every document) as embeddings. Answers carry `x-request-id`; a cached answer says `x-socketllm-cache`. Past a used-up budget it answers as chat does.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","query","documents"],"properties":{"model":{"type":"string","description":"a rerank model's name"},"query":{"type":"string","minLength":1},"documents":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1}},"top_n":{"type":"integer","minimum":1,"description":"the most relevant this many (all by default)"},"return_documents":{"type":"boolean","description":"each result with its document's text (false by default)"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"tags":["calls"]}},"/v1/images/generations":{"post":{"summary":"Image generation (OpenAI's Images API shape)","responses":{"200":{"description":"`{created, data: [{b64_json? | url?, revised_prompt?}], usage: {input_tokens, output_tokens, total_tokens}}`"},"400":{"description":"a bad request, or a chat, embedding or rerank model (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For models declared `kind: \"image\"` in the config, on openai-kind providers whose base serves `/images/generations` (OpenAI, and others in its shape) or the mock; the same keys, rate limits, budgets (input and output tokens), usage records (`kind: \"images\"`), fallbacks and input guardrails (the prompt) as embeddings. Never cached: each call draws afresh. Answers carry `x-request-id`. Past a used-up budget it answers as chat does.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"an image model's name"},"prompt":{"type":"string","minLength":1,"maxLength":32000},"n":{"type":"integer","minimum":1,"maximum":10,"description":"how many images (1 by default)"},"size":{"type":"string","description":"passed on, e.g. `1024x1024`"},"quality":{"type":"string","description":"passed on"},"response_format":{"type":"string","enum":["b64_json","url"],"description":"passed on; the provider's default otherwise"},"style":{"type":"string","description":"passed on"},"background":{"type":"string","description":"passed on"},"output_format":{"type":"string","description":"passed on"},"output_compression":{"type":"integer","description":"passed on"},"moderation":{"type":"string","description":"passed on"},"stream":{"type":"boolean","enum":[false],"description":"streamed image generation isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"tags":["calls"]}},"/v1/images/edits":{"post":{"summary":"Image edits (OpenAI's images/edits shape)","responses":{"200":{"description":"`{created, data: [{b64_json? | url?, revised_prompt?}], usage: {input_tokens, output_tokens, total_tokens}}`"},"400":{"description":"a bad request, or a chat, embedding or rerank model (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For image models (`kind: \"image\"`), on openai-kind providers whose base serves `/images/edits` or the mock; a multipart form, as OpenAI's, of 26 MiB at most. The answer, usage (`kind: \"image_edits\"`, input and output tokens as reported), keys, rate limits, budgets, fallbacks (the same files sent again) and input guardrails (the prompt) are as for generations. Never cached. Answers carry `x-request-id`.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","image[]","prompt"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"an image model's name"},"image[]":{"type":"array","minItems":1,"maxItems":16,"items":{"type":"string","format":"binary"},"description":"the images to edit, each up to 25 MiB, passed on in the field they came in (`image` for one is taken too)"},"mask":{"type":"string","format":"binary","description":"where to edit, passed on"},"prompt":{"type":"string","minLength":1,"maxLength":32000},"n":{"type":"integer","minimum":1,"maximum":10,"description":"how many images (1 by default)"},"size":{"type":"string","description":"passed on, e.g. `1024x1024`"},"quality":{"type":"string","description":"passed on"},"response_format":{"type":"string","enum":["b64_json","url"],"description":"passed on; the provider's default otherwise"},"background":{"type":"string","description":"passed on"},"output_format":{"type":"string","description":"passed on"},"output_compression":{"type":"integer","description":"passed on","minimum":0,"maximum":100},"stream":{"type":"boolean","enum":[false],"description":"streamed image edits aren't served"},"user":{"type":"string","description":"the end user, for budgets and usage"},"input_fidelity":{"type":"string","description":"passed on"}}}}}},"tags":["calls"]}},"/v1/videos":{"post":{"tags":["calls"],"summary":"Start a video job in OpenRouter's shape: `{model, prompt, duration?, size? | resolution and aspect_ratio?, frame_images?, seed?, generate_audio?, user?, session_id?, callback_url?}`","description":"For models declared `kind: \"video\"` in the config, on openai-kind providers whose base serves OpenAI's Videos API (`/videos`), on vertex-kind ones (Veo, its videos in the provider's `videos_storage`), or on gemini-kind ones (Gemini Omni Flash, on the Interactions API). The same keys, rate limits, budgets, input guardrails (the prompt) and spans as any call; priced per second (`price.per_second` times the seconds the provider says the job makes), counted when the provider takes the job. A route falls back to the next only when the provider surely made no job (a rate limit, its credentials refused, never reached). `callback_url` gets a webhook when the job ends (`videos_webhooks`); `seed` and `generate_audio` are Veo's (refused on OpenAI's and Gemini Omni Flash's routes); `input_references` (images) are Gemini Omni Flash's and Veo's; `previous_job_id` (the key's own completed job on the same model; 404, 400 or 409 otherwise) continues it on the provider that made it: OpenAI's extension, Veo's extended video, Omni's next turn.","security":[{"gatewayKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"]}}}},"responses":{"202":{"description":"`{id, generation_id, polling_url, status: \"pending\"}`; `polling_url` is absolute (`videos_public_url`, else the caller's Host)"},"400":{"description":"a bad request, a field this gateway doesn't keep, or a model that isn't a video model (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/v1/videos/models":{"get":{"tags":["calls"],"summary":"The video models this key may use: `{data: [{id, name, supported_durations, supported_resolutions, supported_aspect_ratios, supported_sizes, supported_frame_images, generate_audio, seed}]}`, as its first route's provider makes them","security":[{"gatewayKey":[]}],"responses":{"200":{"description":"the key's video models"},"401":{"$ref":"#/components/responses/Refused"}}}},"/v1/videos/{id}":{"get":{"tags":["calls"],"summary":"A video job of this key, asked of its provider: `{id, generation_id, polling_url, status, status_detail?, progress?, unsigned_urls?, expires_at?, error?, usage: {cost}}`","description":"`status` is `pending`, `in_progress`, `completed` or `failed`; once completed, `unsigned_urls` holds the content URL (it needs the key). A job is kept 30 days.","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the job"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no job of this key with that id, or one past 30 days"},"502":{"description":"the provider failed, or is no longer configured"},"503":{"description":"jobs can't be read just now"}}}},"/v1/videos/{id}/content":{"get":{"tags":["calls"],"summary":"A completed job's video, streamed from its provider with its content type","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"index","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":0}}],"responses":{"200":{"description":"the video (`video/mp4` from OpenAI)"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no job of this key with that id, one past 30 days, or an index other than 0"},"502":{"description":"the provider failed, or is no longer configured"},"503":{"description":"jobs can't be read just now"}}}},"/v1/audio/speech":{"post":{"summary":"Speech (OpenAI's audio/speech shape)","responses":{"200":{"description":"the audio itself, as the provider sent it, with its content type (`audio/mpeg`, `audio/wav`, …)","content":{"audio/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"a bad request, or a model of another kind (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For models declared `kind: \"speech\"` in the config, on openai-kind providers whose base serves `/audio/speech` or the mock; the same keys, rate limits, budgets, usage records (`kind: \"speech\"`, the input's tokens estimated at one per four characters: providers report none), fallbacks (a provider's answer that isn't audio falls back too) and input guardrails (the input and the instructions) as embeddings. Never cached. Answers carry `x-request-id`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input","voice"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a speech model's name"},"input":{"type":"string","minLength":1,"maxLength":4096},"voice":{"type":"string","description":"one of the model's voices, passed on"},"response_format":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"]},"speed":{"type":"number","minimum":0.25,"maximum":4},"instructions":{"type":"string","maxLength":4096},"stream_format":{"type":"string","enum":["audio"],"description":"streamed speech events (sse) aren't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"tags":["calls"]}},"/v1/audio/transcriptions":{"post":{"summary":"Transcription (OpenAI's audio/transcriptions shape)","responses":{"200":{"description":"the transcript as the provider sent it: JSON (`json`, `verbose_json`) or text (`text`, `srt`, `vtt`)","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"a bad request, or a model of another kind (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"For models declared `kind: \"transcription\"` in the config, on openai-kind providers whose base serves `/audio/transcriptions` or the mock; a multipart form, as OpenAI's. The same keys, rate limits, budgets, usage records (`kind: \"transcriptions\"`: the provider's tokens when it reports them, else no input tokens and the transcript's output estimated at one per four characters), fallbacks (a provider's answer that isn't a transcript falls back too, with the same file) and input guardrails (the prompt) as embeddings. Never cached. Answers carry `x-request-id`.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","file"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a transcription model's name"},"file":{"type":"string","format":"binary","description":"the audio, 1 byte to 25 MiB, passed on with its name and content type"},"language":{"type":"string","maxLength":16,"description":"the audio's language code, such as en"},"prompt":{"type":"string","maxLength":4096,"description":"text to guide the transcript (read by input guardrails)"},"response_format":{"type":"string","enum":["json","text","srt","verbose_json","vtt"]},"temperature":{"type":"number","minimum":0,"maximum":1},"timestamp_granularities[]":{"type":"array","items":{"type":"string","enum":["word","segment"]}},"stream":{"type":"boolean","enum":[false],"description":"streamed transcription isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"tags":["calls"]}},"/v1/audio/translations":{"post":{"summary":"Translation into English (OpenAI's audio/translations shape)","responses":{"200":{"description":"the transcript as the provider sent it: JSON (`json`, `verbose_json`) or text (`text`, `srt`, `vtt`)","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"a bad request, or a model of another kind (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed (`insufficient_authorization`, with the challenge) when `admin.nod` is on"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"description":"As `/v1/audio/transcriptions`, on the same transcription models, sent to the provider's `/audio/translations`: the speech written out in English, so `language` and `timestamp_granularities[]` aren't taken. Usage records say `kind: \"translations\"`. Never cached. Answers carry `x-request-id`.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","file"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a transcription model's name (whisper-1 translates; check the provider's model does)"},"file":{"type":"string","format":"binary","description":"the audio, 1 byte to 25 MiB, passed on with its name and content type"},"prompt":{"type":"string","maxLength":4096,"description":"text to guide the transcript (read by input guardrails)"},"response_format":{"type":"string","enum":["json","text","srt","verbose_json","vtt"]},"temperature":{"type":"number","minimum":0,"maximum":1},"stream":{"type":"boolean","enum":[false],"description":"streamed translation isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"tags":["calls"]}},"/v1/messages":{"post":{"summary":"A message (Anthropic's shape)","responses":{"200":{"description":"the message, or Anthropic's server-sent events with stream: true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`)"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Anthropic's Messages request","properties":{"prompt":{"type":"object","description":"A stored prompt to render into this call (docs/gateway.md, Prompts): {id, version | label (default production), variables}. The prompt's messages come first, then the request's own; the request's model and parameters win. A missing, extra or wrongly typed variable is 400; no such prompt, version or label is 404.","required":["id"],"properties":{"id":{"type":"string"},"version":{"type":"integer","minimum":1},"label":{"type":"string"},"variables":{"type":"object"},"from":{"type":"string","enum":["org","key"],"description":"Whose prompt: org (the key's org's; the default for a key in one) or key (the key's own). A key in an org uses its own only when the call says so."}}},"preset":{"description":"A stored preset (docs/gateway.md, Prompts): its name (its latest version) or {name, version}. Its model and parameters fill what the call leaves out; with a prompt, it stands in for the prompt version's preset.","oneOf":[{"type":"string"},{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"version":{"type":"integer","minimum":1},"from":{"type":"string","enum":["org","key"],"description":"Whose preset, as for prompts."}}}]}}}}}},"tags":["calls"],"description":"`prompt` renders a stored prompt (model, messages and parameters may then be left out)."}},"/v1/messages/count_tokens":{"post":{"summary":"Count a Messages request's input tokens (Anthropic's shape)","description":"Anthropic's count (`{input_tokens}`) of what a call to the model would send: the request translated as the Messages door and the Anthropic adapter do, after the input guardrails (a block is 422, a redaction counted redacted), by the model's first route that counts (Anthropic's API, Claude on Vertex AI, Bedrock). Zero retention keeps to providers that keep nothing; a person's own-key routes aren't used. Anthropic bills no tokens for it: no usage is recorded; the key's rate limits hold. docs/gateway.md, Counting tokens.","responses":{"200":{"description":"`{input_tokens}`"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`)"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Anthropic's count_tokens request: anything else (a stored prompt or preset, max_tokens, provider) is 400","required":["model","messages"],"properties":{"model":{},"messages":{},"system":{},"tools":{},"tool_choice":{},"thinking":{},"output_config":{},"cache_control":{},"speed":{}},"additionalProperties":false}}}}}},"/v1/responses":{"post":{"summary":"A response (OpenAI's Responses shape; kept only for keys opted in)","responses":{"200":{"description":"the response object, or Responses' server-sent events with stream: true"},"400":{"description":"a bad request, including `previous_response_id` and `store: true` for a key that doesn't keep responses (`responses.keys`), and `conversation` and `background: true`, which aren't supported"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`)"},"404":{"description":"no such model, or `previous_response_id` names no response of this key"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"OpenAI's Responses request: model, input (text or items), instructions, function tools, tool_choice, max_output_tokens, temperature, top_p, text.format, stream","properties":{"prompt":{"type":"object","description":"A stored prompt to render into this call (docs/gateway.md, Prompts): {id, version | label (default production), variables}. The prompt's messages come first, then the request's own; the request's model and parameters win. A missing, extra or wrongly typed variable is 400; no such prompt, version or label is 404.","required":["id"],"properties":{"id":{"type":"string"},"version":{"type":"integer","minimum":1},"label":{"type":"string"},"variables":{"type":"object"},"from":{"type":"string","enum":["org","key"],"description":"Whose prompt: org (the key's org's; the default for a key in one) or key (the key's own). A key in an org uses its own only when the call says so."}}},"preset":{"description":"A stored preset (docs/gateway.md, Prompts): its name (its latest version) or {name, version}. Its model and parameters fill what the call leaves out; with a prompt, it stands in for the prompt version's preset.","oneOf":[{"type":"string"},{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"version":{"type":"integer","minimum":1},"from":{"type":"string","enum":["org","key"],"description":"Whose preset, as for prompts."}}}]}}}}}},"tags":["calls"],"description":"`prompt` renders a stored prompt (model, messages and parameters may then be left out)."}},"/v1/models":{"get":{"summary":"The models you can ask for","responses":{"200":{"description":"OpenAI's model list"}},"tags":["calls"]}},"/v1/usage":{"get":{"summary":"Your key's own usage","responses":{"200":{"description":"calls and totals"},"401":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"parameters":[{"name":"since_ms","in":"query","required":false,"schema":{"type":"integer"}}],"tags":["calls"]}},"/admin/keys":{"post":{"summary":"Issue a key (shown once)","responses":{"201":{"description":"the key, once"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["keys:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"models":{"type":"array","items":{"type":"string"},"minItems":1,"description":"the models it may use (the platform's names); left out: every model"},"org":{"type":"string","description":"issue it in this org (the caller an admin or owner there); needed when keys:write comes only from an org role"},"budgets":{"type":"array","description":"its first budgets, stored with it in one transaction (PUT /admin/budgets's fields less the key; scope key when left out); needs budgets:write too, or an org","items":{"type":"object","required":["period"],"properties":{"scope":{"type":"string","enum":["key","user","feature"]},"period":{"type":"string","enum":["day","month"]},"max_tokens":{"type":"integer","minimum":1},"max_cost_micros":{"type":"integer","minimum":1}}}}}}}}},"tags":["admin"]},"get":{"summary":"List keys (never the keys)","responses":{"200":{"description":"the keys' ids and when"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["keys:read"]}],"tags":["admin"]}},"/admin/keys/{id}":{"delete":{"summary":"Revoke a key","responses":{"204":{"description":"revoked"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["keys:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/budgets":{"put":{"summary":"Set a budget","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["budgets:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key_id","scope","period","max_tokens"],"properties":{"key_id":{"type":"string"},"scope":{"enum":["key","user","feature"]},"period":{"enum":["day","month"]},"max_tokens":{"type":"integer"}}}}}},"tags":["admin"]},"get":{"summary":"A key's budgets","responses":{"200":{"description":"from the config and set here"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["budgets:read"]}],"parameters":[{"name":"key_id","in":"query","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/budgets/{key}/{scope}/{period}":{"delete":{"summary":"Remove a budget","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["budgets:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"scope","in":"path","required":true,"schema":{"type":"string"}},{"name":"period","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/rate-limits":{"put":{"summary":"Set a key's rate limit","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key_id"],"properties":{"key_id":{"type":"string"},"requests_per_minute":{"type":"integer","minimum":1},"requests_per_hour":{"type":"integer","minimum":1},"requests_per_day":{"type":"integer","minimum":1},"tokens_per_minute":{"type":"integer","minimum":1}},"minProperties":2}}}},"tags":["admin"]},"get":{"summary":"A key's rate limits","responses":{"200":{"description":"the limit and where it's from"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:read"]}],"parameters":[{"name":"key_id","in":"query","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/rate-limits/{key}":{"delete":{"summary":"Lift a key's rate limit","responses":{"204":{"description":"lifted"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/cache":{"put":{"summary":"Cache a key's calls (exact match), on one model or every model","description":"ttl_s 0 turns caching off there, over a model's config. Never shared between keys (only the config shares). 409 when the config sets the key's caching.","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key_id","ttl_s"],"properties":{"key_id":{"type":"string"},"model":{"type":"string","description":"a model's name, or * (the default) for every model"},"ttl_s":{"type":"integer","minimum":0,"maximum":2592000}}}}}},"tags":["admin"]},"get":{"summary":"A key's caching: the config's for the key, settings from the API by model, and models' own","responses":{"200":{"description":"the key's caching"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:read"]}],"parameters":[{"name":"key_id","in":"query","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/cache/{key}/{model}":{"delete":{"summary":"Remove a key's caching set through the API on a model (* for every model)","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"model","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/semantic-cache":{"put":{"summary":"Cache a key's calls semantically (near-duplicate prompts), on one model or every model","description":"A chat call without tools whose last user message is at least threshold similar (cosine, by embedding_model) to an earlier one with the same system prompt, earlier turns, model and parameters is answered from the cache. Each lookup is an embedding call billed to the key; if it fails the call goes on uncached. Replaces the setting there; needs a sealing key (409 without).","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key_id","embedding_model","ttl_s"],"properties":{"key_id":{"type":"string"},"model":{"type":"string","description":"a chat model's name, or * (the default) for every model"},"embedding_model":{"type":"string","description":"an embedding model (kind: embedding)"},"threshold":{"type":"number","exclusiveMinimum":0,"maximum":1,"description":"default 0.95"},"ttl_s":{"type":"integer","minimum":1,"maximum":2592000},"max_entries":{"type":"integer","minimum":1,"maximum":10000,"description":"default 1000"}}}}}},"tags":["admin"]},"get":{"summary":"A key's semantic caching: its settings by model, and each scope's entries, hits, misses, failed embeddings and hit rate","responses":{"200":{"description":"the key's semantic caching"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:read"]}],"parameters":[{"name":"key_id","in":"query","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/semantic-cache/{key}/{model}":{"delete":{"summary":"Turn off a key's semantic caching on a model (* for every model); entries kept run out by their TTL","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"model","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/usage":{"get":{"summary":"Usage across keys, per day, key and model","responses":{"200":{"description":"rows"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"parameters":[{"name":"since_ms","in":"query","required":true,"schema":{"type":"integer"}},{"name":"until_ms","in":"query","required":false,"schema":{"type":"integer"}}],"tags":["admin"]}},"/admin/logs":{"get":{"summary":"The request log, newest first","description":"Each call's record: request and trace ids, key id, model, route, outcome, tokens, cost, timings, cached and guardrails. Never what was asked or answered, and never the person. Kept for the retention (7 days by default); only the keys the token reaches. `next` is the cursor for the page after (pass it as `before`); null at the end.","responses":{"200":{"description":"logs, next, retention_days"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"parameters":[{"name":"key_id","in":"query","required":false,"schema":{"type":"string"},"description":"one key id, or several separated by commas"},{"name":"model","in":"query","required":false,"schema":{"type":"string"}},{"name":"outcome","in":"query","required":false,"schema":{"type":"string"},"description":"ok, not_ok, or a kind: refused, interrupted, guardrail, caller left"},{"name":"since_ms","in":"query","required":false,"schema":{"type":"integer"}},{"name":"until_ms","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"1 to 200, default 50"},{"name":"before","in":"query","required":false,"schema":{"type":"string"},"description":"the previous page's next"}],"tags":["admin"]}},"/admin/availability":{"get":{"summary":"Availability per model and route over a window, and the gateway's own time","description":"From every reachable key's usage records. Each call is ok, the caller's (a 4xx: a budget, a refused request, a guardrail's block, the caller leaving), upstream's (every provider failed) or the gateway's (its own failures, and any outcome not known to be the caller's or a provider's). availability is (calls - caller_errors - gateway_errors) / (calls - caller_errors); answered is ok / (calls - caller_errors); a minute is down when at least half of its calls not the caller's failed by the gateway's cause. gateway_time_us: the call's time less the provider's, at p50, p95 and p99 (nearest rank), over calls answered by the first route tried. Counts and names only: never a key, a person or anything asked or answered.","responses":{"200":{"description":"since_ms, until_ms, total, models, routes, gateway_time_us"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"parameters":[{"name":"since_ms","in":"query","required":false,"schema":{"type":"integer"},"description":"with until_ms; not with hours"},{"name":"until_ms","in":"query","required":false,"schema":{"type":"integer"},"description":"default now"},{"name":"hours","in":"query","required":false,"schema":{"type":"integer"},"description":"back from until_ms, 1 to 744; default 24"}],"tags":["admin"]}},"/admin/mcp-calls":{"get":{"summary":"MCP tool calls, and totals per tool","responses":{"200":{"description":"calls and per_tool"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["keys:read"]}],"parameters":[{"name":"since_ms","in":"query","required":false,"schema":{"type":"integer"}}],"tags":["mcp"]}},"/connect/providers":{"get":{"summary":"Providers that take your own key","responses":{"200":{"description":"providers"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"person":["ai:connect"]}],"tags":["connect"]}},"/connect/keys":{"get":{"summary":"Your connected keys (never the keys)","responses":{"200":{"description":"which providers, since when"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"person":["ai:connect"]}],"tags":["connect"]}},"/connect/keys/{provider}":{"put":{"summary":"Connect your key for a provider","responses":{"204":{"description":"sealed and kept"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"person":["ai:connect"]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["api_key"],"properties":{"api_key":{"type":"string"}}}}}},"tags":["connect"]},"delete":{"summary":"Remove your key","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"person":["ai:connect"]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"tags":["connect"]}},"/mcp":{"post":{"summary":"MCP over HTTP (JSON-RPC; a tool call as a server-sent stream when the client takes one)","responses":{"200":{"description":"a JSON-RPC answer (application/json), or a tool call's stream (text/event-stream); initialize's carries Mcp-Session-Id"},"202":{"description":"a notification taken"},"400":{"description":"an MCP-Protocol-Version it doesn't speak, or no Mcp-Session-Id"},"401":{"description":"sign in (WWW-Authenticate names the metadata)"},"403":{"description":"an Origin it doesn't allow"},"404":{"description":"no such session of the caller's (unknown, ended, idle too long): initialize again"}},"security":[{"mcp":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"tags":["mcp"],"description":"initialize starts a session, answered in the Mcp-Session-Id header; every later request carries it. A session is its token's subject's and client's only, ends when idle (an hour by default) or deleted, and is 404 once ended, so the client initialises again. tools/call with Accept: text/event-stream is answered as SSE: progress notifications while it runs (when params._meta.progressToken asks), then the answer. A caller key (Bearer) is let in too, for its org's registered servers' tools (<server>.<tool>).","parameters":[{"name":"Mcp-Session-Id","in":"header","required":false,"schema":{"type":"string"},"description":"the session initialize gave; needed on every request but initialize"}]},"get":{"summary":"Resume a broken tool-call stream after its Last-Event-ID","description":"Goes on with a streamed tools/call from the event after Last-Event-ID, in the session it was in: progress while the call runs, then its answer (nothing when the client already had it). Streams are kept 10 minutes after their last word, and only on a gateway with a sealing key. There is no server-started stream: without Last-Event-ID this is 405.","parameters":[{"name":"Mcp-Session-Id","in":"header","required":true,"schema":{"type":"string"},"description":"the session the stream was in"},{"name":"Last-Event-ID","in":"header","required":true,"schema":{"type":"string"},"description":"the last event id the client had: <stream>-<n> or <stream>-answer"}],"responses":{"200":{"description":"the rest of the stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"no Mcp-Session-Id, or no stream of this session's to resume (unknown, or past its time)"},"401":{"description":"sign in (WWW-Authenticate names the metadata)"},"403":{"description":"an Origin it doesn't allow"},"404":{"description":"no such session: initialize again"},"405":{"description":"no Last-Event-ID: there's no server-started stream"}},"security":[{"mcp":[]}],"tags":["mcp"]},"delete":{"summary":"End the caller's MCP session","parameters":[{"name":"Mcp-Session-Id","in":"header","required":true,"schema":{"type":"string"},"description":"the session to end"}],"responses":{"204":{"description":"ended"},"400":{"description":"no Mcp-Session-Id"},"401":{"description":"sign in (WWW-Authenticate names the metadata)"},"403":{"description":"an Origin it doesn't allow"},"404":{"description":"no such session of the caller's"}},"security":[{"mcp":[]}],"tags":["mcp"]}},"/.well-known/oauth-protected-resource/mcp":{"get":{"summary":"The MCP server's protected resource metadata (RFC 9728)","responses":{"200":{"description":"metadata naming Harpora"}},"security":[],"tags":["mcp"]}},"/admin/mcp-tools":{"get":{"summary":"The app's MCP tools, for review","responses":{"200":{"description":"the tools","content":{"application/json":{"schema":{"type":"object","properties":{"resource":{"type":"string"},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"input_schema":{"type":"object"},"method":{"type":"string","enum":["GET","POST"]},"path":{"type":"string"},"scope":{"type":"string"},"check":{"type":["object","null"]}}}}}}}}},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"description":"no MCP door on this gateway"}},"security":[{"admin":["keys:read"]}],"tags":["mcp"],"description":"Each tool as assistants are offered it: name, description, arguments (JSON Schema), the call it makes (method and path), the scope it needs and any FGA check. Never the app's address or key. 404 without an MCP door."}},"/admin/mcp":{"post":{"summary":"SocketLLM's own MCP server (JSON-RPC): read-only admin tools, each calling an admin route above with the caller's token, so each needs its route's scope (keys_list keys:read, budgets_list budgets:read, rate_limits_get limits:read, usage_report usage:read); and the views (kit's docs/views.md), view_usage {org}, view_key {key} and view_budgets {org}, with their ui://socketllm/ screens as resources","responses":{"200":{"description":"a JSON-RPC answer; a refused tool is its result with isError"},"202":{"description":"a notification taken"},"401":{"description":"no bearer token (WWW-Authenticate: Bearer)"}},"security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"tags":["admin"]}},"/admin/orgs":{"get":{"summary":"The caller's orgs, their role in each and the keys it gives","responses":{"200":{"description":"{\"orgs\": [{name, role, keys}]}"},"401":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"tags":["orgs"]}},"/admin/orgs/{org}":{"get":{"summary":"An org (its members and operators; 404 for anyone else)","responses":{"200":{"description":"{name, keys, members, machines}"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]},"put":{"summary":"Set the whole org (an operator)","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"422":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["orgs:write"]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"string"},"description":"the caller keys it owns, by id (each in one org at most)"},"members":{"type":"object","additionalProperties":{"type":"string","enum":["owner","admin","deployer"]},"description":"email:<address> or sub:<subject> → role; at least one owner"},"machines":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"a client subject → the org's keys it may use"}}}}}},"tags":["orgs"]},"delete":{"summary":"Delete an org (an operator)","responses":{"204":{"description":"deleted"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["orgs:write"]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]}},"/admin/orgs/{org}/members/{who}":{"put":{"summary":"Add or change a member (an owner; the org keeps an owner)","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"who","in":"path","required":true,"schema":{"type":"string"},"description":"email:<address> or sub:<subject>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["owner","admin","deployer"]}}}}}},"tags":["orgs"]},"delete":{"summary":"Remove a member (an owner; never the last owner)","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"who","in":"path","required":true,"schema":{"type":"string"},"description":"email:<address> or sub:<subject>"}],"tags":["orgs"]}},"/admin/orgs/{org}/keys/{key}":{"put":{"summary":"Add a key the caller may already write, in no other org (an admin or owner)","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"a caller key's id"}],"tags":["orgs"]},"delete":{"summary":"Take a key out of the org, and from its machines (an admin or owner)","responses":{"200":{"description":"the org"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"a caller key's id"}],"tags":["orgs"]}},"/admin/orgs/{org}/machines/{client}":{"put":{"summary":"Limit a machine client to some of the org's keys (an owner)","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"422":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"client","in":"path","required":true,"schema":{"type":"string"},"description":"a machine client's subject"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["keys"],"properties":{"keys":{"type":"array","items":{"type":"string"}}}}}}},"tags":["orgs"]},"delete":{"summary":"Remove a machine client (an owner)","responses":{"200":{"description":"the org"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"client","in":"path","required":true,"schema":{"type":"string"},"description":"a machine client's subject"}],"tags":["orgs"]}},"/admin/runtime/keys/{key}/delist":{"post":{"tags":["admin"],"summary":"Delist a platform key on every replica","description":"Kept in the store and read by every session start and use on every replica, so the key is refused everywhere from now (403), whatever each replica's config says; its sessions are ended. Delisting again keeps the first. Never lifted: list the platform again under a new key id in the config.","security":[{"admin":["keys:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"the platform key's id in the config (runtime.platform_keys), never the key"}],"responses":{"200":{"description":"delisted","content":{"application/json":{"schema":{"type":"object","properties":{"key_id":{"type":"string"},"delisted_ms":{"type":"integer"},"delisted_by":{"type":"string","description":"the admin token's sub"},"sessions_ended":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/admin/runtime/delistings":{"get":{"tags":["admin"],"summary":"List delisted platform keys","description":"Every platform key delisted through the admin API (through an org role, its org's keys only); `in_config`: whether this gateway's runtime.platform_keys still names it.","security":[{"admin":["keys:read"]}],"responses":{"200":{"description":"the delistings","content":{"application/json":{"schema":{"type":"object","properties":{"delistings":{"type":"array","items":{"type":"object","properties":{"key_id":{"type":"string"},"delisted_ms":{"type":"integer"},"delisted_by":{"type":"string"},"in_config":{"type":"boolean"}}}}}}}}},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/agents/{agent}/sessions":{"post":{"tags":["runtime"],"summary":"Start an agent's session","security":[{"gatewayKey":[]}],"description":"The platform passes on the person's token it was issued; SocketLLM exchanges it at Harpora (token exchange with `agent=`, its own client authentication) for the agent's token, kept with the session in the gateway's store, sealed (`SOCKETLLM_SEAL_KEY`), so any replica serves it, and never returned or logged. Only the key that starts a session uses it.","parameters":[{"in":"path","name":"agent","required":true,"schema":{"type":"string"},"description":"the platform's agent (its client id at Harpora)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subject_token","resource"],"additionalProperties":false,"properties":{"subject_token":{"type":"string","description":"the person's own access token, issued to the platform"},"resource":{"type":"string","description":"the product's API at Harpora; one of the config's runtime.products"},"scope":{"type":"string","description":"space-separated; left out: what the person and the delegation both allow"}}}}}},"responses":{"201":{"description":"the session","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"string"},"agent":{"type":"string"},"person":{"type":"string"},"resource":{"type":"string"},"scope":{"type":"string"},"expires_at_ms":{"type":"integer","description":"when the session ends: the person's token's end or runtime.session_max_age_s after it started, whichever is first"}}}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"Harpora refused the exchange; `type` is its OAuth error code (`invalid_grant`, `unauthorized_client`, `invalid_target`, `invalid_scope`)"},"404":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}":{"delete":{"tags":["runtime"],"summary":"End a session (its record and sealed tokens are removed, for every replica)","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"ended"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/call":{"post":{"tags":["runtime"],"summary":"The agent calls its product, with its own token","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"Sent only to the session's product's configured address plus `path`. The token is exchanged again when it runs out; a refused exchange ends the session. The agent's and the person's tokens are taken out of the product's answer.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["method","path"],"additionalProperties":false,"properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","description":"under the product's address: starts with /, no .. segments, //, \\, @ or #"},"body":{"description":"sent as JSON (not with GET)"}}}}}},"responses":{"200":{"description":"the product's answer","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"body":{"description":"the product's JSON, or its text"}}}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"500":{"description":"the session's tokens don't open on this replica (its SOCKETLLM_SEAL_KEY differs)"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/chat/completions":{"post":{"tags":["runtime"],"summary":"The agent's model call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/chat/completions` on the platform's key. Past a used-up budget with `admin.nod` on, SocketLLM asks Nod itself (`bc-authorize` with `agent=` and `login_hint=sub:<person>`), Nod routes it to the platform's surface, and the call waits for the decision: approved, it goes through once; otherwise 403.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"OpenAI's Chat Completions request"}}}},"responses":{"200":{"description":"the completion, or server-sent events with stream: true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/embeddings":{"post":{"tags":["runtime"],"summary":"A session's embeddings call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/embeddings` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"OpenAI's Chat Completions request"}}}},"responses":{"200":{"description":"the completion, or server-sent events with stream: true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/rerank":{"post":{"tags":["runtime"],"summary":"A session's rerank call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/rerank` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","query","documents"],"properties":{"model":{"type":"string","description":"a rerank model's name"},"query":{"type":"string","minLength":1},"documents":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1}},"top_n":{"type":"integer","minimum":1,"description":"the most relevant this many (all by default)"},"return_documents":{"type":"boolean","description":"each result with its document's text (false by default)"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"responses":{"200":{"description":"`{object: \"list\", results: [{index, relevance_score, document?: {text}}], model, usage: {prompt_tokens, total_tokens}}`: the most relevant first, the first `top_n`, each document's text when `return_documents` is true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/images/generations":{"post":{"tags":["runtime"],"summary":"A session's image-generation call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/images/generations` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"an image model's name"},"prompt":{"type":"string","minLength":1,"maxLength":32000},"n":{"type":"integer","minimum":1,"maximum":10,"description":"how many images (1 by default)"},"size":{"type":"string","description":"passed on, e.g. `1024x1024`"},"quality":{"type":"string","description":"passed on"},"response_format":{"type":"string","enum":["b64_json","url"],"description":"passed on; the provider's default otherwise"},"style":{"type":"string","description":"passed on"},"background":{"type":"string","description":"passed on"},"output_format":{"type":"string","description":"passed on"},"output_compression":{"type":"integer","description":"passed on"},"moderation":{"type":"string","description":"passed on"},"stream":{"type":"boolean","enum":[false],"description":"streamed image generation isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"responses":{"200":{"description":"`{created, data: [{b64_json? | url?, revised_prompt?}], usage: {input_tokens, output_tokens, total_tokens}}`"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/images/edits":{"post":{"tags":["runtime"],"summary":"A session's image edit","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/images/edits` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","image[]","prompt"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"an image model's name"},"image[]":{"type":"array","minItems":1,"maxItems":16,"items":{"type":"string","format":"binary"},"description":"the images to edit, each up to 25 MiB, passed on in the field they came in (`image` for one is taken too)"},"mask":{"type":"string","format":"binary","description":"where to edit, passed on"},"prompt":{"type":"string","minLength":1,"maxLength":32000},"n":{"type":"integer","minimum":1,"maximum":10,"description":"how many images (1 by default)"},"size":{"type":"string","description":"passed on, e.g. `1024x1024`"},"quality":{"type":"string","description":"passed on"},"response_format":{"type":"string","enum":["b64_json","url"],"description":"passed on; the provider's default otherwise"},"background":{"type":"string","description":"passed on"},"output_format":{"type":"string","description":"passed on"},"output_compression":{"type":"integer","description":"passed on","minimum":0,"maximum":100},"stream":{"type":"boolean","enum":[false],"description":"streamed image edits aren't served"},"user":{"type":"string","description":"the end user, for budgets and usage"},"input_fidelity":{"type":"string","description":"passed on"}}}}}},"responses":{"200":{"description":"`{created, data: [{b64_json? | url?, revised_prompt?}], usage: {input_tokens, output_tokens, total_tokens}}`"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/audio/speech":{"post":{"tags":["runtime"],"summary":"A session's speech call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/audio/speech` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input","voice"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a speech model's name"},"input":{"type":"string","minLength":1,"maxLength":4096},"voice":{"type":"string","description":"one of the model's voices, passed on"},"response_format":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"]},"speed":{"type":"number","minimum":0.25,"maximum":4},"instructions":{"type":"string","maxLength":4096},"stream_format":{"type":"string","enum":["audio"],"description":"streamed speech events (sse) aren't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"responses":{"200":{"description":"the audio itself, as the provider sent it, with its content type (`audio/mpeg`, `audio/wav`, …)","content":{"audio/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/audio/transcriptions":{"post":{"tags":["runtime"],"summary":"A session's transcription","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/audio/transcriptions` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","file"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a transcription model's name"},"file":{"type":"string","format":"binary","description":"the audio, 1 byte to 25 MiB, passed on with its name and content type"},"language":{"type":"string","maxLength":16,"description":"the audio's language code, such as en"},"prompt":{"type":"string","maxLength":4096,"description":"text to guide the transcript (read by input guardrails)"},"response_format":{"type":"string","enum":["json","text","srt","verbose_json","vtt"]},"temperature":{"type":"number","minimum":0,"maximum":1},"timestamp_granularities[]":{"type":"array","items":{"type":"string","enum":["word","segment"]}},"stream":{"type":"boolean","enum":[false],"description":"streamed transcription isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"responses":{"200":{"description":"the transcript as the provider sent it: JSON (`json`, `verbose_json`) or text (`text`, `srt`, `vtt`)","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}},"text/plain":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/runtime/sessions/{session}/audio/translations":{"post":{"tags":["runtime"],"summary":"A session's translation","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/audio/translations` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["model","file"],"additionalProperties":false,"properties":{"model":{"type":"string","description":"a transcription model's name (whisper-1 translates; check the provider's model does)"},"file":{"type":"string","format":"binary","description":"the audio, 1 byte to 25 MiB, passed on with its name and content type"},"prompt":{"type":"string","maxLength":4096,"description":"text to guide the transcript (read by input guardrails)"},"response_format":{"type":"string","enum":["json","text","srt","verbose_json","vtt"]},"temperature":{"type":"number","minimum":0,"maximum":1},"stream":{"type":"boolean","enum":[false],"description":"streamed translation isn't served"},"user":{"type":"string","description":"the end user, for budgets and usage (not passed on)"}}}}}},"responses":{"200":{"description":"the transcript as the provider sent it: JSON (`json`, `verbose_json`) or text (`text`, `srt`, `vtt`)","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}},"text/plain":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/admin/guardrails":{"put":{"summary":"Set a guardrail on a key's calls (checks on input and output)","description":"check.type: deny_regex, allow_regex, blocked_terms, secrets, pii, max_length, json_schema; mode block (422 naming the guardrail), redact or log. The same name replaces it. 409 when the config has a guardrail of that name.","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key_id","name","mode","check"],"properties":{"key_id":{"type":"string"},"model":{"type":"string"},"name":{"type":"string"},"stage":{"type":"string","enum":["input","output","both"]},"mode":{"type":"string","enum":["block","redact","log"]},"check":{"type":"object"}}}}}},"tags":["admin"]},"get":{"summary":"A key's guardrails: the config's that reach it, and those set through the API","responses":{"200":{"description":"the key's guardrails"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:read"]}],"parameters":[{"name":"key_id","in":"query","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/guardrails/{key}/{name}":{"delete":{"summary":"Remove a guardrail set through the API for a key","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["limits:write"]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"tags":["admin"]}},"/admin/prompts/{owner}":{"get":{"summary":"An owner's stored prompts: name, latest version and labels","responses":{"200":{"description":"the prompts"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"}],"tags":["prompts"]}},"/admin/prompts/{owner}/{name}":{"get":{"summary":"One version of a prompt (the latest when neither version nor label is asked)","responses":{"200":{"description":"the version: messages, model, parameters, variables, labels"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"},{"name":"version","in":"query","schema":{"type":"integer","minimum":1}},{"name":"label","in":"query","schema":{"type":"string"}}],"tags":["prompts"]},"put":{"summary":"Save the next version of a prompt (a version is never changed)","description":"messages with {{variables}} (\\{{ is a literal {{); values go in once and are never read as template. {{#if variable}}…{{else}}…{{/if}} shows one part by a variable (true, a number not 0, a string not empty); {{> name}} puts in another prompt of the owner (one message), at its production label, or {{> name@3}} / {{> name@staging}}; a cycle, partials more than 4 deep or more than 50 of them, an unbalanced tag and a missing partial are 422. preset: a preset's name (its latest version, pinned now) or {name, version}; the prompt's own model and parameters win over the preset's. variables: name to string, number or boolean (left out: every variable the messages use is a string; declared and used must agree). labels go on the new version, moving from where they were. 409: no sealing key, or a limit (200 prompts per owner, 500 versions, 20 labels).","responses":{"201":{"description":"saved: {owner, name, version, labels}"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"422":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:write"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant","developer","tool"]},"content":{"description":"text (a template), or parts: text parts (templates) and, in a user message, images by an https: or data:image/ URL or a whole {{variable}}","oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":20,"items":{"oneOf":[{"type":"object","required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}}},{"type":"object","required":["type","image_url"],"properties":{"type":{"const":"image_url"},"image_url":{"type":"object","required":["url"],"properties":{"url":{"type":"string"},"detail":{"type":"string","enum":["auto","low","high"]}}}}}]}}]},"tool_calls":{"type":"array","minItems":1,"maxItems":16,"description":"an assistant message's fixed tool calls, a few-shot example's: {id, type: function, function: {name, arguments}}, arguments a JSON object's text","items":{"type":"object","required":["id","type","function"],"properties":{"id":{"type":"string"},"type":{"const":"function"},"function":{"type":"object","required":["name","arguments"],"properties":{"name":{"type":"string"},"arguments":{"type":"string"}}}}}},"tool_call_id":{"type":"string","description":"a tool message's: the call of the assistant message before it that it answers"}}}},"model":{"type":"string"},"parameters":{"type":"object","description":"temperature, top_p, presence_penalty, frequency_penalty, max_tokens, max_completion_tokens, seed, stop, response_format, tools, tool_choice"},"variables":{"type":"object","additionalProperties":{"type":"string","enum":["string","number","boolean","list"]}},"defaults":{"type":"object","description":"a declared variable's value when a call leaves it out (of its type)"},"labels":{"type":"array","items":{"type":"string"}},"preset":{"description":"a preset of the same owner: its name, or {name, version}","oneOf":[{"type":"string"},{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"version":{"type":"integer","minimum":1}}}]}}}}}},"tags":["prompts"]}},"/admin/prompts/{owner}/{name}/versions":{"get":{"summary":"Every version of a prompt, newest first, with its content and labels","responses":{"200":{"description":"the versions and where each label points"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"}],"tags":["prompts"]}},"/admin/prompts/{owner}/{name}/render":{"post":{"summary":"The chat completions request a call with this prompt would send; no model is called and nothing is used up","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"version":{"type":"integer","minimum":1},"label":{"type":"string","description":"production when neither is given"},"variables":{"type":"object"},"request":{"type":"object","description":"the call's own chat completions request: its messages after the prompt's, its model and parameters first"}}}}}},"responses":{"200":{"description":"{name, version, request}: the rendered request"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"}],"tags":["prompts"]}},"/admin/prompts/{owner}/{name}/labels/{label}":{"put":{"summary":"The label now names that version","responses":{"200":{"description":"the prompt's labels"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:write"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"},{"name":"label","in":"path","required":true,"schema":{"type":"string"},"description":"a label: letters, digits, _ . and -, up to 32 (production is what a call without a version or label uses)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"type":"integer","minimum":1}}}}}},"tags":["prompts"]},"delete":{"summary":"Take the label off (the versions stay)","responses":{"204":{"description":"removed"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:write"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the prompt's name: letters, digits, _ . and -, up to 64"},{"name":"label","in":"path","required":true,"schema":{"type":"string"},"description":"a label: letters, digits, _ . and -, up to 32 (production is what a call without a version or label uses)"}],"tags":["prompts"]}},"/admin/orgs/{org}/cache":{"put":{"summary":"Let the org's keys share cached answers for chosen models (an admin or owner)","description":"The entries' scope is the org's immutable id: never shared with another org's keys nor a key in no org. Each key still needs its own caching on. Replaces the earlier setting; needs a sealing key (409 without).","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["models"],"properties":{"models":{"type":"array","items":{"type":"string"},"description":"model names, or * for every model"},"max_entries":{"type":"integer","minimum":1,"description":"the most entries kept for the org (default 1000)"},"semantic":{"type":"boolean","description":"share the keys' semantic caches too, for these models (each key still needs its own semantic caching on)"}}}}}},"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]},"delete":{"summary":"Stop the org's keys sharing cached answers (an admin or owner)","responses":{"200":{"description":"the org"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]}},"/admin/routes":{"get":{"summary":"Each model's routes in the order calls try them, and how each is doing","description":"Per route: provider, upstream model, own_key, weight, when (the calls it takes; null: all), price; answered_today and avg_first_output_ms_today (every server's, from usage records); avg_first_output_ms, cooling_ms and recent_fails (this server's view). added_by for a route added at run time. Never a provider's key.","responses":{"200":{"description":"{\"models\": [{name, kind, auto, cheapest, routes: [...]}]}"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"tags":["admin"]}},"/admin/providers":{"get":{"summary":"The upstream providers: kind, address, timeouts, whether the key is held, and the routes through each","description":"Per provider: name, kind, origin (scheme and host only), region and api_version where they apply, key_held (true or false: never the key, its variable or a hash), first_output_s, idle_s, retries and cooldown as they take effect (cooldown null: never cooled), routes (model, upstream_model, own_key, cooling_ms, recent_fails, avg_first_output_ms: this server's view), routes_cooling and recent_fails. added_by: who added it at run time (null for the config's).","responses":{"200":{"description":"{\"providers\": [{name, kind, origin, key_held, routes: [...], ...}]}"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"tags":["admin"]}},"/v1/responses/{id}":{"get":{"summary":"A kept response of this key (`responses.keys`)","security":[{"gatewayKey":[]}],"responses":{"200":{"description":"the response object as it was answered"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no response of this key with that id (another key's, expired, or never kept)"},"503":{"description":"kept responses can't be read just now"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"delete":{"summary":"Forget a kept response of this key","security":[{"gatewayKey":[]}],"responses":{"200":{"description":"`{id, object: response, deleted: true}`"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no response of this key with that id"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/admin/logs/{id}/content":{"get":{"summary":"One call's content (a key with content logging on)","description":"The request as it was sent on (after the input guardrails' redactions) and the answer as the caller received it, for a key named in `logs.content`, kept sealed for that key's days. Needs `logs:content` on the token itself (no org role gives it). A call not kept is 404.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"the call's request id (x-request-id)"}],"responses":{"200":{"description":"request_id, key_id, content {request, answer, answer_broke_off, cut?}"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["logs:content"]}]}},"/admin/presets/{owner}":{"get":{"summary":"An owner's presets: name and latest version","responses":{"200":{"description":"the presets"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"}],"tags":["prompts"]}},"/admin/presets/{owner}/{name}":{"get":{"summary":"One version of a preset (the latest when no version is asked)","responses":{"200":{"description":"the version: model, parameters, who saved it and when"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:read"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the preset's name: letters, digits, _ . and -, up to 64"},{"name":"version","in":"query","schema":{"type":"integer","minimum":1}}],"tags":["prompts"]},"put":{"summary":"Save the next version of a preset (a version is never changed)","description":"Call settings a prompt version can name: a model and parameters, at least one. A prompt saved naming the preset keeps the version it was saved with; the prompt's own settings, then the call's, win over it. 409: no sealing key, or a limit (200 presets per owner, 500 versions).","responses":{"201":{"description":"saved: {owner, name, version}"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["prompts:write"]}],"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string"},"description":"org:<name>, or key:<id> for a key in no org (an org's keys use the org's prompts)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the preset's name: letters, digits, _ . and -, up to 64"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string"},"parameters":{"type":"object","description":"temperature, top_p, presence_penalty, frequency_penalty, max_tokens, max_completion_tokens, seed, stop, response_format"}}}}}},"tags":["prompts"]}},"/admin/orgs/{org}/mcp-servers":{"get":{"summary":"The org's registered third-party MCP servers (any member)","description":"Each server's URL, how SocketLLM signs in to it (the header's name, never its value), its tools as the org's keys see them (<server>.<tool>), the ones left out and why, and the allow-lists.","responses":{"200":{"description":"{servers: [...]}"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]}},"/admin/orgs/{org}/mcp-servers/{name}":{"put":{"summary":"Register a third-party MCP server for the org's keys (an admin or owner)","description":"SocketLLM connects to the server and reads its tools before keeping anything; the org's keys then call them on the MCP door as <name>.<tool>. The URL must be https on a public address (a host in mcp.upstreams_allowed excepted). A header's value is kept sealed (409 without a sealing key) and never shown; left out on a server already registered with that header, it's kept. Registering again reads the tools afresh.","responses":{"200":{"description":"the server, as listed"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"the server's MCP endpoint"},"auth":{"type":"object","description":"{\"type\": \"none\"} or {\"type\": \"header\", \"name\", \"value\"}","properties":{"type":{"type":"string","enum":["none","header"]},"name":{"type":"string"},"value":{"type":"string","writeOnly":true}}},"tools":{"type":"array","items":{"type":"string"},"description":"the tools the org's keys may use; left out: every one"},"keys":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"the org's keys with lists of their own, replacing tools for them"}}}}}},"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the server's name, its tools' namespace (one DNS label of at most 32)"}],"tags":["orgs"]},"delete":{"summary":"Remove a registered MCP server (an admin or owner): its tools leave the org's keys at once","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the server's name, its tools' namespace (one DNS label of at most 32)"}],"tags":["orgs"]}},"/v1/feedback":{"post":{"summary":"Score one of your key's calls (its route's quality)","description":"For a call this key made (or, for a key in an org, one of the org's keys made), by its x-request-id: score from 0 to 1, or thumbs up (1) or down (0). Counted once, for the route that answered, in its quality score (weighing three calls' own signals). Another key's call is 404, as one that isn't there; a call no route answered (or the cache did), or one already scored, is 409.","responses":{"204":{"description":"counted"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request_id"],"properties":{"request_id":{"type":"string","description":"the call's x-request-id"},"score":{"type":"number","minimum":0,"maximum":1},"thumbs":{"type":"string","enum":["up","down"]}}}}}},"tags":["calls"]}},"/admin/quality":{"get":{"summary":"Each chat model's quality routing and its routes' scores","description":"Per model: its setting (null when off) and its scores per route and task (\"\": every call): score (0 to 1), samples (decayed), counts (whether they reach min_samples), and the signals behind them: calls, errors, refusals, guardrail_blocks, truncated, malformed, empty, feedback {n, mean}, judge {n, mean}. Numbers only: never anything asked or answered.","responses":{"200":{"description":"{\"models\": [{name, setting, scores: [...]}], feedback_weight, judge_prompt_version}"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"parameters":[{"name":"model","in":"query","required":false,"schema":{"type":"string"},"description":"one chat model; all when left out"}],"tags":["admin"]}},"/admin/quality/{model}":{"put":{"summary":"Route a chat model by measured quality","description":"observe keeps scores and routes as before; quality puts the best score first; quality_then_price the cheapest route within tolerance of the best (every route needs a price). Conditions, cooldown and budgets apply first; until every route left has min_samples the order is as before; explore is the share of calls another route goes first on. Replaces the model's setting.","responses":{"204":{"description":"set"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["mode"],"properties":{"mode":{"type":"string","enum":["observe","quality","quality_then_price"]},"explore":{"type":"number","minimum":0,"maximum":0.5,"description":"the share of calls another route goes first on (default 0.05)"},"tolerance":{"type":"number","minimum":0,"maximum":1,"description":"quality_then_price: how far below the best score a cheaper route may be (default 0.05)"},"min_samples":{"type":"number","minimum":1,"maximum":10000,"description":"the samples (decayed) every route needs before scores decide (default 20)"},"half_life_s":{"type":"integer","minimum":60,"maximum":2592000,"description":"a sample's weight halves every this many seconds (default 86400)"}}}}}},"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a chat model's name"}],"tags":["admin"]},"delete":{"summary":"Turn quality routing off for a model (its scores are kept, and decay)","responses":{"204":{"description":"off"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a chat model's name"}],"tags":["admin"]}},"/admin/orgs/{org}/quality-judge":{"put":{"summary":"Let a judge model score a share of the named org keys' calls (an admin or owner)","description":"Off unless set. The judge reads what those calls asked and answered (only the keys named here, each the org's), on models with a quality setting; only its score is kept. Each judge call is the judged call's key's usage (kind quality_judge, with the judge prompt's name and version), so the org pays for it. Replaces the earlier setting.","responses":{"200":{"description":"the org"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"422":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","share","keys"],"properties":{"model":{"type":"string","description":"a chat model to judge with"},"share":{"type":"number","exclusiveMinimum":0,"maximum":1,"description":"the share of the keys' calls judged"},"keys":{"type":"array","items":{"type":"string"},"description":"the org's keys whose calls the judge may read"}}}}}},"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]},"delete":{"summary":"Turn the org's judge off (an admin or owner)","responses":{"200":{"description":"the org"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"}],"tags":["orgs"]}},"/admin/route-settings":{"get":{"summary":"Every route setting an operator made over the config's","responses":{"200":{"description":"{settings: [...]}","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"type":"array","items":{"type":"object","properties":{"model":{"type":"string"},"provider":{"type":"string"},"upstream_model":{"type":"string"},"weight":{"type":["integer","null"]},"drained":{"type":"boolean"},"by":{"type":"string"},"at_ms":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"tags":["admin"]}},"/admin/route-settings/{model}/{provider}/{upstream}":{"put":{"summary":"Set a configured route's weight, or drain it (never tried), at run time","description":"Only a route the config has: nothing here adds a destination or a key. What's left out stays as set before. Draining a model's last undrained route is 409. Applies at once on this replica, within admin.orgs_cache_ms on the others.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"weight":{"type":"integer","minimum":0,"maximum":1000000,"description":"its weight instead of the config's (0: a fallback only)"},"drained":{"type":"boolean","description":"never tried while true"}}}}}},"responses":{"200":{"description":"the setting","content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string"},"provider":{"type":"string"},"upstream_model":{"type":"string"},"weight":{"type":["integer","null"]},"drained":{"type":"boolean"},"by":{"type":"string"},"at_ms":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a model's name"},{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"the route's provider, as the config names it"},{"name":"upstream","in":"path","required":true,"schema":{"type":"string"},"description":"the route's upstream model"}],"tags":["admin"]},"delete":{"summary":"Put a route back as configured","responses":{"204":{"description":"as configured"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a model's name"},{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"the route's provider, as the config names it"},{"name":"upstream","in":"path","required":true,"schema":{"type":"string"},"description":"the route's upstream model"}],"tags":["admin"]}},"/admin/providers/{name}":{"put":{"summary":"Add a provider at run time, or change one added","description":"Held to the config's own checks. Needs admin.provider_hosts and a sealing key (409 without), and a name the config doesn't use (409). With admin.nod, a person's nod of exactly this provider, kind and host (action provider.set, resource socketllm:provider:<name>?kind=<kind>&host=<host>, class deploy under admin.nod_org): 403 with the challenge otherwise, the approval (Nod-Approval) spent with the write. Applies at once on this replica, within admin.orgs_cache_ms on the others.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["kind","base_url"],"properties":{"kind":{"type":"string","enum":["openai","anthropic","azure-openai","gemini","vertex","bedrock"]},"base_url":{"type":"string","description":"https://<host>/<path>, the host on the config's admin.provider_hosts (by name, no port, user, query or fragment)"},"api_key":{"type":"string","description":"its credential: an API key; vertex: the service account's JSON key; bedrock: the AWS access key id. Kept sealed, never shown or logged; needed for a new provider and for a new host"},"first_output_s":{"type":"integer","minimum":0},"idle_s":{"type":"integer","minimum":0},"api_version":{"type":"string","description":"azure-openai only"},"retries":{"type":"integer","minimum":0,"maximum":5},"cooldown":{"type":"object","properties":{"fails":{"type":"integer"},"within_s":{"type":"integer"},"for_s":{"type":"integer"}}},"region":{"type":"string","description":"vertex's location (us-central1, global) or bedrock's region (us-east-1)"},"secret_key":{"type":"string","description":"bedrock: the AWS secret access key, with api_key"},"session_token":{"type":"string","description":"bedrock: a session token, for temporary credentials"}}}}}},"responses":{"200":{"description":"the provider (never its key)","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string"},"host":{"type":"string"},"key_held":{"type":"boolean"},"by":{"type":"string"},"at_ms":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["providers:write"]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"the provider's name (not one the config names)"}],"tags":["admin"]},"delete":{"summary":"Remove a provider added at run time, and its sealed key","description":"409 while an added route uses it, or for the config's own.","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["providers:write"]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"an added provider's name"}],"tags":["admin"]}},"/admin/added-routes/{model}/{provider}/{upstream}":{"put":{"summary":"Add a route at run time, to a configured model or a new one","description":"Through a provider the gateway has; held to the config's own checks (400 with what fails). A route the config has is 409 (its weight and draining are route settings). A new model is chat unless kind says otherwise, and its added routes agree on it. Its weight and draining are then route settings like any route's.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"weight":{"type":"integer","minimum":0,"maximum":1000000},"kind":{"type":"string","enum":["chat","embedding","rerank","image","speech","transcription"],"description":"for a new model"}}}}}},"responses":{"200":{"description":"the route","content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string"},"provider":{"type":"string"},"upstream_model":{"type":"string"},"weight":{"type":["integer","null"]},"kind":{"type":["string","null"]},"by":{"type":"string"},"at_ms":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a model's name (the config's, or a new one)"},{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"a provider the gateway has (the config's or added)"},{"name":"upstream","in":"path","required":true,"schema":{"type":"string"},"description":"the model's name at the provider"}],"tags":["admin"]},"delete":{"summary":"Remove a route added at run time","description":"409 when the model would have only drained routes left.","responses":{"204":{"description":"removed"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["routes:write"]}],"parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":"a model's name (the config's, or a new one)"},{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"a provider the gateway has (the config's or added)"},{"name":"upstream","in":"path","required":true,"schema":{"type":"string"},"description":"the model's name at the provider"}],"tags":["admin"]}},"/admin/approvals":{"get":{"summary":"What the gateway asked people to approve, and what came of it","description":"Newest first. asked: a nod-level action refused for want of a person's nod (or, for a runtime session, Nod asked by the gateway); refused: an approval that didn't pass, an approval used already, or Nod's answer was no (why); used: an approval spent with what it approved (person, agent, approved_by). Each with action, resource and summary; never a token. Kept per UTC day, written off the call's path.","parameters":[{"name":"since_ms","in":"query","required":false,"schema":{"type":"integer"},"description":"from (default: a day before until_ms)"},{"name":"until_ms","in":"query","required":false,"schema":{"type":"integer"},"description":"to (default: now); at most 31 days after since_ms"},{"name":"event","in":"query","required":false,"schema":{"type":"string","enum":["asked","refused","used"]},"description":"only these"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500},"description":"at most (default 100)"}],"responses":{"200":{"description":"{\"since_ms\", \"until_ms\", \"approvals\": [{at_ms, event, action, resource, summary, person, agent, approved_by, why}]}"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":["usage:read"]}],"tags":["admin"]}},"/admin/orgs/{org}/budgets/{period}":{"put":{"summary":"Cap all the org's keys' calls together for a day or month (an admin or owner)","description":"Beside each key's own budgets. A first budget, or a lower one, needs only the role. With nod on (admin.nod), raising a limit or dropping one needs a person's nod of exactly that: budget.raise on socketllm:org:<org>:budget:<period>?max_tokens=<n>&max_cost_micros=<n> (each empty when not set), class spend, carried in Nod-Approval and spent with the write. 409 when the budget changed between the nod and the write. The org's own body never sets budgets.","responses":{"200":{"description":"the org, with its budgets"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"409":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"max_tokens":{"type":"integer","exclusiveMinimum":0,"description":"tokens in and out, across the org's keys"},"max_cost_micros":{"type":"integer","exclusiveMinimum":0,"description":"cost in millionths of the routes' price currency"}},"description":"at least one"}}}},"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"period","in":"path","required":true,"schema":{"type":"string","enum":["day","month"]},"description":"UTC day or month"}],"tags":["orgs"]},"delete":{"summary":"Remove the org's budget for the period (an admin or owner)","description":"With nod on, a person's nod: budget.delete on socketllm:org:<org>:budget:<period>, class spend.","responses":{"200":{"description":"the org"},"401":{"$ref":"#/components/responses/Refused"},"403":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"admin":[]}],"parameters":[{"name":"org","in":"path","required":true,"schema":{"type":"string"},"description":"the org's name (one DNS label)"},{"name":"period","in":"path","required":true,"schema":{"type":"string","enum":["day","month"]},"description":"UTC day or month"}],"tags":["orgs"]}},"/v1/key":{"get":{"summary":"Your key's spend and nearest limit (OpenRouter's current key)","responses":{"200":{"description":"{data: {label, usage, usage_daily, usage_weekly, usage_monthly, limit, limit_remaining, limit_reset, socketllm_budgets}}"},"401":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"tags":["calls"]}},"/v1/generation":{"get":{"summary":"One of your key's calls (OpenRouter's generation metadata)","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{data: {id, created_at, model, provider_name, tokens…, total_cost, usage, latency, is_byok, external_user, socketllm}}"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"tags":["calls"]}},"/v1/models/{model}":{"get":{"summary":"One model you can ask for (OpenAI's retrieve model)","parameters":[{"name":"model","in":"path","required":true,"description":"the model name; it may contain slashes","schema":{"type":"string"}}],"responses":{"200":{"description":"the model, as the list says it"},"401":{"$ref":"#/components/responses/Refused"},"404":{"$ref":"#/components/responses/Refused"}},"tags":["calls"]}},"/v1/moderations":{"post":{"summary":"Moderation (OpenAI's shape)","description":"For models declared `kind: \"moderation\"` in the config, on openai-kind providers whose base serves `/moderations`; the same keys, rate limits, budgets (input tokens, estimated), usage records (`kind: \"moderations\"`), fallbacks and input guardrails (the text) as embeddings; not cached.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"a moderation model's name"},"input":{"description":"a string, up to 2,048 strings, or parts ({type: text, text} and {type: image_url, image_url: {url}})"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"responses":{"200":{"description":"`{id, model, results}`: a result for each string, one for parts together"},"400":{"description":"a bad request, or a model of another kind (`invalid_request_error`)"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key may not use that model (`permission_error`), or a budget is used up and a person's nod is needed"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"422":{"description":"blocked by an input guardrail (`guardrail_violation`, naming it)"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}},"security":[{"gatewayKey":[]},{"anthropicKey":[]}],"tags":["calls"]}},"/runtime/sessions/{session}/moderations":{"post":{"tags":["runtime"],"summary":"A session's moderation call","security":[{"gatewayKey":[]}],"parameters":[{"in":"path","name":"session","required":true,"schema":{"type":"string"}}],"description":"As `/v1/moderations` on the platform's key, with a runtime session's over-budget flow exactly as for `/runtime/sessions/{session}/chat/completions` (SocketLLM asks the session's person's nod, spends it before the call and keeps it in the session if no provider ran the call). Its `user` is that person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"a moderation model's name"},"input":{"description":"a string, up to 2,048 strings, or parts ({type: text, text} and {type: image_url, image_url: {url}})"},"user":{"type":"string","description":"the end user, for budgets and usage"}}}}}},"responses":{"200":{"description":"`{object: \"list\", results: [{index, relevance_score, document?: {text}}], model, usage: {prompt_tokens, total_tokens}}`: the most relevant first, the first `top_n`, each document's text when `return_documents` is true"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"no nod (`nod_declined`: declined or expired; `nod_refused`: Nod wouldn't ask), or the approval didn't pass"},"404":{"$ref":"#/components/responses/Refused"},"413":{"$ref":"#/components/responses/Refused"},"429":{"$ref":"#/components/responses/Refused"},"502":{"$ref":"#/components/responses/Refused"},"503":{"$ref":"#/components/responses/Refused"}}}},"/v1/batches":{"post":{"summary":"Submit a batch (OpenRouter's Batch API shape): `endpoint`, `model`, `requests` of `{custom_id, body}`, and `provider`'s `only` and `allow_fallbacks`; run by the gateway as calls of this key (`batches.keys`)","security":[{"gatewayKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["endpoint","model","requests"],"properties":{"endpoint":{"type":"string","enum":["/v1/chat/completions","/v1/responses","/v1/messages","/v1/embeddings"]},"model":{"type":"string"},"requests":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","required":["custom_id","body"],"properties":{"custom_id":{"type":"string"},"body":{"type":"object"}}}},"provider":{"type":"object","properties":{"only":{"type":"array","items":{"type":"string"}},"allow_fallbacks":{"type":"boolean"}}},"completion_window":{"type":"string","enum":["24h"]},"callback_url":{"type":"string","format":"uri","description":"https, public: a webhook (`batch.<status>`) when the batch ends"}}}}}},"responses":{"202":{"description":"the batch, `in_progress`"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"this key doesn't submit batches, or is zero-retention"},"404":{"description":"batches aren't on at this gateway"},"413":{"$ref":"#/components/responses/Refused"},"503":{"description":"batches can't be kept just now"}}},"get":{"summary":"This key's batches, newest first, without results","security":[{"gatewayKey":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"after","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"`{object: list, data, first_id, last_id, has_more}`"},"400":{"$ref":"#/components/responses/Refused"},"401":{"$ref":"#/components/responses/Refused"},"503":{"description":"batches can't be read just now"}}}},"/v1/batches/{id}":{"get":{"summary":"A batch of this key: its status and counts, and once it has ended its `results`, one per request in the order submitted","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the batch"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no batch of this key with that id"},"503":{"description":"batches can't be read just now"}}},"delete":{"summary":"An ended batch and its answers, gone","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"`{id, object: batch, deletion}`"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no batch of this key with that id"},"409":{"description":"the batch is still running; cancel it first"},"503":{"description":"batches can't be changed just now"}}}},"/v1/batches/{id}/cancel":{"post":{"summary":"Run no more of a batch: what hasn't started fails, what is running finishes","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the batch, `cancelling` or `cancelled`"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no batch of this key with that id"},"409":{"description":"the batch has ended"},"503":{"description":"batches can't be changed just now"}}}},"/v1/batches/{id}/results":{"get":{"summary":"An ended batch's answers a page at a time, in the order submitted, as OpenRouter pages them: `{object: list, data, has_more, next_cursor}`; a page holds at most `limit` rows and 4 MiB of them (at least one)","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":500}},{"name":"cursor","in":"query","required":false,"description":"the previous page's `next_cursor`","schema":{"type":"string"}}],"responses":{"200":{"description":"the page"},"400":{"description":"a `limit` outside 1 to 1000, or a cursor this batch's pages didn't give"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no batch of this key with that id"},"409":{"description":"the batch is still running"},"503":{"description":"batches can't be read just now"}}}},"/v1/builder/projects":{"post":{"tags":["calls"],"summary":"A builder project of this key (docs/builder.md): `{description, model}` → `{id, object: builder.project, model, description, created_at, version, files}`","security":[{"gatewayKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["description","model"],"properties":{"description":{"type":"string","description":"what the app is, 1 to 32 KiB"},"model":{"type":"string","description":"the chat model the builder's agent uses (one the key may use)"}}}}}},"responses":{"201":{"description":"the project"},"400":{"description":"no description or model, or too long"},"401":{"$ref":"#/components/responses/Refused"},"403":{"description":"the key may not use the model"},"404":{"description":"no such model"},"413":{"$ref":"#/components/responses/Refused"},"503":{"description":"projects can't be kept just now"}}}},"/v1/builder/projects/{id}":{"get":{"tags":["calls"],"summary":"A builder project of this key with its files: `files: [{path, content}]`","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the project"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no project of this key with that id"},"503":{"description":"projects can't be read just now"}}}},"/v1/builder/projects/{id}/messages":{"post":{"tags":["calls"],"summary":"The builder's agent's turn on a message `{text}`, as server-sent events: `message {text}`, `file {path, action, bytes}`, `error {message}`, `done {project, version, files}`","description":"The agent's model calls go through this gateway's chat door with the caller's key (its budgets, limits, guardrails and usage apply). A turn is kept whole or not at all: only `done` means its files and messages are in the project; a failed call, 24 steps without finishing, or another turn saved meanwhile is an `error` and keeps nothing.","security":[{"gatewayKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"1 to 32 KiB"}}}}}},"responses":{"200":{"description":"the turn's events (text/event-stream)"},"400":{"description":"no text, or too long"},"401":{"$ref":"#/components/responses/Refused"},"404":{"description":"no project of this key with that id"},"413":{"$ref":"#/components/responses/Refused"},"503":{"description":"projects can't be read just now"}}}},"/v1/test-runs/bundles/{token}":{"get":{"tags":["calls"],"summary":"A builder test run's files, as a tar.gz, for its Rankine job alone (docs/gateway.md, \"Test runs\")","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the project's files (`application/gzip`, a tar)"},"404":{"description":"no such bundle: a wrong token, a run that ended, or one past 15 minutes"}}}}}}