{"openapi":"3.1.0","info":{"title":"Router API","version":"0.1.0","description":"Chat Completions, stateless Responses, and Messages with automatic supply selection. User images, including this account's temporary uploads, use only compatible vision routes and never fall back to text-only supply. The full inference JSON body is limited to 2 MiB. Image requests bypass text techniques, response caching and automatic model changes; rewriting experiments return 400 incompatible_image_input. A conservative input bound above 272000 returns 400 image_input_limit; actual supplier usage determines billing. A model without image capability returns 400 unsupported_parameter; unavailable eligible vision supply returns 503 image_capacity_unavailable, or min_discount_unavailable for an unmet explicit discount. General Files APIs, documents, audio/video input and media output remain unsupported."},"servers":[{"url":"https://ai.medz.dev"}],"security":[{"BearerAuth":[]}],"paths":{"/v1/uploads":{"post":{"summary":"Upload one temporary image","description":"Requires inference scope or a same-origin browser session. Accepts exactly one multipart file, PNG/JPEG/WebP/GIF with matching MIME and magic signature, 1 byte to 10 MiB; multipart envelope at most 10 MiB plus 64 KiB. New uploads expire one hour after admission; earlier uploads retain their recorded expiry. Router quotas: 32 retained objects and 64 MiB per account including pending writes and queued deletions. Rolling limits are 20 admitted uploads per minute and 120 per day, including admitted storage failures. Tombstones remain for 24 hours after physical removal, so deletion does not reset rate counters. Account ZDR returns 403 data_protection_restriction. Uploading makes no supplier inference call. This is not a vendor Files API.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"x-required-scope":"inference","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"additionalProperties":false,"properties":{"file":{"type":"string","format":"binary","description":"One image file, at most 10485760 bytes."}}},"encoding":{"file":{"contentType":"image/png, image/jpeg, image/webp, image/gif"}}}}},"responses":{"201":{"description":"A temporary image owned by this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Upload"}}}},"400":{"description":"invalid_upload: malformed multipart or not exactly one file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope/origin denial or data_protection_restriction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"upload_too_large: empty file, oversized file or multipart envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"invalid_content_type or unsupported_file_type: MIME and image signature must agree.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"upload_rate_limit or upload_quota_exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"uploads_unavailable: missing configuration or temporary storage failure.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/uploads/{id}":{"delete":{"summary":"Delete your temporary image","description":"Requires inference scope or a same-origin browser session. Invalid, unknown, foreign, expired and deleted IDs return 404. Deletion remains authorized under account ZDR, though files already scheduled for deletion are unavailable. Deletion blocks new image reads; physical removal is asynchronous. Bytes already downloaded by a provider cannot be recalled.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"x-required-scope":"inference","parameters":[{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UploadId"}}],"responses":{"204":{"description":"Deleted. No response body."},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/data-protection":{"get":{"summary":"Read account data protection","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataProtection"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","description":"Requires account:read for an API key, or a signed-in session. No-store."},"patch":{"summary":"Set account data protection","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataProtectionUpdate"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataProtection"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Requires a same-origin signed-in browser session. A valid API key returns 403 session_required. Only zero_data_retention:boolean is accepted; invalid settings return 400 invalid_data_protection. Enabling blocks new inference without verified ZDR supply, even if request zdr is false; blocks new uploads and uploaded-image access; clears existing exact-response cache and schedules uploads for deletion. Saved experiment prompts and browser drafts remain. Already sent supplier requests cannot be recalled."}},"/v1/docs":{"get":{"summary":"Browse or search documentation section overviews","description":"Requires a valid API key, with no additional scope or wallet balance. Without q, returns section metadata without bodies; q returns matching overview paragraphs also rendered at /docs. Interactive examples and detailed field tables remain on the linked page.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"parameters":[{"name":"q","in":"query","schema":{"type":"string","maxLength":500}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":10,"default":4},"description":"Ignored without q."}],"responses":{"200":{"description":"Ordered section metadata and matching overview text.","content":{"application/json":{"schema":{"type":"object","required":["object","query","data"],"properties":{"object":{"const":"list"},"query":{"type":["string","null"]},"data":{"type":"array","items":{"type":"object","required":["id","title","category","url"],"properties":{"id":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"url":{"type":"string","format":"uri"},"body":{"type":"string"}}}}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/completions":{"post":{"summary":"Create a legacy text completion","x-required-scope":"inference","description":"Adapts one text prompt to the shared Chat gateway with the same authentication, pricing, retries and single settlement. Returns text_completion choices with text and optional prompt echo, including SSE. Token IDs, multiple prompts or samples, legacy logprobs and suffix insertion are unsupported. Request history records the underlying chat protocol.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"parameters":[{"name":"X-CI-Experiment","in":"header","schema":{"type":"string"},"description":"Your experiment slug. Running experiments assign a variant; promoted experiments use the winner. Draft, paused or completed experiments leave the request unchanged. Unknown or foreign slugs return 404."},{"name":"X-CI-End-User","in":"header","schema":{"type":"string","maxLength":200},"description":"A stable non-sensitive identifier; required for sticky assignment."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]},"stream":{"type":"boolean","default":false},"temperature":{"type":"number","minimum":0,"maximum":2},"min_discount_percent":{"type":"number","minimum":0,"maximum":99.99,"description":"Minimum savings against the verified official price, independently for input and output. An explicit requirement without a known list price returns 400 list_price_unknown. No matching supply returns 503. Without this field, an unknown list price uses configured customer rates with no claimed discount."},"zdr":{"type":"boolean","default":false,"description":"Requires a verified zero data retention route. Adds to the account restriction; false cannot override an enabled account setting. No such route is currently configured, so effective ZDR returns 503 zdr_capacity_unavailable."},"prompt":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":1,"items":{"type":"string"}}]},"max_tokens":{"type":"integer","minimum":1,"default":128},"echo":{"type":"boolean","default":false},"n":{"type":"integer","const":1},"best_of":{"type":"integer","const":1}},"additionalProperties":true}}}},"responses":{"200":{"description":"Model output with token usage and finalized request cost. Streams emit the selected protocol’s SSE events.","content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient wallet balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API key scope, model or IP policy rejects the request, or its policy changed before reservation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate, daily request, concurrency, or key monthly budget limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/count_tokens":{"post":{"summary":"Estimate Messages input tokens locally","x-required-scope":"inference","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"description":"Free Unicode heuristic for text, system instructions and client function tools/history. Makes no supplier call, reservation or charge. max_tokens is not required. The result is not an official model tokenizer or a billing amount. Media and opaque history are unsupported.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/MessagesImagePart"},{"type":"object","not":{"required":["type"],"properties":{"type":{"enum":["image","image_url","input_image"]}}}}]}}]}}}},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]},"tools":{"type":"array","items":{"type":"object"}}}}}}},"responses":{"200":{"description":"Approximate input token count. The x-ci-token-count-estimated header is true.","content":{"application/json":{"schema":{"type":"object","required":["input_tokens"],"properties":{"input_tokens":{"type":"integer","minimum":0}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/chat/completions":{"post":{"summary":"Create a chat completion","x-required-scope":"inference","description":"Requires an API key with inference permission. Missing required permission returns 403. Each eligible route has at most two physical attempts, sharing one reservation and the original 180-second deadline. Same-route retries cover qualifying transport failures before downstream output or HTTP 404/408/409/425/429/5xx. A rejected underlying JSON-body read or SSE prebuffer read, or supplier timeout during those reads, can retry after response headers arrive; parsing, decoding, invalid stream frames, usage-validation and database failures are excluded. A valid Retry-After is honored in full only when it fits that attempt’s remaining budget, otherwise that retry is skipped. No retry occurs after a streaming response is returned, settlement begins or client cancellation. Only a valid final success is charged once.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"parameters":[{"name":"X-CI-Experiment","in":"header","schema":{"type":"string"},"description":"Your experiment slug. Running experiments assign a variant; promoted experiments use the winner. Draft, paused or completed experiments leave the request unchanged. Unknown or foreign slugs return 404."},{"name":"X-CI-End-User","in":"header","schema":{"type":"string","maxLength":200},"description":"A stable non-sensitive identifier; required for sticky assignment."},{"name":"x-ci-prompt-cache","in":"header","schema":{"type":"string","enum":["on","off","passthrough"]},"description":"Overrides the API key prompt_cache_mode (default passthrough). on leaves non-Claude models unchanged and adds automatic cache_control only when absent on a compatible native Claude Messages route; currently only claude-opus-4.8 has such a verified route. off disables routing affinity but preserves client cache_control. Automatic markers use the five-minute default. Supported Chat/Responses to Messages conversions preserve 5m markers; explicit 1h returns 400 unsupported_conversion until exact supplier alias pricing is verified. Native same-protocol 1h behavior is retained with its price dimension not independently verified. Unsupported conversion returns 400; an explicit unsatisfied discount floor retains 503 min_discount_unavailable. No cache hit or model availability is guaranteed."},{"name":"x-ci-prompt-cache-scope","in":"header","schema":{"type":"string","enum":["session","user","org"],"default":"session"},"description":"Isolates the routing hint by API key plus session label, responsible user, or workspace (personal account when no workspace). Workspace org scope is shared by its members. All scopes retain tenant isolation and normal pricing, health, protocol and ZDR rules."},{"name":"x-ci-prompt-cache-session","in":"header","schema":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?=.*[!-~])[ -~]+$"},"description":"Optional nonblank printable ASCII label for session-scoped affinity; omit to use the key without an additional label. Never put a secret here."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]},"stream":{"type":"boolean","default":false},"temperature":{"type":"number","minimum":0,"maximum":2},"min_discount_percent":{"type":"number","minimum":0,"maximum":99.99,"description":"Minimum savings against the verified official price, independently for input and output. An explicit requirement without a known list price returns 400 list_price_unknown. No matching supply returns 503. Without this field, an unknown list price uses configured customer rates with no claimed discount."},"zdr":{"type":"boolean","default":false,"description":"Requires a verified zero data retention route. Adds to the account restriction; false cannot override an enabled account setting. No such route is currently configured, so effective ZDR returns 503 zdr_capacity_unavailable."},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["system","developer","user","assistant","tool"]},"content":{"oneOf":[{"type":"string"},{"type":"null"},{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/ChatImagePart"},{"type":"object","not":{"required":["type"],"properties":{"type":{"enum":["image","image_url","input_image"]}}}}]}}]},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}}}}},"max_tokens":{"type":"integer","minimum":1},"max_completion_tokens":{"type":"integer","minimum":1},"tools":{"type":"array","items":{"type":"object"}},"tool_choice":{"oneOf":[{"type":"string"},{"type":"object"}]},"response_format":{"type":"object"},"thinking":{"type":"object"},"reasoning_effort":{"type":"string","description":"Equivalent to reasoning.effort. Both may be supplied only when equal; conflicts return 400. No effort default or value clamping is introduced."},"reasoning":{"type":["object","null"],"properties":{"effort":{"type":"string"}},"description":"Null is treated as omitted. On a Chat route, an explicit effort is forwarded as reasoning_effort; other reasoning fields remain intact."},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Null or an empty array imposes no stop constraint. A supplied string or nonempty array needs a compatible Chat or Messages route; it is never silently removed for a Responses route."}},"additionalProperties":true}}}},"responses":{"200":{"description":"Model output with token usage and finalized request cost. Streams emit the selected protocol’s SSE events.","headers":{"x-ci-prompt-cache-affinity":{"description":"Present when a cacheable prefix participates in routing affinity. new/hit/stale/miss describe the five-minute route preference, not supplier cache reads. A route fallback is miss; retries on the same route retain the initial result. Expired or ineligible hints are stale. A storage read failure is miss without overwriting the unknown hint.","schema":{"type":"string","enum":["new","hit","stale","miss"]}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient wallet balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API key scope, model or IP policy rejects the request, or its policy changed before reservation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate, daily request, concurrency, or key monthly budget limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/responses":{"post":{"summary":"Create a stateless response","x-required-scope":"inference","description":"Requires an API key with inference permission. Missing required permission returns 403. Each eligible route has at most two physical attempts, sharing one reservation and the original 180-second deadline. Same-route retries cover qualifying transport failures before downstream output or HTTP 404/408/409/425/429/5xx. A rejected underlying JSON-body read or SSE prebuffer read, or supplier timeout during those reads, can retry after response headers arrive; parsing, decoding, invalid stream frames, usage-validation and database failures are excluded. A valid Retry-After is honored in full only when it fits that attempt’s remaining budget, otherwise that retry is skipped. No retry occurs after a streaming response is returned, settlement begins or client cancellation. Only a valid final success is charged once.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"parameters":[{"name":"X-CI-Experiment","in":"header","schema":{"type":"string"},"description":"Your experiment slug. Running experiments assign a variant; promoted experiments use the winner. Draft, paused or completed experiments leave the request unchanged. Unknown or foreign slugs return 404."},{"name":"X-CI-End-User","in":"header","schema":{"type":"string","maxLength":200},"description":"A stable non-sensitive identifier; required for sticky assignment."},{"name":"x-ci-prompt-cache","in":"header","schema":{"type":"string","enum":["on","off","passthrough"]},"description":"Overrides the API key prompt_cache_mode (default passthrough). on leaves non-Claude models unchanged and adds automatic cache_control only when absent on a compatible native Claude Messages route; currently only claude-opus-4.8 has such a verified route. off disables routing affinity but preserves client cache_control. Automatic markers use the five-minute default. Supported Chat/Responses to Messages conversions preserve 5m markers; explicit 1h returns 400 unsupported_conversion until exact supplier alias pricing is verified. Native same-protocol 1h behavior is retained with its price dimension not independently verified. Unsupported conversion returns 400; an explicit unsatisfied discount floor retains 503 min_discount_unavailable. No cache hit or model availability is guaranteed."},{"name":"x-ci-prompt-cache-scope","in":"header","schema":{"type":"string","enum":["session","user","org"],"default":"session"},"description":"Isolates the routing hint by API key plus session label, responsible user, or workspace (personal account when no workspace). Workspace org scope is shared by its members. All scopes retain tenant isolation and normal pricing, health, protocol and ZDR rules."},{"name":"x-ci-prompt-cache-session","in":"header","schema":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?=.*[!-~])[ -~]+$"},"description":"Optional nonblank printable ASCII label for session-scoped affinity; omit to use the key without an additional label. Never put a secret here."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input","store"],"properties":{"model":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]},"stream":{"type":"boolean","default":false},"temperature":{"type":"number","minimum":0,"maximum":2},"min_discount_percent":{"type":"number","minimum":0,"maximum":99.99,"description":"Minimum savings against the verified official price, independently for input and output. An explicit requirement without a known list price returns 400 list_price_unknown. No matching supply returns 503. Without this field, an unknown list price uses configured customer rates with no claimed discount."},"zdr":{"type":"boolean","default":false,"description":"Requires a verified zero data retention route. Adds to the account restriction; false cannot override an enabled account setting. No such route is currently configured, so effective ZDR returns 503 zdr_capacity_unavailable."},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/ResponsesImagePart"},{"type":"object","not":{"required":["type"],"properties":{"type":{"enum":["image","image_url","input_image"]}}}}]}}]}}}}]},"instructions":{"type":"string"},"max_output_tokens":{"type":["integer","null"],"minimum":1,"description":"Null is treated as omitted; existing output-budget rules still apply."},"store":{"type":"boolean","const":false,"default":false},"tools":{"type":"array","items":{"type":"object"}},"reasoning":{"type":["object","null"],"properties":{"effort":{"type":"string"}},"description":"Null is treated as omitted. Explicit effort is forwarded in this nested object on a Responses route, without adding a default or clamping the value."},"reasoning_effort":{"type":"string","description":"Alias of reasoning.effort. Conflicting values return 400; equal values are accepted and normalized to reasoning.effort."}},"additionalProperties":true}}}},"responses":{"200":{"description":"Model output with token usage and finalized request cost. Streams emit the selected protocol’s SSE events.","headers":{"x-ci-prompt-cache-affinity":{"description":"Present when a cacheable prefix participates in routing affinity. new/hit/stale/miss describe the five-minute route preference, not supplier cache reads. A route fallback is miss; retries on the same route retain the initial result. Expired or ineligible hints are stale. A storage read failure is miss without overwriting the unknown hint.","schema":{"type":"string","enum":["new","hit","stale","miss"]}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient wallet balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API key scope, model or IP policy rejects the request, or its policy changed before reservation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate, daily request, concurrency, or key monthly budget limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages":{"post":{"summary":"Create a Messages response","x-required-scope":"inference","description":"Requires an API key with inference permission. Missing required permission returns 403. Each eligible route has at most two physical attempts, sharing one reservation and the original 180-second deadline. Same-route retries cover qualifying transport failures before downstream output or HTTP 404/408/409/425/429/5xx. A rejected underlying JSON-body read or SSE prebuffer read, or supplier timeout during those reads, can retry after response headers arrive; parsing, decoding, invalid stream frames, usage-validation and database failures are excluded. A valid Retry-After is honored in full only when it fits that attempt’s remaining budget, otherwise that retry is skipped. No retry occurs after a streaming response is returned, settlement begins or client cancellation. Only a valid final success is charged once.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"parameters":[{"name":"X-CI-Experiment","in":"header","schema":{"type":"string"},"description":"Your experiment slug. Running experiments assign a variant; promoted experiments use the winner. Draft, paused or completed experiments leave the request unchanged. Unknown or foreign slugs return 404."},{"name":"X-CI-End-User","in":"header","schema":{"type":"string","maxLength":200},"description":"A stable non-sensitive identifier; required for sticky assignment."},{"name":"x-ci-prompt-cache","in":"header","schema":{"type":"string","enum":["on","off","passthrough"]},"description":"Overrides the API key prompt_cache_mode (default passthrough). on leaves non-Claude models unchanged and adds automatic cache_control only when absent on a compatible native Claude Messages route; currently only claude-opus-4.8 has such a verified route. off disables routing affinity but preserves client cache_control. Automatic markers use the five-minute default. Supported Chat/Responses to Messages conversions preserve 5m markers; explicit 1h returns 400 unsupported_conversion until exact supplier alias pricing is verified. Native same-protocol 1h behavior is retained with its price dimension not independently verified. Unsupported conversion returns 400; an explicit unsatisfied discount floor retains 503 min_discount_unavailable. No cache hit or model availability is guaranteed."},{"name":"x-ci-prompt-cache-scope","in":"header","schema":{"type":"string","enum":["session","user","org"],"default":"session"},"description":"Isolates the routing hint by API key plus session label, responsible user, or workspace (personal account when no workspace). Workspace org scope is shared by its members. All scopes retain tenant isolation and normal pricing, health, protocol and ZDR rules."},{"name":"x-ci-prompt-cache-session","in":"header","schema":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?=.*[!-~])[ -~]+$"},"description":"Optional nonblank printable ASCII label for session-scoped affinity; omit to use the key without an additional label. Never put a secret here."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]},"stream":{"type":"boolean","default":false},"temperature":{"type":"number","minimum":0,"maximum":2},"min_discount_percent":{"type":"number","minimum":0,"maximum":99.99,"description":"Minimum savings against the verified official price, independently for input and output. An explicit requirement without a known list price returns 400 list_price_unknown. No matching supply returns 503. Without this field, an unknown list price uses configured customer rates with no claimed discount."},"zdr":{"type":"boolean","default":false,"description":"Requires a verified zero data retention route. Adds to the account restriction; false cannot override an enabled account setting. No such route is currently configured, so effective ZDR returns 503 zdr_capacity_unavailable."},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/MessagesImagePart"},{"type":"object","not":{"required":["type"],"properties":{"type":{"enum":["image","image_url","input_image"]}}}}]}}]}}}},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]},"max_tokens":{"type":"integer","minimum":1},"tools":{"type":"array","items":{"type":"object"}},"thinking":{"type":"object"},"stop_sequences":{"type":"array","items":{"type":"string"},"description":"An empty array imposes no stop constraint. Null is invalid. A nonempty array requires a compatible Chat or Messages route; Responses has no equivalent."}},"additionalProperties":true}}}},"responses":{"200":{"description":"Model output with token usage and finalized request cost. Streams emit the selected protocol’s SSE events.","headers":{"x-ci-prompt-cache-affinity":{"description":"Present when a cacheable prefix participates in routing affinity. new/hit/stale/miss describe the five-minute route preference, not supplier cache reads. A route fallback is miss; retries on the same route retain the initial result. Expired or ineligible hints are stale. A storage read failure is miss without overwriting the unknown hint.","schema":{"type":"string","enum":["new","hit","stale","miss"]}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient wallet balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API key scope, model or IP policy rejects the request, or its policy changed before reservation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate, daily request, concurrency, or key monthly budget limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/public/models":{"get":{"summary":"Browse the public model catalog without an API key","security":[],"description":"Returns {models: [...]} with visible models that have price-eligible configured supply. This does not guarantee current credentials, health or capacity. Only zdr=true enables the ZDR filter; no verified ZDR supply is currently configured, so that filter returns an empty list. This compatibility surface differs from the UI /api/public/models payload.","parameters":[{"name":"zdr","in":"query","schema":{"type":"boolean","default":false},"description":"Only the literal query value true enables this filter."}],"responses":{"200":{"description":"Public catalog; Cache-Control: public, max-age=0, must-revalidate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicModelCatalog"}}}},"503":{"description":"The catalog is temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCatalogError"}}}}}}},"/public/models/{model_id}":{"get":{"summary":"Read one public model without an API key","security":[],"description":"Use an exact, case-sensitive canonical ID or a listed alias. Slash-containing aliases are supported by the catch-all path and are returned with the canonical model ID. No lowercasing, whitespace trimming or inferred provider prefix is performed. Unavailable or hidden models, unknown IDs and models excluded by zdr=true return 404 with {detail: string}.","parameters":[{"name":"model_id","in":"path","required":true,"schema":{"type":"string"},"description":"Exact public ID or alias, including its slash if present."},{"name":"zdr","in":"query","schema":{"type":"boolean","default":false},"description":"Only the literal query value true enables this filter."}],"responses":{"200":{"description":"One public model; Cache-Control: public, max-age=0, must-revalidate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicModel"}}}},"404":{"description":"The model is not currently available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCatalogError"}}}},"503":{"description":"The catalog is temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCatalogError"}}}}}}},"/v1/models":{"get":{"summary":"List model IDs, prices, and verified capabilities","x-required-scope":"inference","responses":{"200":{"description":"OpenAI-style model list.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogModel"}},"pricing_version":{"type":"string","description":"SHA-256 of the returned model catalog."},"pricing_checked_at":{"type":"null"},"pricing_observed_at":{"type":"string","format":"date-time"},"pricing_updated_at":{"type":["string","null"],"format":"date-time"},"release":{"type":"integer"}}}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models/supply":{"get":{"summary":"Inspect anonymous supply for a model","x-required-scope":"inference","parameters":[{"name":"model","in":"query","required":true,"schema":{"type":"string","description":"A model ID from GET /v1/models.","examples":["deepseek-v4-flash"]}},{"name":"min_discount_percent","in":"query","schema":{"type":"number","minimum":0,"maximum":99.99}},{"name":"zdr","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Anonymous eligible supply. Provider identity and credentials are never included."},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models/compare":{"get":{"summary":"Estimate model costs for a workload","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelComparison"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"usage:read","description":"Uses configured customer catalog prices, with per-request rounding before multiplication. No inference is performed. Estimates do not reserve supply or guarantee the final route or bill. Results include anonymous supplier numbers, never internal supplier identities. Unknown or disallowed model IDs return found:false. Found results are sorted by estimated billed_usd. Responses are not cached.","parameters":[{"name":"models","in":"query","required":true,"description":"One to ten comma-separated model IDs or aliases. Repeated identical IDs are deduplicated.","schema":{"type":"string","example":"deepseek-v4-flash,deepseek-v4-pro"}},{"name":"prompt_tokens","in":"query","schema":{"type":"integer","minimum":0,"maximum":10000000,"default":0}},{"name":"completion_tokens","in":"query","schema":{"type":"integer","minimum":0,"maximum":10000000,"default":0}},{"name":"requests","in":"query","description":"Number of identical requests to estimate. A total exceeding the supported integer nano-USD range returns 400.","schema":{"type":"integer","minimum":1,"maximum":9007199254740991,"default":1}}]}},"/v1/pricing/changes":{"get":{"summary":"Read catalog changes since a timestamp","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingChanges"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"usage:read","description":"Returns the latest change per allowed model at or after since (inclusive), ordered by change time and internal pagination position. Initial observations are updated entries with null previous prices; removed models have null model/current prices. Pagination freezes the catalog version from the first page. Reuse the same since and credential/model-policy context with next_cursor; changing them returns 400. A cursor is opaque. source is configured_catalog and pricing_checked_at is null: no live supplier price check is claimed. Responses are not cached.","parameters":[{"name":"since","in":"query","required":true,"description":"Inclusive RFC 3339 timestamp with an explicit timezone, e.g. 2026-09-06T00:00:00Z.","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"cursor","in":"query","schema":{"type":"string","maxLength":2048},"description":"Opaque next_cursor from the previous page. Omit to start from the latest catalog version."}]}},"/v1/channels":{"get":{"summary":"List connected digest channels","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelList"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listChannels","x-required-scope":"account:read","description":"Lists this account’s connected Email, Slack, Discord and Telegram channels. Channels contain only this account’s personal usage, excluding workspace requests. available_events describes the nine supported optional product events; each channel’s events array is its explicitly saved selection, independent of the digest schedule. Responses are not cached."}},"/v1/channels/{channel_id}":{"get":{"summary":"Read one digest channel","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Channel"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getChannel","x-required-scope":"account:read","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Read an owned connected channel and its digest schedule. Unknown, disconnected or foreign channels are not found. No-store."},"patch":{"summary":"Update digest frequency","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelUpdateRequest"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Channel"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateChannel","x-required-scope":"account:write","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"At least one field is required; missing fields remain unchanged. events: [] is supported; any event ID is unavailable and rejects the whole update. No destination or report hour can be set here. Browser-session mutations require the same origin. No-store."}},"/v1/channels/{channel_id}/send-report":{"post":{"summary":"Send one usage digest","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelReportResponse"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Manual report admission limit reached: rate_limited.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1},"description":"Seconds until the admission limit permits another attempt."}},"content":{"application/json":{"schema":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"503":{"description":"email_unavailable or channel_unavailable when unconfigured; report_unavailable when a complete report cannot fit; report_pending while a delivery awaits retry; email_delivery_failed or report_delivery_failed after terminal delivery failure.","content":{"application/json":{"schema":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"operationId":"sendChannelReport","x-required-scope":"account:write","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Explicit external message action. Sends the previous complete UTC period for this channel’s frequency; off uses the previous day. Limited to once per channel per minute and 20 times per UTC day, including admitted no-activity and failed attempts. Reconnecting does not reset these Router limits. Manual sending does not change or consume the next scheduled digest. sent:false with a message means no activity, not a delivery failure. Unconfigured transports return 503. An unknown provider acknowledgement is not automatically resent. Browser-session mutations require the same origin. No-store."}},"/api/channels/email":{"get":{"summary":"Read email digest connection status","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelStatus"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Router workspace extension requiring a signed-in browser session. Reports configuration availability, current verified-email status and the connected channel. API keys cannot use this connection surface. No-store."},"post":{"summary":"Connect the verified account email","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelConnect"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Channel"}}}},"201":{"description":"New connection created. An already connected identical configuration returns 200.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Channel"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Email configuration unavailable.","content":{"application/json":{"schema":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"description":"Router workspace extension requiring a same-origin browser session. Explicit consent:true and a frequency are required. The destination is the current verified account email; arbitrary recipients are not accepted. Missing mail configuration returns 503 email_unavailable; unverified email returns 403 email_verification_required. Connecting does not send an immediate report. Reconnecting an existing disconnected channel returns 200. A connected channel with a different frequency returns 409 channel_already_connected; use PATCH to change it. No-store."}},"/api/channels/email/{id}":{"delete":{"summary":"Disconnect the email digest channel","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelDisconnected"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Router workspace extension requiring a same-origin browser session. Disconnects an owned channel; it cannot retract messages already submitted to the mail provider. This is not a public /v1 channel-deletion API. No-store."}},"/api/channels/{platform}":{"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","enum":["slack","discord","telegram"]}}],"get":{"summary":"Read an external report connection","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalChannelStatus"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Router browser extension for this personal account. Reports connection configuration, the owned channel and any unexpired connection pending in the current session. API keys and workspace selection cannot use this surface. Credentials are never returned. Reading does not connect or send. No-store."},"post":{"summary":"Begin an external report connection","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionRequest"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelConnectionStart"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Same-origin browser session and consent:true required. Returns a Slack/Discord authorization URL or Telegram Bot deep link. The connection is bound to this session for fifteen minutes. An existing connected channel must be disconnected before starting another connection. Authorization creates an Off schedule and never sends a report. Telegram additionally requires confirmation after the user starts the Bot. No-store."}},"/api/channels/{platform}/{id}":{"delete":{"summary":"Disconnect an external report channel","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelDisconnected"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","enum":["slack","discord","telegram"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Same-origin browser session only. Disconnects this account’s matching platform channel, removes its local credential and cancels unsent deliveries. It does not delete remote webhooks or messages. Manual report limits are preserved on reconnection. No-store."}},"/api/channels/telegram/confirm":{"post":{"summary":"Confirm the pending Telegram recipient","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramChannelConfirm"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Channel"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Same-origin browser session that began this connection, an unexpired ready flow and consent:true are required. The recipient comes from a validated private-chat Bot update; client-provided chat IDs are not accepted. Creates an Off schedule and does not send a message. No-store."}},"/v1/account":{"get":{"summary":"Read your account","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","description":"Account identity belongs to the responsible actor. Key counts and usage follow the selected workspace or personal scope; workspace technique count is zero. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}]}},"/v1/account/balance":{"get":{"summary":"Read current wallet balance and reservations","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountBalance"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","description":"Atomic wallet, available balance and in-flight reservations in USD. Workspace reads show the owner-funded shared wallet without owner personal payment settings; those fields are false or null. Personal reads show actual account payment configuration. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}]}},"/v1/billing/topup":{"post":{"summary":"Create a wallet top-up checkout","operationId":"startTopup","x-required-scope":"account:write","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"description":"Requires a valid API key with account:write; a browser session alone is insufficient. Creates a Stripe-hosted Checkout session without charging or crediting the wallet here. Amounts are USD 5–1000 with at most two decimal places; excess precision is rejected without rounding. Return URLs are owned by the server and cannot be customized. Supply an optional Idempotency-Key to retry the same top-up; without it, each HTTP request starts a fresh checkout. A credited replay returns the original persisted Stripe URL and session, which does not create another charge; use a new key for another top-up. If that completed purchase has no persisted URL/session, returns 409 checkout_completed. Responses are not cached.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":16,"maxLength":100,"pattern":"^[a-zA-Z0-9_-]{16,100}$"},"description":"Reuse for retries of the same amount and top-up intent. Omission creates a new checkout per HTTP request. Use a new key for another top-up."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopupRequest"}}}},"responses":{"200":{"description":"The hosted checkout link and session. This is not evidence of a completed payment or wallet credit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopupResponse"}}}},"400":{"description":"Invalid amount or idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API key lacks account:write or its IP policy rejects the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Idempotency conflict, expired checkout, or checkout_completed when a credited purchase lacks its persisted Stripe URL/session. Use a new key for a new top-up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many checkout attempts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Unexpected checkout response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"payments_unavailable until payment configuration is present, or checkout_unavailable when Stripe checkout cannot be reached or created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/account/usage":{"get":{"summary":"Summarize account usage and recorded price savings","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUsage"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","description":"A trailing window of days times 24 hours, with an inclusive start and exclusive end. Costs use settled ledger entries. New requests capture the effective model’s published standard input/output quote; historical missing quotes are not reconstructed. If any settled request lacks a baseline, list/saved totals and percent are null. Exact-cache hits have zero new tokens and zero baseline; no hypothetical optimization savings are inferred. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90,"default":7},"description":"Supply once as an integer."}]}},"/v1/account/savings":{"get":{"summary":"Read account savings, experiments and technique state","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSavings"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","description":"Trailing 24-hour, 7-day and 30-day windows sharing one exclusive end; actual personal experiment economics and account technique state. Workspace reads exclude personal experiments and have all techniques disabled. Standard list-price differences do not establish causal savings from a technique or changed model. Unknown baselines remain null. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}]}},"/v1/keys":{"get":{"summary":"List API key prefixes and policies","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeySummary"}}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:read","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."},{"name":"include_revoked","in":"query","schema":{"type":"boolean","default":false}}]},"post":{"summary":"Create an API key","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreateRequest"}}}},"responses":{"201":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:write","description":"Returns the plaintext key once. A personal API-key caller may grant only a subset of its own scopes and may create keys only without policy restrictions. Creating workspace keys requires a same-origin session; the owner may assign an active member, while a member may create only their own keys. Keys cannot change workspace or responsible member. Workspace requests use the owner wallet and the member UTC monthly allowance, including pending reservations, as well as key limits."}},"/v1/keys/{key_id}":{"delete":{"summary":"Revoke an API key","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"api_key.revoked"},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"account:write","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}],"description":"The next authentication with a revoked key fails. Personal API keys may self-revoke; workspace key revocation requires a same-origin session. Members can revoke only their own workspace keys; the owner can revoke workspace member keys. Already reserved requests may still settle."}},"/api/keys":{"get":{"parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}],"x-required-scope":"account:read","summary":"Read keys in the signed-in workspace","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/DashboardApiKey"}}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"x-required-scope":"account:write","summary":"Create a key in the signed-in workspace","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreateRequest"}}}},"responses":{"201":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/DashboardApiKey"},"token":{"type":"string","description":"Plaintext secret returned only on creation."}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/keys/{id}":{"patch":{"summary":"Edit an existing key policy","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyUpdateRequest"}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/DashboardApiKey"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}],"description":"Requires a signed-in browser session and matching Origin. Only included fields change. Arrays [] remove restrictions; numeric limits and expiry null clear them. Never returns the secret."},"delete":{"x-required-scope":"account:write","summary":"Revoke a key in the signed-in workspace","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}]}},"/v1/techniques":{"get":{"x-required-scope":"account:read","summary":"Read account technique controls","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Technique"}}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/techniques/{id}":{"patch":{"x-required-scope":"account:write","summary":"Enable or disable one account technique","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["enabled"],"properties":{"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"technique"},"id":{"type":"string"},"name":{"type":"string"},"enabled":{"type":"boolean"},"changed":{"type":"boolean"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","enum":["concise-output","context-window-trim","duplicate-message-collapse","exact-cache","json-minify","output-token-budget","model-routing","whitespace-normalization"]}}],"description":"Session requests require same origin. All techniques default off. Explicit experiment selections override the account setting. Disabling exact-cache clears existing entries but active experiments enabling it can create new entries."}},"/v1/experiments":{"get":{"x-required-scope":"account:read","summary":"Read your experiment summaries","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ExperimentSummary"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/experiments/{id}":{"get":{"x-required-scope":"account:read","summary":"Read an experiment and observed results","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"API-key views omit full saved system prompts and include a 300-character preview."}},"/v1/feedback":{"post":{"x-required-scope":"inference","summary":"Record quality feedback","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request_id","score"],"properties":{"request_id":{"type":"string","maxLength":100},"score":{"type":"integer","minimum":1,"maximum":5},"comment":{"type":["string","null"],"maxLength":2000}},"description":"Only an owned successful request can be scored. Resubmitting replaces its prior score and comment."}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."}],"description":"Score your own successful request. Session callers select organization_id for team requests; API keys retain their assigned workspace and require inference scope. Owner funding does not grant permission to score another member. Personal mode excludes all workspace requests. Replacing a rating does not change billing."}},"/api/experiments":{"get":{"summary":"List experiments in the signed-in workspace","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ExperimentSummary"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a draft experiment","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExperimentConfiguration"}}}},"responses":{"201":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/experiments/{id}":{"get":{"summary":"Read full experiment configuration","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"patch":{"summary":"Replace a draft configuration","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ExperimentConfiguration"},{"type":"object","required":["version"],"properties":{"version":{"type":"integer","minimum":1}}}]}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Draft only. Requires same origin and the current version. Stale updates return 409."},"delete":{"summary":"Delete an unused draft","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Only drafts without recorded requests. Requires same origin."}},"/api/experiments/{id}/start":{"post":{"summary":"Start a draft or paused experiment","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Requires a signed-in session and same-origin request."}},"/api/experiments/{id}/pause":{"post":{"summary":"Pause a running experiment","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Requires a signed-in session and same-origin request."}},"/api/experiments/{id}/complete":{"post":{"summary":"Complete a running or paused experiment","security":[{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Requires a signed-in session and same-origin request."}},"/api/experiments/{id}/promote":{"post":{"summary":"Promote one variant of a running, paused or completed experiment","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Experiment"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"description":"Requires a signed-in session and same-origin request."}},"/api/experiments/feedback":{"post":{"summary":"Record feedback in the signed-in personal account","security":[{"SessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request_id","score"],"properties":{"request_id":{"type":"string","maxLength":100},"score":{"type":"integer","minimum":1,"maximum":5},"comment":{"type":["string","null"],"maxLength":2000}},"description":"Only an owned successful request can be scored. Resubmitting replaces its prior score and comment."}}}},"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}}}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/usage":{"get":{"summary":"List your request history (alias of /v1/usage/requests)","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageRequestList"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"usage:read","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."},{"name":"start_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Inclusive lower bound. A timestamp without an offset is interpreted as UTC."},{"name":"end_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Exclusive upper bound."},{"name":"api_key_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Filter to a key belonging to this account, including a revoked key. An unknown or foreign key returns 404."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Opaque cursor from the previous page. Keep the same account, date bounds and key filter while paging."}]}},"/v1/usage/requests":{"get":{"summary":"List your request history","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageRequestList"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"usage:read","description":"Requires usage:read. Newest first, with stable pagination bounds. Unsettled requests have no paid amount; supplier identity and unrecorded pricing comparisons remain null. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."},{"name":"start_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Inclusive lower bound. A timestamp without an offset is interpreted as UTC."},{"name":"end_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Exclusive upper bound."},{"name":"api_key_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Filter to a key belonging to this account, including a revoked key. An unknown or foreign key returns 404."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Opaque cursor from the previous page. Keep the same account, date bounds and key filter while paging."}]}},"/v1/usage/daily":{"get":{"summary":"Daily account usage","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]},{"SessionAuth":[]}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageDaily"}}}},"400":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-required-scope":"usage:read","description":"Requires usage:read. Defaults to 30 calendar days and fills missing calendar days with zeros. The duration cannot exceed 366 days (at most 367 partial/full calendar buckets). Only settled ledger entries contribute to spend. Unknown upstream cache reporting remains unknown. Responses are not cached.","parameters":[{"name":"organization_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Select an accessible workspace for a signed-in session. Omit for personal data. An API key is fixed to its assigned workspace and cannot switch scope."},{"name":"start_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Inclusive lower bound. A timestamp without an offset is interpreted as UTC."},{"name":"end_at","in":"query","schema":{"type":"string","format":"date-time"},"description":"Exclusive upper bound."},{"name":"api_key_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Filter to a key belonging to this account, including a revoked key. An unknown or foreign key returns 404."},{"name":"timezone_offset_minutes","in":"query","schema":{"type":"integer","minimum":-840,"maximum":840,"default":0},"description":"Fixed minutes east of UTC used to group calendar days."},{"name":"start","in":"query","deprecated":true,"schema":{"type":"string","format":"date"},"description":"Legacy inclusive UTC date. Cannot be mixed with start_at/end_at."},{"name":"end","in":"query","deprecated":true,"schema":{"type":"string","format":"date"},"description":"Legacy inclusive UTC date. Cannot be mixed with start_at/end_at."}]}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Router API key","description":"Keys carry permissions. New keys default to inference and usage:read; account:read and account:write are optional controls in the dashboard. See each operation’s x-required-scope. Missing permission returns 403."},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"},"SessionAuth":{"type":"apiKey","in":"cookie","name":"router_session","description":"Browser session. Mutations require a matching Origin header."}},"schemas":{"UploadId":{"type":"string","pattern":"^rtr_upload_[a-f0-9]{32}$","description":"An unexpired image ID created by this Router account; not a vendor file ID."},"Upload":{"type":"object","required":["id","bytes","content_type","expires_at"],"properties":{"id":{"$ref":"#/components/schemas/UploadId"},"bytes":{"type":"integer","minimum":1,"maximum":10485760},"content_type":{"type":"string","enum":["image/png","image/jpeg","image/webp","image/gif"]},"expires_at":{"type":"string","format":"date-time","description":"One hour after admission for new uploads; earlier uploads retain their recorded expiry. Logical expiry blocks new reads before asynchronous physical cleanup."}}},"DataProtection":{"type":"object","required":["zero_data_retention","updated_at","verified_zdr_capacity"],"properties":{"zero_data_retention":{"type":"boolean"},"updated_at":{"type":["string","null"],"format":"date-time"},"verified_zdr_capacity":{"const":false}}},"DataProtectionUpdate":{"type":"object","required":["zero_data_retention"],"additionalProperties":false,"properties":{"zero_data_retention":{"type":"boolean"}}},"UsageRequestList":{"type":"object","required":["object","scope","data","has_more","next_cursor"],"properties":{"object":{"const":"list"},"scope":{"const":"workspace","description":"The authorized scope: an API key has a fixed workspace, while a signed-in session can select organization_id. Personal reads include only personal requests; shared reads include only that workspace. Cursors and API key filters cannot cross scopes."},"data":{"type":"array","items":{"$ref":"#/components/schemas/UsageRequest"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"Channel":{"type":"object","required":["object","id","platform","workspace_name","integration_active","events","report_frequency","report_hour"],"properties":{"object":{"const":"channel"},"id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["email","slack","discord","telegram"]},"workspace_name":{"type":["string","null"],"description":"Display name of the external destination when available; not a Router workspace identifier. Email uses null."},"integration_active":{"type":"boolean","description":"The connected transport has its required configuration. Email also requires this account’s matching verified address. This is not a live provider health or delivery check."},"events":{"type":"array","maxItems":9,"uniqueItems":true,"items":{"type":"string","enum":["experiment.started","experiment.paused","experiment.resumed","experiment.completed","experiment.winner_promoted","spend.anomaly","technique.available","technique.enabled","technique.disabled"]},"description":"Explicitly saved optional product events. New and reconnected channels default to []; report_frequency: off does not disable these events."},"report_frequency":{"type":"string","enum":["daily","weekly","monthly","off"]},"report_hour":{"type":"integer","const":0,"description":"UTC hour. Scheduled digests become due at 00:05 and are checked by the five-minute scheduler."}}},"ChannelEvent":{"type":"object","required":["id","name","description"],"properties":{"id":{"type":"string","enum":["experiment.started","experiment.paused","experiment.resumed","experiment.completed","experiment.winner_promoted","spend.anomaly","technique.available","technique.enabled","technique.disabled"]},"name":{"type":"string"},"description":{"type":"string"}}},"ChannelList":{"type":"object","required":["object","data","available_events"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"available_events":{"type":"array","maxItems":9,"items":{"$ref":"#/components/schemas/ChannelEvent"},"description":"Supported event IDs, display names and descriptions. Listing these options never subscribes a channel."}}},"ChannelUpdateRequest":{"type":"object","additionalProperties":false,"minProperties":1,"description":"Only present fields change. Events and digest frequency are independent. Empty events unsubscribes from optional events; unknown or repeated IDs reject the whole update. Saving preferences does not send or replay an event.","properties":{"report_frequency":{"type":"string","enum":["daily","weekly","monthly","off"]},"events":{"type":"array","maxItems":9,"uniqueItems":true,"items":{"type":"string","enum":["experiment.started","experiment.paused","experiment.resumed","experiment.completed","experiment.winner_promoted","spend.anomaly","technique.available","technique.enabled","technique.disabled"]},"description":"Explicitly saved optional product events. New and reconnected channels default to []; report_frequency: off does not disable these events."}}},"ChannelReportResponse":{"type":"object","required":["object","sent","cadence","window_label"],"properties":{"object":{"const":"channel.report"},"sent":{"type":"boolean","description":"True means the message provider accepted the submission, not confirmed receipt or reading by a person. False with message means the completed period had no activity."},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"window_label":{"type":"string"},"message":{"type":"string"}}},"EmailChannelStatus":{"type":"object","required":["available","email_verified","email","channel"],"properties":{"available":{"type":"boolean","description":"Mail configuration is present; not a live provider check."},"email_verified":{"type":"boolean"},"email":{"type":"string","format":"email"},"channel":{"anyOf":[{"$ref":"#/components/schemas/Channel"},{"type":"null"}]}}},"EmailChannelConnect":{"type":"object","additionalProperties":false,"required":["consent","report_frequency"],"properties":{"consent":{"const":true},"report_frequency":{"type":"string","enum":["daily","weekly","monthly","off"]}}},"ExternalChannelStatus":{"type":"object","required":["available","channel"],"properties":{"available":{"type":"boolean","description":"Configuration needed to start a connection is present; not a live provider check. Existing channel sending availability is integration_active."},"channel":{"anyOf":[{"$ref":"#/components/schemas/Channel"},{"type":"null"}]},"pending":{"anyOf":[{"$ref":"#/components/schemas/PendingChannelConnection"},{"type":"null"}]}}},"PendingChannelConnection":{"type":"object","required":["flow_id","expires_at","ready"],"properties":{"flow_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"expires_at":{"type":"string","format":"date-time"},"ready":{"type":"boolean"},"target_name":{"type":["string","null"]},"connect_url":{"type":"string","format":"uri"}}},"ChannelConnectionRequest":{"type":"object","additionalProperties":false,"required":["consent","return_to"],"properties":{"consent":{"const":true},"return_to":{"type":"string","enum":["/dashboard/reports","/dashboard/notifications"]}}},"ChannelConnectionStart":{"type":"object","required":["url","flow_id","expires_at"],"properties":{"url":{"type":"string","format":"uri"},"flow_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"expires_at":{"type":"string","format":"date-time"}}},"TelegramChannelConfirm":{"type":"object","additionalProperties":false,"required":["flow_id","consent"],"properties":{"flow_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"consent":{"const":true}}},"ChannelDisconnected":{"type":"object","required":["object","id"],"properties":{"object":{"const":"channel.disconnected"},"id":{"type":"string","format":"uuid"}}},"UsageRequest":{"type":"object","required":["request_id","model","endpoint","status","currency","created_at"],"properties":{"request_id":{"type":"string","pattern":"^req_[a-f0-9]{32}$"},"can_feedback":{"type":"boolean","description":"Successful request owned by the current actor in the authorized personal or team context. No actor identity is exposed; the write endpoint rechecks membership and API-key permission."},"api_key_id":{"type":["string","null"],"format":"uuid"},"api_key_name":{"type":["string","null"]},"model":{"type":"string"},"endpoint":{"type":"string"},"status":{"type":"string","enum":["settled","cached","failed","pending"]},"prompt_tokens":{"type":["integer","null"]},"completion_tokens":{"type":["integer","null"]},"total_tokens":{"type":["integer","null"]},"billed_cost_usd":{"type":["string","null"],"description":"Exact ledger charge, or null without a settled usage entry."},"paid_amount_usd":{"type":["string","null"]},"provider_list_price_usd":{"type":["string","null"],"description":"Exact benchmark for settled actual tokens using the effective model’s captured standard input/output quote. Historical requests without a recorded quote remain null."},"savings_usd":{"type":["string","null"],"description":"Exact signed list-price amount minus the settled ledger charge."},"route":{"type":"null","deprecated":true},"serving_provider":{"type":"null","deprecated":true},"pricing_basis":{"type":["string","null"]},"pricing_snapshot":{"anyOf":[{"$ref":"#/components/schemas/RequestPricing"},{"type":"null"}]},"pricing_version":{"type":"null"},"customer_price_ceiling_usd":{"type":"null"},"maker_list_ceiling_usd":{"type":"null"},"requested_reasoning_effort":{"type":"null"},"effective_reasoning_effort":{"type":"null"},"time_to_response_headers_ms":{"type":"null"},"model_time_to_response_headers_ms":{"type":"null"},"time_to_first_visible_output_ms":{"type":"null","description":"Current TTFT includes reasoning, so it is not claimed as visible-output timing."},"model_time_to_first_visible_output_ms":{"type":"null"},"routing_overhead_ms":{"type":"null"},"provider_attempt_count":{"type":"integer"},"cache_reporting_state":{"type":["string","null"],"enum":["hit","zero","unknown","not_applicable",null],"description":"For settled supplier requests, a positive cache-read count is hit, an explicitly reported zero is zero, and absent read reporting is unknown. Historical positive counts prove a hit; historical zero alone does not prove a reported zero. Platform exact-cache hits are not_applicable; unsettled requests are null."},"currency":{"const":"USD"},"total_latency_ms":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"cache_read_input_tokens":{"type":["integer","null"],"description":"Reported supplier cache-read tokens, retaining an explicit zero; null when unknown or not applicable."},"cache_write_input_tokens":{"type":["integer","null"],"description":"Reported supplier cache-write tokens, retaining an explicit zero; null when unknown or not applicable. Write reporting does not establish cache-read reporting."},"image_output_tokens":{"type":"null"},"time_to_first_token_ms":{"type":"null"},"model_latency_ms":{"type":"null"},"model_time_to_first_token_ms":{"type":"null"},"generation_duration_ms":{"type":"null"},"output_tokens_per_second":{"type":"null"},"id":{"type":"string","deprecated":true,"description":"Alias of request_id."},"protocol":{"type":"string"},"input_tokens":{"type":["integer","null"]},"output_tokens":{"type":["integer","null"]},"cached_tokens":{"type":["integer","null"]},"cache_write_tokens":{"type":["integer","null"]},"reasoning_tokens":{"type":["integer","null"]},"latency_ms":{"type":["integer","null"]},"ttft_ms":{"type":["integer","null"]},"error_code":{"type":["string","null"]}}},"UsageDailyRow":{"type":"object","required":["date","request_count","settled_request_count","spend_usd","prompt_tokens","cached_tokens","cache_reported_request_count","cache_hit_pct"],"properties":{"date":{"type":"string","format":"date"},"request_count":{"type":"integer"},"settled_request_count":{"type":"integer"},"failed_request_count":{"type":"integer"},"pending_request_count":{"type":"integer"},"spend_usd":{"type":"string"},"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"cached_tokens":{"type":"integer"},"cache_reported_request_count":{"type":"integer","description":"Settled supplier requests with proven cache-read reporting, including explicit zero reads. Excludes platform exact-cache hits and requests with unknown read reporting."},"cache_hit_pct":{"type":["number","null"],"description":"Percentage of prompt tokens served from supplier cache among settled supplier requests with proven cache-read reporting, including explicit zero reads. Platform exact-cache hits and requests without read-reporting evidence are excluded; null when no eligible prompt tokens are recorded."}}},"UsageDaily":{"type":"object","required":["object","scope","currency","spend_usd","prompt_tokens","cached_tokens","cache_reported_request_count","cache_hit_pct","daily_spend"],"properties":{"object":{"const":"usage.daily"},"scope":{"const":"workspace","description":"The authenticated personal account in this deployment."},"currency":{"const":"USD"},"start_at":{"type":"string","format":"date-time"},"end_at":{"type":"string","format":"date-time"},"timezone_offset_minutes":{"type":"integer","minimum":-840,"maximum":840},"total_requests":{"type":"integer"},"settled_requests":{"type":"integer"},"failed_requests":{"type":"integer"},"pending_requests":{"type":"integer"},"spend_usd":{"type":"string"},"prompt_tokens":{"type":"integer","description":"Input tokens from requests with a settled usage ledger entry; includes upstream cached tokens."},"completion_tokens":{"type":"integer"},"cached_tokens":{"type":"integer"},"cache_reported_request_count":{"type":"integer","description":"Settled supplier requests with proven cache-read reporting, including explicitly reported zero or historical positive counts. Platform exact-cache hits and historical zero without reporting evidence are excluded."},"cache_hit_pct":{"type":["number","null"],"description":"Percentage of prompt tokens served from supplier cache among settled supplier requests with proven cache-read reporting, including explicit zero reads. Platform exact-cache hits and requests without read-reporting evidence are excluded; null when no eligible prompt tokens are recorded."},"daily_spend":{"type":"array","items":{"$ref":"#/components/schemas/UsageDailyRow"}},"data":{"type":"array","deprecated":true,"description":"Legacy daily rows retained for existing clients.","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"requests":{"type":"integer"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"billed_cost_usd":{"type":"string"}}}}}},"PublicModelCatalog":{"type":"object","required":["models"],"properties":{"models":{"type":"array","items":{"$ref":"#/components/schemas/PublicModel"}}}},"PublicCatalogError":{"type":"object","required":["detail"],"properties":{"detail":{"type":"string"}}},"PublicModel":{"type":"object","description":"Public compatibility DTO with decimal USD-per-million prices and no serving-supplier identities or route table. Unknown reference prices remain null. Only this compatibility surface serializes an unknown discount as 0.00; it is not evidence of a verified zero discount. The UI /api/public/models surface retains null for unknown discount.","required":["id","context_length","max_output_tokens","aliases","model_type","input_per_million","output_per_million","cache_read_per_million","cache_write_per_million","reference_input_per_million","reference_output_per_million","reference_cache_read_per_million","reference_source_url","reference_price_note","reference_cache_write_per_million","discount_percent","provider_name","is_visible","supports_vision","supports_video","supports_streaming","supports_image_edit","is_free","zero_data_retention","zero_data_retention_route"],"properties":{"id":{"type":"string"},"context_length":{"type":"integer"},"max_output_tokens":{"type":"integer"},"aliases":{"type":"array","items":{"type":"string"}},"model_type":{"const":"text"},"input_per_million":{"type":"string"},"output_per_million":{"type":"string"},"cache_read_per_million":{"type":"string"},"cache_write_per_million":{"type":"string"},"reference_input_per_million":{"type":["string","null"]},"reference_output_per_million":{"type":["string","null"]},"reference_cache_read_per_million":{"type":["string","null"],"description":"Verified model-maker cache-read price in USD per million tokens at the current pricing period. Null when no current cache-read reference is verified. This catalog comparison does not change settled billing or historical request savings."},"reference_cache_write_per_million":{"type":"null"},"reference_source_url":{"type":["string","null"],"format":"uri","description":"Official maker pricing source, never a serving supplier."},"reference_price_note":{"type":["string","null"],"description":"Applicable context, time-period and promotion scope of the list comparison. Null without a current reference."},"discount_percent":{"type":"string","description":"Signed decimal percentage. 0.00 is also the compatibility fallback when reference prices are null; do not treat that case as a known discount."},"provider_name":{"type":"string","description":"Model maker, not the serving supplier."},"is_visible":{"const":true},"supports_vision":{"type":"boolean","description":"At least one configured image-capable route is price-eligible; admission still checks credentials, health and request compatibility."},"supports_video":{"const":false},"supports_reasoning":{"type":"boolean","description":"Omitted when reasoning capability is unverified; absence does not mean false."},"reasoning_capability_mode":{"type":"string","enum":["auto"],"description":"Only emitted with the currently verified reasoning declaration; omitted when unknown."},"supports_streaming":{"const":true},"supports_image_edit":{"const":false},"is_free":{"const":false},"zero_data_retention":{"const":false},"zero_data_retention_route":{"type":"null"}}},"CatalogModel":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"const":0},"owned_by":{"type":"string","description":"Model maker, not an internal serving supplier."},"type":{"type":"string"},"aliases":{"type":"array","items":{"type":"string"}},"context_length":{"type":"integer"},"max_output_tokens":{"type":"integer"},"capabilities":{"type":"object","properties":{"streaming":{"const":true},"vision":{"type":"boolean","description":"At least one configured image-capable route meets the current price ceiling. Actual credentials, health and request constraints are still checked at admission. Anonymous route supports_vision is capability only, separate from its eligible price flag."},"reasoning":{"type":["boolean","null"]}}},"pricing":{"type":"object","description":"Decimal strings in USD per million tokens.","properties":{"currency":{"const":"USD"},"input_per_million":{"type":"string"},"output_per_million":{"type":"string"},"cache_read_input_per_million":{"type":"string"},"cache_write_input_per_million":{"type":"string"},"list_input_per_million":{"type":["string","null"]},"list_output_per_million":{"type":["string","null"]}}}}},"ImageReference":{"type":"string","pattern":"^(?:https?://|data:image/(?:png|jpeg|webp|gif);base64,)","description":"A complete HTTP(S) URL with a hostname and no credentials, whitespace or control characters, or a canonical padded base64 data URL labelled PNG, JPEG, WebP or GIF. Router does not download external image URLs or validate their decoded image format/animation; the provider validates the image. Temporary image handles are described separately. The entire inference JSON request, including encoded image data, is limited to 2 MiB."},"ImageDetail":{"type":"string","enum":["low","high","auto","original"],"description":"Chat and Responses preserve this value. Omission uses auto for reservation. Messages has no equivalent, so conversion to Messages rejects any explicit detail."},"ChatImagePart":{"type":"object","required":["type","image_url"],"description":"Only in ordinary user message content. Images nested inside tool results or non-user messages are unsupported. Additional native fields require a route using the same protocol and cannot be silently converted.","properties":{"type":{"const":"image_url"},"image_url":{"type":"object","required":["url"],"properties":{"url":{"oneOf":[{"$ref":"#/components/schemas/ImageReference"},{"type":"string","pattern":"^router-upload://rtr_upload_[a-f0-9]{32}$","description":"Router extension for an image owned by this account; resolved locally before forwarding."}]},"detail":{"$ref":"#/components/schemas/ImageDetail"}}}},"oneOf":[{"properties":{"image_url":{"properties":{"url":{"$ref":"#/components/schemas/ImageReference"}}}}},{"properties":{"type":{"const":"image_url"},"image_url":{"type":"object","required":["url"],"properties":{"url":{"type":"string","pattern":"^router-upload://rtr_upload_[a-f0-9]{32}$"},"detail":{"$ref":"#/components/schemas/ImageDetail"}},"additionalProperties":false}},"additionalProperties":false}]},"ResponsesImagePart":{"type":"object","required":["type"],"description":"Only in ordinary user input message content. Choose one raw image_url or an owned Router upload file_id. Vendor file IDs are not accepted. Additional native fields are not automatically portable to another protocol.","properties":{"type":{"const":"input_image"},"image_url":{"anyOf":[{"$ref":"#/components/schemas/ImageReference"},{"type":"null"}]},"detail":{"$ref":"#/components/schemas/ImageDetail"},"file_id":{"anyOf":[{"$ref":"#/components/schemas/UploadId"},{"type":"null"}]}},"oneOf":[{"required":["image_url"],"properties":{"image_url":{"$ref":"#/components/schemas/ImageReference"},"file_id":{"type":"null"}}},{"required":["file_id"],"properties":{"type":{"const":"input_image"},"image_url":{"type":"null"},"file_id":{"$ref":"#/components/schemas/UploadId"},"detail":{"$ref":"#/components/schemas/ImageDetail"}},"additionalProperties":false}]},"MessagesImagePart":{"type":"object","required":["type","source"],"description":"Only in ordinary user content, not inside tool_result. Text tool-result siblings remain supported. There is no detail field; omission uses auto for reservation. Additional native fields cannot be silently converted.","properties":{"type":{"const":"image"},"source":{"oneOf":[{"type":"object","required":["type","url"],"properties":{"type":{"const":"url"},"url":{"type":"string","format":"uri","pattern":"^https?://","description":"Complete HTTP(S) URL without credentials, whitespace or control characters. Inline data belongs in a base64 source, not a URL source."}},"not":{"anyOf":[{"required":["data"]},{"required":["media_type"]}]}},{"type":"object","required":["type","media_type","data"],"properties":{"type":{"const":"base64"},"media_type":{"type":"string","enum":["image/png","image/jpeg","image/webp","image/gif"]},"data":{"type":"string","minLength":1,"description":"Canonical base64 payload without a data-URL prefix; no whitespace. Decoded image validity is checked by the provider."}},"not":{"required":["url"]}},{"type":"object","required":["type","file_id"],"properties":{"type":{"const":"file"},"file_id":{"$ref":"#/components/schemas/UploadId"}},"additionalProperties":false}]}},"not":{"required":["detail"]},"allOf":[{"if":{"properties":{"source":{"properties":{"type":{"const":"file"}}}}},"then":{"properties":{"type":{"const":"image"},"source":{}},"additionalProperties":false}}]},"ChangedPricing":{"type":"object","properties":{"input_per_million":{"type":["string","null"]},"output_per_million":{"type":["string","null"]},"media_unit_price":{"type":"null"}}},"PricingChanges":{"type":"object","properties":{"object":{"const":"list"},"pricing_version":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$","description":"Hash of the allowed model catalog at the frozen pagination version."},"pricing_checked_at":{"type":"null","description":"No live supplier price check is performed."},"pricing_observed_at":{"type":"string","format":"date-time","description":"Time of this configured-catalog observation, which can advance between pages."},"pricing_updated_at":{"type":["string","null"],"format":"date-time","description":"Most recent allowed model change within the frozen version."},"source":{"const":"configured_catalog"},"data":{"type":"array","items":{"type":"object","properties":{"model_id":{"type":"string"},"change_type":{"type":"string","enum":["updated","removed"]},"changed_at":{"type":"string","format":"date-time"},"model":{"anyOf":[{"$ref":"#/components/schemas/CatalogModel"},{"type":"null"}]},"previous_pricing":{"$ref":"#/components/schemas/ChangedPricing"},"current_pricing":{"$ref":"#/components/schemas/ChangedPricing"}}}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"ModelComparison":{"type":"object","properties":{"object":{"const":"model.comparison"},"currency":{"const":"USD"},"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"requests":{"type":"integer"},"pricing_checked_at":{"type":"null","description":"No live supplier price check is performed."},"pricing_observed_at":{"type":"string","format":"date-time"},"pricing_updated_at":{"type":["string","null"],"format":"date-time"},"release":{"type":"integer"},"note":{"type":"string"},"data":{"type":"array","items":{"oneOf":[{"type":"object","required":["model","found"],"properties":{"model":{"type":"string"},"found":{"const":false}}},{"type":"object","required":["model","found"],"properties":{"model":{"type":"string"},"found":{"const":true},"label":{"type":"string"},"provider":{"type":"string","description":"Public model maker, not a serving supplier."},"input_per_m":{"type":"number"},"output_per_m":{"type":"number"},"list_price_known":{"type":"boolean"},"billed_usd":{"type":"number","description":"Estimated customer cost, not a settled charge."},"list_usd":{"type":["number","null"]},"saved_usd":{"type":["number","null"],"description":"Estimated difference from the verified list cost. May be negative; null without a verified list price."},"available":{"type":"boolean"},"source":{"const":"configured_catalog"},"suppliers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","examples":["Provider 1"]},"number":{"type":"integer"},"input_per_million":{"type":"string"},"output_per_million":{"type":"string"},"eligible":{"type":"boolean"}}}}}}]}}}},"Account":{"type":"object","properties":{"object":{"const":"account"},"email":{"type":"string","format":"email"},"workspace_name":{"type":["string","null"]},"workspace":{"type":"object","required":["id","name","role"],"description":"Present only for a selected shared workspace. The account email and platform role still identify the responsible actor.","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","member"]}}},"funded_by_owner":{"type":"boolean","description":"True when the responsible actor differs from the shared wallet owner."},"role":{"type":"string","enum":["user","admin"]},"active_key_count":{"type":"integer","description":"Unrevoked and unexpired API keys in the selected personal or workspace scope."},"last_key_use_at":{"type":["string","null"],"format":"date-time"},"auto_recharge_enabled":{"type":"boolean","description":"Actual personal account state; false in a workspace."},"enabled_technique_count":{"type":"integer","description":"Enabled personal account settings; zero for workspace scope. Explicit experiment overrides are separate."}}},"AccountBalance":{"type":"object","properties":{"object":{"const":"account.balance"},"currency":{"const":"USD"},"balance_usd":{"type":"number"},"available_usd":{"type":"number"},"reserved_usd":{"type":"number"},"auto_recharge_enabled":{"type":"boolean","description":"Actual personal account state; false in a workspace."},"threshold_usd":{"type":["number","null"]},"recharge_amount_usd":{"type":["number","null"]},"card":{"type":["string","null"],"description":"Personal account card summary. Always null in workspace reads."},"workspace_name":{"type":["string","null"]},"workspace":{"type":"object","required":["id","name","role"],"description":"Present only for a selected shared workspace. The account email and platform role still identify the responsible actor.","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","member"]}}},"funded_by_owner":{"type":"boolean","description":"True when the responsible actor differs from the shared wallet owner."}}},"TopupRequest":{"type":"object","required":["amount_usd"],"properties":{"amount_usd":{"type":"number","minimum":5,"maximum":1000,"multipleOf":0.01,"description":"USD amount with at most two decimal places. Excess precision is rejected; the amount is never rounded."}}},"TopupResponse":{"type":"object","required":["object","amount_usd","checkout_url","session_id","min_usd","max_usd"],"properties":{"object":{"type":"string","const":"billing.topup"},"amount_usd":{"type":"number","minimum":5,"maximum":1000,"multipleOf":0.01},"checkout_url":{"type":"string","format":"uri","pattern":"^https://checkout\\.stripe\\.com/","description":"Actual Stripe-hosted checkout URL, including the original persisted URL on an idempotent replay. Never a dashboard return URL."},"session_id":{"type":"string"},"min_usd":{"type":"number","const":5},"max_usd":{"type":"number","const":1000}}},"RequestPricing":{"type":"object","additionalProperties":false,"required":["version","basis","currency","model_id","input_per_million","output_per_million","reference_source_url","reference_verified_at","evaluated_at"],"properties":{"version":{"const":1},"basis":{"const":"published_standard_tokens","description":"All actual input tokens at the published standard input rate, and actual output tokens at the standard output rate. Provider-specific cache premiums, cache-hit counterfactuals and unoptimized prompts are not estimated."},"currency":{"const":"USD"},"model_id":{"type":"string"},"input_per_million":{"type":"string"},"output_per_million":{"type":"string"},"reference_source_url":{"type":"string","format":"uri"},"reference_verified_at":{"type":"string"},"evaluated_at":{"type":"string","format":"date-time"}}},"AccountUsage":{"type":"object","required":["days","window_start","window_end","request_count","billed_usd","list_usd","saved_usd","amounts_nanos","settled_request_count","priced_request_count","savings_status","top_models","object","currency"],"properties":{"days":{"type":"integer","minimum":1,"maximum":90},"window_start":{"type":"string","format":"date-time"},"window_end":{"type":"string","format":"date-time"},"request_count":{"type":"integer","description":"All requests, including pending and failed."},"billed_usd":{"type":"number","description":"Sum of settled usage ledger charges."},"list_usd":{"type":["number","null"]},"saved_usd":{"type":["number","null"],"description":"Recorded standard list-price amount minus actual charges; may be negative."},"savings_percent":{"type":["number","null"]},"amounts_nanos":{"type":"object","required":["billed","list","saved"],"description":"Exact integer nanoUSD strings; use these for arithmetic without JSON-number rounding.","properties":{"billed":{"type":"string","pattern":"^\\d+$"},"list":{"type":["string","null"],"pattern":"^\\d+$"},"saved":{"type":["string","null"],"pattern":"^-?\\d+$"}}},"settled_request_count":{"type":"integer"},"priced_request_count":{"type":"integer"},"savings_status":{"type":"string","enum":["complete","partial","unavailable"]},"top_models":{"type":"array","maxItems":5,"description":"Actual billed amount descending, then request count descending and model ID.","items":{"type":"object","required":["model","request_count","billed_usd","saved_usd"],"properties":{"model":{"type":"string"},"request_count":{"type":"integer"},"billed_usd":{"type":"number","description":"Sum of settled usage ledger charges."},"list_usd":{"type":["number","null"]},"saved_usd":{"type":["number","null"],"description":"Recorded standard list-price amount minus actual charges; may be negative."},"savings_percent":{"type":["number","null"]},"amounts_nanos":{"type":"object","required":["billed","list","saved"],"description":"Exact integer nanoUSD strings; use these for arithmetic without JSON-number rounding.","properties":{"billed":{"type":"string","pattern":"^\\d+$"},"list":{"type":["string","null"],"pattern":"^\\d+$"},"saved":{"type":["string","null"],"pattern":"^-?\\d+$"}}},"settled_request_count":{"type":"integer"},"priced_request_count":{"type":"integer"},"savings_status":{"type":"string","enum":["complete","partial","unavailable"]}}}},"object":{"const":"account.usage"},"currency":{"const":"USD"}}},"AccountSavings":{"type":"object","required":["object","currency","windows","experiments","experiments_has_more","techniques"],"properties":{"object":{"const":"account.savings"},"currency":{"const":"USD"},"windows":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"object","required":["days","window_start","window_end","request_count","billed_usd","list_usd","saved_usd","amounts_nanos","settled_request_count","priced_request_count","savings_status","top_models"],"properties":{"days":{"type":"integer","enum":[1,7,30]},"window_start":{"type":"string","format":"date-time"},"window_end":{"type":"string","format":"date-time"},"request_count":{"type":"integer","description":"All requests, including pending and failed."},"billed_usd":{"type":"number","description":"Sum of settled usage ledger charges."},"list_usd":{"type":["number","null"]},"saved_usd":{"type":["number","null"],"description":"Recorded standard list-price amount minus actual charges; may be negative."},"savings_percent":{"type":["number","null"]},"amounts_nanos":{"type":"object","required":["billed","list","saved"],"description":"Exact integer nanoUSD strings; use these for arithmetic without JSON-number rounding.","properties":{"billed":{"type":"string","pattern":"^\\d+$"},"list":{"type":["string","null"],"pattern":"^\\d+$"},"saved":{"type":["string","null"],"pattern":"^-?\\d+$"}}},"settled_request_count":{"type":"integer"},"priced_request_count":{"type":"integer"},"savings_status":{"type":"string","enum":["complete","partial","unavailable"]},"top_models":{"type":"array","maxItems":5,"description":"Actual billed amount descending, then request count descending and model ID.","items":{"type":"object","required":["model","request_count","billed_usd","saved_usd"],"properties":{"model":{"type":"string"},"request_count":{"type":"integer"},"billed_usd":{"type":"number","description":"Sum of settled usage ledger charges."},"list_usd":{"type":["number","null"]},"saved_usd":{"type":["number","null"],"description":"Recorded standard list-price amount minus actual charges; may be negative."},"savings_percent":{"type":["number","null"]},"amounts_nanos":{"type":"object","required":["billed","list","saved"],"description":"Exact integer nanoUSD strings; use these for arithmetic without JSON-number rounding.","properties":{"billed":{"type":"string","pattern":"^\\d+$"},"list":{"type":["string","null"],"pattern":"^\\d+$"},"saved":{"type":["string","null"],"pattern":"^-?\\d+$"}}},"settled_request_count":{"type":"integer"},"priced_request_count":{"type":"integer"},"savings_status":{"type":"string","enum":["complete","partial","unavailable"]}}}}}}},"experiments":{"type":"array","items":{"$ref":"#/components/schemas/ExperimentSummary"}},"experiments_has_more":{"type":"boolean"},"techniques":{"type":"array","items":{"$ref":"#/components/schemas/Technique"}}}},"ApiKeyCreateRequest":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":64},"scopes":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"string","enum":["inference","usage:read","account:read","account:write"]},"description":"New keys default to inference and usage:read."},"prompt_cache_mode":{"type":"string","enum":["on","off","passthrough"],"default":"passthrough","description":"Default prompt-cache routing mode. A valid x-ci-prompt-cache request header overrides it. For Claude, on requires a compatible native Messages candidate; off preserves customer cache_control while disabling affinity. Changing this policy invalidates stale key admissions through the policy revision."},"allowed_models":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Allowed model IDs or aliases; aliases are normalized. Both requested and effective models must match. [] allows every model. Null is invalid."},"allowed_ip_cidrs":{"type":"array","maxItems":50,"items":{"type":"string"},"description":"IPv4 or IPv6 addresses/CIDRs. [] allows any source IP. Null is invalid. Restricted keys fail with 403 if a trusted Cloudflare client IP is unavailable."},"expires_at":{"type":["string","null"],"format":"date-time","description":"An absolute future timestamp, or null for no expiry."},"rate_limit_per_minute":{"type":["integer","null"],"minimum":1,"maximum":100000,"description":"Accepted logical inference requests per fixed UTC minute, including cache hits and failures; null is unlimited."},"daily_request_limit":{"type":["integer","null"],"minimum":1,"maximum":1000000000,"description":"Accepted logical inference requests per UTC day; null is unlimited. Failed accepted requests still count."},"concurrency_limit":{"type":["integer","null"],"minimum":1,"maximum":10000,"description":"In-flight logical inference requests; null is unlimited."},"monthly_spend_limit_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"At most 9 decimal places. null is unlimited; 0 blocks positive-cost inference. Includes in-flight reservations, attributed to the UTC month of request acceptance."},"organization_id":{"type":["string","null"],"format":"uuid","description":"Fixed workspace identifier, or null for a personal key."},"member_user_id":{"type":"string","description":"Workspace-only responsibility assignment. Defaults to the signed-in actor; an owner can select an active teammate, while a member can select only themselves."}}},"ApiKeyUpdateRequest":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":64},"scopes":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"string","enum":["inference","usage:read","account:read","account:write"]},"description":"New keys default to inference and usage:read."},"prompt_cache_mode":{"type":"string","enum":["on","off","passthrough"],"default":"passthrough","description":"Default prompt-cache routing mode. A valid x-ci-prompt-cache request header overrides it. For Claude, on requires a compatible native Messages candidate; off preserves customer cache_control while disabling affinity. Changing this policy invalidates stale key admissions through the policy revision."},"allowed_models":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Allowed model IDs or aliases; aliases are normalized. Both requested and effective models must match. [] allows every model. Null is invalid."},"allowed_ip_cidrs":{"type":"array","maxItems":50,"items":{"type":"string"},"description":"IPv4 or IPv6 addresses/CIDRs. [] allows any source IP. Null is invalid. Restricted keys fail with 403 if a trusted Cloudflare client IP is unavailable."},"expires_at":{"type":["string","null"],"format":"date-time","description":"An absolute future timestamp, or null for no expiry."},"rate_limit_per_minute":{"type":["integer","null"],"minimum":1,"maximum":100000,"description":"Accepted logical inference requests per fixed UTC minute, including cache hits and failures; null is unlimited."},"daily_request_limit":{"type":["integer","null"],"minimum":1,"maximum":1000000000,"description":"Accepted logical inference requests per UTC day; null is unlimited. Failed accepted requests still count."},"concurrency_limit":{"type":["integer","null"],"minimum":1,"maximum":10000,"description":"In-flight logical inference requests; null is unlimited."},"monthly_spend_limit_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"At most 9 decimal places. null is unlimited; 0 blocks positive-cost inference. Includes in-flight reservations, attributed to the UTC month of request acceptance."},"organization_id":{"type":["string","null"],"format":"uuid","description":"Fixed workspace identifier, or null for a personal key."}},"description":"Partial policy update. Omitted fields remain unchanged. Only same-origin browser sessions can edit policies. organization_id, if supplied, must match the existing scope; member_user_id and workspace ownership cannot be changed."},"ApiKeySummary":{"type":"object","required":["id","name","prefix","scopes"],"properties":{"organization_id":{"type":["string","null"],"format":"uuid","description":"Fixed workspace identifier, or null for a personal key."},"member_user_id":{"type":["string","null"],"description":"Responsible member of a workspace key, or null for a personal key."},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"A non-secret key prefix. The full credential and its hash are never included."},"scopes":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"string","enum":["inference","usage:read","account:read","account:write"]},"description":"New keys default to inference and usage:read."},"prompt_cache_mode":{"type":"string","enum":["on","off","passthrough"],"default":"passthrough","description":"Default prompt-cache routing mode. A valid x-ci-prompt-cache request header overrides it. For Claude, on requires a compatible native Messages candidate; off preserves customer cache_control while disabling affinity. Changing this policy invalidates stale key admissions through the policy revision."},"allowed_models":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Allowed model IDs or aliases; aliases are normalized. Both requested and effective models must match. [] allows every model. Null is invalid."},"allowed_ip_cidrs":{"type":"array","maxItems":50,"items":{"type":"string"},"description":"IPv4 or IPv6 addresses/CIDRs. [] allows any source IP. Null is invalid. Restricted keys fail with 403 if a trusted Cloudflare client IP is unavailable."},"expires_at":{"type":["string","null"],"format":"date-time","description":"An absolute future timestamp, or null for no expiry."},"rate_limit_per_minute":{"type":["integer","null"],"minimum":1,"maximum":100000,"description":"Accepted logical inference requests per fixed UTC minute, including cache hits and failures; null is unlimited."},"daily_request_limit":{"type":["integer","null"],"minimum":1,"maximum":1000000000,"description":"Accepted logical inference requests per UTC day; null is unlimited. Failed accepted requests still count."},"concurrency_limit":{"type":["integer","null"],"minimum":1,"maximum":10000,"description":"In-flight logical inference requests; null is unlimited."},"monthly_spend_limit_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"At most 9 decimal places. null is unlimited; 0 blocks positive-cost inference. Includes in-flight reservations, attributed to the UTC month of request acceptance."},"created_at":{"type":["string","null"],"format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"}}},"DashboardApiKey":{"type":"object","properties":{"organization_id":{"type":["string","null"],"format":"uuid","description":"Fixed workspace identifier, or null for a personal key."},"member_user_id":{"type":["string","null"],"description":"Responsible member of a workspace key, or null for a personal key."},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"A non-secret key prefix. The full credential and its hash are never included."},"scopes":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"string","enum":["inference","usage:read","account:read","account:write"]},"description":"New keys default to inference and usage:read."},"prompt_cache_mode":{"type":"string","enum":["on","off","passthrough"],"default":"passthrough","description":"Default prompt-cache routing mode. A valid x-ci-prompt-cache request header overrides it. For Claude, on requires a compatible native Messages candidate; off preserves customer cache_control while disabling affinity. Changing this policy invalidates stale key admissions through the policy revision."},"allowed_models":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Allowed model IDs or aliases; aliases are normalized. Both requested and effective models must match. [] allows every model. Null is invalid."},"allowed_ip_cidrs":{"type":"array","maxItems":50,"items":{"type":"string"},"description":"IPv4 or IPv6 addresses/CIDRs. [] allows any source IP. Null is invalid. Restricted keys fail with 403 if a trusted Cloudflare client IP is unavailable."},"expires_at":{"type":["string","null"],"format":"date-time","description":"An absolute future timestamp, or null for no expiry."},"rate_limit_per_minute":{"type":["integer","null"],"minimum":1,"maximum":100000,"description":"Accepted logical inference requests per fixed UTC minute, including cache hits and failures; null is unlimited."},"daily_request_limit":{"type":["integer","null"],"minimum":1,"maximum":1000000000,"description":"Accepted logical inference requests per UTC day; null is unlimited. Failed accepted requests still count."},"concurrency_limit":{"type":["integer","null"],"minimum":1,"maximum":10000,"description":"In-flight logical inference requests; null is unlimited."},"monthly_spend_limit_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"At most 9 decimal places. null is unlimited; 0 blocks positive-cost inference. Includes in-flight reservations, attributed to the UTC month of request acceptance."},"createdAt":{"type":"integer","description":"Unix milliseconds."},"lastUsedAt":{"type":["integer","null"]},"revokedAt":{"type":["integer","null"]}}},"ApiKeyCreated":{"type":"object","required":["object","id","name","prefix","key"],"properties":{"object":{"const":"api_key"},"organization_id":{"type":["string","null"],"format":"uuid","description":"Fixed workspace identifier, or null for a personal key."},"member_user_id":{"type":["string","null"],"description":"Responsible member of a workspace key, or null for a personal key."},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"A non-secret key prefix. The full credential and its hash are never included."},"scopes":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"string","enum":["inference","usage:read","account:read","account:write"]},"description":"New keys default to inference and usage:read."},"prompt_cache_mode":{"type":"string","enum":["on","off","passthrough"],"default":"passthrough","description":"Default prompt-cache routing mode. A valid x-ci-prompt-cache request header overrides it. For Claude, on requires a compatible native Messages candidate; off preserves customer cache_control while disabling affinity. Changing this policy invalidates stale key admissions through the policy revision."},"key":{"type":"string","description":"The plaintext secret, returned once and never recoverable."}}},"Technique":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"tier":{"type":"integer"},"status":{"type":"string","enum":["enabled","preview"]},"available":{"type":"boolean"},"enabled":{"type":"boolean"},"explicitly_enabled":{"type":["boolean","null"]},"savings_summary":{"type":"string"},"savings_min_pct":{"type":"null"},"savings_max_pct":{"type":"null"},"quality_risk":{"type":["string","null"]}},"description":"Savings are unquantified. Exact cache is opt-in, per-user, plain-text/no-tools, temperature 0, non-streaming; 15-minute reuse, 100 entries, 256 KiB each. Prompt text is not stored. Expired entries are cleaned lazily during writes."},"ExperimentVariantInput":{"type":"object","required":["name","is_control","weight"],"properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"is_control":{"type":"boolean"},"weight":{"type":"integer","minimum":1,"maximum":10000},"model":{"type":["string","null"],"description":"Null inherits the requested model. A fixed model cannot be combined with explicit model-routing."},"system_prompt":{"type":["string","null"],"maxLength":12000,"description":"Null inherits request instructions; an empty string clears them. Stored as experiment configuration."},"technique_ids":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string","enum":["concise-output","context-window-trim","duplicate-message-collapse","exact-cache","json-minify","output-token-budget","model-routing","whitespace-normalization"]},"description":"Null inherits account controls; [] disables all optional techniques. Explicit selections override account controls, including exact-cache."}}},"ExperimentConfiguration":{"type":"object","required":["name","slug","dimension","assignment_mode","variants"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"slug":{"type":"string","maxLength":80,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"dimension":{"type":"string","enum":["prompt","model","technique"]},"assignment_mode":{"type":"string","enum":["random","sticky"]},"variants":{"type":"array","minItems":2,"maxItems":10,"items":{"$ref":"#/components/schemas/ExperimentVariantInput"},"description":"Exactly one control; variant names and IDs must be unique."}},"description":"Complete saved configuration, at most 150 KiB encoded JSON."},"ExperimentSummary":{"allOf":[{"type":"object","properties":{"request_count":{"type":"integer"},"successful_requests":{"type":"integer"},"failed_requests":{"type":"integer"},"pending_requests":{"type":"integer"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"total_cost_usd":{"type":"number"},"avg_cost_usd":{"type":["number","null"],"description":"Settled spend divided by all recorded requests, including pending or failed zero-charge requests; null with no requests."},"average_latency_ms":{"type":["number","null"]},"average_ttft_ms":{"type":["number","null"]},"feedback_avg":{"type":["number","null"]},"feedback_count":{"type":"integer"},"avg_saved_usd":{"type":"null","description":"No counterfactual baseline is established."}}},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"dimension":{"type":"string","enum":["prompt","model","technique"]},"assignment_mode":{"type":"string","enum":["random","sticky"]},"status":{"type":"string","enum":["draft","running","paused","completed","promoted"]},"version":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"started_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"promoted_at":{"type":["string","null"],"format":"date-time"},"promoted_variant_id":{"type":["string","null"]},"savings_status":{"const":"unavailable_no_counterfactual"}}}]},"Experiment":{"allOf":[{"allOf":[{"type":"object","properties":{"request_count":{"type":"integer"},"successful_requests":{"type":"integer"},"failed_requests":{"type":"integer"},"pending_requests":{"type":"integer"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"total_cost_usd":{"type":"number"},"avg_cost_usd":{"type":["number","null"],"description":"Settled spend divided by all recorded requests, including pending or failed zero-charge requests; null with no requests."},"average_latency_ms":{"type":["number","null"]},"average_ttft_ms":{"type":["number","null"]},"feedback_avg":{"type":["number","null"]},"feedback_count":{"type":"integer"},"avg_saved_usd":{"type":"null","description":"No counterfactual baseline is established."}}},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"dimension":{"type":"string","enum":["prompt","model","technique"]},"assignment_mode":{"type":"string","enum":["random","sticky"]},"status":{"type":"string","enum":["draft","running","paused","completed","promoted"]},"version":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"started_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"promoted_at":{"type":["string","null"],"format":"date-time"},"promoted_variant_id":{"type":["string","null"]},"savings_status":{"const":"unavailable_no_counterfactual"}}}]},{"type":"object","properties":{"object":{"const":"experiment"},"variants":{"type":"array","items":{"allOf":[{"type":"object","required":["name","is_control","weight"],"properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"is_control":{"type":"boolean"},"weight":{"type":"integer","minimum":1,"maximum":10000},"model":{"type":["string","null"],"description":"Null inherits the requested model. A fixed model cannot be combined with explicit model-routing."},"system_prompt":{"type":["string","null"],"maxLength":12000,"description":"Null inherits request instructions; an empty string clears them. Stored as experiment configuration."},"technique_ids":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string","enum":["concise-output","context-window-trim","duplicate-message-collapse","exact-cache","json-minify","output-token-budget","model-routing","whitespace-normalization"]},"description":"Null inherits account controls; [] disables all optional techniques. Explicit selections override account controls, including exact-cache."}}},{"type":"object","properties":{"request_count":{"type":"integer"},"successful_requests":{"type":"integer"},"failed_requests":{"type":"integer"},"pending_requests":{"type":"integer"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"total_cost_usd":{"type":"number"},"avg_cost_usd":{"type":["number","null"],"description":"Settled spend divided by all recorded requests, including pending or failed zero-charge requests; null with no requests."},"average_latency_ms":{"type":["number","null"]},"average_ttft_ms":{"type":["number","null"]},"feedback_avg":{"type":["number","null"]},"feedback_count":{"type":"integer"},"avg_saved_usd":{"type":"null","description":"No counterfactual baseline is established."}}},{"type":"object","properties":{"system_prompt_preview":{"type":["string","null"]}}}]}},"recent_requests":{"type":"array","maxItems":50,"items":{"type":"object","properties":{"request_id":{"type":"string"},"variant_id":{"type":"string"},"variant_name":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"model":{"type":"string"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"billed_cost_usd":{"type":"number"},"feedback_score":{"type":["integer","null"]},"feedback_comment":{"type":["string","null"]}}}}}}]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}}}}