{
  "openapi": "3.1.0",
  "info": {
    "title": "Cheaper Inference API",
    "version": "1.0.0",
    "description": "Wallet-backed, OpenAI- and Anthropic-compatible inference. Authenticate with `Authorization: Bearer ci_live_...` or `x-api-key: ci_live_...`. Both are accepted on every endpoint, and `Authorization` wins if both are present.\n\nEvery successful BUFFERED response carries `request_id` and `billing` at the top level, with the request id and what the request was billed. Messages streams carry them on the terminal `message_delta`, and Responses streams on the terminal `response.completed` or `response.incomplete`. Chat Completions and Completions streams carry neither: reconcile those from the `x-ci-request-id` response header. `billed_cost_usd` is a fixed 6-decimal string, not a number: a JSON float cannot round-trip a micro-dollar amount.\n\nJSON inference bodies may be compressed: `/v1/chat/completions`, `/v1/completions`, `/v1/responses`, `/v1/messages`, `/v1/messages/count_tokens`, `/v1/images/generations` and `/v1/videos/generations`. Send `Content-Encoding: gzip`, `deflate` or `br` and the body is inflated before parsing, which is how a conversation larger than the 4.5 MB wire limit can be sent. A single encoding only, and a body that inflates past 20 MB is refused with 413 - except on `/v1/messages/count_tokens`, where the inflated ceiling is 4.5 MB. Multipart image edits and the non-inference endpoints read their bodies directly and expect them uncompressed.\n\nThis document covers the customer-facing `/v1` surface only."
  },
  "servers": [
    {
      "url": "https://api.cheaperinference.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "AnthropicApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "OpenAI-compatible chat and text completion."
    },
    {
      "name": "Images",
      "description": "OpenAI-compatible image generation and canary-gated image editing."
    },
    {
      "name": "Messages",
      "description": "Anthropic Messages. Claude Code integrates here."
    },
    {
      "name": "Responses",
      "description": "OpenAI Responses. Codex integrates here."
    },
    {
      "name": "Decisions",
      "description": "OpenAI Decisions. Typed questions answered with probabilities by decision models such as Jev."
    },
    {
      "name": "Embeddings",
      "description": "OpenAI Embeddings. One vector per input from an embedding model."
    },
    {
      "name": "Rerank",
      "description": "Cohere Rerank. Documents scored against a query by a rerank model."
    },
    {
      "name": "Audio",
      "description": "Speech, transcription and translation, and live voice sessions over a WebSocket (/v1/realtime, /v1/live/sessions)."
    },
    {
      "name": "Generations",
      "description": "Fetch again the images, video or speech a request produced. Files are kept 7 days, except for zero data retention requests. Requires the inference scope."
    },
    {
      "name": "Models",
      "description": "The catalog, its capabilities and its prices."
    },
    {
      "name": "Usage",
      "description": "What the workspace spent. Requires the usage:read scope."
    },
    {
      "name": "Feedback",
      "description": "Score a completed request."
    },
    {
      "name": "Account",
      "description": "Wallet, savings, experiments, techniques, keys and connected chat channels. Reads need the account:read scope and changes need account:write; neither is on a key by default. This is the surface the MCP server drives."
    },
    {
      "name": "Prompt Studio",
      "description": "Prompt Studio: the caller's runs and jobs, what the service can do, a free check of a prompt with cost estimates, and starting a zero-shot optimization. Reads need the prompt-studio:read scope; starting an optimization needs prompt-studio:write and spends the calling key's wallet. Neither scope is on a key by default."
    },
    {
      "name": "Code hosts",
      "description": "The caller's connected code hosts (a GitHub App installation today): the repositories they cover, the working repository, reading files, and opening a pull request that puts a Prompt Studio run's optimized prompt-set back into the code. Reads need the repos:read scope; the working repository and pull requests need repos:write. Neither is on a key by default. A host is connected from the dashboard (Integrations), never through this API."
    },
    {
      "name": "Prompt Studio bot",
      "description": "The Prompt Studio bot on connected repositories: switch it on per repository and set its tier and monthly budget (repos:read to read, repos:write to change), list the prompts it found, start a pull-request review or a whole-repository run, and follow its runs (prompt-studio:read to read, prompt-studio:write to start). A run spends the repository's monthly budget from the wallet of the person who set it up. A key with prompt-studio:write but no repos scope can still start a run on a repository its holder connected. Repositories are connected from the dashboard, never through this API."
    },
    {
      "name": "Docs",
      "description": "The product documentation, searchable. Public content, so any valid key can read it without an additional scope. It exists as an endpoint so an assistant can answer 'how do I…' from the shipped text rather than from memory."
    },
    {
      "name": "Keak Code",
      "description": "The opt-in client contract the Keak Code VS Code extension uses: the calling key's technique profile, task budgets and request attribution, alongside the `x-ci-model-lock` and `x-ci-stream-receipt` headers on the inference endpoints. These routes need the `inference` scope, not `account:read`."
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create a chat completion",
        "operationId": "createChatCompletion",
        "description": "OpenAI-compatible. The request is optimized, served from the exact-match cache when possible, and billed against the wallet. Two opt-in request headers form the client contract Keak Code uses: `x-ci-model-lock` (serve exactly the named model) and `x-ci-stream-receipt` (receipt frames in the stream). A PDF goes in a `file` content part: `{\"type\":\"file\",\"file\":{\"filename\":\"a.pdf\",\"file_data\":\"data:application/pdf;base64,...\"}}`. `file_data` may also be a public https link, which we download (10 MB and 10 links per request). `file_id` is refused. A PDF is routed only to a model that reads PDFs, else 400 `unsupported_parameter`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "x-ci-techniques",
            "in": "header",
            "required": false,
            "description": "Set to off to disable optional workspace techniques for a controlled benchmark. Preserves workspace defaults and billing policy; takes precedence over technique opt-in headers.",
            "schema": {
              "type": "string",
              "enum": [
                "off"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache",
            "in": "header",
            "required": false,
            "description": "Prompt-cache knob. `passthrough` (default, or the API key's `prompt_cache_mode`) forwards the request unchanged; `on` additionally adds provider cache breakpoints for supported models. For Claude, unmarked requests cache the shared system/tools prefix and growing conversation; caller-supplied cache controls and lifetimes are preserved. `off` removes explicit cache controls, disables sticky affinity for this request and, for models that read a cache marker, prefers routes that forward the body as sent over the marketplace; it does not disable a provider's implicit caching.",
            "schema": {
              "type": "string",
              "enum": [
                "on",
                "off",
                "passthrough"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-scope",
            "in": "header",
            "required": false,
            "description": "Sticky-affinity scope: `session` (default), `user`, or `org`. Scopes the affinity key that keeps a repeated prompt prefix on the same upstream provider so its cache stays warm.",
            "schema": {
              "type": "string",
              "enum": [
                "session",
                "user",
                "org"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-session",
            "in": "header",
            "required": false,
            "description": "Session id read when the scope is `session`. Send one stable value per conversation or agent run. When absent, a string prompt_cache_key in the request body is used. Without either identifier, the tools, opening system instructions and first conversation message identify the session. Affinity remains isolated to the API key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-ci-model-lock",
            "in": "header",
            "required": false,
            "description": "Model Lock. Serve exactly the model named in the body: no model-routing technique, no experiment variant and no admission canary may substitute it. Combined with `X-CI-Experiment` (or a forced experiment variant) it is refused with 400 `model_lock_conflict` before anything is read or reserved. If any stage would still change the model, the request is refused with 500 `model_lock_violation` before reaching a model and nothing is billed. Model routing is held off even when the key, the workspace or `x-ci-route` turns it on. `1` or `true` (any case) turns it on; absent or empty leaves it off. Any other value, including `0` and `false`, is refused with 400 `invalid_contract_header` naming the header in `param`, so a typo never silently means off.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          },
          {
            "name": "x-ci-stream-receipt",
            "in": "header",
            "required": false,
            "description": "Receipt mode. On a streamed `/v1/chat/completions` request (`stream: true`), add two standalone SSE frames: an opening frame before the first upstream frame and a final receipt after billing finalize, before `data: [DONE]`. See the `text/event-stream` response. Accepted and ignored on a non-streamed request. `1` or `true` (any case) turns it on; absent or empty leaves it off. Any other value, including `0` and `false`, is refused with 400 `invalid_contract_header` naming the header in `param`, so a typo never silently means off.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Set `stream: true` on the request to select this. Native Chat streams carry no `cheaper_inference` envelope (KEA-5313): the settled charge is on the usage API (`GET /v1/usage/requests?request_ids=`). In receipt mode (`x-ci-stream-receipt`) two extra `data:` frames are added, each one line of compact JSON whose top-level keys are exactly `type`, `object` and `cheaper_inference` (no `choices`, `id`, `model` or `usage`):\n\n1. Opening (`type: response.cheaper_inference.request`, schema `ReceiptOpeningFrame`), immediately before the first upstream frame. It names the request id, so a stream cut before the end can still be reconciled.\n2. Final (`type: response.cheaper_inference.receipt`, schema `ReceiptFinalFrame`), after billing finalize and before `data: [DONE]`, or before `event: error` when the stream ended incomplete. It carries the charge the ledger settled.\n\nNeither frame is written on a non-streamed, cached or refused response.\n\nOpening example:\n\n```\ndata: {\"type\":\"response.cheaper_inference.request\",\"object\":\"cheaper_inference.request\",\"cheaper_inference\":{\"receipt_version\":1,\"phase\":\"opening\",\"request_id\":\"6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f\",\"api_key_id\":\"0b7e9d2c-5a14-4f3b-9c8d-7e6f5a4b3c2d\",\"requested_model\":\"claude-sonnet-4.6\",\"model_lock\":{\"requested\":true,\"enforced\":true}}}\n```\n\nFinal example:\n\n```\ndata: {\"type\":\"response.cheaper_inference.receipt\",\"object\":\"cheaper_inference.receipt\",\"cheaper_inference\":{\"receipt_version\":1,\"phase\":\"final\",\"request_id\":\"6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f\",\"api_key_id\":\"0b7e9d2c-5a14-4f3b-9c8d-7e6f5a4b3c2d\",\"requested_model\":\"claude-sonnet-4.6\",\"served_model\":\"claude-sonnet-4.6\",\"model_lock\":{\"requested\":true,\"enforced\":true},\"complete\":true,\"billing\":{\"status\":\"settled\",\"billed_cost_usd\":\"0.004213\",\"currency\":\"USD\",\"usage_known\":true,\"basis\":\"ledger\",\"zero_data_retention\":false},\"tokens\":{\"input\":1820,\"output\":214,\"cache_read\":1536,\"cache_write\":0,\"reasoning\":0},\"prompt_cache_mode\":\"on\",\"techniques\":[{\"slug\":\"model-routing\",\"outcome\":\"skipped\",\"reason\":\"model_lock\",\"tokens_saved\":0,\"version\":null,\"layer\":\"cheaper_inference\"}],\"warnings\":[]}}\n```"
                },
                "examples": {
                  "receipt_opening": {
                    "summary": "Receipt mode: opening frame",
                    "value": "data: {\"type\":\"response.cheaper_inference.request\",\"object\":\"cheaper_inference.request\",\"cheaper_inference\":{\"receipt_version\":1,\"phase\":\"opening\",\"request_id\":\"6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f\",\"api_key_id\":\"0b7e9d2c-5a14-4f3b-9c8d-7e6f5a4b3c2d\",\"requested_model\":\"claude-sonnet-4.6\",\"model_lock\":{\"requested\":true,\"enforced\":true}}}\n\n"
                  },
                  "receipt_final": {
                    "summary": "Receipt mode: final frame",
                    "value": "data: {\"type\":\"response.cheaper_inference.receipt\",\"object\":\"cheaper_inference.receipt\",\"cheaper_inference\":{\"receipt_version\":1,\"phase\":\"final\",\"request_id\":\"6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f\",\"api_key_id\":\"0b7e9d2c-5a14-4f3b-9c8d-7e6f5a4b3c2d\",\"requested_model\":\"claude-sonnet-4.6\",\"served_model\":\"claude-sonnet-4.6\",\"model_lock\":{\"requested\":true,\"enforced\":true},\"complete\":true,\"billing\":{\"status\":\"settled\",\"billed_cost_usd\":\"0.004213\",\"currency\":\"USD\",\"usage_known\":true,\"basis\":\"ledger\",\"zero_data_retention\":false},\"tokens\":{\"input\":1820,\"output\":214,\"cache_read\":1536,\"cache_write\":0,\"reasoning\":0},\"prompt_cache_mode\":\"on\",\"techniques\":[{\"slug\":\"model-routing\",\"outcome\":\"skipped\",\"reason\":\"model_lock\",\"tokens_saved\":0,\"version\":null,\"layer\":\"cheaper_inference\"}],\"warnings\":[]}}\n\n"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`) Under the client contract also `code: invalid_contract_header` (a bad `x-ci-model-lock` or `x-ci-stream-receipt` value) and `code: model_lock_conflict` (Model Lock combined with an experiment). While the key has an open task budget (`/v1/keys/self/task-budgets`), also `code: task_budget_exhausted` (`param: task_budget`): the request's worst-case charge does not fit what the budget has left, so it was refused before anything was held and nothing was charged. Only with a contract header, when the workspace policy requires a task budget and the key has none open, also `code: task_budget_required` (`param: task_budget`); nothing was held or charged. Only with a contract header, every 402, 403 and 429 refusal on the inference path is answered as this 400 instead, with one of these codes: `code: workspace_monthly_cap_hit` (`param: workspace_monthly_cap`), `code: member_monthly_cap_hit` (`param: member_monthly_cap`), `code: wallet_too_low` (`param: wallet`), `code: wallet_top_up_failed` (`param: wallet`), `code: key_monthly_cap_hit` (`param: key_monthly_cap`), `code: contract_funding_refused`, `code: workspace_membership_ended` (`param: workspace_membership`), `code: key_scope_missing` (`param`: the missing scope), `code: key_network_refused` (`param: key_network`), `code: key_allowlist_refused` (`param: key_allowlist`), `code: key_policy_refused` (`param: key_policy`), `code: provider_policy_block` (`param: end_user`), `code: contract_access_refused`, `code: key_minute_cap_hit` (`param: key_minute_cap`), `code: key_daily_cap_hit` (`param: key_daily_cap`), `code: key_parallel_cap_hit` (`param: key_parallel_cap`), `code: contract_pacing_refused`. Each message starts with a distinct phrase and nothing was charged unless it says otherwise. Without a contract header these refusals keep their usual status and code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`) Under Model Lock also `code: model_lock_violation`: a stage would have served another model, so the request was refused before reaching any model and nothing was billed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create a text completion",
        "operationId": "createCompletion",
        "description": "OpenAI-compatible legacy completions. Portable prompt arrays are served as independent, sequential requests through normal admission and billing, then combined in prompt order. Token-ID prompts use the o200k_base compatibility encoding on this translated path, including for non-OpenAI models. Native-only controls retain the supplier's tokenizer. Batch responses expose request_ids for the individual billing records; usage and billing totals cover all completed prompts. If a later prompt fails, earlier completed prompts remain billable and remaining prompts are not started.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "x-ci-model-lock",
            "in": "header",
            "required": false,
            "description": "Model Lock. Serve exactly the model named in the body: no model-routing technique, no experiment variant and no admission canary may substitute it. Combined with `X-CI-Experiment` (or a forced experiment variant) it is refused with 400 `model_lock_conflict` before anything is read or reserved. If any stage would still change the model, the request is refused with 500 `model_lock_violation` before reaching a model and nothing is billed. Model routing is held off even when the key, the workspace or `x-ci-route` turns it on. `1` or `true` (any case) turns it on; absent or empty leaves it off. Any other value, including `0` and `false`, is refused with 400 `invalid_contract_header` naming the header in `param`, so a typo never silently means off.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Set `stream: true` on the request to select this."
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`) Under the client contract also `code: invalid_contract_header` (a bad `x-ci-model-lock` or `x-ci-stream-receipt` value) and `code: model_lock_conflict` (Model Lock combined with an experiment). While the key has an open task budget (`/v1/keys/self/task-budgets`), also `code: task_budget_exhausted` (`param: task_budget`): the request's worst-case charge does not fit what the budget has left, so it was refused before anything was held and nothing was charged. Only with a contract header, when the workspace policy requires a task budget and the key has none open, also `code: task_budget_required` (`param: task_budget`); nothing was held or charged. Only with a contract header, every 402, 403 and 429 refusal on the inference path is answered as this 400 instead, with one of these codes: `code: workspace_monthly_cap_hit` (`param: workspace_monthly_cap`), `code: member_monthly_cap_hit` (`param: member_monthly_cap`), `code: wallet_too_low` (`param: wallet`), `code: wallet_top_up_failed` (`param: wallet`), `code: key_monthly_cap_hit` (`param: key_monthly_cap`), `code: contract_funding_refused`, `code: workspace_membership_ended` (`param: workspace_membership`), `code: key_scope_missing` (`param`: the missing scope), `code: key_network_refused` (`param: key_network`), `code: key_allowlist_refused` (`param: key_allowlist`), `code: key_policy_refused` (`param: key_policy`), `code: provider_policy_block` (`param: end_user`), `code: contract_access_refused`, `code: key_minute_cap_hit` (`param: key_minute_cap`), `code: key_daily_cap_hit` (`param: key_daily_cap`), `code: key_parallel_cap_hit` (`param: key_parallel_cap`), `code: contract_pacing_refused`. Each message starts with a distinct phrase and nothing was charged unless it says otherwise. Without a contract header these refusals keep their usual status and code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`) Under Model Lock also `code: model_lock_violation`: a stage would have served another model, so the request was refused before reaching any model and nothing was billed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/generations": {
      "post": {
        "tags": [
          "Videos"
        ],
        "summary": "Generate a video",
        "operationId": "createVideo",
        "description": "Generate a video and wait for the completed result. Streaming is not supported.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/decisions": {
      "post": {
        "tags": [
          "Decisions"
        ],
        "summary": "Ask a decision model typed questions",
        "operationId": "createDecision",
        "description": "Ask predicate, choice and score questions about one input and receive probabilities instead of text. OpenAI Decisions API shape; the OpenAI SDKs work with only a base URL change. Billed on input tokens only. Streaming is not supported.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "summary": "Create embeddings",
        "operationId": "createEmbedding",
        "description": "Turn text, or token ids, into vectors. OpenAI Embeddings API shape; the OpenAI SDKs work with only a base URL change. Billed on the input tokens the model counts. Streaming is not supported. Embedding models have type embedding in GET /v1/models.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/rerank": {
      "post": {
        "tags": [
          "Rerank"
        ],
        "summary": "Rerank documents",
        "operationId": "createRerank",
        "description": "Score up to 1000 documents against a query and return them by relevance. Cohere Rerank API shape; the Cohere SDKs work with only a base URL change. Documents are strings, or objects ranked on rank_fields. Billed on the input tokens or the search units (one query over up to 100 documents) the model counts, as its price in GET /v1/models states. Streaming is not supported. Rerank models have type rerank in GET /v1/models.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RerankRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerankResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/rerank": {
      "post": {
        "tags": [
          "Rerank"
        ],
        "summary": "Rerank documents (Cohere v2)",
        "operationId": "createRerankV2",
        "description": "The Cohere v2 Rerank shape, which the Cohere SDKs call on the API host: the same as POST /v1/rerank with string documents only.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RerankRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerankResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create speech",
        "operationId": "createSpeech",
        "description": "Turn text into one audio file. OpenAI Speech API shape; the OpenAI SDKs work with only a base URL change. Billed per input character; the charge is in the x-ci-billed-cost-usd header. Streaming is not supported. Text-to-speech models have type speech in GET /v1/models.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The audio file.",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create a transcription",
        "operationId": "createTranscription",
        "description": "Turn audio into text. OpenAI Transcriptions API shape; the OpenAI SDKs work with only a base URL change. Billed per second of audio; the charge is in the x-ci-billed-cost-usd header. Streaming is not supported. Speech-to-text models have type transcription in GET /v1/models.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The transcript: JSON for json and verbose_json, plain text for text and srt, WebVTT for vtt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "words": {
                      "type": "array",
                      "description": "Word timestamps when requested and supported. Times are in seconds.",
                      "items": {
                        "type": "object",
                        "required": [
                          "word",
                          "start",
                          "end"
                        ],
                        "properties": {
                          "word": {
                            "type": "string"
                          },
                          "start": {
                            "type": "number"
                          },
                          "end": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "segments": {
                      "type": "array",
                      "description": "Timed transcript segments. Times are in seconds.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "text": {
                            "type": "string"
                          },
                          "start": {
                            "type": "number"
                          },
                          "end": {
                            "type": "number"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "text/vtt": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The audio file: flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav or webm, at most 4.5 MB in a request body. MAI-Transcribe-2 accepts WAV, MP3 or FLAC only; the dashboard converts other browser-decodable audio to WAV before uploading."
                  },
                  "file_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "A public https link to an audio file of up to 25 MB, instead of file."
                  },
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "srt",
                      "verbose_json",
                      "vtt"
                    ],
                    "default": "json"
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "language": {
                    "type": "string",
                    "description": "The input language, ISO-639-1."
                  },
                  "timestamp_granularities[]": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "word",
                        "segment"
                      ]
                    }
                  },
                  "timestamps": {
                    "type": "string",
                    "enum": [
                      "none",
                      "segment",
                      "word",
                      "words"
                    ],
                    "description": "MAI-Transcribe-2 timing granularity. 'words' is an alias for 'word'. Word and segment timing default response_format to verbose_json; an explicit format must be json or verbose_json. Word timing is returned in words as word/start/end in seconds; segment timing is returned in segments. The OpenAI timestamp_granularities list is also supported; timestamps takes precedence."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/audio/translations": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create a translation",
        "operationId": "createTranslation",
        "description": "Turn audio in any language into English text. OpenAI Translations API shape. Billed per second of audio like transcriptions. Only the transcription models that list /v1/audio/translations in supported_endpoints serve it.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The transcript: JSON for json and verbose_json, plain text for text and srt, WebVTT for vtt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "text/vtt": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The audio file: flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav or webm, at most 4.5 MB in a request body."
                  },
                  "file_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "A public https link to an audio file of up to 25 MB, instead of file."
                  },
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "srt",
                      "verbose_json",
                      "vtt"
                    ],
                    "default": "json"
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime": {
      "get": {
        "tags": [
          "Audio"
        ],
        "summary": "Open a voice session (WebSocket)",
        "operationId": "openRealtimeSession",
        "description": "A live voice or text conversation over one WebSocket: connect to `wss://api.cheaperinference.com/v1/realtime?model=<id>` with `Authorization: Bearer <key>`. Models whose supported_endpoints in GET /v1/models list /v1/realtime serve it (for example gpt-realtime-mini, gemini-3.8-live, grok-voice-3.0). Client events: `session-update` (`config`, such as instructions; send it first), `conversation-item-create` (for example a `text-message` item) and `response-create`. Server events include `session-created`, `response-created`, the response deltas such as `audio-delta`, `response-done` and `error`. Billing: the session is one request. `max_session_usd` is held when the session opens; each finished response is metered in the units the model is priced in (text and audio tokens, or audio seconds and text inputs, as its price in GET /v1/models states), and the session settles once when it closes. A session ends when either side closes, when the budget is reached, or after about 13 minutes. Errors before the upgrade are JSON with the usual codes (`invalid_api_key` 401, `invalid_request` 400, `insufficient_balance` 402, `model_not_found` 404). Errors during the session are an `error` event (`invalid_event`, `invalid_frame`, or the code of a refused admission), then a close: 1000 normal, 1008 refused, 1011 upstream failure.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": true,
            "description": "The model id, as in GET /v1/models.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_session_usd",
            "in": "query",
            "required": false,
            "description": "The most the session may spend, in USD: 0.01 to 25, default 1. The amount is held from the wallet when the session opens and bounds the charge. When the next response would pass it, the session ends with the close reason `budget_reached`.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,4}(\\.\\d{1,6})?$",
              "default": "1"
            }
          }
        ],
        "responses": {
          "101": {
            "description": "Switching Protocols: the session runs on the WebSocket. Events are JSON text frames, one event per frame."
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "426": {
            "description": "Upgrade Required: the request had no `Upgrade: websocket` header. Error code `websocket_required`."
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/live/sessions": {
      "get": {
        "tags": [
          "Audio"
        ],
        "summary": "Open a GPT-Live session (WebSocket)",
        "operationId": "openLiveSession",
        "description": "OpenAI Live events over one WebSocket, for gpt-live-1: connect to `wss://api.cheaperinference.com/v1/live/sessions` with `Authorization: Bearer <key>`. The first event must be `session.start` with `session.model` (or name `model` in the URL), within 10 seconds. Then send `session.input_audio.append` with base64 PCM16 audio at 24 kHz, sent at playback speed, and `session.close` to end. The server answers with `session.started`, audio and transcript events, and `session.closed`, whose `usage.seconds` is the metered voice time. Billing: per voice second, as the model's price in GET /v1/models states. `max_session_usd` is held when the session opens and the session settles once when it closes. GET /v1/realtime?model=gpt-live-1 serves the same session. Errors are as for GET /v1/realtime.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "The model id, if the first event does not name it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_session_usd",
            "in": "query",
            "required": false,
            "description": "The most the session may spend, in USD: 0.01 to 25, default 1. The amount is held from the wallet when the session opens and bounds the charge. When the next response would pass it, the session ends with the close reason `budget_reached`.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,4}(\\.\\d{1,6})?$",
              "default": "1"
            }
          }
        ],
        "responses": {
          "101": {
            "description": "Switching Protocols: the session runs on the WebSocket. Events are JSON text frames, one event per frame."
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "426": {
            "description": "Upgrade Required: the request had no `Upgrade: websocket` header. Error code `websocket_required`."
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Generate images",
        "operationId": "createImage",
        "description": "Generate one or more images. Streaming is not supported on this endpoint.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Edit images",
        "operationId": "createImageEdit",
        "description": "Edit up to 10 source images with a 20 MiB decoded aggregate limit across the sources and optional mask. The OpenAI-compatible multipart form accepts `image` uploads and an optional PNG `mask`. The JSON extension accepts `input_references` containing HTTP(S) URLs or image data URLs; external URLs are passed only to compatible providers and are never fetched or stored by CheaperInference. Models are eligible only after a live edit canary; discover them through `capabilities.image_edit` on GET /v1/models.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImageEditMultipartRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageEditJsonRequest"
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Create a message",
        "operationId": "createMessage",
        "description": "Anthropic Messages. `max_tokens` is required. Errors use Anthropic's envelope, which carries no `code` or `param`. A PDF goes in a `document` block with a `base64` (`application/pdf`), `url` or `text` source, plus optional `title`, `context`, `citations` and `cache_control`. A `url` is downloaded by us (https, public hosts, 10 MB and 10 links per request). Upload ids are refused. A PDF is routed only to a model that reads PDFs.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "x-ci-techniques",
            "in": "header",
            "required": false,
            "description": "Set to off to disable optional workspace techniques for a controlled benchmark. Preserves workspace defaults and billing policy; takes precedence over technique opt-in headers.",
            "schema": {
              "type": "string",
              "enum": [
                "off"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache",
            "in": "header",
            "required": false,
            "description": "Prompt-cache knob. `passthrough` (default, or the API key's `prompt_cache_mode`) forwards the request unchanged; `on` additionally adds provider cache breakpoints for supported models. For Claude, unmarked requests cache the shared system/tools prefix and growing conversation; caller-supplied cache controls and lifetimes are preserved. `off` removes explicit cache controls, disables sticky affinity for this request and, for models that read a cache marker, prefers routes that forward the body as sent over the marketplace; it does not disable a provider's implicit caching.",
            "schema": {
              "type": "string",
              "enum": [
                "on",
                "off",
                "passthrough"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-scope",
            "in": "header",
            "required": false,
            "description": "Sticky-affinity scope: `session` (default), `user`, or `org`. Scopes the affinity key that keeps a repeated prompt prefix on the same upstream provider so its cache stays warm.",
            "schema": {
              "type": "string",
              "enum": [
                "session",
                "user",
                "org"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-session",
            "in": "header",
            "required": false,
            "description": "Session id read when the scope is `session`. Send one stable value per conversation or agent run. When absent, a string prompt_cache_key in the request body is used. Without either identifier, the tools, opening system instructions and first conversation message identify the session. Affinity remains isolated to the API key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-ci-model-lock",
            "in": "header",
            "required": false,
            "description": "Model Lock. Serve exactly the model named in the body: no model-routing technique, no experiment variant and no admission canary may substitute it. Combined with `X-CI-Experiment` (or a forced experiment variant) it is refused with 400 `model_lock_conflict` before anything is read or reserved. If any stage would still change the model, the request is refused with 500 `model_lock_violation` before reaching a model and nothing is billed. Model routing is held off even when the key, the workspace or `x-ci-route` turns it on. `1` or `true` (any case) turns it on; absent or empty leaves it off. Any other value, including `0` and `false`, is refused with 400 `invalid_contract_header` naming the header in `param`, so a typo never silently means off. Anthropic's error envelope carries no code, so on this path the refusals are told apart by status and message only.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Set `stream: true` on the request to select this."
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Count input tokens",
        "operationId": "countMessageTokens",
        "description": "Estimate the input tokens for a Messages request. Makes no upstream call and moves no money, so `max_tokens` is not required.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CountTokensRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountTokensResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "tags": [
          "Responses"
        ],
        "summary": "Create a response",
        "operationId": "createResponse",
        "description": "OpenAI Responses, the surface Codex uses. A PDF goes in an `input_file` part with `file_data` (a data URI) or `file_url` (https; we download it, 10 MB and 10 links per request) and an optional `filename`. Upload ids are refused. Stateless: `store` is accepted and ignored (we send `store: false` upstream; responses cannot be retrieved later), and `previous_response_id` and `conversation` are refused. Replay prior output items in `input` instead. Namespace tools may mix function and custom/freeform entries, including inside `input[].additional_tools`; namespace and call metadata are preserved in buffered and streamed output. Gemini 3 requests using `reasoning_effort: none` fail with code `unsupported_reasoning_effort`. To use Pro, send a POST request to /v1/responses with store: false and reasoning.mode: \"pro\". Set reasoning.effort separately to control how much reasoning the model does. Pro requires the Responses endpoint. Chat Completions returns HTTP 400 for Pro requests. The models gpt-5.6-luna, gpt-5.6-terra, gpt-5.6-sol and gpt-6-astra support Pro mode. Set stream: true to receive output as it arrives, or stream: false to receive one complete response. These models use standard mode when reasoning.mode is omitted. For gpt-5.5-pro, gpt-5-pro, gpt-5.2-pro, gpt-5.4-pro and o3-pro, the model ID already selects Pro. Omit reasoning.mode and set stream: false. These models do not support streaming. Other catalog ids ending in -pro are ordinary entries served on the endpoints their supported_endpoints list, not Pro routes. Your price, provider, region and data-retention settings still apply. The provider must also support the features in your request. If no compatible Pro provider is available, the API returns HTTP 503 without charging you. A provider response that does not confirm Pro is rejected without a charge. Other OpenAI Pro model IDs, model IDs with a date suffix, and Pro reasoning replay are not yet supported. This includes requesting reasoning.encrypted_content. Pro can take longer and use more tokens than standard mode. Billing includes the total input and output tokens used across its model work, so input_tokens can exceed your original prompt's token count. The gpt-5.5-pro model has its own pricing. For streaming requests, read the final event as well as the HTTP status. A stream can start with HTTP 200 and later report an error. Pro streams are charged only when a valid final response confirms Pro and includes token usage.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "x-ci-techniques",
            "in": "header",
            "required": false,
            "description": "Set to off to disable optional workspace techniques for a controlled benchmark. Preserves workspace defaults and billing policy; takes precedence over technique opt-in headers.",
            "schema": {
              "type": "string",
              "enum": [
                "off"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache",
            "in": "header",
            "required": false,
            "description": "Prompt-cache knob. `passthrough` (default, or the API key's `prompt_cache_mode`) forwards the request unchanged; `on` additionally adds provider cache breakpoints for supported models. For Claude, unmarked requests cache the shared system/tools prefix and growing conversation; caller-supplied cache controls and lifetimes are preserved. `off` removes explicit cache controls, disables sticky affinity for this request and, for models that read a cache marker, prefers routes that forward the body as sent over the marketplace; it does not disable a provider's implicit caching.",
            "schema": {
              "type": "string",
              "enum": [
                "on",
                "off",
                "passthrough"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-scope",
            "in": "header",
            "required": false,
            "description": "Sticky-affinity scope: `session` (default), `user`, or `org`. Scopes the affinity key that keeps a repeated prompt prefix on the same upstream provider so its cache stays warm.",
            "schema": {
              "type": "string",
              "enum": [
                "session",
                "user",
                "org"
              ]
            }
          },
          {
            "name": "x-ci-prompt-cache-session",
            "in": "header",
            "required": false,
            "description": "Session id read when the scope is `session`. Send one stable value per conversation or agent run. When absent, a string prompt_cache_key in the request body is used. Without either identifier, the tools, opening system instructions and first conversation message identify the session. Affinity remains isolated to the API key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-ci-model-lock",
            "in": "header",
            "required": false,
            "description": "Model Lock. Serve exactly the model named in the body: no model-routing technique, no experiment variant and no admission canary may substitute it. Combined with `X-CI-Experiment` (or a forced experiment variant) it is refused with 400 `model_lock_conflict` before anything is read or reserved. If any stage would still change the model, the request is refused with 500 `model_lock_violation` before reaching a model and nothing is billed. Model routing is held off even when the key, the workspace or `x-ci-route` turns it on. `1` or `true` (any case) turns it on; absent or empty leaves it off. Any other value, including `0` and `false`, is refused with 400 `invalid_contract_header` naming the header in `param`, so a typo never silently means off.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-ci-zdr": {
                "description": "Whether zero data retention applied to this request. Absent when no policy was recorded.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "x-ci-discount-percent": {
                "description": "Quoted customer rate discount versus list, not the final effective savings after usage and optimizations. See usage history for the settled effective discount.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Cheaper-Inference-Request-Id": {
                "description": "Request identifier. Legacy name, still emitted; identical to x-ci-request-id.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-request-id": {
                "description": "Request identifier. Canonical going forward.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-request-id": {
                "description": "Request identifier, sent INSTEAD of every x-ci-* header and X-Cheaper-Inference-Request-Id when the API key has white-label turned on. The body keeps request_id (the same value) but carries no billing or usage.cost.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "x-ci-tokens-saved": {
                "description": "Input tokens removed by the optimizer.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-saved-usd": {
                "description": "Total saved against the provider's list price, in USD.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-techniques": {
                "description": "Comma-separated ids of the optimization techniques applied. Empty when none were.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-cache": {
                "description": "`hit` or `miss` for the exact-match cache.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-prompt-cache-affinity": {
                "description": "Sticky prompt-cache outcome (KEA-5164). One of `hit`, `moved`, `new`, `stale`. `hit` means the request was served on the route its conversation was warm on; `moved` means a warm route was remembered but another route served this turn, so its cache was not reused. Present only when the request carried a cacheable prefix and the affinity mode was not off; the exact-match `cache` header covers the separate response cache. Absent on a stream whose headers were sent before a route answered (after about 1 s).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-experiment-variant": {
                "description": "Name of the assigned experiment variant. Present only when the request included X-CI-Experiment and matched a running experiment.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-routing-overhead-ms": {
                "description": "Elapsed milliseconds from proxy request start to dispatch of the successful provider attempt, including routing and prior attempts. On an exact-match cache hit, measures elapsed proxy processing time before returning the cached response. Present on successful buffered, streaming, and cached responses. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-routing-overhead-ms: <n>` ahead of the first event.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-model-response-ms": {
                "description": "Elapsed milliseconds from dispatch of the successful provider attempt to its complete response body. Present on successful non-streaming responses; absent on streaming responses and when no provider was called.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "x-ci-warning": {
                "description": "Present when the request was served with a parameter value other than the one sent, because the model does not accept the value sent. Names the parameter, the value sent and the value used. Example: GPT-6 reasoning_effort \"minimal\" is served as \"low\". A request pinned to a provider is refused with 400 unsupported_parameter instead. On a stream whose headers were sent before a route answered (after about 1 s), it arrives instead as the SSE comment line `: x-ci-warning: <text>` ahead of the first event.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ci-stage-timing": {
                "description": "Optional diagnostic timing breakdown, emitted when PROXY_STAGE_TIMING=1 and a request timer is active. Comma-separated stage=milliseconds entries with total first; zero-duration stages are omitted. Stage names depend on the request path.",
                "schema": {
                  "type": "string",
                  "example": "total=1534,auth=258,wallet_hold=128"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Set `stream: true` on the request to select this."
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`) Under the client contract also `code: invalid_contract_header` (a bad `x-ci-model-lock` or `x-ci-stream-receipt` value) and `code: model_lock_conflict` (Model Lock combined with an experiment). While the key has an open task budget (`/v1/keys/self/task-budgets`), also `code: task_budget_exhausted` (`param: task_budget`): the request's worst-case charge does not fit what the budget has left, so it was refused before anything was held and nothing was charged. Only with a contract header, when the workspace policy requires a task budget and the key has none open, also `code: task_budget_required` (`param: task_budget`); nothing was held or charged. Only with a contract header, every 402, 403 and 429 refusal on the inference path is answered as this 400 instead, with one of these codes: `code: workspace_monthly_cap_hit` (`param: workspace_monthly_cap`), `code: member_monthly_cap_hit` (`param: member_monthly_cap`), `code: wallet_too_low` (`param: wallet`), `code: wallet_top_up_failed` (`param: wallet`), `code: key_monthly_cap_hit` (`param: key_monthly_cap`), `code: contract_funding_refused`, `code: workspace_membership_ended` (`param: workspace_membership`), `code: key_scope_missing` (`param`: the missing scope), `code: key_network_refused` (`param: key_network`), `code: key_allowlist_refused` (`param: key_allowlist`), `code: key_policy_refused` (`param: key_policy`), `code: provider_policy_block` (`param: end_user`), `code: contract_access_refused`, `code: key_minute_cap_hit` (`param: key_minute_cap`), `code: key_daily_cap_hit` (`param: key_daily_cap`), `code: key_parallel_cap_hit` (`param: key_parallel_cap`), `code: contract_pacing_refused`. Each message starts with a distinct phrase and nothing was charged unless it says otherwise. Without a contract header these refusals keep their usual status and code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`) Under Model Lock also `code: model_lock_violation`: a stage would have served another model, so the request was refused before reaching any model and nothing was billed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List models",
        "operationId": "listModels",
        "description": "Every model this platform serves, with capabilities and prices. `pricing_version` is a SHA-256 over the list that was returned, so a filtered response validates its own cache and not the unfiltered one.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "`text` for chat models, `image` for image generation, `video` for video generation, `decision` for decision models served on /v1/decisions.",
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "image",
                "video",
                "decision",
                "embedding",
                "speech",
                "transcription"
              ]
            }
          },
          {
            "name": "vision",
            "in": "query",
            "required": false,
            "description": "Select models that do or do not accept image input. Accepts 1/true/t/yes/y/on and 0/false/f/no/n/off.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "video",
            "in": "query",
            "required": false,
            "description": "Select models that do or do not accept video input. Accepts 1/true/t/yes/y/on and 0/false/f/no/n/off.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "reasoning",
            "in": "query",
            "required": false,
            "description": "Select models that do or do not reason. Accepts 1/true/t/yes/y/on and 0/false/f/no/n/off.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "streaming",
            "in": "query",
            "required": false,
            "description": "Select models that do or do not stream. Accepts 1/true/t/yes/y/on and 0/false/f/no/n/off.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "zdr",
            "in": "query",
            "required": false,
            "description": "`true` switches to the zero-data-retention view: only models a `zdr: true` request can be served for, priced at what that request pays. `false` (the default) is the standard view, not a filter for models without ZDR supply.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Exact provider name, compared trimmed and case-insensitively. A prefix does not match.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/public/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List models (public)",
        "operationId": "listPublicModels",
        "description": "The advertised catalog, with live prices, and NO API KEY. This is what the marketing pages and any other surface that cannot hold a key read. Prices are resolved by the same rule that bills a request, so a quote here and the charge cannot disagree. `/v1/models` covers the same catalog for authenticated clients and adds marketplace-only models.",
        "security": [],
        "responses": {
          "200": {
            "description": "The catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicModelCatalog"
                }
              }
            }
          },
          "503": {
            "description": "The catalog could not be read. No prices are served rather than stale ones.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetailError"
                }
              }
            }
          }
        }
      }
    },
    "/public/models/{model_id}": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Get one model (public)",
        "operationId": "getPublicModel",
        "description": "One catalog entry. The id may contain slashes (`google/gemini-3.5-flash-lite`) and is matched exactly, including case.",
        "security": [],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "description": "Model id. May contain `/`.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "simple": {
                "value": "claude-opus-5"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicModel"
                }
              }
            }
          },
          "404": {
            "description": "No such model, or it is not currently advertised.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetailError"
                }
              }
            }
          },
          "503": {
            "description": "The catalog could not be read. No prices are served rather than stale ones.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetailError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/requests": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "List requests",
        "operationId": "listUsageRequests",
        "description": "Per-request history for the calling workspace, newest first. Requires the `usage:read` scope. `cursor` is opaque and comes from the previous page's `next_cursor`; do not parse it. With `request_ids`, the named requests are returned instead of a page: `has_more` is false, `next_cursor` is null and `missing_request_ids` lists the ids that did not come back.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "request_ids",
            "in": "query",
            "required": false,
            "description": "Comma-separated request ids (1 to 100 UUIDs) to look up directly, for a client reconciling its own receipts. Deduplicated and compared case-insensitively. A malformed list or more than 100 entries is a 422 naming the parameter; combining it with `cursor` is a 400. The other filters still apply. Ids that do not exist, ids that are not the caller's, and ids whose detail has passed the 45-day per-request retention window are all reported in `missing_request_ids`, deliberately indistinguishable. A client reconciling receipts older than that window should expect them here rather than treat their absence as a request we never served.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "minItems": 1,
              "maxItems": 100
            }
          },
          {
            "name": "start_at",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound. A value with no offset is read as UTC.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_at",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "api_key_id",
            "in": "query",
            "required": false,
            "description": "Limit to one key in the calling workspace. A key outside it is a 404, not an empty list.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRequestList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/daily": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Daily spend",
        "operationId": "getDailyUsage",
        "description": "Daily spend for the calling workspace, defaulting to the last 30 days and zero-filled across the range so a chart does not close gaps. Requires the `usage:read` scope. Only settled requests contribute to spend. Older than 45 days, usage is kept in 15-minute buckets, so a `start_at` or `end_at` that far back must fall on a 15-minute boundary, and `timezone_offset_minutes` must be a multiple of 15 for such a range; otherwise the request is refused naming that parameter.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "start_at",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound. A value with no offset is read as UTC.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_at",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "api_key_id",
            "in": "query",
            "required": false,
            "description": "Limit to one key in the calling workspace. A key outside it is a 404, not an empty list.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "timezone_offset_minutes",
            "in": "query",
            "required": false,
            "description": "Minutes east of UTC, deciding which calendar day a request falls on.",
            "schema": {
              "type": "integer",
              "minimum": -840,
              "maximum": 840,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDaily"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/attributions": {
      "post": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Attribute your requests to a task",
        "operationId": "createUsageAttribution",
        "description": "Tag requests made with the calling key with a client task, an opaque project id and the client name. Requires the `inference` scope (describing your own traffic is part of sending it); only an API key authenticates here. All or nothing: every listed request must belong to the calling key and its actor, otherwise nothing is written. A tag never changes once written: a different task, project or client for an already tagged request is a 409, and repeating an identical post is a no-op that counts the ids as `unchanged`. The tag is read back as `attribution` on `GET /v1/usage/requests`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsageAttributionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAttribution"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`), with `param` naming the field: not JSON, an unknown field, `task_id` not a UUID, `project_id` not null or 16 to 64 characters of A-Z, a-z, 0-9, `_` or `-`, `client` other than `keak-code`, or `request_ids` not 1 to 100 UUIDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: request_not_found`: some listed requests were not made with the calling key, do not exist, or are older than the 45-day per-request retention window; the three are indistinguishable. They are listed in `error.missing_request_ids`, inside the `error` object. Nothing was written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAttributionError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: attribution_conflict`: some listed requests already carry a different task, project or client, listed in `error.conflicting_request_ids`. Nothing was written for them; a tag never changes once written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAttributionError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: attribution_unavailable`: the attribution could not be read or recorded, including before the request_tags migration is applied. Safe to retry: the post is idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/task-outcomes": {
      "post": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Report a completed task",
        "operationId": "createUsageTaskOutcome",
        "description": "Record that a task the calling key already attributed (`POST /v1/usage/attributions`) was completed. Requires the `inference` scope; only an API key authenticates here. `completed` is the only outcome recorded: a Keak Code task can be resumed after it failed or was cancelled, so those are not final. Idempotent: repeating it answers 200 with `created: false`. The workspace is copied from the task's tags and the member from the key. Team Savings reads it as \"completed tasks, as reported by Keak Code\".",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsageTaskOutcomeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageTaskOutcome"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`), with `param` naming the field: not JSON, an unknown field, `task_id` not a UUID, `outcome` other than `completed`, or `client` other than `keak-code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: task_not_found` (`param: task_id`): no request made with the calling key is tagged with this task. Attribute the requests first (`POST /v1/usage/attributions`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: task_spans_workspaces` (`param: task_id`): the task's requests are tagged in more than one workspace, so the outcome is not recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_outcomes_unavailable`: the outcome could not be read or recorded, including before the task_outcomes migration is applied. Safe to retry: the post is idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/team-savings": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Team Savings",
        "operationId": "getUsageTeamSavings",
        "description": "What the calling key's workspace spent, against the list price of the same model (`baseline.id: same_model_list_price_v1`), in total and by member, project or model, over inclusive UTC days (at most 92). Requires `usage:read`; `scope=team` also requires `account:read`. Includes every key in the workspace, not only Keak Code; requests without a Keak Code project tag are Unattributed. Spend: a settled request at its charge, a failed request that was charged at its charge, a cache hit at $0; in-flight requests are counted as pending with no amount. Requests with no known list price are left out of the baseline and of the comparable spend, and `coverage` says how much. Savings may be negative. Amounts are 6-decimal strings rounded half-even one by one, so a figure derived from two others can differ by $0.000001; groups sum to the totals exactly before rounding. At most 500 groups are returned (`groups_truncated`); totals are always complete. A member is the owner of the key that sent the request.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "`self` (default): the caller's own requests in the key's workspace. `team`: the workspace's members the caller may see, which needs the `account:read` scope as well as a workspace role that includes team reports (owner, admin, or a member granted Team reports). The workspace is always the calling key's; it cannot be named.",
            "schema": {
              "type": "string",
              "enum": [
                "self",
                "team"
              ],
              "default": "self"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First UTC day, inclusive. Defaults to 29 days before `to`. The period may cover at most 92 days (`code: range_too_large`), and may start no earlier than 45 days ago, the period request-level detail is kept for (`code: range_outside_retention`). Longer savings history is in the savings report.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last UTC day, inclusive. Defaults to today (UTC).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "description": "How `groups` is split. Ignored by the requests listing.",
            "schema": {
              "type": "string",
              "enum": [
                "member",
                "project",
                "model"
              ],
              "default": "member"
            }
          },
          {
            "name": "member",
            "in": "query",
            "required": false,
            "description": "Comma-separated: `me` or up to 50 member user ids. Anyone other than the caller needs `scope=team` (`code: member_requires_team_scope`).",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1,
              "maxItems": 50
            }
          },
          {
            "name": "project",
            "in": "query",
            "required": false,
            "description": "Comma-separated: up to 50 opaque project ids from Keak Code's attribution, or `unattributed` for requests with no project tag.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(unattributed|[A-Za-z0-9_-]{16,64})$"
              },
              "minItems": 1,
              "maxItems": 50
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "Comma-separated: up to 20 model ids, matched exactly.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$"
              },
              "minItems": 1,
              "maxItems": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamSavings"
                }
              }
            }
          },
          "400": {
            "description": "`param` names the parameter. `code: invalid_request` for a malformed, repeated or unknown parameter; `code: range_too_large` (`param: from`) for more than 92 days; `code: range_outside_retention` (`param: from`) for a start more than 45 days ago; `code: member_requires_team_scope` (`param: member`) for another member with `scope=self`; `code: invalid_cursor` for a cursor this service did not issue.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `usage:read`, or `account:read` for `scope=team` (`param` is the scope). `code: team_reports_forbidden` (`param: scope`) when the caller's role does not include team reports, or the key is a personal key. `code: member_not_visible` (`param: member`) for a member not shared with the caller. `code: organization_membership_required` when the key's workspace membership was removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: team_savings_unavailable` before the deployment's database has the report, or `code: report_timeout` when the report took too long; try a shorter period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/team-savings/requests": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Team Savings request records",
        "operationId": "listUsageTeamSavingsRequests",
        "description": "The request records behind a Team Savings figure, newest first, with the same scope, filters and permissions as `GET /v1/usage/team-savings`. Records only: no prompt, response or request body. The charged pages of a period sum to the report's `actual_usd`. `cursor` is opaque and comes from the previous page's `next_cursor`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "`self` (default): the caller's own requests in the key's workspace. `team`: the workspace's members the caller may see, which needs the `account:read` scope as well as a workspace role that includes team reports (owner, admin, or a member granted Team reports). The workspace is always the calling key's; it cannot be named.",
            "schema": {
              "type": "string",
              "enum": [
                "self",
                "team"
              ],
              "default": "self"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First UTC day, inclusive. Defaults to 29 days before `to`. The period may cover at most 92 days (`code: range_too_large`), and may start no earlier than 45 days ago, the period request-level detail is kept for (`code: range_outside_retention`). Longer savings history is in the savings report.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last UTC day, inclusive. Defaults to today (UTC).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "description": "How `groups` is split. Ignored by the requests listing.",
            "schema": {
              "type": "string",
              "enum": [
                "member",
                "project",
                "model"
              ],
              "default": "member"
            }
          },
          {
            "name": "member",
            "in": "query",
            "required": false,
            "description": "Comma-separated: `me` or up to 50 member user ids. Anyone other than the caller needs `scope=team` (`code: member_requires_team_scope`).",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1,
              "maxItems": 50
            }
          },
          {
            "name": "project",
            "in": "query",
            "required": false,
            "description": "Comma-separated: up to 50 opaque project ids from Keak Code's attribution, or `unattributed` for requests with no project tag.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(unattributed|[A-Za-z0-9_-]{16,64})$"
              },
              "minItems": 1,
              "maxItems": 50
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "Comma-separated: up to 20 model ids, matched exactly.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$"
              },
              "minItems": 1,
              "maxItems": 20
            }
          },
          {
            "name": "bucket",
            "in": "query",
            "required": false,
            "description": "`charged` (default): settled, cached and charged failures, the requests the report's spend is made of. `pending`: in flight. `failed_unbilled`: failed with no charge. `all`: every one.",
            "schema": {
              "type": "string",
              "enum": [
                "charged",
                "pending",
                "failed_unbilled",
                "all"
              ],
              "default": "charged"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamSavingsRequestList"
                }
              }
            }
          },
          "400": {
            "description": "`param` names the parameter. `code: invalid_request` for a malformed, repeated or unknown parameter; `code: range_too_large` (`param: from`) for more than 92 days; `code: range_outside_retention` (`param: from`) for a start more than 45 days ago; `code: member_requires_team_scope` (`param: member`) for another member with `scope=self`; `code: invalid_cursor` for a cursor this service did not issue.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `usage:read`, or `account:read` for `scope=team` (`param` is the scope). `code: team_reports_forbidden` (`param: scope`) when the caller's role does not include team reports, or the key is a personal key. `code: member_not_visible` (`param: member`) for a member not shared with the caller. `code: organization_membership_required` when the key's workspace membership was removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: team_savings_unavailable` before the deployment's database has the report, or `code: report_timeout` when the report took too long; try a shorter period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pricing/changes": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Price changes",
        "operationId": "listPricingChanges",
        "description": "Price moves at or after `since`, oldest first, so a client can detect changes without re-diffing the catalogue. Store the `changed_at` of the last change you processed and pass it as `since` on the next poll, then follow `next_cursor` to the end. Requires the `usage:read` scope.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": true,
            "description": "Return changes at or after this time. Required: there is no default window, and an unbounded feed would return the whole price history.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum changes to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `next_cursor`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingChangeList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/docs": {
      "get": {
        "tags": [
          "Docs"
        ],
        "summary": "Search the documentation",
        "operationId": "searchDocs",
        "description": "With `q`, the matching sections in full, best match first. Without it, the table of contents includes every section's id, title, category and link without bodies. A client can see what exists before choosing what to read. Needs a valid key and no scope: this is the same text served at /docs.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "What to look up. Keywords beat sentences: the corpus is a couple of dozen sections and matching is on titles, keywords and body text.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum sections to return. Ignored without `q`.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 4
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocSectionList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/feedback": {
      "post": {
        "tags": [
          "Feedback"
        ],
        "summary": "Score a request",
        "operationId": "createFeedback",
        "description": "Rate a completed request 1-5. Not present on the legacy service.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/generations/{request_id}": {
      "get": {
        "tags": [
          "Generations"
        ],
        "summary": "Fetch a request's files again",
        "operationId": "getGeneration",
        "description": "Fresh download links for the images, video or speech one of your requests produced, so a client that timed out, crashed or lost the answer can still get the files. Image (`/v1/images/generations`, `/v1/images/edits`), video (`/v1/videos/generations`) and speech (`/v1/audio/speech`) results are kept for 7 days after the request, except for zero data retention requests and requests that failed. Each link works for 1 hour; call this again for fresh ones. Only the API key's own user can read a request's files. Requires the `inference` scope.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "description": "The request that produced the files: the `request_id` field of an image or video answer, or the `x-ci-request-id` response header (`x-request-id` for a white-label key), which speech answers carry.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request_id` (`param: request_id`): `request_id` is not a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope), or `code: ip_not_allowed` when the key's IP allowlist does not include the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: generation_not_found`: nothing is stored for this request. It was not an image, video or speech request, it was made by another user (a teammate included), it used zero data retention, it failed, or its files were deleted; these are deliberately indistinguishable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "410": {
            "description": "`code: generation_expired`: the request is more than 7 days old, so its files are no longer kept.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: generation_storage_unavailable`: file storage could not be reached. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Generations"
        ],
        "summary": "Delete a request's files",
        "operationId": "deleteGeneration",
        "description": "Removes the stored files of one of your requests now, instead of when the 7 days run out. Links already handed out stop working. Deleting again, or deleting a request with nothing stored, answers 200 with `files_deleted: 0`. Only the API key's own user can delete. Requires the `inference` scope.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "description": "The request that produced the files: the `request_id` field of an image or video answer, or the `x-ci-request-id` response header (`x-request-id` for a white-label key), which speech answers carry.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerationDeleted"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request_id` (`param: request_id`): `request_id` is not a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope), or `code: ip_not_allowed` when the key's IP allowlist does not include the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: generation_not_found`: no image, video or speech request with this id belongs to the API key's own user, or the request is past the retention window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: generation_storage_unavailable`: file storage could not be reached. Retry shortly. Some files may already be gone; a retry removes the rest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the account",
        "operationId": "getAccount",
        "description": "Email, workspace and role, how many keys are live and when one was last used, and how many optimization techniques are actually on.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/balance": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the wallet balance",
        "operationId": "getAccountBalance",
        "description": "Balance, what is reserved against requests in flight, and auto-recharge state. Spend against `available_usd`, not `balance_usd`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountBalance"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Summarize usage over a window",
        "operationId": "getAccountUsage",
        "description": "Requests, billed, saved versus list price and the top models. The rolled-up counterpart to /v1/usage/daily's per-day series.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Window in days. Defaults to 7, maximum 90.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountUsage"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/savings": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the savings snapshot",
        "operationId": "getAccountSavings",
        "description": "Savings over 24 hours, 7 days and 30 days, every experiment's per-request economics, and the technique catalog with this account's state on each.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSavings"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/workspace-policy": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Read the workspace admin policy",
        "operationId": "getWorkspaceAdminPolicy",
        "description": "The admin policy of the calling key's workspace, and `can_edit` (owner or admin). Five settings bind every member, owners and admins included: a maximum task limit that clamps every task budget, an advisory default task limit, whether Keak Code contract requests need an open task budget, techniques locked off, and a prompt-cache rule. Requires `account:read`; any member may read it. Free: runs no inference.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceAdminPolicyView"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `account:read` (`param` is the scope); a temporary Prompt Studio key carries only `inference`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: workspace_not_found`: the key is a personal key, which no workspace policy covers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: workspace_policy_unavailable`: the policy could not be read or changed, including on a deployment whose database does not have the workspace admin policy migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Replace the workspace admin policy",
        "operationId": "setWorkspaceAdminPolicy",
        "description": "Replace the whole policy of the calling key's workspace; the workspace is always the key's own. Send `expected_version` as read: a policy saved in between is 409 with the current one. Lowering `task_limit_max_usd` lowers every open task budget above it in the same transaction (`clamped_task_budget_count`); raising or clearing it changes no budget. Every save is audited. Requires `account:write` and a workspace owner or admin.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceAdminPolicyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceAdminPolicySaved"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request`, with `param` naming the field: not a JSON object, an unknown or missing field, `expected_version` not a whole number, a money field not null or a decimal string above 0 and at most 10000 with at most 6 places, the default above the maximum, `task_budget_required` not a boolean, `techniques_locked_off` not a list of at most 32 distinct catalog technique ids, or `prompt_cache_rule` not null, on, off or passthrough.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `account:write` (`param` is the scope); a temporary Prompt Studio key carries only `inference`. `code: workspace_manager_required` unless the key's creator is a workspace owner or admin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: workspace_not_found`: the key is a personal key, which no workspace policy covers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: workspace_admin_policy_conflict`: the policy was saved since `expected_version` was read. The current policy is in `error.current`; nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceAdminPolicyConflict"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: workspace_policy_unavailable`: the policy could not be read or changed, including on a deployment whose database does not have the workspace admin policy migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/task-budgets": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List the workspace's task budgets",
        "operationId": "listWorkspaceTaskBudgets",
        "description": "Every member's task budgets in the calling key's workspace, newest first, each with its member and key. Requires `account:read` and a workspace owner or admin.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "`open` (open and unexpired, the default) or `recent` (opened in the last 7 days, any status).",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "recent"
              ],
              "default": "open"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many budgets, 1 to 200. Defaults to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminTaskBudgetList"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request` (`param: status` or `limit`) for a status other than open or recent, or a limit outside 1 to 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `account:read` (`param` is the scope); a temporary Prompt Studio key carries only `inference`. `code: workspace_manager_required` unless the key's creator is a workspace owner or admin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: workspace_not_found`: the key is a personal key, which no workspace policy covers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: workspace_policy_unavailable`: the policy could not be read or changed, including on a deployment whose database does not have the workspace admin policy migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/task-budgets/{budget_id}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Read one of the workspace's task budgets",
        "operationId": "getWorkspaceTaskBudget",
        "description": "One budget in the calling key's workspace. With `include=requests`, up to 500 of the requests it held, oldest first, and `requests_truncated`; that also needs the caller to see the member's requests in Team reports. Requires `account:read` and a workspace owner or admin.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "budget_id",
            "in": "path",
            "required": true,
            "description": "A budget in the calling key's workspace. Another workspace's budget id answers 404.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "`requests` adds the requests this budget held.",
            "schema": {
              "type": "string",
              "enum": [
                "requests"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminTaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request` (`param: include`) for an `include` other than `requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `account:read` (`param` is the scope); a temporary Prompt Studio key carries only `inference`. `code: workspace_manager_required` unless the key's creator is a workspace owner or admin. With `include=requests`, `code: team_reports_forbidden` or `member_not_visible` when the caller may not see that member's requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: workspace_not_found`: the key is a personal key, which no workspace policy covers. `code: task_budget_not_found` (`param: budget_id`): no such budget in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: workspace_policy_unavailable`: the policy could not be read or changed, including on a deployment whose database does not have the workspace admin policy migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/task-budgets/{budget_id}/close": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Close a member's task budget",
        "operationId": "closeWorkspaceTaskBudget",
        "description": "Close a budget in the calling key's workspace now: `close_reason: admin` and `closed_by_user_id`, audited. Requests it already held settle into it later. Idempotent: a closed or expired budget is answered as it is. The member may open a new budget. Body `{}` or none. Requires `account:write` and a workspace owner or admin.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "budget_id",
            "in": "path",
            "required": true,
            "description": "A budget in the calling key's workspace. Another workspace's budget id answers 404.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminTaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request` for a body that is not empty, `{}`, or a JSON object without fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `account:write` (`param` is the scope); a temporary Prompt Studio key carries only `inference`. `code: workspace_manager_required` unless the key's creator is a workspace owner or admin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: workspace_not_found`: the key is a personal key, which no workspace policy covers. `code: task_budget_not_found` (`param: budget_id`): no such budget in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: workspace_policy_unavailable`: the policy could not be read or changed, including on a deployment whose database does not have the workspace admin policy migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/experiments": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List experiments",
        "operationId": "listExperiments",
        "description": "Every experiment on the account with its cost, savings and feedback.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExperimentList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/experiments/{experiment_id}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get an experiment",
        "operationId": "getExperiment",
        "description": "One experiment broken down per variant, so arms can be compared.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "experiment_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Experiment"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/techniques": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List optimization techniques",
        "operationId": "listTechniques",
        "description": "The catalog with this account's state on each entry. Preview and unimplemented techniques are included and flagged, not hidden.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TechniqueList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/techniques/{technique_id}": {
      "patch": {
        "tags": [
          "Account"
        ],
        "summary": "Enable or disable a technique",
        "operationId": "updateTechnique",
        "description": "Requires account:write. A technique that is not implemented, or is deprecated, is refused with a 404. Turning on a technique the workspace admin policy locks off is refused with 409 technique_locked_by_workspace; turning it off is always allowed.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "technique_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TechniqueUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TechniqueUpdateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List API keys",
        "operationId": "listApiKeys",
        "description": "Prefixes only. Saved full keys can be copied by their owner in the dashboard.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "include_revoked",
            "in": "query",
            "required": false,
            "description": "Include revoked keys. Defaults to false. Accepts 1/true/t/yes/y/on and 0/false/f/no/n/off.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create an API key",
        "operationId": "createApiKey",
        "description": "Requires account:write, and refuses a caller authenticated through a chat integration: a short-lived internal token must not be able to mint a permanent credential. The plaintext key is returned in the response. Its owner can also copy the saved key in the dashboard.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key_id}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Revoke an API key",
        "operationId": "revokeApiKey",
        "description": "Requires account:write. Revoking the key you are authenticating with is allowed. The next request simply fails to authenticate.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyRevoked"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key_id}/techniques": {
      "get": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Read the calling key's technique profile",
        "operationId": "getKeyTechniqueProfile",
        "description": "What each Cheaper Inference technique will do for requests made with this key, derived from the same resolver that serves requests: the key's own override, the workspace setting, the effective state and where it comes from. Also the key's id, prefix, scopes, monthly spend limit and `prompt_cache_mode`. On a workspace key also the workspace admin policy (`admin_policy`): a technique it locks off reads `locked_by_workspace: true` and `effective: false`, and `prompt_cache_mode_effective` applies its cache rule. Requires the `inference` scope. Only `self` is accepted as `key_id` in this release.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyTechniqueProfile"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked after it authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. Use the selected API key instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: technique_settings_unavailable`: the profile could not be read. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Narrow the calling key's technique profile",
        "operationId": "updateKeyTechniqueProfile",
        "description": "Move the key's own techniques toward conservative and set its prompt-cache default. `profile: \"coding-safe-v1\"` writes an explicit off override for every implemented technique; entries in `techniques` then apply on top of it. `off` is always allowed; `inherit` only while the workspace has that technique off; `on` never (403 `technique_change_requires_manager`, turned on by the key's manager in the dashboard). Unknown fields are refused. Requires the `inference` scope. Only `self` is accepted as `key_id`. Answers with the profile read back after the change. Under a workspace `prompt_cache_rule`, `prompt_cache_mode` is still stored as the key's default and the answer is 200: `prompt_cache_mode` shows it and `prompt_cache_mode_effective` the rule. `inherit` on a technique the workspace locks off is refused like any `inherit` while the workspace has it on, because it would turn on when the lock is lifted.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyTechniqueProfileUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyTechniqueProfile"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`): not a JSON object, empty, an unknown field, an unknown technique id, a state other than on/off/inherit, or a `prompt_cache_mode` other than on/off/passthrough/require. `param` names the field, for example `techniques.<id>`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it. `code: technique_change_requires_manager` (`param: techniques.<id>`) for `on`, or for `inherit` while the workspace has that technique on, because either would turn it on for this key. `code: api_key_not_manageable` when the caller cannot manage the key. Nothing is written on any 403.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked after it authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. Use the selected API key instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: technique_settings_unavailable`: the profile could not be read. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key_id}/task-budgets": {
      "get": {
        "tags": [
          "Keak Code"
        ],
        "summary": "List the calling key's task budgets",
        "operationId": "listTaskBudgets",
        "description": "The key's open task budget (null when none is open and unexpired) and its 20 newest budgets, newest first. A task budget is a spending cap Cheaper Inference enforces on this key while it is open: every inference request the key admits holds its worst-case charge against the budget before any wallet hold, and one that does not fit is refused with 400 `code: task_budget_exhausted`. Enforcement is per key, not per task: every request on the key counts, whichever client sent it, and only requests that reach Cheaper Inference are held. Also the workspace admin policy (`admin_policy`). Requires the `inference` scope; only `self` is accepted as `key_id`. Free: runs no inference.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetList"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request` (`param: include`) for an `include` other than `requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_budget_unavailable`: the budget could not be read or changed, including on a deployment whose database does not have the task budget migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Open a task budget on the calling key",
        "operationId": "openTaskBudget",
        "description": "Open the key's task budget for one client task, with a limit and a lease. Until it is closed or the lease expires, each request on the key holds its worst-case charge against the limit and settles to what it was billed; a request that does not fit is refused before anything is held. At expiry enforcement ends and the key falls back to its normal limits, so renew the lease with PATCH while the task runs. One open budget per key: repeating the same task and limit replays it (200, `replayed: true`); the same task with another limit is 409 `task_budget_exists` (raise it with PATCH instead); another task's open budget is 409 `task_budget_conflict` with that budget in `error.active`. On a workspace key, a limit above the workspace admin policy's maximum is clamped to it, never refused: `limit_usd` is the maximum and `clamped_to_max` is true. A replay compares the clamped limit.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskBudgetOpenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Already open for this task with this limit (`replayed: true`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudget"
                }
              }
            }
          },
          "201": {
            "description": "Opened (`replayed: false`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`), with `param` naming the field: not a JSON object, an unknown field, `task_id` not a UUID, `limit_usd` not a decimal string with at most 6 places above 0 and at most 10000 (an exponent or a JSON number is refused), `expires_in_s` not a whole number from 60 to 86400, or `force` not a boolean.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. `code: task_budget_conflict`: another task's budget is open on this key, in `error.active`. `code: task_budget_exists`: this task's budget is open with another limit, in `error.active`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_budget_unavailable`: the budget could not be read or changed, including on a deployment whose database does not have the task budget migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key_id}/task-budgets/{budget_id}": {
      "get": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Read one of the calling key's task budgets",
        "operationId": "getTaskBudget",
        "description": "The budget as it is now. `status` is the effective one: an open budget past its lease reads `expired`. `read_at` is the server's clock, for lease arithmetic. With `include=requests`, up to 500 of the requests it held, oldest first, and `requests_truncated`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          },
          {
            "name": "budget_id",
            "in": "path",
            "required": true,
            "description": "A budget of the calling key. Another key's budget id answers 404, like one that does not exist.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "`requests` adds the requests this budget held.",
            "schema": {
              "type": "string",
              "enum": [
                "requests"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "`code: invalid_request` (`param: include`) for an `include` other than `requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked or expired. `code: task_budget_not_found` (`param: budget_id`): no such budget on this key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_budget_unavailable`: the budget could not be read or changed, including on a deployment whose database does not have the task budget migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Raise a task budget or renew its lease",
        "operationId": "updateTaskBudget",
        "description": "Raise the limit, renew the lease from now, or both. The limit asked for never goes down. Only the budget of the task named in the body changes, and only while it is open. On a workspace key a raise above the workspace admin policy's maximum lands at it (`clamped_to_max: true`), and a renewal alone of a budget above the maximum lowers it to the maximum.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          },
          {
            "name": "budget_id",
            "in": "path",
            "required": true,
            "description": "A budget of the calling key. Another key's budget id answers 404, like one that does not exist.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskBudgetUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`), with `param` naming the field: not a JSON object, an unknown field, `task_id` not a UUID, `limit_usd` not a decimal string with at most 6 places above 0 and at most 10000 (an exponent or a JSON number is refused), `expires_in_s` not a whole number from 60 to 86400, or `force` not a boolean.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked or expired. `code: task_budget_not_found` (`param: budget_id`): no such budget on this key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. `code: task_budget_not_open`: closed or expired, the budget in `error.budget`. `code: task_budget_limit_decrease`: a lower limit, the budget in `error.budget`. `code: task_budget_task_mismatch`: the budget belongs to another task, in `error.active`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_budget_unavailable`: the budget could not be read or changed, including on a deployment whose database does not have the task budget migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key_id}/task-budgets/{budget_id}/close": {
      "post": {
        "tags": [
          "Keak Code"
        ],
        "summary": "Close a task budget",
        "operationId": "closeTaskBudget",
        "description": "Close the budget now; requests on the key are no longer held by it. Requests it already held stay counted and settle into it later. Idempotent: a closed or expired budget is answered as it is. Closing another task's budget needs `force: true`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "description": "`self`: the API key making the request. Any other value is a 404 in this release.",
            "schema": {
              "type": "string",
              "enum": [
                "self"
              ]
            }
          },
          {
            "name": "budget_id",
            "in": "path",
            "required": true,
            "description": "A budget of the calling key. Another key's budget id answers 404, like one that does not exist.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskBudgetCloseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudget"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body (`code: invalid_request`), with `param` naming the field: not a JSON object, an unknown field, `task_id` not a UUID, `limit_usd` not a decimal string with at most 6 places above 0 and at most 10000 (an exponent or a JSON number is refused), `expires_in_s` not a whole number from 60 to 86400, or `force` not a boolean.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`code: insufficient_scope` when the key lacks `inference` (`param` is the scope). `code: api_key_required` for a caller with no API key behind it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`code: api_key_not_found`: `key_id` is not `self`, or the key was revoked or expired. `code: task_budget_not_found` (`param: budget_id`): no such budget on this key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "`code: delegated_api_key`: a temporary Prompt Studio key authenticates as its parent, so `self` would describe another key. `code: task_budget_task_mismatch`: another task's budget and no `force`, in `error.active`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskBudgetError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`code: task_budget_unavailable`: the budget could not be read or changed, including on a deployment whose database does not have the task budget migration yet. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List connected chat channels",
        "operationId": "listChannels",
        "description": "Every Slack, Discord, Telegram and email channel this account has connected, plus the event catalog PATCH accepts.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels/{channel_id}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get a channel",
        "operationId": "getChannel",
        "description": "One channel's subscriptions and digest schedule.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "channel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Account"
        ],
        "summary": "Change a channel's schedule or subscriptions",
        "operationId": "updateChannel",
        "description": "Requires account:write. An events list containing an unknown id is refused whole rather than partially applied.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "channel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels/{channel_id}/send-report": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Post the savings digest now",
        "operationId": "sendChannelReport",
        "description": "Requires account:write. Throttled to one send per channel per minute, and does not consume the next scheduled digest.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "channel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/capabilities": {
      "get": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "What Prompt Studio can do",
        "operationId": "getPromptStudioCapabilities",
        "description": "The optimization modes and which are available, the rewriter model, the {{variable}} template rule, the limits, and whether the service is reachable now (`available`). Answers 200 with `available: false` when Prompt Studio is down. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioCapabilities"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/check-prompt": {
      "post": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "Check a prompt and estimate what optimizing it costs",
        "operationId": "checkPromptForPromptStudio",
        "description": "Free: no model runs and nothing is billed. Judges whether a prompt is fit to optimize (`verdict`, `issues`, `notes`, `variables`) and estimates, from the rates this account is offered, a zero-shot optimization and the prompt's serving cost per call and per month. Estimates are null when a price is unknown. Few-shot and training-data modes, and benchmark estimates, need profiling of how the prompt is used and are not offered yet. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptStudioCheckPromptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioPromptCheck"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/optimize": {
      "post": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "Start a zero-shot optimization",
        "operationId": "optimizePromptStudioPrompt",
        "description": "Spends money: the run bills the calling key's wallet, so the key needs `inference` as well as `prompt-studio:write`. Before anything is spent the prompt gets the same check and estimate as check-prompt; a prompt that needs changes is refused (`prompt_needs_changes`), and so is one whose cost cannot be estimated (`estimate_unavailable`), and a run the calling key's wallet cannot cover (402 `insufficient_balance`: the wallet must hold the run's upper estimate, and at least $0.25, the hold one model call needs). Show the user check-prompt's estimate and get their go-ahead before calling: the estimate is not a cap, and a run that costs more is still billed to the calling key. Returns the job id to poll with GET /v1/prompt-studio/jobs/{job_id}, and the estimate. A repeat of the same request, through the same key and within the same ten-minute slot of the clock, returns the same job; a retry across a slot boundary can start a second one. For a guarantee, send your own `Idempotency-Key` header (reusing a key for a different request is a 409).",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "1-128 characters of letters, digits, _ : -. Scoped to the calling key: the same value sent through another key is a separate request. Defaults to one derived from the request.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptStudioOptimizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioOptimizeStarted"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/runs": {
      "get": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "List Prompt Studio runs",
        "operationId": "listPromptStudioRuns",
        "description": "The caller's finished Prompt Studio runs, newest first. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Defaults to all.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "optimize",
                "benchmark"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Defaults to 20, maximum 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioRunList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/runs/{run_id}": {
      "get": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "Get a Prompt Studio run",
        "operationId": "getPromptStudioRun",
        "description": "One run: the baseline prompt-set that went in, the optimized prompt-set and model that came out (`optimized`), or a benchmark's per-arm numbers (`benchmark_arms`), and the experiments started from it. Benchmark cases are not included. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioRun"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/jobs/{job_id}": {
      "get": {
        "tags": [
          "Prompt Studio"
        ],
        "summary": "Get a Prompt Studio job's status",
        "operationId": "getPromptStudioJob",
        "description": "A running or finished job: status, stage, and once done its run id and outcome. Polling runs no inference. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptStudioJob"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/repos/connections": {
      "get": {
        "tags": [
          "Code hosts"
        ],
        "summary": "List connected code hosts and repositories",
        "operationId": "listRepoConnections",
        "description": "The caller's code-host connections with the repositories each covers, the working repository, and for every host that can be connected the dashboard page that does it. `sync=1` re-reads the repository lists from the hosts first. Requires `repos:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "sync",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoConnectionList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/repos/working": {
      "put": {
        "tags": [
          "Code hosts"
        ],
        "summary": "Set the working repository",
        "operationId": "setWorkingRepo",
        "description": "Make a connected repository the default for the repo endpoints and the MCP's repo tools, kept on the account. 404 `repo_not_connected` when no connection covers it. Requires `repos:write`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepoWorkingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoConnection"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/repos/{host}/{owner}/{repo}/contents": {
      "get": {
        "tags": [
          "Code hosts"
        ],
        "summary": "Read a file or directory from a connected repository",
        "operationId": "readRepoContents",
        "description": "A file, decoded, up to 1 MB (`repos.file`), or a directory listing (`repos.directory`) at `path` on `ref` (default branch when omitted). Requires `repos:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "host",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "github",
                "gitlab",
                "bitbucket"
              ]
            }
          },
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoContents"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/repos/pull-requests": {
      "post": {
        "tags": [
          "Code hosts"
        ],
        "summary": "Open a pull request with a run's optimized prompt",
        "operationId": "openPromptPullRequest",
        "description": "Put a Prompt Studio run's optimized prompt-set into the file the prompt lives in, on a new branch, and open a pull request with the run linked. The default branch is never written: 400 `protected_branch` when branch_name names it or a mainline (main, master, develop, production…), and an existing branch is not reused. The code's own interpolations are kept where the {{variables}} are. 409 `prompt_not_found`, `prompt_ambiguous` or `no_counterpart` when the prompt cannot be placed exactly; nothing is pushed then. A run that already has a pull request returns it with `existing: true`. Requires `repos:write`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepoPullRequestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoPullRequest"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/repos/review-settings": {
      "get": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "Read the bot's settings for a repository",
        "operationId": "getRepoReviewSettings",
        "description": "With `repo`, the bot's settings for that connected repository (`repos.review_settings`); a repository nobody has set up answers the defaults with `configured: false`. Without `repo`, every repository the caller has set up, as a list. 404 `repo_not_connected` when no connection of the caller covers the repository; the message carries the setup page. Requires `repos:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": false,
            "description": "Defaults to github.",
            "schema": {
              "type": "string",
              "enum": [
                "github",
                "gitlab",
                "bitbucket"
              ]
            }
          },
          {
            "name": "repo",
            "in": "query",
            "required": false,
            "description": "owner/name. Omit for the list.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoReviewSettingsOrList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "Switch the bot on for a repository or change its settings",
        "operationId": "setRepoReviewSettings",
        "description": "Create or change the bot's settings for a connected repository; fields left out keep their value (defaults on first save: Light, pull-request review on, commits off, $10 a month). The first save records the caller as the one who enabled it and whose wallet pays. 400 `tier_unavailable` for `deep` until the Deep tier exists; 404 `repo_not_connected` when no connection of the caller covers the repository. Requires `repos:write`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepoReviewSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoReviewSettings"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/repo-prompts": {
      "get": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "List the prompts the bot found in a repository",
        "operationId": "listRepoPrompts",
        "description": "The prompts the bot last saw in a connected repository, one row per file and symbol: where each lives, the model it targets, the commit and run that last saw it. Prompt text is never returned. 404 `repo_not_connected` when no connection of the caller covers the repository. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": false,
            "description": "Defaults to github.",
            "schema": {
              "type": "string",
              "enum": [
                "github",
                "gitlab",
                "bitbucket"
              ]
            }
          },
          {
            "name": "repo",
            "in": "query",
            "required": true,
            "description": "owner/name.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoPromptList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/bot-runs": {
      "get": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "List bot runs",
        "operationId": "listBotRuns",
        "description": "The caller's bot runs, newest first: pull-request reviews (`pr_push`) and whole-repository runs (`dashboard_run`), with counts and spend. Runs started in the Prompt Studio editor or with POST /v1/prompt-studio/optimize are not bot runs; GET /v1/prompt-studio/runs lists those. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": false,
            "description": "Defaults to github when `repo` is given; alone, filters by host.",
            "schema": {
              "type": "string",
              "enum": [
                "github",
                "gitlab",
                "bitbucket"
              ]
            }
          },
          {
            "name": "repo",
            "in": "query",
            "required": false,
            "description": "owner/name, matched in any case.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pr_push",
                "dashboard_run"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "done",
                "error",
                "skipped"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Defaults to 25; values above 100 are clamped to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotRunList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "Review a pull request now",
        "operationId": "startBotReview",
        "description": "Ask the bot to review one pull request of a connected repository: the prompts it changed are checked, improved within the repository's monthly budget, and posted as inline suggestions the author can commit. Works with pull-request review switched off in the settings. 202 with the queued run; poll GET /v1/prompt-studio/bot-runs/{id}. When the pull request's head commit was already reviewed, this run ends `skipped` with `error_code` `already_reviewed`, or `merged_into` when the earlier run had failed and is retried instead. 400 `settings_required` until the repository is set up (PUT /v1/repos/review-settings); 404 `repo_not_connected`; 502 `bot_unreachable` when the bot did not accept the job (the run is then marked `error`). Requires `prompt-studio:write`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BotRunRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the run is queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotRun"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/bot-runs/{id}": {
      "get": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "Get a bot run with its findings",
        "operationId": "getBotRun",
        "description": "One bot run with every prompt it found: location, verdict, state, a short preview of the suggestion (never the prompt text), and the comment, pull request and Prompt Studio run it led to. 404 `run_not_found` unless the run is the caller's. Requires `prompt-studio:read`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotRunDetail"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prompt-studio/repo-runs": {
      "post": {
        "tags": [
          "Prompt Studio bot"
        ],
        "summary": "Run the bot over a whole repository",
        "operationId": "startRepoRun",
        "description": "Ask the bot to read a connected repository's default branch, check every prompt it finds, improve those worth it within the monthly budget, and open one pull request per improved prompt; the default branch is never written. 202 with the queued run. 400 `settings_required` until the repository is set up; 404 `repo_not_connected`; 409 `run_in_progress` while a repository run is still queued or running; 502 `bot_unreachable` when the bot did not accept the job. Requires `prompt-studio:write`.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepoRunRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the run is queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotRun"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/supply": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Count supply under a price ceiling",
        "operationId": "modelSupply",
        "description": "How many supply sources would currently serve a chat request carrying `min_discount_percent` and/or `zdr=true` for this model, using the same filter the request path applies. At least one of the two is required. Candidates are priced under the ceiling now; health and fill are not guaranteed.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_discount_percent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 99.99
            }
          },
          {
            "name": "zdr",
            "in": "query",
            "required": false,
            "description": "Count only zero-data-retention suppliers.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelSupply"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/compare": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Price a workload across models",
        "operationId": "compareModels",
        "description": "What a given number of prompt and completion tokens would cost on each of up to ten models, cheapest first. Needs usage:read only. It discloses catalog pricing, nothing about the account.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "models",
            "in": "query",
            "required": true,
            "description": "Comma-separated model ids. At most 10.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prompt_tokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "completion_tokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "requests",
            "in": "query",
            "required": false,
            "description": "Multiply the per-request cost by this. Defaults to 1.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelComparison"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/security/strikes": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Record a refused request against the calling account",
        "operationId": "recordSecurityStrike",
        "description": "Reported by the MCP server when it refuses a call. `injection`, `escalation` and `policy` describe hostile arguments and trigger a permanent ban on the first occurrence, across every surface, not only the account API. `unauthorized` and `forbidden` describe a credential rather than an intent (a rotated key, a missing scope), so they are accepted and have no consequence. There is no rolling window, no warning tier and no escalation ladder. No scope is required. Returns the account's standing, and files a support ticket on the account's behalf so a block has somewhere to be contested.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecurityStrikeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityStanding"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/security/standing": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the calling account's standing",
        "operationId": "getSecurityStanding",
        "description": "Whether the account is blocked, and where to appeal. A block is a ban: it has no expiry, so `blocked_until` is always null and `permanent` is true whenever `tier` is `blocked`. The counting fields (`strikes`, `attempts`, `remaining`, `warn_after`, `block_after`, `window_hours`) are retained for compatibility with deployed MCP clients and now describe a one-strike policy rather than a tally. No scope is required. A banned account is refused at authentication, so this route answers for accounts that are not blocked, which lets a client notice a lift.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityStanding"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/topup": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Start a wallet top-up",
        "operationId": "startTopup",
        "description": "Requires account:write. Creates a Stripe Checkout session and returns its link. Nothing is charged here. The customer completes the payment on Stripe's own page, with the amount in front of them. The default minimum is $25; eligible onboarding experiments may assign a different minimum, enforced by the server.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Upload a temporary image",
        "operationId": "createUpload",
        "description": "Store an image for a short time and receive a `file_id`. Send that id in a chat message and it is swapped for a signed URL on the way to the provider. At most 4 MB per image; the whole request body may not exceed 4.5 MB. Rejected for an account with zero data retention.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The upload was stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads/{upload_id}": {
      "delete": {
        "tags": [
          "Uploads"
        ],
        "summary": "Delete a temporary image",
        "operationId": "deleteUpload",
        "description": "Remove an upload before it expires. An id belonging to another account answers 404, exactly as an unknown one does.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "AnthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "upload_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The upload was deleted"
          },
          "400": {
            "description": "Malformed request (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key (`type: authentication_error`, `code: invalid_api_key`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient wallet balance (`type: invalid_request_error`, `code: insufficient_balance`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the scope this endpoint requires (`type: permission_denied_error`, `code: permission_denied`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`type: invalid_request_error`, `code: not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "408": {
            "description": "Request timed out (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`type: invalid_request_error`, `code: conflict`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "413": {
            "description": "Request too large (`type: invalid_request_error`, `code: request_too_large`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "A parameter failed validation (`type: invalid_request_error`, `code: invalid_request`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "425": {
            "description": "Too early (`type: invalid_request_error`, `code: request_failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (`type: rate_limit_error`, `code: rate_limit_exceeded`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "500": {
            "description": "Server error (`type: api_error`, `code: server_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider returned an unusable response (`type: api_error`, `code: upstream_error`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable (`type: api_error`, `code: service_unavailable`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout (`type: api_error`, `code: upstream_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      },
      "AnthropicApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "OpenAIError": {
        "type": "object",
        "description": "Every `/v1/*` path except `/v1/messages*`.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string",
                "description": "Stable machine-readable code. Gemini 3 thinking cannot be disabled, so `reasoning_effort: none` returns `unsupported_reasoning_effort`."
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "AnthropicError": {
        "type": "object",
        "description": "`/v1/messages` and `/v1/messages/count_tokens`. No `code`, no `param`.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "message"
            ]
          }
        },
        "required": [
          "type",
          "error"
        ]
      },
      "ChatCompletionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "stream": {
            "type": "boolean"
          },
          "max_tokens": {
            "type": "integer"
          },
          "max_completion_tokens": {
            "type": "integer",
            "description": "Alternative output-token limit. If both limits are supplied, they must match."
          },
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          },
          "zdr": {
            "type": "boolean",
            "description": "Route this request only through providers that support a zero-data-retention policy. A zero-data-retention provider does not keep your prompts or responses and does not train on them. The marketplace and every unverified provider are excluded, so the price is the ZDR price shown by `GET /v1/models?zdr=true`. Adds to the account's Data Protection setting; it cannot lift it. With no qualifying supply the request fails before it is sent upstream with 503 `zdr_capacity_unavailable`. Stripped before forwarding."
          },
          "ranking": {
            "type": "string",
            "enum": [
              "speed",
              "discount",
              "balance"
            ],
            "default": "balance",
            "description": "How the gateway orders the sources that can serve this request, from its own recent traffic on this model. `discount`: lowest expected cost per answer first, weighed against how often each source fails. `speed`: fastest expected full answer first (recent time to first output plus output speed), also weighed against failures. `balance` (default): expected cost, reliability and time to first token together; a slow first token adds a small premium to a source's cost. A source that answers 429 is set aside for a few minutes. Speed and discount are NOT a trade-off: the fastest source is often also a cheap one, so `speed` can return the same route as `discount`. Every eligible source is ranked the same way, fallback capacity included. The mode changes the order only, never which sources are eligible. Stripped before forwarding."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "Model-specific sampling control. Omit on models that do not support sampling. Claude Chat-to-native translation caps values above 1 at 1. A value outside 0 to 2 is refused with 400."
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Model-specific sampling control. Omit on models that do not support it. A value outside 0 to 1 is refused with 400."
          },
          "n": {
            "type": "integer",
            "description": "Number of completions. Claude supports only 1."
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "tool_choice": {},
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "none",
              "minimal",
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "description": "Alias for reasoning.effort, including Claude. Conflicting values return 400. Supported levels depend on the model; Gemini 3 accepts minimal, low, medium, and high only. Claude native bridges translate effort into adaptive thinking or a manual budget within max_tokens. A manual budget must be an integer of at least 1024, strictly below the output limit. Thinking summaries, when returned, appear in message.reasoning_content or delta.reasoning_content. Native thinking and output_config settings take precedence."
          },
          "reasoning": {
            "type": [
              "object",
              "boolean",
              "null"
            ],
            "description": "Portable reasoning controls, including Claude. false disables thinking where supported. Use /v1/responses for Pro. Chat Completions returns HTTP 400 for reasoning.mode: pro or an OpenAI Pro model ID such as gpt-5.5-pro.",
            "properties": {
              "effort": {
                "type": "string",
                "enum": [
                  "none",
                  "minimal",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              },
              "enabled": {
                "type": "boolean"
              },
              "exclude": {
                "type": "boolean",
                "description": "For Claude Chat, true hides returned thinking summaries without disabling thinking."
              },
              "max_tokens": {
                "type": "integer",
                "description": "Manual reasoning budget where supported. Claude requires at least 1024 and strictly less than the request output limit. Adaptive-only Claude models reject this portable budget."
              }
            },
            "additionalProperties": true
          },
          "thinking": {
            "type": "object",
            "description": "Native Claude thinking configuration. Takes precedence over portable effort. Active thinking supports auto or none tool_choice, not required or a forced named tool.",
            "additionalProperties": true
          },
          "output_config": {
            "type": "object",
            "description": "Native Claude output configuration, including effort for adaptive thinking. Preserved by the native Chat bridges.",
            "additionalProperties": true
          },
          "include_reasoning": {
            "type": "boolean",
            "description": "Claude Chat thinking summaries are hidden by default. Set true (or reasoning.exclude: false) to include them. False or reasoning.exclude: true always hides them without disabling thinking or changing token billing."
          },
          "cache_control": {
            "type": "object",
            "description": "Request-level Claude cache control. Supported controls on tools, messages and content blocks are also preserved by native bridges. An opt-in does not guarantee a cache hit; off removes explicit controls; ZDR keeps them.",
            "additionalProperties": true
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "usage": {
            "type": "object"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "id",
          "choices"
        ],
        "additionalProperties": true
      },
      "CompletionRequest": {
        "type": "object",
        "properties": {
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          },
          "zdr": {
            "type": "boolean",
            "description": "Route this request only through providers that support a zero-data-retention policy. A zero-data-retention provider does not keep your prompts or responses and does not train on them. The marketplace and every unverified provider are excluded, so the price is the ZDR price shown by `GET /v1/models?zdr=true`. Adds to the account's Data Protection setting; it cannot lift it. With no qualifying supply the request fails before it is sent upstream with 503 `zdr_capacity_unavailable`. Stripped before forwarding."
          },
          "ranking": {
            "type": "string",
            "enum": [
              "speed",
              "discount",
              "balance"
            ],
            "default": "balance",
            "description": "How the gateway orders the sources that can serve this request, from its own recent traffic on this model. `discount`: lowest expected cost per answer first, weighed against how often each source fails. `speed`: fastest expected full answer first (recent time to first output plus output speed), also weighed against failures. `balance` (default): expected cost, reliability and time to first token together; a slow first token adds a small premium to a source's cost. A source that answers 429 is set aside for a few minutes. Speed and discount are NOT a trade-off: the fastest source is often also a cheap one, so `speed` can return the same route as `discount`. Every eligible source is ranked the same way, fallback capacity included. The mode changes the order only, never which sources are eligible. Stripped before forwarding."
          },
          "model": {
            "type": "string"
          },
          "prompt": {
            "description": "A text prompt, a batch of text prompts, one token-ID prompt, or a batch of token-ID prompts. Token-ID arrays use o200k_base on the translated path. Arrays must be non-empty and homogeneous.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "max_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true
      },
      "CompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "usage": {
            "type": "object"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "request_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Individual billed request IDs for a translated prompt batch, in prompt order. request_id identifies the first request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "id",
          "choices"
        ],
        "additionalProperties": true
      },
      "VideoGenerationRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "seedance-2.5"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1
          },
          "duration_seconds": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "duration": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Alias for duration_seconds."
          },
          "resolution": {
            "type": "string",
            "description": "For example 480p, 720p or 1080p, as the model's catalog entry lists."
          },
          "aspect_ratio": {
            "type": "string"
          },
          "audio": {
            "type": "boolean"
          },
          "image_url": {
            "type": "string"
          },
          "input_references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "stream": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "zdr": {
            "type": "boolean",
            "description": "Route this request only through providers that support a zero-data-retention policy. A zero-data-retention provider does not keep your prompts or responses and does not train on them. The marketplace and every unverified provider are excluded, so the price is the ZDR price shown by `GET /v1/models?zdr=true`. Adds to the account's Data Protection setting; it cannot lift it. With no qualifying supply the request fails before it is sent upstream with 503 `zdr_capacity_unavailable`. Stripped before forwarding."
          },
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "anyOf": [
          {
            "required": [
              "duration_seconds"
            ]
          },
          {
            "required": [
              "duration"
            ]
          }
        ],
        "additionalProperties": true
      },
      "VideoResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "succeeded"
            ]
          },
          "duration_seconds": {
            "type": [
              "number",
              "string"
            ]
          },
          "videos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "b64_video": {
                  "type": "string"
                },
                "duration_seconds": {
                  "type": [
                    "number",
                    "string"
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "id",
          "status",
          "videos"
        ],
        "additionalProperties": true
      },
      "SpeechRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "type": "string",
            "description": "1 to 4096 characters."
          },
          "voice": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          },
          "speed": {
            "type": "number"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true
      },
      "EmbeddingRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "description": "A string, an array of token ids, or an array of 1 to 2048 of these.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "encoding_format": {
            "type": "string",
            "enum": [
              "float",
              "base64"
            ]
          },
          "dimensions": {
            "type": "integer"
          },
          "user": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true
      },
      "EmbeddingResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string"
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "data"
        ],
        "additionalProperties": true
      },
      "RerankRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "A rerank model, such as rerank-2.5."
          },
          "query": {
            "type": "string"
          },
          "documents": {
            "description": "1 to 1000 documents: strings, or objects ranked on rank_fields (POST /v1/rerank only).",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "additionalProperties": true
                }
              ]
            }
          },
          "top_n": {
            "type": "integer",
            "minimum": 1
          },
          "max_tokens_per_doc": {
            "type": "integer"
          },
          "return_documents": {
            "type": "boolean"
          },
          "rank_fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "model",
          "query",
          "documents"
        ],
        "additionalProperties": true
      },
      "RerankResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The request id."
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "relevance_score": {
                  "type": "number"
                },
                "document": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "additionalProperties": true
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "billed_units": {
                "type": "object",
                "properties": {
                  "input_tokens": {
                    "type": "integer"
                  },
                  "search_units": {
                    "type": "integer"
                  }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": true
      },
      "DecisionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "A decision model, such as jev-1.13."
          },
          "input": {
            "description": "The text every question is asked against: a string, or an array of user messages whose content is a string or a list of input_text parts.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "message"
                      ],
                      "description": "Optional discriminator; the only accepted value is message."
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "input_text"
                                ]
                              },
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "text"
                            ],
                            "additionalProperties": true
                          }
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "additionalProperties": true
                }
              }
            ]
          },
          "questions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "description": "Each question needs a type and instructions. A choice question lists 2 to 255 choices; a score question lists 2 to 10 levels. Names are optional and must be unique.",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/DecisionPredicateQuestion"
                },
                {
                  "$ref": "#/components/schemas/DecisionChoiceQuestion"
                },
                {
                  "$ref": "#/components/schemas/DecisionScoreQuestion"
                }
              ],
              "discriminator": {
                "propertyName": "type",
                "mapping": {
                  "predicate": "#/components/schemas/DecisionPredicateQuestion",
                  "choice": "#/components/schemas/DecisionChoiceQuestion",
                  "score": "#/components/schemas/DecisionScoreQuestion"
                }
              }
            }
          },
          "safety_identifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own id for the end user behind this request. Folded into the upstream safety identity, so a policy block on one end user does not affect your account; the raw value is never forwarded."
          },
          "stream": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Decisions are never streamed; only false or absent is accepted."
          },
          "zdr": {
            "type": "boolean",
            "description": "Require a zero data retention route."
          },
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          }
        },
        "required": [
          "model",
          "input",
          "questions"
        ],
        "additionalProperties": true
      },
      "DecisionPredicateQuestion": {
        "type": "object",
        "description": "A yes or no question, answered with the probability of yes.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "predicate"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Optional; unique within the request."
          },
          "instructions": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "type",
          "instructions"
        ],
        "additionalProperties": true
      },
      "DecisionChoiceQuestion": {
        "type": "object",
        "description": "A pick from the listed choices, answered with the chosen value and a probability per choice.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "choice"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Optional; unique within the request."
          },
          "instructions": {
            "type": "string",
            "minLength": 1
          },
          "choices": {
            "type": "array",
            "minItems": 2,
            "maxItems": 255,
            "description": "Distinct values. Values are typed: a string and a boolean with the same text are two choices.",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": [
                    "string",
                    "boolean"
                  ]
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "value"
              ]
            }
          }
        },
        "required": [
          "type",
          "instructions",
          "choices"
        ],
        "additionalProperties": true
      },
      "DecisionScoreQuestion": {
        "type": "object",
        "description": "A rating on the listed levels, answered with a probability-weighted level index and a probability per level.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "score"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Optional; unique within the request."
          },
          "instructions": {
            "type": "string",
            "minLength": 1
          },
          "levels": {
            "type": "array",
            "minItems": 2,
            "maxItems": 10,
            "description": "Ordered from lowest to highest.",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "label"
              ]
            }
          }
        },
        "required": [
          "type",
          "instructions",
          "levels"
        ],
        "additionalProperties": true
      },
      "DecisionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "answers": {
            "type": "array",
            "description": "One answer per question, in request order. A predicate carries the probability of yes; a choice carries the chosen value, a confidence and a probability per choice; a score carries the probability-weighted level index, a confidence and a probability per level. A question the model declines comes back as type refusal.",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/DecisionPredicateAnswer"
                },
                {
                  "$ref": "#/components/schemas/DecisionChoiceAnswer"
                },
                {
                  "$ref": "#/components/schemas/DecisionScoreAnswer"
                },
                {
                  "$ref": "#/components/schemas/DecisionRefusalAnswer"
                }
              ],
              "discriminator": {
                "propertyName": "type",
                "mapping": {
                  "predicate": "#/components/schemas/DecisionPredicateAnswer",
                  "choice": "#/components/schemas/DecisionChoiceAnswer",
                  "score": "#/components/schemas/DecisionScoreAnswer",
                  "refusal": "#/components/schemas/DecisionRefusalAnswer"
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/DecisionUsage"
          }
        },
        "required": [
          "id",
          "model",
          "answers",
          "usage"
        ],
        "additionalProperties": true
      },
      "DecisionPredicateAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "predicate"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The question's name, null for an unnamed question."
          },
          "probability": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "The probability that the statement holds."
          }
        },
        "required": [
          "type",
          "name",
          "probability"
        ],
        "additionalProperties": true
      },
      "DecisionChoiceAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "choice"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The question's name, null for an unnamed question."
          },
          "choice": {
            "type": [
              "string",
              "boolean"
            ],
            "description": "The chosen value, typed as the question offered it."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "probabilities": {
            "type": "array",
            "description": "One entry per offered choice.",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": [
                    "string",
                    "boolean"
                  ]
                },
                "probability": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "value",
                "probability"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "type",
          "name",
          "choice",
          "confidence",
          "probabilities"
        ],
        "additionalProperties": true
      },
      "DecisionScoreAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "score"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The question's name, null for an unnamed question."
          },
          "score": {
            "type": "number",
            "description": "The probability-weighted level index, from 0 to the number of levels minus one."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "probabilities": {
            "type": "array",
            "description": "One entry per level when the model reports them; may be empty.",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "integer"
                },
                "label": {
                  "type": "string"
                },
                "probability": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "value",
                "label",
                "probability"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "type",
          "name",
          "score",
          "confidence",
          "probabilities"
        ],
        "additionalProperties": true
      },
      "DecisionRefusalAnswer": {
        "type": "object",
        "description": "The model declined to answer this question. Other questions in the same request can still receive answers.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "refusal"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The question's name, null for an unnamed question."
          }
        },
        "required": [
          "type",
          "name"
        ],
        "additionalProperties": true
      },
      "DecisionUsage": {
        "type": "object",
        "description": "Billed on input tokens; a decision has no cache or reasoning tokens, so the detail counters are zero.",
        "properties": {
          "input_tokens": {
            "type": "integer"
          },
          "input_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer"
              },
              "cache_write_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "cached_tokens",
              "cache_write_tokens"
            ],
            "additionalProperties": true
          },
          "output_tokens": {
            "type": "integer"
          },
          "output_tokens_details": {
            "type": "object",
            "properties": {
              "reasoning_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "reasoning_tokens"
            ],
            "additionalProperties": true
          },
          "total_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "input_tokens",
          "input_tokens_details",
          "output_tokens",
          "output_tokens_details",
          "total_tokens"
        ],
        "additionalProperties": true
      },
      "ImageGenerationRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "gpt-image-2"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "size": {
            "type": "string"
          },
          "quality": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true
      },
      "ImageEditJsonRequest": {
        "type": "object",
        "description": "CheaperInference JSON extension. URL references are never fetched or stored by CheaperInference and are eligible only on provider routes that accept URLs.",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "gpt-image-2"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32000
          },
          "input_references": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "description": "An HTTP(S) URL or PNG, JPEG, or WebP data URL."
            }
          },
          "mask_reference": {
            "type": "string",
            "description": "Optional PNG data URL. External mask URLs are not accepted."
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "size": {
            "type": "string"
          },
          "quality": {
            "type": "string"
          },
          "background": {
            "type": "string"
          },
          "input_fidelity": {
            "type": "string"
          },
          "output_format": {
            "type": "string"
          },
          "output_compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "response_format": {
            "type": "string"
          },
          "user": {
            "type": "string"
          },
          "stream": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "model",
          "prompt",
          "input_references"
        ],
        "additionalProperties": false
      },
      "ImageEditMultipartRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "gpt-image-2"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32000
          },
          "image": {
            "oneOf": [
              {
                "type": "string",
                "format": "binary"
              },
              {
                "type": "array",
                "minItems": 1,
                "maxItems": 10,
                "items": {
                  "type": "string",
                  "format": "binary"
                }
              }
            ],
            "description": "One to 10 PNG, JPEG, or WebP uploads. Decoded sources plus the optional mask must total at most 20 MiB."
          },
          "mask": {
            "type": "string",
            "format": "binary",
            "description": "Optional PNG mask upload."
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "size": {
            "type": "string"
          },
          "quality": {
            "type": "string"
          },
          "background": {
            "type": "string"
          },
          "input_fidelity": {
            "type": "string"
          },
          "output_format": {
            "type": "string"
          },
          "output_compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "response_format": {
            "type": "string"
          },
          "user": {
            "type": "string"
          },
          "stream": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "model",
          "prompt",
          "image"
        ],
        "additionalProperties": false
      },
      "ImageResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "b64_json": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "data"
        ],
        "additionalProperties": true
      },
      "AnthropicMessagesRequest": {
        "type": "object",
        "properties": {
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          },
          "zdr": {
            "type": "boolean",
            "description": "Route this request only through providers that support a zero-data-retention policy. A zero-data-retention provider does not keep your prompts or responses and does not train on them. The marketplace and every unverified provider are excluded, so the price is the ZDR price shown by `GET /v1/models?zdr=true`. Adds to the account's Data Protection setting; it cannot lift it. With no qualifying supply the request fails before it is sent upstream with 503 `zdr_capacity_unavailable`. Stripped before forwarding."
          },
          "ranking": {
            "type": "string",
            "enum": [
              "speed",
              "discount",
              "balance"
            ],
            "default": "balance",
            "description": "How the gateway orders the sources that can serve this request, from its own recent traffic on this model. `discount`: lowest expected cost per answer first, weighed against how often each source fails. `speed`: fastest expected full answer first (recent time to first output plus output speed), also weighed against failures. `balance` (default): expected cost, reliability and time to first token together; a slow first token adds a small premium to a source's cost. A source that answers 429 is set aside for a few minutes. Speed and discount are NOT a trade-off: the fastest source is often also a cheap one, so `speed` can return the same route as `discount`. Every eligible source is ranked the same way, fallback capacity included. The mode changes the order only, never which sources are eligible. Stripped before forwarding."
          },
          "model": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer",
            "description": "Required on this endpoint."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "system": {
            "type": [
              "string",
              "array"
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "tool_choice": {
            "type": "object"
          },
          "thinking": {
            "type": "object"
          }
        },
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "additionalProperties": true
      },
      "AnthropicMessagesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "msg_0123456789abcdef0123456789abcdef"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "stop_sequence": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "type": "object"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "role",
          "content"
        ]
      },
      "CountTokensRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "system": {
            "type": [
              "string",
              "array"
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true
      },
      "CountTokensResponse": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "input_tokens"
        ]
      },
      "ResponsesRequest": {
        "type": "object",
        "properties": {
          "min_discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 99.99,
            "description": "Price ceiling for this request as a minimum discount off the model's list price (see GET /v1/models pricing.list_*). Only supply priced under list × (1 − d) serves the request, and the bill is capped at that rate. With no qualifying supply the request fails with 503 `min_discount_unavailable` instead of falling back. Stripped before forwarding."
          },
          "zdr": {
            "type": "boolean",
            "description": "Route this request only through providers that support a zero-data-retention policy. A zero-data-retention provider does not keep your prompts or responses and does not train on them. The marketplace and every unverified provider are excluded, so the price is the ZDR price shown by `GET /v1/models?zdr=true`. Adds to the account's Data Protection setting; it cannot lift it. With no qualifying supply the request fails before it is sent upstream with 503 `zdr_capacity_unavailable`. Stripped before forwarding."
          },
          "ranking": {
            "type": "string",
            "enum": [
              "speed",
              "discount",
              "balance"
            ],
            "default": "balance",
            "description": "How the gateway orders the sources that can serve this request, from its own recent traffic on this model. `discount`: lowest expected cost per answer first, weighed against how often each source fails. `speed`: fastest expected full answer first (recent time to first output plus output speed), also weighed against failures. `balance` (default): expected cost, reliability and time to first token together; a slow first token adds a small premium to a source's cost. A source that answers 429 is set aside for a few minutes. Speed and discount are NOT a trade-off: the fastest source is often also a cheap one, so `speed` can return the same route as `discount`. Every eligible source is ranked the same way, fallback capacity included. The mode changes the order only, never which sources are eligible. Stripped before forwarding."
          },
          "model": {
            "type": "string"
          },
          "store": {
            "type": "boolean",
            "description": "Accepted and ignored. This endpoint is stateless: we send `store: false` upstream whatever you send, and responses cannot be retrieved later. Content retention is controlled separately by `zdr`."
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/ResponsesInputItem"
                }
              }
            ]
          },
          "instructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResponsesTool"
            }
          },
          "tool_choice": {},
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "none",
              "minimal",
              "low",
              "medium",
              "high"
            ],
            "description": "Alias for reasoning.effort. Supplying conflicting values is a 400. Gemini 3 does not support `none` and returns `unsupported_reasoning_effort`."
          },
          "reasoning": {
            "type": [
              "object",
              "null"
            ],
            "description": "Set mode and effort separately. For gpt-5.5-pro, the model ID selects Pro, so omit mode.",
            "properties": {
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "standard",
                  "pro",
                  null
                ],
                "description": "Choose standard or Pro mode. Standard is the default. Pro returns HTTP 503 if no compatible provider is available."
              },
              "effort": {
                "type": "string",
                "enum": [
                  "none",
                  "minimal",
                  "low",
                  "medium",
                  "high"
                ]
              }
            },
            "additionalProperties": true
          },
          "text": {
            "type": "object"
          }
        },
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true
      },
      "ResponsesFunctionTool": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true
          },
          "strict": {
            "type": "boolean"
          }
        },
        "required": [
          "type",
          "name"
        ],
        "additionalProperties": true
      },
      "ResponsesCustomTool": {
        "type": "object",
        "description": "A freeform/custom tool. Providers without native custom tools receive a function wrapper whose sole input is the raw custom-tool string.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "custom"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "format": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "type",
          "name"
        ],
        "additionalProperties": true
      },
      "ResponsesNamespaceTool": {
        "type": "object",
        "description": "Responses Lite namespace. Function and custom entries may be mixed in one namespace.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "namespace"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "tools": {
            "type": "array",
            "minItems": 1,
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ResponsesFunctionTool"
                },
                {
                  "$ref": "#/components/schemas/ResponsesCustomTool"
                }
              ]
            }
          }
        },
        "required": [
          "type",
          "name",
          "tools"
        ],
        "additionalProperties": true
      },
      "ResponsesHostedTool": {
        "type": "object",
        "description": "An optional hosted tool. Offering one is tolerated, but selecting it with tool_choice is rejected because CheaperInference cannot execute it.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "file_search",
              "tool_search",
              "web_search",
              "web_search_preview"
            ]
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "ResponsesTool": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ResponsesFunctionTool"
          },
          {
            "$ref": "#/components/schemas/ResponsesCustomTool"
          },
          {
            "$ref": "#/components/schemas/ResponsesNamespaceTool"
          },
          {
            "$ref": "#/components/schemas/ResponsesHostedTool"
          }
        ]
      },
      "ResponsesAdditionalToolsItem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "additional_tools"
            ]
          },
          "tools": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ResponsesTool"
            }
          }
        },
        "required": [
          "type",
          "tools"
        ],
        "additionalProperties": true
      },
      "ResponsesInputItem": {
        "description": "A message, reasoning item, replayed function/custom call or output, agent message, or Responses Lite additional-tools declaration.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ResponsesAdditionalToolsItem"
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": true
          }
        ]
      },
      "ResponsesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "resp_0123456789abcdef0123456789abcdef"
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "response"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "incomplete",
              "failed",
              "in_progress"
            ]
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "usage": {
            "type": [
              "object",
              "null"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id to quote when contacting support about this request."
          },
          "billing": {
            "type": "object",
            "description": "What this request was billed. Present on every successful response.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "Customer billing settlement status. pending means the final charge is unknown; inference may have completed successfully."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null when the request failed or customer settlement is pending; a settled zero charge is 0.000000.",
                "examples": [
                  "0.000123"
                ]
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "Request-time zero data retention policy."
              },
              "effective_discount_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Effective discount vs request-time list cost including optimizations; null without a known comparison."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            },
            "required": [
              "status",
              "currency"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "status",
          "output"
        ],
        "additionalProperties": true
      },
      "ModelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          },
          "pricing_version": {
            "type": "string",
            "examples": [
              "sha256:…"
            ]
          },
          "pricing_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "pricing_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "object",
          "data",
          "pricing_version"
        ]
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "context_length": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Total context window in tokens; null when the provider does not publish it."
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Published maximum output tokens; null when unknown."
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "owned_by": {
            "type": "string"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image",
              "video",
              "decision",
              "embedding",
              "speech",
              "transcription"
            ]
          },
          "endpoint": {
            "type": "string",
            "description": "Preferred endpoint for this model. Dedicated Pro models use /v1/responses; decision models use /v1/decisions."
          },
          "supported_endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Currently advertised endpoints after model-specific restrictions. Use this list to choose a compatible API."
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "vision": {
                "type": "boolean"
              },
              "video": {
                "type": "boolean"
              },
              "reasoning": {
                "type": "boolean"
              },
              "streaming": {
                "type": "boolean"
              },
              "image_generation": {
                "type": "boolean"
              },
              "image_edit": {
                "type": "boolean",
                "description": "True only after this model passes a live image-edit canary."
              }
            },
            "required": [
              "vision",
              "video",
              "reasoning",
              "streaming",
              "image_generation",
              "image_edit"
            ]
          },
          "is_free": {
            "type": "boolean"
          },
          "available_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "pricing": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              },
              "input_per_million": {
                "type": "string",
                "examples": [
                  "0.700000"
                ]
              },
              "cache_read_input_per_million": {
                "type": "string",
                "description": "Price per million prompt tokens read from the provider cache."
              },
              "cache_write_input_per_million": {
                "type": "string"
              },
              "output_per_million": {
                "type": "string"
              },
              "image_output_per_million": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_input_unit_price": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_unit_price": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_unit": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "resolution_prices": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "reference_resolution_prices": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "image_pricing_unit": {
                "type": "string"
              },
              "discount_percent": {
                "type": "string",
                "examples": [
                  "30.00"
                ]
              },
              "input_token_price_threshold": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "above_threshold": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Conditional rates for the whole request when total prompt tokens, including cached tokens, exceed the threshold. applies_when states whether the serving supplier must also charge a long-context premium. Customer price caps still apply.",
                "properties": {
                  "input_token_price_threshold": {
                    "type": "integer"
                  },
                  "applies_when": {
                    "type": "string",
                    "enum": [
                      "prompt_tokens_above_threshold",
                      "prompt_tokens_above_threshold_and_supplier_charges_long_context_premium"
                    ]
                  },
                  "input_per_million": {
                    "type": "string"
                  },
                  "cache_read_input_per_million": {
                    "type": "string"
                  },
                  "cache_write_input_per_million": {
                    "type": "string"
                  },
                  "output_per_million": {
                    "type": "string"
                  },
                  "list_input_per_million": {
                    "type": "string"
                  },
                  "list_cache_read_input_per_million": {
                    "type": "string"
                  },
                  "list_cache_write_input_per_million": {
                    "type": "string"
                  },
                  "list_output_per_million": {
                    "type": "string"
                  }
                }
              },
              "source": {
                "type": "string",
                "enum": [
                  "catalog",
                  "marketplace"
                ],
                "description": "Not on the legacy service."
              },
              "list_input_per_million": {
                "type": "string",
                "description": "What the provider charges direct. Not on the legacy service."
              },
              "list_output_per_million": {
                "type": "string"
              },
              "zero_data_retention": {
                "type": "boolean",
                "description": "True in the `?zdr=true` view: the rates are what a request carrying `zdr: true` pays, and only models a zero-data-retention supplier can serve are listed."
              },
              "zero_data_retention_route": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "discounted",
                  "rail_only",
                  "none",
                  null
                ],
                "description": "The model's zero-data-retention tier, in every view: `discounted` (ZDR served from discounted supply), `rail_only` (ZDR served only through a gateway route) or `none` (a `zdr: true` request is refused with 503 `zdr_capacity_unavailable`). Null only when the tier could not be read."
              }
            },
            "required": [
              "currency",
              "input_per_million",
              "output_per_million",
              "discount_percent"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "endpoint",
          "supported_endpoints",
          "capabilities",
          "pricing"
        ]
      },
      "PublicModelCatalog": {
        "type": "object",
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicModel"
            }
          }
        },
        "required": [
          "models"
        ]
      },
      "PublicModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "claude-opus-5"
            ]
          },
          "context_length": {
            "type": [
              "integer",
              "null"
            ]
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ]
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Vendor-qualified ids that also resolve to this model.",
            "examples": [
              [
                "anthropic/claude-opus-5"
              ]
            ]
          },
          "model_type": {
            "type": "string",
            "enum": [
              "text",
              "image",
              "video",
              "decision",
              "embedding",
              "speech",
              "transcription"
            ]
          },
          "endpoint": {
            "type": "string",
            "description": "Preferred inference endpoint for this model."
          },
          "supported_endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Currently advertised inference endpoints."
          },
          "input_per_million": {
            "type": "string",
            "examples": [
              "3.500000"
            ]
          },
          "output_per_million": {
            "type": "string",
            "examples": [
              "17.500000"
            ]
          },
          "cache_read_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "cache_write_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "image_output_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "media_input_unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "media_unit_price": {
            "type": [
              "string",
              "null"
            ],
            "description": "Price per picture, for models billed per unit. Their token rates are not the price."
          },
          "media_unit": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "image"
            ]
          },
          "media_prices": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "image_pricing_unit": {
            "type": "string",
            "enum": [
              "token",
              "image"
            ]
          },
          "reference_input_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_output_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_cache_read_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_cache_write_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_image_output_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_media_input_unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_media_unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_media_prices": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "discount_percent": {
            "type": "string",
            "description": "Measured from the price actually charged against the list price, on whichever basis bills the model. `0.00` means no list price is published to compare with.",
            "examples": [
              "30.00"
            ]
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "primary_model_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_visible": {
            "type": "boolean"
          },
          "supports_vision": {
            "type": "boolean"
          },
          "supports_video": {
            "type": "boolean"
          },
          "supports_reasoning": {
            "type": "boolean"
          },
          "reasoning_capability_mode": {
            "type": "string",
            "enum": [
              "auto",
              "manual"
            ]
          },
          "supports_streaming": {
            "type": "boolean"
          },
          "supports_image_edit": {
            "type": "boolean",
            "description": "True only after this model passes a live image-edit canary."
          },
          "is_free": {
            "type": "boolean"
          },
          "available_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "input_token_price_threshold": {
            "type": [
              "integer",
              "null"
            ]
          },
          "input_per_million_above_threshold": {
            "type": [
              "string",
              "null"
            ]
          },
          "output_per_million_above_threshold": {
            "type": [
              "string",
              "null"
            ]
          },
          "above_threshold": {
            "type": [
              "object",
              "null"
            ],
            "description": "Conditional rates for the whole request when total prompt tokens, including cached tokens, exceed the threshold. applies_when states whether the serving supplier must also charge a long-context premium. Customer price caps still apply.",
            "properties": {
              "input_token_price_threshold": {
                "type": "integer"
              },
              "applies_when": {
                "type": "string",
                "enum": [
                  "prompt_tokens_above_threshold",
                  "prompt_tokens_above_threshold_and_supplier_charges_long_context_premium"
                ]
              },
              "input_per_million": {
                "type": "string"
              },
              "cache_read_input_per_million": {
                "type": "string"
              },
              "cache_write_input_per_million": {
                "type": "string"
              },
              "output_per_million": {
                "type": "string"
              },
              "list_input_per_million": {
                "type": "string"
              },
              "list_cache_read_input_per_million": {
                "type": "string"
              },
              "list_cache_write_input_per_million": {
                "type": "string"
              },
              "list_output_per_million": {
                "type": "string"
              }
            }
          },
          "zero_data_retention": {
            "type": "boolean"
          },
          "zero_data_retention_route": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "discounted",
              "rail_only",
              "none",
              null
            ],
            "description": "The model's zero-data-retention tier, in every view: `discounted`, `rail_only` or `none`. Same as `pricing.zero_data_retention_route` on `GET /v1/models`."
          }
        },
        "required": [
          "id",
          "model_type",
          "endpoint",
          "supported_endpoints",
          "input_per_million",
          "output_per_million",
          "discount_percent"
        ]
      },
      "DetailError": {
        "type": "object",
        "description": "The error body the /public routes answer with.",
        "properties": {
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail"
        ]
      },
      "UsageRequestList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "workspace"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageRequest"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque. Pass back as `cursor`; do not parse."
          },
          "missing_request_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Present only when the request named `request_ids`: the requested ids, lower-cased, that are not in `data` because they do not exist, are not the caller's, or have passed the per-request retention window. The three are deliberately indistinguishable; use `retention_days` to tell which absences your own records explain."
          },
          "retention_days": {
            "type": "integer",
            "description": "Present alongside `missing_request_ids`: how many days per-request detail is kept. Ids are never individually marked as expired, because that would reveal whether an id exists. You know when you made each request, so compare its age against this: an id older than the window is missing because the detail is no longer kept, not because the request was never served. Daily and day-by-model totals for that period remain available."
          }
        },
        "required": [
          "object",
          "scope",
          "data",
          "has_more"
        ]
      },
      "UsageRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "api_key_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "validating",
              "forwarding",
              "settled",
              "cached",
              "failed"
            ]
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "billed_cost_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null unless the request settled."
          },
          "provider_list_price_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Request-time maker/provider list-price comparison amount."
          },
          "paid_amount_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customer amount paid; null unless the request settled."
          },
          "savings_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customer-visible savings, always non-negative when present."
          },
          "route": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Always null. Identified the supply route that served the request; withdrawn because it names our supplier. The key remains so existing clients keep a stable shape."
          },
          "serving_provider": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Always null. Identified the serving provider; withdrawn for the same reason as `route`."
          },
          "retention": {
            "type": "string",
            "enum": [
              "zdr",
              "standard",
              "unknown"
            ],
            "description": "Recorded request-time retention policy; unknown for historical requests without evidence."
          },
          "effective_discount_percent": {
            "type": [
              "number",
              "null"
            ],
            "description": "Effective discount against request-time list cost, including optimizations; null without comparable settled costs."
          },
          "pricing_basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing_snapshot": {
            "type": [
              "object",
              "null"
            ],
            "description": "Immutable customer and maker-list rates resolved at admission.",
            "additionalProperties": true
          },
          "pricing_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "customer_price_ceiling_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "maker_list_ceiling_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "requested_reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_reasoning_effort": {
            "type": [
              "string",
              "null"
            ]
          },
          "time_to_response_headers_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From our API receiving the request to the serving supplier's response headers."
          },
          "model_time_to_response_headers_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From dispatch to the serving supplier to its response headers."
          },
          "time_to_first_visible_output_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Like time_to_first_token_ms, but excludes reasoning-only output. Streamed requests only."
          },
          "model_time_to_first_visible_output_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From dispatch to the first visible output. Streamed requests only."
          },
          "routing_overhead_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From our API receiving the request to dispatch to the serving supplier, earlier failed attempts included."
          },
          "provider_attempt_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cache_reporting_state": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "hit",
              "zero",
              "unknown",
              "not_applicable",
              null
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "total_latency_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Latency: from our API receiving the request to the last byte of the response."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "cache_read_input_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Not recorded yet."
          },
          "cache_write_input_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Not recorded yet."
          },
          "image_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Not recorded yet."
          },
          "time_to_first_token_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "TTFT: from our API receiving the request to the first output token, reasoning included. Streamed requests only; null when not streamed."
          },
          "model_latency_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Not recorded yet."
          },
          "model_time_to_first_token_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From dispatch to the serving supplier to the first output token, reasoning included. routing_overhead_ms + model_time_to_first_token_ms = time_to_first_token_ms. Streamed requests only."
          },
          "generation_duration_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "From the first output token to the end of the response. Streamed requests only."
          },
          "output_tokens_per_second": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tokens per second: completion_tokens * 1000 / generation_duration_ms. Streamed requests only."
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the request settled or failed."
          },
          "billing": {
            "$ref": "#/components/schemas/UsageRequestBilling"
          },
          "techniques": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageRequestTechnique"
            },
            "description": "Cheaper Inference techniques recorded for this request. Entries recorded before outcomes were stored only ever listed applied work, so they read as `applied`. Notes, release ids and evidence are not exposed."
          },
          "attribution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UsageRequestAttribution"
              },
              {
                "type": "null"
              }
            ],
            "description": "The tag written by `POST /v1/usage/attributions`, or null when the request was never attributed (also null on a deployment that has not applied the request_tags migration)."
          }
        },
        "required": [
          "request_id",
          "model",
          "endpoint",
          "status",
          "currency",
          "created_at",
          "billing",
          "techniques",
          "attribution"
        ]
      },
      "UsageRequestBilling": {
        "type": "object",
        "description": "The request's billing state for a client reconciling its own ledger. Derived from `status`: settled carries the settled charge; an incomplete request whose delivered partial stream was billed is also settled, with that charge, matching the stream receipt; cached, and failed with no charge, say `0.000000`; validating and forwarding (in flight, or a settlement that has not landed) are `pending` with a null amount, because the amount is not known.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "settled",
              "cached",
              "failed",
              "pending"
            ]
          },
          "billed_cost_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fixed 6 decimal places, as a string. Null only while pending.",
            "examples": [
              "0.004213"
            ]
          }
        },
        "required": [
          "status",
          "billed_cost_usd"
        ]
      },
      "UsageRequestTechnique": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "skipped",
              "error"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "tokens_saved": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "slug",
          "outcome",
          "reason",
          "tokens_saved"
        ]
      },
      "UsageRequestAttribution": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9_-]{16,64}$"
          },
          "client": {
            "type": "string"
          }
        },
        "required": [
          "task_id",
          "project_id",
          "client"
        ]
      },
      "UsageAttributionRequest": {
        "type": "object",
        "description": "Strict: any other field is refused with 400.",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "The client's task id."
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9_-]{16,64}$",
            "description": "An opaque client-side hash identifying the project, never a readable path or URL. Optional; null when the client has none."
          },
          "client": {
            "type": "string",
            "enum": [
              "keak-code"
            ]
          },
          "request_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 100,
            "description": "Request ids from the receipts. Deduplicated and lower-cased."
          }
        },
        "required": [
          "task_id",
          "client",
          "request_ids"
        ],
        "additionalProperties": false
      },
      "UsageAttribution": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "usage.attribution"
            ]
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "client": {
            "type": "string"
          },
          "request_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "created": {
            "type": "integer",
            "minimum": 0,
            "description": "Tags written by this call."
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0,
            "description": "Ids that already carried exactly this tag."
          }
        },
        "required": [
          "object",
          "task_id",
          "project_id",
          "client",
          "request_ids",
          "created",
          "unchanged"
        ]
      },
      "UsageAttributionError": {
        "type": "object",
        "description": "The OpenAI error envelope with the ids the caller must act on inside `error`, never at the top level.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "request_ids"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "request_not_found",
                  "attribution_conflict"
                ]
              },
              "missing_request_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "On 404 `request_not_found` only."
              },
              "conflicting_request_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "On 409 `attribution_conflict` only."
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "UsageTaskOutcomeRequest": {
        "type": "object",
        "description": "Strict: any other field is refused with 400.",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "The task id used in the attribution."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed"
            ]
          },
          "client": {
            "type": "string",
            "enum": [
              "keak-code"
            ]
          }
        },
        "required": [
          "task_id",
          "outcome",
          "client"
        ],
        "additionalProperties": false
      },
      "UsageTaskOutcome": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "usage.task_outcome"
            ]
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed"
            ]
          },
          "created": {
            "type": "boolean",
            "description": "False when the task was already recorded as completed."
          }
        },
        "required": [
          "object",
          "task_id",
          "outcome",
          "created"
        ]
      },
      "TeamSavingsSummary": {
        "type": "object",
        "description": "Amounts are USD strings with 6 decimal places, rounded half-even, and may be negative. Rates are fractions with 6 decimal places, or null when there is nothing to divide by.",
        "properties": {
          "requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Charged requests: settled, cache hits and charged failures."
          },
          "actual_usd": {
            "type": "string",
            "description": "What those requests were billed. Cache hits count $0."
          },
          "comparable_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Charged requests with a known list price."
          },
          "comparable_actual_usd": {
            "type": "string"
          },
          "baseline_usd": {
            "type": "string",
            "description": "List price of the comparable requests."
          },
          "savings_usd": {
            "type": "string",
            "description": "`baseline_usd - comparable_actual_usd`. May be negative."
          },
          "savings_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "`savings_usd / baseline_usd`; null when the baseline is 0."
          },
          "savings_breakdown": {
            "type": "object",
            "properties": {
              "same_model_price_usd": {
                "type": "string",
                "description": "Savings on requests that ran."
              },
              "response_cache_usd": {
                "type": "string",
                "description": "List price of cache hits, which cost $0."
              }
            },
            "required": [
              "same_model_price_usd",
              "response_cache_usd"
            ]
          },
          "coverage": {
            "type": "object",
            "description": "How much of the spend the savings figure covers.",
            "properties": {
              "requests_rate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`comparable_requests / requests`."
              },
              "spend_rate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`comparable_actual_usd / actual_usd`."
              }
            },
            "required": [
              "requests_rate",
              "spend_rate"
            ]
          },
          "not_comparable": {
            "type": "object",
            "description": "Charged requests left out of the savings because their list price is unknown.",
            "properties": {
              "requests": {
                "type": "integer",
                "minimum": 0
              },
              "actual_usd": {
                "type": "string"
              }
            },
            "required": [
              "requests",
              "actual_usd"
            ]
          },
          "attribution": {
            "type": "object",
            "description": "Charged requests with and without a Keak Code attribution tag.",
            "properties": {
              "attributed_requests": {
                "type": "integer",
                "minimum": 0
              },
              "attributed_actual_usd": {
                "type": "string"
              },
              "unattributed_requests": {
                "type": "integer",
                "minimum": 0
              },
              "unattributed_actual_usd": {
                "type": "string"
              }
            },
            "required": [
              "attributed_requests",
              "attributed_actual_usd",
              "unattributed_requests",
              "unattributed_actual_usd"
            ]
          },
          "pending_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "In flight, or not yet settled. No amount."
          },
          "failed_unbilled_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Failed and not charged."
          },
          "tasks": {
            "type": "object",
            "description": "Keak Code tasks with charged requests in this period. Completed tasks are as reported by Keak Code, and their spend is only what fell inside the period.",
            "properties": {
              "attributed": {
                "type": "integer",
                "minimum": 0
              },
              "reported_completed": {
                "type": "integer",
                "minimum": 0
              },
              "reported_completed_actual_usd": {
                "type": "string"
              },
              "cost_per_reported_completed_task_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Null when no task was reported completed, and on `group_by=model` groups, where one task spans several models."
              }
            },
            "required": [
              "attributed",
              "reported_completed",
              "reported_completed_actual_usd",
              "cost_per_reported_completed_task_usd"
            ]
          }
        },
        "required": [
          "requests",
          "actual_usd",
          "comparable_requests",
          "comparable_actual_usd",
          "baseline_usd",
          "savings_usd",
          "savings_rate",
          "savings_breakdown",
          "coverage",
          "not_comparable",
          "attribution",
          "pending_requests",
          "failed_unbilled_requests",
          "tasks"
        ]
      },
      "TeamSavingsGroup": {
        "type": "object",
        "description": "A summary for one member, project or model.",
        "properties": {
          "requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Charged requests: settled, cache hits and charged failures."
          },
          "actual_usd": {
            "type": "string",
            "description": "What those requests were billed. Cache hits count $0."
          },
          "comparable_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Charged requests with a known list price."
          },
          "comparable_actual_usd": {
            "type": "string"
          },
          "baseline_usd": {
            "type": "string",
            "description": "List price of the comparable requests."
          },
          "savings_usd": {
            "type": "string",
            "description": "`baseline_usd - comparable_actual_usd`. May be negative."
          },
          "savings_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "`savings_usd / baseline_usd`; null when the baseline is 0."
          },
          "savings_breakdown": {
            "type": "object",
            "properties": {
              "same_model_price_usd": {
                "type": "string",
                "description": "Savings on requests that ran."
              },
              "response_cache_usd": {
                "type": "string",
                "description": "List price of cache hits, which cost $0."
              }
            },
            "required": [
              "same_model_price_usd",
              "response_cache_usd"
            ]
          },
          "coverage": {
            "type": "object",
            "description": "How much of the spend the savings figure covers.",
            "properties": {
              "requests_rate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`comparable_requests / requests`."
              },
              "spend_rate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`comparable_actual_usd / actual_usd`."
              }
            },
            "required": [
              "requests_rate",
              "spend_rate"
            ]
          },
          "not_comparable": {
            "type": "object",
            "description": "Charged requests left out of the savings because their list price is unknown.",
            "properties": {
              "requests": {
                "type": "integer",
                "minimum": 0
              },
              "actual_usd": {
                "type": "string"
              }
            },
            "required": [
              "requests",
              "actual_usd"
            ]
          },
          "attribution": {
            "type": "object",
            "description": "Charged requests with and without a Keak Code attribution tag.",
            "properties": {
              "attributed_requests": {
                "type": "integer",
                "minimum": 0
              },
              "attributed_actual_usd": {
                "type": "string"
              },
              "unattributed_requests": {
                "type": "integer",
                "minimum": 0
              },
              "unattributed_actual_usd": {
                "type": "string"
              }
            },
            "required": [
              "attributed_requests",
              "attributed_actual_usd",
              "unattributed_requests",
              "unattributed_actual_usd"
            ]
          },
          "pending_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "In flight, or not yet settled. No amount."
          },
          "failed_unbilled_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Failed and not charged."
          },
          "tasks": {
            "type": "object",
            "description": "Keak Code tasks with charged requests in this period. Completed tasks are as reported by Keak Code, and their spend is only what fell inside the period.",
            "properties": {
              "attributed": {
                "type": "integer",
                "minimum": 0
              },
              "reported_completed": {
                "type": "integer",
                "minimum": 0
              },
              "reported_completed_actual_usd": {
                "type": "string"
              },
              "cost_per_reported_completed_task_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Null when no task was reported completed, and on `group_by=model` groups, where one task spans several models."
              }
            },
            "required": [
              "attributed",
              "reported_completed",
              "reported_completed_actual_usd",
              "cost_per_reported_completed_task_usd"
            ]
          },
          "key": {
            "type": [
              "string",
              "null"
            ],
            "description": "The member's user id, the project id, or the model. Null only for the Unattributed project group."
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "description": "The member's email, when grouping by member and they are still a member. Null otherwise."
          },
          "unattributed": {
            "type": "boolean",
            "description": "True for the project group of requests with no Keak Code project tag."
          },
          "current_member": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Grouping by member in a workspace: false for a former member, whose spend still counts. Null otherwise."
          }
        },
        "required": [
          "requests",
          "actual_usd",
          "comparable_requests",
          "comparable_actual_usd",
          "baseline_usd",
          "savings_usd",
          "savings_rate",
          "savings_breakdown",
          "coverage",
          "not_comparable",
          "attribution",
          "pending_requests",
          "failed_unbilled_requests",
          "tasks",
          "key",
          "label",
          "unattributed",
          "current_member"
        ]
      },
      "TeamSavings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "usage.team_savings"
            ]
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "viewer": {
            "type": "object",
            "properties": {
              "user_id": {
                "type": "string",
                "format": "uuid"
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The caller's workspace role; null for a personal key."
              },
              "can_view_team": {
                "type": "boolean",
                "description": "Whether `scope=team` is open to the caller's role."
              }
            },
            "required": [
              "user_id",
              "role",
              "can_view_team"
            ]
          },
          "scope": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "self",
                  "team",
                  "team_partial",
                  "personal"
                ],
                "description": "`team_partial`: the caller's grant shares only some members, so the report covers those members and the caller. `personal`: a key with no workspace."
              },
              "organization_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            },
            "required": [
              "kind",
              "organization_id"
            ]
          },
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "start_at": {
                "type": "string",
                "format": "date-time",
                "description": "Inclusive."
              },
              "end_at": {
                "type": "string",
                "format": "date-time",
                "description": "Exclusive: the day after `to`."
              },
              "time_zone": {
                "type": "string",
                "enum": [
                  "UTC"
                ]
              }
            },
            "required": [
              "from",
              "to",
              "start_at",
              "end_at",
              "time_zone"
            ]
          },
          "filters": {
            "type": "object",
            "properties": {
              "member_ids": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "project_ids": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "models": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "member_ids",
              "project_ids",
              "models"
            ]
          },
          "group_by": {
            "type": "string",
            "enum": [
              "member",
              "project",
              "model"
            ]
          },
          "baseline": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "enum": [
                  "same_model_list_price_v1"
                ]
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "description"
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/TeamSavingsSummary"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamSavingsGroup"
            },
            "description": "Highest spend first."
          },
          "group_count": {
            "type": "integer",
            "minimum": 0,
            "description": "How many groups exist."
          },
          "groups_truncated": {
            "type": "boolean",
            "description": "True when more than 500 groups exist."
          }
        },
        "required": [
          "object",
          "version",
          "generated_at",
          "currency",
          "viewer",
          "scope",
          "period",
          "filters",
          "group_by",
          "baseline",
          "totals",
          "groups",
          "group_count",
          "groups_truncated"
        ]
      },
      "TeamSavingsRequest": {
        "type": "object",
        "description": "A request record. No prompt, response or request body.",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "member_id": {
            "type": "string",
            "format": "uuid",
            "description": "The owner of the key that sent it."
          },
          "member_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Their email while they are a member of the workspace."
          },
          "model": {
            "type": "string"
          },
          "billing_status": {
            "type": "string",
            "enum": [
              "settled",
              "cached",
              "failed",
              "pending"
            ],
            "description": "As on `GET /v1/usage/requests`: a charged failure is `settled`."
          },
          "actual_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null only while pending."
          },
          "baseline_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null when the list price is unknown or nothing was charged."
          },
          "savings_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null when not comparable. May be negative."
          },
          "comparable": {
            "type": "boolean"
          },
          "attribution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UsageRequestAttribution"
              },
              {
                "type": "null"
              }
            ]
          },
          "task_outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "completed",
              null
            ]
          }
        },
        "required": [
          "request_id",
          "created_at",
          "member_id",
          "member_label",
          "model",
          "billing_status",
          "actual_usd",
          "baseline_usd",
          "savings_usd",
          "comparable",
          "attribution",
          "task_outcome"
        ]
      },
      "TeamSavingsRequestList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamSavingsRequest"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "KeyTechniqueProfile": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key.technique_profile"
            ]
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "monthly_spend_limit_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fixed 6 decimal places, as a string. Null when the key has no limit."
          },
          "prompt_cache_mode": {
            "type": "string",
            "enum": [
              "on",
              "off",
              "passthrough",
              "require"
            ],
            "description": "The key's stored mode. Require defaults the marker mode to on and restricts cache requests to routes with recent write-and-read verification. The workspace rule and request header still select marker behavior. The request's minimum discount still applies."
          },
          "prompt_cache_mode_effective": {
            "type": "string",
            "enum": [
              "on",
              "off",
              "passthrough"
            ],
            "description": "The mode a request without a cache header runs under: the workspace's `prompt_cache_rule`, else the key's marker mode (on for require). Zero data retention does not change it; the receipt reports what applied."
          },
          "admin_policy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WorkspaceAdminPolicy"
              },
              {
                "type": "null"
              }
            ],
            "description": "The workspace admin policy: the object for a workspace key, null for a personal key (no policy applies), and absent when this deployment's database does not have the policy yet."
          },
          "workspace_policy": {
            "type": "object",
            "description": "Deprecated, always false; see `admin_policy`.",
            "properties": {
              "enforced": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "supported": {
                "type": "boolean",
                "enum": [
                  false
                ]
              }
            },
            "required": [
              "enforced",
              "supported"
            ]
          },
          "profile_match": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "coding-safe-v1",
              null
            ],
            "description": "`coding-safe-v1` when every implemented technique has a current explicit off override on this key, otherwise null."
          },
          "techniques": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KeyTechniqueProfileEntry"
            }
          },
          "contract": {
            "type": "object",
            "properties": {
              "receipt_version": {
                "type": "integer",
                "enum": [
                  1
                ]
              }
            },
            "required": [
              "receipt_version"
            ]
          },
          "read_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "object",
          "api_key_id",
          "api_key_prefix",
          "scopes",
          "monthly_spend_limit_usd",
          "prompt_cache_mode",
          "prompt_cache_mode_effective",
          "workspace_policy",
          "profile_match",
          "techniques",
          "contract",
          "read_at"
        ]
      },
      "KeyTechniqueProfileEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The technique slug."
          },
          "name": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "unavailable_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "not_in_catalog",
              "not_released",
              null
            ]
          },
          "key_override": {
            "type": "string",
            "enum": [
              "on",
              "off",
              "inherit"
            ]
          },
          "key_override_current": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Null when the key has no override. False when a technique release demanded re-confirmation after the override was written, so it no longer counts."
          },
          "workspace": {
            "type": "string",
            "enum": [
              "on",
              "off"
            ]
          },
          "workspace_explicit": {
            "type": "boolean"
          },
          "effective": {
            "type": "boolean",
            "description": "What a request with this key gets."
          },
          "source": {
            "type": "string",
            "enum": [
              "key",
              "workspace",
              "default",
              "unavailable"
            ]
          },
          "request_header_can_force_on": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Request headers that can turn this technique on for one request."
          },
          "disabled_by_model_lock": {
            "type": "boolean",
            "description": "True for `model-routing`, which `x-ci-model-lock` always holds off."
          },
          "layer": {
            "type": "string",
            "enum": [
              "cheaper_inference"
            ]
          },
          "locked_by_workspace": {
            "type": "boolean",
            "description": "The workspace admin policy locks this technique off: it never runs on this key's requests, so `effective` is false and no header can force it on. `available`, `source` and `key_override` are unchanged."
          }
        },
        "required": [
          "id",
          "name",
          "available",
          "unavailable_reason",
          "key_override",
          "key_override_current",
          "workspace",
          "workspace_explicit",
          "effective",
          "source",
          "request_header_can_force_on",
          "disabled_by_model_lock",
          "layer",
          "locked_by_workspace"
        ]
      },
      "KeyTechniqueProfileUpdate": {
        "type": "object",
        "description": "Strict and non-empty: send at least one field; any other field is refused.",
        "properties": {
          "profile": {
            "type": "string",
            "enum": [
              "coding-safe-v1"
            ],
            "description": "An explicit off override for every implemented technique."
          },
          "techniques": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "off",
                "inherit",
                "on"
              ]
            },
            "description": "Technique id to state, applied on top of `profile`. `on` is always refused with 403, and `inherit` while the workspace has the technique on."
          },
          "prompt_cache_mode": {
            "type": "string",
            "enum": [
              "on",
              "off",
              "passthrough",
              "require"
            ]
          }
        },
        "additionalProperties": false,
        "minProperties": 1
      },
      "TaskBudget": {
        "type": "object",
        "description": "A task budget on one API key. Money is USD as strings with exactly 6 decimal places. `limit_usd - reserved_usd - settled_usd` is what is left (`remaining_usd`, never below 0). A held request counts its worst-case charge in `reserved_usd` until it settles, then its billed amount in `settled_usd`; a request that was not billed (a failure, or no usage reported) settles at 0. On a workspace key the workspace admin policy's maximum caps `limit_usd`: an open, raise or renewal above it lands at it, and lowering the maximum lowers every open budget above it (`limit_clamped_at`).",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key.task_budget"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "client": {
            "type": "string",
            "enum": [
              "keak-code"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed",
              "expired"
            ],
            "description": "Effective: an open budget past its lease reads `expired`."
          },
          "limit_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "At most the workspace maximum, when the workspace admin policy sets one."
          },
          "reserved_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "Held by requests that have not settled."
          },
          "settled_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "Billed to requests that settled."
          },
          "remaining_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$"
          },
          "reserved_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Requests held, settled or not."
          },
          "settled_count": {
            "type": "integer",
            "minimum": 0
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "End of the lease. Renew it with PATCH."
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "close_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "client",
              "forced",
              "expired",
              "admin",
              null
            ],
            "description": "`forced`: closed by another task with `force: true`. `admin`: closed by a workspace owner or admin."
          },
          "limit_clamped_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last time the workspace maximum lowered this budget's limit: at an open, raise or renewal above it, or when the maximum was lowered. Null when it never was. A later raise that fits does not clear it, so it can describe an earlier limit; whether an open or update was clamped is `clamped_to_max` on that answer."
          },
          "read_at": {
            "type": "string",
            "format": "date-time",
            "description": "The server's clock when this was read."
          },
          "replayed": {
            "type": "boolean",
            "description": "On the open only: true when this task's budget with this limit (after the clamp) was already open."
          },
          "clamped_to_max": {
            "type": "boolean",
            "description": "On the open and the update only: true when the limit asked for was above the workspace maximum, so `limit_usd` is the maximum instead. Never a refusal."
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskBudgetHold"
            },
            "description": "With `include=requests` only: up to 500 held requests, oldest first."
          },
          "requests_truncated": {
            "type": "boolean",
            "description": "With `include=requests` only."
          }
        },
        "required": [
          "object",
          "id",
          "api_key_id",
          "task_id",
          "client",
          "status",
          "limit_usd",
          "reserved_usd",
          "settled_usd",
          "remaining_usd",
          "reserved_count",
          "settled_count",
          "opened_at",
          "expires_at",
          "closed_at",
          "close_reason",
          "limit_clamped_at",
          "read_at"
        ]
      },
      "TaskBudgetHold": {
        "type": "object",
        "description": "One request held by the budget. Every request on the key counts, whichever client sent it; compare the ids with your own to find requests you did not send.",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "reserved_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "The request's worst-case charge."
          },
          "settled_usd": {
            "type": [
              "string",
              "null"
            ],
            "description": "What it was billed, once settled."
          },
          "status": {
            "type": "string",
            "enum": [
              "reserved",
              "settled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "settled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "request_id",
          "reserved_usd",
          "settled_usd",
          "status",
          "created_at",
          "settled_at"
        ]
      },
      "TaskBudgetList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "open": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TaskBudget"
              },
              {
                "type": "null"
              }
            ],
            "description": "The open, unexpired budget, or null."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskBudget"
            },
            "description": "The 20 newest budgets, newest first, the open one included."
          },
          "admin_policy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WorkspaceAdminPolicy"
              },
              {
                "type": "null"
              }
            ],
            "description": "The workspace admin policy: the object for a workspace key, null for a personal key (no policy applies), and absent when this deployment's database does not have the policy yet."
          }
        },
        "required": [
          "object",
          "open",
          "data"
        ]
      },
      "TaskBudgetOpenRequest": {
        "type": "object",
        "description": "Strict: any other field is refused with 400.",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "The client's task id."
          },
          "limit_usd": {
            "type": "string",
            "pattern": "^\\d{1,5}(\\.\\d{1,6})?$",
            "description": "USD, above 0 and at most 10000, at most 6 decimal places. A string, not a number."
          },
          "expires_in_s": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "description": "The lease, in seconds from now."
          },
          "client": {
            "type": "string",
            "enum": [
              "keak-code"
            ],
            "default": "keak-code"
          }
        },
        "required": [
          "task_id",
          "limit_usd",
          "expires_in_s"
        ],
        "additionalProperties": false
      },
      "TaskBudgetUpdateRequest": {
        "type": "object",
        "description": "Strict: any other field is refused with 400. Send `limit_usd`, `expires_in_s` or both.",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "Must be the budget's task."
          },
          "limit_usd": {
            "type": "string",
            "pattern": "^\\d{1,5}(\\.\\d{1,6})?$",
            "description": "The new limit; not below the current one."
          },
          "expires_in_s": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "description": "Renew the lease to this many seconds from now."
          }
        },
        "required": [
          "task_id"
        ],
        "additionalProperties": false
      },
      "TaskBudgetCloseRequest": {
        "type": "object",
        "description": "Strict: any other field is refused with 400.",
        "properties": {
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "force": {
            "type": "boolean",
            "default": false,
            "description": "Close the budget even when it belongs to another task. Send only on a user's request."
          }
        },
        "required": [
          "task_id"
        ],
        "additionalProperties": false
      },
      "TaskBudgetError": {
        "type": "object",
        "description": "The OpenAI error envelope, with what the client must act on inside `error`: the open budget in the way (`active`) or the budget as it is now (`budget`).",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "delegated_api_key",
                  "task_budget_conflict",
                  "task_budget_exists",
                  "task_budget_task_mismatch",
                  "task_budget_not_open",
                  "task_budget_limit_decrease"
                ]
              },
              "active": {
                "type": "object",
                "description": "On `task_budget_conflict`, `task_budget_exists` and `task_budget_task_mismatch`.",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "task_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "id",
                  "task_id",
                  "expires_at"
                ]
              },
              "budget": {
                "$ref": "#/components/schemas/TaskBudget",
                "description": "On `task_budget_not_open` and `task_budget_limit_decrease`."
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "ReceiptTechnique": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "skipped"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null when applied. `model_lock` when Model Lock held the technique off."
          },
          "tokens_saved": {
            "type": "integer",
            "minimum": 0
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The technique release's version when a release governed it, otherwise null."
          },
          "layer": {
            "type": "string",
            "enum": [
              "cheaper_inference"
            ]
          }
        },
        "required": [
          "slug",
          "outcome",
          "reason",
          "tokens_saved",
          "version",
          "layer"
        ],
        "additionalProperties": false
      },
      "ReceiptModelLock": {
        "type": "object",
        "properties": {
          "requested": {
            "type": "boolean",
            "description": "The request carried `x-ci-model-lock`."
          },
          "enforced": {
            "type": "boolean",
            "description": "The lock held for this request. Never true unless requested."
          }
        },
        "required": [
          "requested",
          "enforced"
        ],
        "additionalProperties": false
      },
      "ReceiptOpening": {
        "type": "object",
        "properties": {
          "receipt_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "opening"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "requested_model": {
            "type": "string",
            "description": "The catalog model the caller named."
          },
          "model_lock": {
            "$ref": "#/components/schemas/ReceiptModelLock"
          }
        },
        "required": [
          "receipt_version",
          "phase",
          "request_id",
          "api_key_id",
          "requested_model",
          "model_lock"
        ],
        "additionalProperties": false
      },
      "ReceiptOpeningFrame": {
        "type": "object",
        "description": "One `data:` line of compact JSON. These are the only top-level keys.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "response.cheaper_inference.request"
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "cheaper_inference.request"
            ]
          },
          "cheaper_inference": {
            "$ref": "#/components/schemas/ReceiptOpening"
          }
        },
        "required": [
          "type",
          "object",
          "cheaper_inference"
        ],
        "additionalProperties": false
      },
      "ReceiptFinal": {
        "type": "object",
        "description": "Never contains a key named `model` or `usage`.",
        "properties": {
          "receipt_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "final"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "requested_model": {
            "type": "string"
          },
          "served_model": {
            "type": "string",
            "description": "Present only when `model_lock.enforced` is true, and then equal to `requested_model`. Omitted, with the lock still enforced, when a supplier answered with another model mid-stream: that stream is cut unbilled and no served model is stated. CI states its routing guarantee, not proof of the supplier's identity."
          },
          "model_lock": {
            "$ref": "#/components/schemas/ReceiptModelLock"
          },
          "complete": {
            "type": "boolean",
            "description": "The request completed; false when the stream ended incomplete."
          },
          "billing": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "settled",
                  "cached",
                  "failed",
                  "pending"
                ],
                "description": "settled: complete, or a partial charge above zero. failed: incomplete with a zero charge. cached: served from cache. pending: settlement did not finish, the charge is not known yet; reconcile through the usage API."
              },
              "billed_cost_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fixed 6 decimal places, as a string. Null only while pending. A request whose usage was not reported settles at `0.000000` with `usage_known: false`."
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              },
              "usage_known": {
                "type": "boolean",
                "description": "False when no usage was reported. Missing usage is unknown, never zero."
              },
              "basis": {
                "type": "string",
                "enum": [
                  "ledger",
                  "computed"
                ]
              },
              "zero_data_retention": {
                "type": "boolean"
              }
            },
            "required": [
              "status",
              "billed_cost_usd",
              "currency",
              "usage_known",
              "basis",
              "zero_data_retention"
            ],
            "additionalProperties": false
          },
          "tokens": {
            "oneOf": [
              {
                "type": "object",
                "description": "Disjoint billed units, as the ledger counts them: `input` excludes cache reads and writes, `cache_write` sums the 5-minute and 1-hour writes, and `reasoning` is non-zero only when the tariff bills it apart from `output`.",
                "properties": {
                  "input": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "output": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cache_read": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cache_write": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "reasoning": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "input",
                  "output",
                  "cache_read",
                  "cache_write",
                  "reasoning"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when usage is unknown (or a count is not a safe non-negative integer)."
          },
          "prompt_cache_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "on",
              "off",
              "passthrough",
              null
            ],
            "description": "The prompt-cache mode that applied: the workspace `prompt_cache_rule`, else the request header, else the key's default. Zero data retention does not change it."
          },
          "techniques": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptTechnique"
            },
            "description": "Each Cheaper Inference technique applied to this request, plus a `model-routing` entry skipped with reason `model_lock` only when something (the key, the workspace, `x-ci-route`, a trial or a private release) had routing on. With routing off there is no skipped entry, so a client must not require one."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "receipt_version",
          "phase",
          "request_id",
          "api_key_id",
          "requested_model",
          "model_lock",
          "complete",
          "billing",
          "tokens",
          "prompt_cache_mode",
          "techniques",
          "warnings"
        ],
        "additionalProperties": false
      },
      "ReceiptFinalFrame": {
        "type": "object",
        "description": "One `data:` line of compact JSON. These are the only top-level keys.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "response.cheaper_inference.receipt"
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "cheaper_inference.receipt"
            ]
          },
          "cheaper_inference": {
            "$ref": "#/components/schemas/ReceiptFinal"
          }
        },
        "required": [
          "type",
          "object",
          "cheaper_inference"
        ],
        "additionalProperties": false
      },
      "DocSectionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "query": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Stable section id, e.g. `api-keys`."
                },
                "title": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Absolute link to the section."
                },
                "body": {
                  "type": "string",
                  "description": "The section's full text. Present only on a search (`q`)."
                }
              },
              "required": [
                "id",
                "title",
                "category",
                "url"
              ]
            }
          }
        },
        "required": [
          "object",
          "query",
          "data"
        ]
      },
      "PricingChangeList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "pricing_version": {
            "type": "string"
          },
          "pricing_checked_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "pricing_updated_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "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"
                },
                "changed_fields": {
                  "type": "array",
                  "description": "The rates in `previous_pricing` and `current_pricing` that differ. `billable_schedule` means none of those five moved and the change is in the rest of the billable schedule, such as a long-context tier or an image size price; `model` carries the current schedule.",
                  "items": {
                    "type": "string",
                    "enum": [
                      "input_per_million",
                      "output_per_million",
                      "media_unit_price",
                      "cache_read_per_million",
                      "cache_write_per_million",
                      "billable_schedule"
                    ]
                  }
                },
                "model": {
                  "$ref": "#/components/schemas/Model",
                  "nullable": true
                },
                "previous_pricing": {
                  "$ref": "#/components/schemas/PricingChangeRates"
                },
                "current_pricing": {
                  "$ref": "#/components/schemas/PricingChangeRates"
                }
              },
              "required": [
                "model_id",
                "change_type",
                "changed_at",
                "changed_fields",
                "model",
                "previous_pricing",
                "current_pricing"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "pricing_version"
        ]
      },
      "PricingChangeRates": {
        "type": "object",
        "description": "Customer-facing rates on one side of a change. Null means the rate was not quoted at that point, which is different from zero.",
        "properties": {
          "input_per_million": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "output_per_million": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "media_unit_price": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "cache_read_per_million": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "cache_write_per_million": {
            "type": [
              "number",
              "string",
              "null"
            ]
          }
        }
      },
      "UsageDaily": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "usage.daily"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "workspace"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "start_at": {
            "type": "string",
            "format": "date-time"
          },
          "end_at": {
            "type": "string",
            "format": "date-time"
          },
          "timezone_offset_minutes": {
            "type": "integer"
          },
          "total_requests": {
            "type": "integer"
          },
          "settled_requests": {
            "type": "integer"
          },
          "spend_usd": {
            "type": "string"
          },
          "prompt_tokens": {
            "type": "integer",
            "description": "Settled prompt tokens. Already includes any tokens served from the prompt cache."
          },
          "cached_tokens": {
            "type": "integer",
            "description": "The share of prompt_tokens the upstream served from its prompt cache."
          },
          "cache_reported_request_count": {
            "type": "integer",
            "description": "Settled requests whose upstream reported cache usage at all. Compare with settled_requests to see how much of the window cache_hit_pct speaks for."
          },
          "cache_hit_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percent of prompt tokens served from cache, over the cache-reporting requests only. Null when no upstream reported cache usage indicates an unknown rate, which is not the same as a reported 0%."
          },
          "daily_spend": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "request_count": {
                  "type": "integer"
                },
                "settled_request_count": {
                  "type": "integer"
                },
                "spend_usd": {
                  "type": "string"
                },
                "prompt_tokens": {
                  "type": "integer"
                },
                "cached_tokens": {
                  "type": "integer"
                },
                "cache_reported_request_count": {
                  "type": "integer"
                },
                "cache_hit_pct": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "date",
                "request_count",
                "settled_request_count",
                "spend_usd",
                "prompt_tokens",
                "cached_tokens",
                "cache_reported_request_count",
                "cache_hit_pct"
              ]
            }
          }
        },
        "required": [
          "object",
          "scope",
          "currency",
          "spend_usd",
          "prompt_tokens",
          "cached_tokens",
          "cache_reported_request_count",
          "cache_hit_pct",
          "daily_spend"
        ]
      },
      "FeedbackRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "score": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "request_id",
          "score"
        ]
      },
      "FeedbackResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ]
      },
      "Generation": {
        "type": "object",
        "description": "The stored files of one image, video or speech request, with fresh download links.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "generation"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint": {
            "type": "string",
            "description": "Where the request was sent: `/v1/images/generations`, `/v1/images/edits`, `/v1/videos/generations` or `/v1/audio/speech`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the files stop being available: 7 days after `created_at`."
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GenerationFile"
            },
            "description": "In the order the answer listed them. Never empty: a request with nothing stored is a 404."
          }
        },
        "required": [
          "object",
          "request_id",
          "endpoint",
          "created_at",
          "expires_at",
          "files"
        ]
      },
      "GenerationFile": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "description": "Position in the answer: the `data` entry for images, the `videos` entry for video, 0 for speech."
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "file"
            ]
          },
          "content_type": {
            "type": "string",
            "examples": [
              "image/png",
              "video/mp4",
              "audio/mpeg"
            ]
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "A signed download link, valid for 1 hour. Anyone holding it can download the file, so do not share it. Call `GET /v1/generations/{request_id}` again for a fresh one."
          },
          "url_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "index",
          "type",
          "content_type",
          "size_bytes",
          "url",
          "url_expires_at"
        ]
      },
      "GenerationDeleted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "generation.deleted"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "files_deleted": {
            "type": "integer",
            "minimum": 0,
            "description": "How many stored files were removed. 0 when nothing was stored."
          }
        },
        "required": [
          "object",
          "request_id",
          "deleted",
          "files_deleted"
        ]
      },
      "Account": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "workspace_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for a personal account."
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "funded_by_owner": {
            "type": "boolean",
            "description": "True when this member's usage is paid from the workspace owner's wallet."
          },
          "active_key_count": {
            "type": "integer"
          },
          "last_key_use_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "auto_recharge_enabled": {
            "type": "boolean"
          },
          "enabled_technique_count": {
            "type": "integer"
          }
        },
        "required": [
          "object",
          "active_key_count",
          "enabled_technique_count"
        ]
      },
      "SecurityStrikeRequest": {
        "type": "object",
        "required": [
          "tool",
          "kind",
          "detail"
        ],
        "properties": {
          "tool": {
            "type": "string",
            "maxLength": 80,
            "description": "The MCP tool that was called.",
            "examples": [
              "search_docs"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "injection",
              "escalation",
              "policy",
              "unauthorized",
              "forbidden"
            ],
            "description": "What was refused. `injection`, `escalation` and `policy` are refusals the MCP server issued itself and each count as a strike; `unauthorized` (401) and `forbidden` (403) are API denials and count once per distinct `detail`."
          },
          "detail": {
            "type": "string",
            "maxLength": 200,
            "description": "A short stable code for the reason. Never the offending text.",
            "examples": [
              "search_docs:query:injection",
              "403:insufficient_scope:API key scope required: account:read."
            ]
          }
        }
      },
      "SecurityStanding": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "security.standing"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "clear",
              "warn",
              "blocked"
            ]
          },
          "strikes": {
            "type": "integer",
            "description": "Distinct strikes in the current window. This is what the tiers compare against."
          },
          "attempts": {
            "type": "integer",
            "description": "Every denied call in the window, duplicates included."
          },
          "remaining": {
            "type": "integer",
            "description": "Strikes left before the block. 0 while blocked."
          },
          "warn_after": {
            "type": "integer"
          },
          "block_after": {
            "type": "integer",
            "description": "The daily limit."
          },
          "window_hours": {
            "type": "integer"
          },
          "blocked_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a timed block lifts. Null when not blocked, and null when the block is permanent. See `permanent`."
          },
          "permanent": {
            "type": "boolean",
            "description": "True for a block with no expiry: the daily limit was reached again within the repeat window of an earlier block. Only an admin lifts it."
          },
          "prior_blocks": {
            "type": "integer",
            "description": "Earlier blocks on record that ran their course. One or more means the next block is permanent. A block an admin lifted does not count."
          },
          "ban_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "suspension_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "report_url": {
            "type": "string",
            "format": "uri",
            "description": "Where to appeal."
          },
          "reported": {
            "type": "boolean",
            "description": "True when this call filed the automatic support report for the account."
          }
        },
        "required": [
          "object",
          "tier",
          "strikes",
          "attempts",
          "remaining",
          "warn_after",
          "block_after",
          "window_hours",
          "blocked_until",
          "permanent",
          "prior_blocks",
          "ban_id",
          "suspension_id",
          "report_url",
          "reported"
        ]
      },
      "AccountBalance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account.balance"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "balance_usd": {
            "type": "number"
          },
          "available_usd": {
            "type": "number",
            "description": "Balance minus what is held against requests in flight. This, not balance_usd, is what can be spent right now."
          },
          "reserved_usd": {
            "type": "number"
          },
          "auto_recharge_enabled": {
            "type": "boolean"
          },
          "threshold_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "recharge_amount_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "card": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "visa ending 4242"
            ]
          },
          "workspace_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "funded_by_owner": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "currency",
          "balance_usd",
          "available_usd",
          "reserved_usd"
        ]
      },
      "PromptStudioCapabilities": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "prompt_studio.capabilities"
            ]
          },
          "available": {
            "type": "boolean",
            "description": "Whether the Prompt Studio service answered just now."
          },
          "modes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PromptStudioMode"
            }
          },
          "rewriter_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "template_rule": {
            "type": "string"
          },
          "limits": {
            "type": "object",
            "properties": {
              "prompt_max_chars": {
                "type": "integer"
              },
              "optimize_budget": {
                "type": "object",
                "properties": {
                  "min": {
                    "type": "integer"
                  },
                  "max": {
                    "type": "integer"
                  },
                  "default": {
                    "type": "integer"
                  }
                },
                "required": [
                  "min",
                  "max",
                  "default"
                ]
              }
            },
            "required": [
              "prompt_max_chars",
              "optimize_budget"
            ]
          },
          "scorer_revisions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "object",
          "available",
          "modes",
          "rewriter_model",
          "template_rule",
          "limits",
          "scorer_revisions"
        ]
      },
      "PromptStudioMode": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "zero_shot",
              "few_shot",
              "training_data"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "mode",
          "available",
          "reason"
        ]
      },
      "PromptStudioCheckPromptRequest": {
        "type": "object",
        "properties": {
          "user_prompt": {
            "type": "string",
            "maxLength": 100000,
            "description": "The prompt as found in code, with {{variables}}."
          },
          "system_prompt": {
            "type": "string",
            "maxLength": 100000
          },
          "task_description": {
            "type": "string",
            "maxLength": 2000,
            "description": "One line: what the prompt is for."
          },
          "task_model": {
            "type": "string",
            "description": "Catalog id of the model the prompt runs on."
          },
          "monthly_calls": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls per month, for the monthly serving cost."
          },
          "variable_value_chars": {
            "type": "integer",
            "minimum": 1,
            "description": "Assumed length of each variable's value. Defaults to 400."
          },
          "average_output_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Output tokens per call. Defaults to a 128 to 512 range."
          },
          "source": {
            "type": "object",
            "description": "Where the prompt lives in the code, so a pull request can put the optimized prompt back (POST /v1/repos/pull-requests). Stored when an optimization starts.",
            "properties": {
              "host": {
                "type": "string",
                "enum": [
                  "github",
                  "gitlab",
                  "bitbucket"
                ],
                "description": "Defaults to github."
              },
              "repo": {
                "type": "string",
                "description": "owner/name"
              },
              "path": {
                "type": "string",
                "maxLength": 1024,
                "description": "The file the prompt lives in."
              },
              "start_line": {
                "type": "integer",
                "minimum": 1
              },
              "end_line": {
                "type": "integer",
                "minimum": 1
              },
              "ref": {
                "type": "string",
                "description": "The commit the lines were read at."
              }
            },
            "required": [
              "repo",
              "path"
            ]
          }
        },
        "required": [
          "user_prompt"
        ]
      },
      "PromptStudioOptimizeRequest": {
        "type": "object",
        "properties": {
          "task_description": {
            "type": "string",
            "maxLength": 2000,
            "description": "One line: what the prompt is for. The rewriter optimizes toward it."
          },
          "user_prompt": {
            "type": "string",
            "maxLength": 100000,
            "description": "The prompt as found in code, with {{variables}}."
          },
          "system_prompt": {
            "type": "string",
            "maxLength": 100000
          },
          "task_model": {
            "type": "string",
            "description": "Catalog id of the model the prompt runs on."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Run name; reduced to letters, digits, . _ -."
          },
          "mode": {
            "type": "string",
            "enum": [
              "zero_shot"
            ],
            "description": "The only mode available so far; may be omitted."
          },
          "source": {
            "type": "object",
            "description": "Where the prompt lives in the code, so a pull request can put the optimized prompt back (POST /v1/repos/pull-requests). Stored when an optimization starts.",
            "properties": {
              "host": {
                "type": "string",
                "enum": [
                  "github",
                  "gitlab",
                  "bitbucket"
                ],
                "description": "Defaults to github."
              },
              "repo": {
                "type": "string",
                "description": "owner/name"
              },
              "path": {
                "type": "string",
                "maxLength": 1024,
                "description": "The file the prompt lives in."
              },
              "start_line": {
                "type": "integer",
                "minimum": 1
              },
              "end_line": {
                "type": "integer",
                "minimum": 1
              },
              "ref": {
                "type": "string",
                "description": "The commit the lines were read at."
              }
            },
            "required": [
              "repo",
              "path"
            ]
          }
        },
        "required": [
          "task_description",
          "user_prompt",
          "task_model"
        ]
      },
      "PromptStudioOptimizeStarted": {
        "type": "object",
        "properties": {
          "job_id": {
            "type": "string",
            "description": "Poll with GET /v1/prompt-studio/jobs/{job_id}."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ]
          },
          "estimate": {
            "type": "object",
            "properties": {
              "usd": {
                "type": "number"
              },
              "upper_usd": {
                "type": "number",
                "description": "1.5 x usd: most runs cost no more."
              },
              "rewriter_model": {
                "type": "string"
              }
            },
            "required": [
              "usd",
              "upper_usd",
              "rewriter_model"
            ]
          }
        },
        "required": [
          "job_id",
          "status",
          "estimate"
        ]
      },
      "PromptStudioPromptCheck": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "prompt_studio.prompt_check"
            ]
          },
          "verdict": {
            "type": "string",
            "enum": [
              "ready",
              "needs_changes"
            ],
            "description": "needs_changes when an issue blocks optimizing; notes never change it."
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ]
            }
          },
          "notes": {
            "type": "array",
            "description": "Qualify the result (looks like code, an unknown, $0-priced or long-context-tier model); never change the verdict.",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ]
            }
          },
          "variables": {
            "type": "object",
            "properties": {
              "found": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "usable": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "unusable": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "found",
              "usable",
              "unusable"
            ]
          },
          "task_model": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "input_per_million_usd": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "output_per_million_usd": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "estimates": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              },
              "zero_shot_optimize": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "usd": {
                    "type": "number"
                  },
                  "upper_usd": {
                    "type": "number",
                    "description": "1.5 x usd: most runs cost no more. Show both to the user before optimizing."
                  },
                  "rewriter_model": {
                    "type": "string"
                  },
                  "input_tokens": {
                    "type": "integer"
                  },
                  "output_tokens": {
                    "type": "integer"
                  }
                }
              },
              "serving": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "per_call_low_usd": {
                    "type": "number"
                  },
                  "per_call_high_usd": {
                    "type": "number"
                  },
                  "monthly_calls": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "monthly_low_usd": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "monthly_high_usd": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "input_tokens": {
                    "$ref": "#/components/schemas/PromptStudioTokenRange"
                  },
                  "output_tokens": {
                    "$ref": "#/components/schemas/PromptStudioTokenRange"
                  }
                }
              },
              "assumptions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "currency",
              "zero_shot_optimize",
              "serving",
              "assumptions"
            ]
          },
          "modes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PromptStudioMode"
            }
          },
          "next_step": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "verdict",
          "issues",
          "notes",
          "variables",
          "task_model",
          "estimates",
          "modes",
          "next_step"
        ]
      },
      "PromptStudioTokenRange": {
        "type": "object",
        "properties": {
          "low": {
            "type": "integer"
          },
          "high": {
            "type": "integer"
          }
        },
        "required": [
          "low",
          "high"
        ]
      },
      "PromptStudioRunSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "job_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "optimize, benchmark, or another run kind."
          },
          "label": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_s": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "job_id",
          "kind",
          "label",
          "status",
          "summary",
          "created_at",
          "duration_s"
        ]
      },
      "PromptStudioRunList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PromptStudioRunSummary"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "PromptStudioOptimized": {
        "type": [
          "object",
          "null"
        ],
        "description": "The prompt-set and model an optimize run produced: what to put back into the code. For a benchmark, the optimized prompt-set it compared, with no model or scores.",
        "properties": {
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "content": {
                  "type": "string"
                }
              },
              "required": [
                "role",
                "content"
              ]
            }
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scores": {
            "type": "object",
            "properties": {
              "initial": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "final": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "improvement": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          }
        }
      },
      "PromptStudioBenchmarkArm": {
        "type": "object",
        "properties": {
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "variant": {
            "type": [
              "string",
              "null"
            ],
            "description": "baseline or optimized."
          },
          "errors": {
            "type": [
              "number",
              "null"
            ]
          },
          "reference": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PromptStudioMetric"
              },
              {
                "type": "null"
              }
            ]
          },
          "rubric": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PromptStudioMetric"
              },
              {
                "type": "null"
              }
            ]
          },
          "estimated_cost_per_call_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "latency_p95_s": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "PromptStudioMetric": {
        "type": "object",
        "description": "pass_rate is passed / evaluated. evaluation_errors are judge failures, not task errors.",
        "properties": {
          "n": {
            "type": [
              "integer",
              "null"
            ]
          },
          "evaluated": {
            "type": [
              "integer",
              "null"
            ]
          },
          "evaluation_errors": {
            "type": [
              "integer",
              "null"
            ]
          },
          "passed": {
            "type": [
              "integer",
              "null"
            ]
          },
          "pass_rate": {
            "type": [
              "number",
              "null"
            ]
          },
          "mean_score": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "PromptStudioRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "prompt_studio.run"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "job_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_s": {
            "type": [
              "number",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "task_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "task_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "rewriter_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "baseline": {
            "type": "object",
            "description": "The prompt-set that went in. `messages` is authoritative: every message in its evaluated order (a benchmark baseline may hold up to 20). `system_prompt` and `user_prompt` join the messages by role, a convenience that loses order and boundaries.",
            "properties": {
              "messages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                }
              },
              "system_prompt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user_prompt": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "messages",
              "system_prompt",
              "user_prompt"
            ]
          },
          "optimized": {
            "$ref": "#/components/schemas/PromptStudioOptimized"
          },
          "benchmark_arms": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PromptStudioBenchmarkArm"
            }
          },
          "linked_experiments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          },
          "source": {
            "type": [
              "object",
              "null"
            ],
            "description": "Where the prompt lives in the code, when the run was started with a `source`.",
            "properties": {
              "host": {
                "type": "string"
              },
              "repo": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "start_line": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "end_line": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "ref": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "pull_request": {
            "type": [
              "object",
              "null"
            ],
            "description": "The pull request opened from this run, if any.",
            "properties": {
              "url": {
                "type": "string"
              },
              "number": {
                "type": "integer"
              },
              "branch": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "object",
          "id",
          "kind",
          "status",
          "baseline",
          "optimized",
          "benchmark_arms",
          "linked_experiments"
        ]
      },
      "PromptStudioJob": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "prompt_studio.job"
            ]
          },
          "job_id": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "running, done, error, cancelled, ..."
          },
          "stage": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "optimized": {
            "$ref": "#/components/schemas/PromptStudioOptimized"
          },
          "benchmark_arms": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PromptStudioBenchmarkArm"
            }
          }
        },
        "required": [
          "object",
          "job_id",
          "status",
          "optimized",
          "benchmark_arms"
        ]
      },
      "RepoConnection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ]
          },
          "account_login": {
            "type": "string"
          },
          "account_type": {
            "type": "string",
            "enum": [
              "user",
              "organization"
            ]
          },
          "repository_selection": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "working_repo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The repository repo tools default to; set with PUT /v1/repos/working."
          },
          "suspended": {
            "type": "boolean"
          },
          "manage_url": {
            "type": "string",
            "description": "The host's settings page for this grant: add or remove repositories, uninstall."
          },
          "repos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "full_name": {
                  "type": "string"
                },
                "default_branch": {
                  "type": "string"
                },
                "private": {
                  "type": "boolean"
                }
              },
              "required": [
                "full_name",
                "default_branch",
                "private"
              ]
            }
          }
        },
        "required": [
          "id",
          "host",
          "account_login",
          "account_type",
          "repository_selection",
          "working_repo",
          "suspended",
          "manage_url",
          "repos"
        ]
      },
      "RepoConnectionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepoConnection"
            }
          },
          "connect_url": {
            "type": "string",
            "description": "The dashboard page where the user picks a host and connects it; for when the remote is not known."
          },
          "available_hosts": {
            "type": "array",
            "description": "Every host this deployment can connect, with the dashboard page that starts it.",
            "items": {
              "type": "object",
              "properties": {
                "host": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "connect_url": {
                  "type": "string"
                }
              },
              "required": [
                "host",
                "label",
                "connect_url"
              ]
            }
          }
        },
        "required": [
          "object",
          "connections",
          "available_hosts"
        ]
      },
      "RepoWorkingRequest": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ],
            "description": "Defaults to github."
          },
          "repo": {
            "type": "string",
            "description": "owner/name; must be covered by a connection."
          }
        },
        "required": [
          "repo"
        ]
      },
      "RepoContents": {
        "type": "object",
        "description": "A file (`repos.file`, decoded, up to 1 MB) or a directory listing (`repos.directory`).",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "repos.file",
              "repos.directory"
            ]
          },
          "host": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "sha": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "content": {
            "type": "string"
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "size": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "required": [
          "object",
          "host",
          "repo",
          "path",
          "ref"
        ]
      },
      "RepoPullRequestRequest": {
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "A Prompt Studio run with an optimized prompt-set."
          },
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ],
            "description": "Defaults to the run's source, then github."
          },
          "repo": {
            "type": "string",
            "description": "owner/name. Defaults to the run's source, then the working repository."
          },
          "path": {
            "type": "string",
            "maxLength": 1024,
            "description": "The file the prompt lives in. Defaults to the run's source."
          },
          "start_line": {
            "type": "integer",
            "minimum": 1,
            "description": "With end_line: which occurrence, when the prompt appears more than once."
          },
          "end_line": {
            "type": "integer",
            "minimum": 1
          },
          "branch_name": {
            "type": "string",
            "maxLength": 120,
            "description": "Defaults to ci/prompt-studio-<run>."
          },
          "title": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "run_id"
        ]
      },
      "RepoPullRequest": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "repos.pull_request"
            ]
          },
          "url": {
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "branch": {
            "type": "string"
          },
          "base": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "existing": {
            "type": "boolean",
            "description": "The run already had this pull request; nothing new was pushed."
          },
          "replaced": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "line": {
                  "type": "integer"
                }
              },
              "required": [
                "role",
                "line"
              ]
            }
          },
          "new_variables": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "{{variables}} the rewrite introduced that the code must now supply."
          }
        },
        "required": [
          "object",
          "url",
          "number",
          "branch",
          "base",
          "host",
          "repo",
          "path",
          "existing",
          "replaced",
          "new_variables"
        ]
      },
      "RepoReviewSettings": {
        "type": "object",
        "description": "The Prompt Studio bot's settings for one connected repository.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "repos.review_settings"
            ]
          },
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ]
          },
          "repo": {
            "type": "string",
            "description": "owner/name."
          },
          "configured": {
            "type": "boolean",
            "description": "False when nobody has set the repository up: the values are the defaults the bot would use."
          },
          "tier": {
            "type": "string",
            "enum": [
              "light",
              "deep"
            ],
            "description": "Light rewrites prompts with a reflection model; Deep (not available yet) also benchmarks and trains."
          },
          "review_prs": {
            "type": "boolean",
            "description": "Review the prompts a pull request changes, on every push."
          },
          "allow_commits": {
            "type": "boolean",
            "description": "Let the bot commit suggestions itself instead of posting them for the author to commit."
          },
          "monthly_budget_usd": {
            "type": "number",
            "description": "What the bot may spend on this repository per calendar month, 0 to 1000."
          },
          "spent_usd": {
            "type": "number",
            "description": "Spent on this repository this month, runs and detection calls."
          },
          "ignore_paths": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Glob patterns the bot skips."
          },
          "enabled_by_me": {
            "type": "boolean",
            "description": "The caller is the one who set the repository up and whose wallet its runs bill."
          }
        },
        "required": [
          "object",
          "host",
          "repo",
          "configured",
          "tier",
          "review_prs",
          "allow_commits",
          "monthly_budget_usd",
          "spent_usd",
          "ignore_paths",
          "enabled_by_me"
        ]
      },
      "RepoReviewSettingsList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "settings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepoReviewSettings"
            },
            "description": "Every repository the caller's connections have settings for."
          }
        },
        "required": [
          "object",
          "settings"
        ]
      },
      "RepoReviewSettingsOrList": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/RepoReviewSettings"
          },
          {
            "$ref": "#/components/schemas/RepoReviewSettingsList"
          }
        ],
        "description": "One repository's settings when `repo` is given, else the list."
      },
      "RepoReviewSettingsRequest": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ],
            "description": "Defaults to github."
          },
          "repo": {
            "type": "string",
            "description": "owner/name; must be covered by one of the caller's connections."
          },
          "tier": {
            "type": "string",
            "enum": [
              "light",
              "deep"
            ],
            "description": "`deep` is refused with `tier_unavailable` until the Deep tier exists."
          },
          "review_prs": {
            "type": "boolean"
          },
          "allow_commits": {
            "type": "boolean"
          },
          "monthly_budget_usd": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000
          },
          "ignore_paths": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 300
            },
            "maxItems": 100
          }
        },
        "required": [
          "repo"
        ]
      },
      "RepoPrompt": {
        "type": "object",
        "description": "Where a prompt lives in the repository; the text itself is never returned.",
        "properties": {
          "path": {
            "type": "string"
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The function or constant that holds the prompt, when known."
          },
          "start_line": {
            "type": "integer"
          },
          "end_line": {
            "type": "integer"
          },
          "task_model": {
            "type": [
              "string",
              "null"
            ],
            "description": "The model the code sends the prompt to, when the bot could tell."
          },
          "last_seen_sha": {
            "type": [
              "string",
              "null"
            ],
            "description": "The commit the bot last saw the prompt at."
          },
          "last_run_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The bot run that last saw it (GET /v1/prompt-studio/bot-runs/{id})."
          },
          "dismissed": {
            "type": "boolean",
            "description": "The owner asked the bot to leave this prompt alone."
          }
        },
        "required": [
          "path",
          "symbol",
          "start_line",
          "end_line",
          "task_model",
          "last_seen_sha",
          "last_run_id",
          "dismissed"
        ]
      },
      "RepoPromptList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "host": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "prompts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepoPrompt"
            },
            "description": "By path."
          }
        },
        "required": [
          "object",
          "host",
          "repo",
          "prompts"
        ]
      },
      "BotRun": {
        "type": "object",
        "description": "A Prompt Studio bot run: a pull-request review (`pr_push`) or a whole-repository run (`dashboard_run`).",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "prompt_studio.bot_run"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "host": {
            "type": "string"
          },
          "repo_full_name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "pr_push",
              "dashboard_run"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "light",
              "deep"
            ]
          },
          "trigger": {
            "type": "string",
            "enum": [
              "webhook",
              "command",
              "dashboard",
              "mcp"
            ],
            "description": "What started it: a push, a `/prompt-studio` comment, the dashboard, or this API."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "done",
              "error",
              "skipped"
            ]
          },
          "stage": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "detect",
              "check",
              "rewrite",
              "pull_requests",
              "finish",
              null
            ]
          },
          "pr_number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "pr_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "pr_title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Filled in by the bot once it has read the pull request."
          },
          "prompts_found": {
            "type": "integer"
          },
          "suggestions_posted": {
            "type": "integer"
          },
          "prs_opened": {
            "type": "integer"
          },
          "spend_usd": {
            "type": "number",
            "description": "What this run has spent of the repository's monthly budget so far."
          },
          "summary_comment_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The bot's summary comment on the pull request, when posted."
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the run failed, as a code (`bot_unreachable`, `budget`, …); never free text."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "object",
          "id",
          "host",
          "repo_full_name",
          "kind",
          "tier",
          "trigger",
          "status",
          "stage",
          "pr_number",
          "pr_url",
          "pr_title",
          "prompts_found",
          "suggestions_posted",
          "prs_opened",
          "spend_usd",
          "summary_comment_id",
          "error_code",
          "created_at",
          "updated_at"
        ]
      },
      "BotRunList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotRun"
            },
            "description": "Newest first."
          }
        },
        "required": [
          "object",
          "runs"
        ]
      },
      "BotRunFinding": {
        "type": "object",
        "description": "One prompt a bot run found and what became of it. The prompt text is never returned; `suggestion_preview` is the first 200 characters of the rewrite.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "path": {
            "type": "string"
          },
          "start_line": {
            "type": "integer"
          },
          "end_line": {
            "type": "integer"
          },
          "verdict": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "ready",
              "needs_changes",
              null
            ],
            "description": "The free check's verdict."
          },
          "state": {
            "type": "string",
            "enum": [
              "checked",
              "rewriting",
              "suggested",
              "summary_only",
              "pr_opened",
              "skipped_budget",
              "applied",
              "ignored",
              "error",
              "outdated"
            ]
          },
          "estimate_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "The check's estimate for rewriting this prompt."
          },
          "suggestion_preview": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The inline review comment carrying the suggestion."
          },
          "pr_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The pull request opened for this prompt by a repository run."
          },
          "pr_number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "studio_run_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The Prompt Studio run with the full rewrite (GET /v1/prompt-studio/runs/{run_id})."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bot found this prompt."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When its state last changed."
          }
        },
        "required": [
          "id",
          "path",
          "start_line",
          "end_line",
          "verdict",
          "state",
          "estimate_usd",
          "suggestion_preview",
          "comment_id",
          "pr_url",
          "pr_number",
          "studio_run_id",
          "created_at",
          "updated_at"
        ]
      },
      "BotRunDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BotRun"
          },
          {
            "type": "object",
            "properties": {
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BotRunFinding"
                },
                "description": "In the order the bot found them."
              }
            },
            "required": [
              "findings"
            ]
          }
        ]
      },
      "BotRunRequest": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ],
            "description": "Defaults to github."
          },
          "repo": {
            "type": "string",
            "description": "owner/name; must be covered by one of the caller's connections."
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          }
        },
        "required": [
          "repo",
          "pr_number"
        ]
      },
      "RepoRunRequest": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket"
            ],
            "description": "Defaults to github."
          },
          "repo": {
            "type": "string",
            "description": "owner/name; must be covered by one of the caller's connections."
          }
        },
        "required": [
          "repo"
        ]
      },
      "AccountUsage": {
        "type": "object",
        "description": "Rolled up over a window. Distinct from /v1/usage/daily, which is the per-day series.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account.usage"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "days": {
            "type": "integer"
          },
          "start_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the window summed: `days` ago, or the start of that UTC day when it is more than 45 days ago, since older usage is kept per day. When the window could only be read in part, the start of the newest part that was read, so the totals cover exactly from here."
          },
          "request_count": {
            "type": "integer"
          },
          "billed_usd": {
            "type": "number"
          },
          "saved_usd": {
            "type": "number",
            "description": "List price minus what was billed."
          },
          "list_usd": {
            "type": "number"
          },
          "savings_percent": {
            "type": [
              "number",
              "null"
            ]
          },
          "top_models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "string"
                },
                "request_count": {
                  "type": "integer"
                },
                "billed_usd": {
                  "type": "number"
                },
                "saved_usd": {
                  "type": "number"
                }
              },
              "required": [
                "model",
                "request_count"
              ]
            }
          }
        },
        "required": [
          "object",
          "currency",
          "days",
          "request_count",
          "billed_usd",
          "saved_usd"
        ]
      },
      "AccountSavings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account.savings"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "windows": {
            "type": "array",
            "description": "One entry each for the last 24 hours, 7 days and 30 days.",
            "items": {
              "type": "object",
              "properties": {
                "days": {
                  "type": "integer",
                  "enum": [
                    1,
                    7,
                    30
                  ]
                },
                "request_count": {
                  "type": "integer"
                },
                "billed_usd": {
                  "type": "number"
                },
                "saved_usd": {
                  "type": "number"
                },
                "list_usd": {
                  "type": "number"
                },
                "savings_percent": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "top_models": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "model": {
                        "type": "string"
                      },
                      "request_count": {
                        "type": "integer"
                      },
                      "saved_usd": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "model"
                    ]
                  }
                }
              },
              "required": [
                "days",
                "request_count"
              ]
            }
          },
          "experiments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExperimentSummary"
            }
          },
          "techniques": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Technique"
            }
          }
        },
        "required": [
          "object",
          "currency",
          "windows",
          "experiments",
          "techniques"
        ]
      },
      "ExperimentSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "dimension": {
            "type": "string",
            "description": "What the experiment varies: prompt, model or technique."
          },
          "request_count": {
            "type": "integer"
          },
          "avg_cost_usd": {
            "type": "number"
          },
          "avg_saved_usd": {
            "type": "number"
          },
          "feedback_avg": {
            "type": [
              "number",
              "null"
            ]
          },
          "feedback_count": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "request_count"
        ]
      },
      "ExperimentList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExperimentSummary"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "Experiment": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "experiment"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "dimension": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "request_count": {
            "type": "integer"
          },
          "avg_cost_usd": {
            "type": "number"
          },
          "avg_saved_usd": {
            "type": "number"
          },
          "feedback_avg": {
            "type": [
              "number",
              "null"
            ]
          },
          "feedback_count": {
            "type": "integer"
          },
          "variants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "is_control": {
                  "type": "boolean"
                },
                "model": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "weight": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "system_prompt_preview": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Truncated to 300 characters. The dashboard has the full text."
                },
                "request_count": {
                  "type": "integer"
                },
                "avg_cost_usd": {
                  "type": "number"
                },
                "avg_saved_usd": {
                  "type": "number"
                },
                "feedback_avg": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "feedback_count": {
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "name",
                "is_control",
                "request_count"
              ]
            }
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "status",
          "variants"
        ]
      },
      "Technique": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "whitespace-normalization"
            ]
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "tier": {
            "type": "integer",
            "description": "1 deterministic, 2 statistical, 3 model-touching."
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "preview",
              "deprecated"
            ]
          },
          "available": {
            "type": "boolean",
            "description": "Whether PATCH will accept it. False for preview and deprecated entries."
          },
          "enabled": {
            "type": "boolean",
            "description": "What the proxy will actually do for this account. Every implemented technique is off by default, so this is false until the account opts in."
          },
          "explicitly_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "The stored choice, or null when the account has never set one."
          },
          "savings_summary": {
            "type": "string"
          },
          "savings_min_pct": {
            "type": [
              "number",
              "null"
            ]
          },
          "savings_max_pct": {
            "type": [
              "number",
              "null"
            ]
          },
          "quality_risk": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "enabled"
        ]
      },
      "TechniqueList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Technique"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "TechniqueUpdateRequest": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "TechniqueUpdateResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "technique"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "changed": {
            "type": "boolean",
            "description": "False when it was already in the requested state."
          }
        },
        "required": [
          "object",
          "id",
          "enabled",
          "changed"
        ]
      },
      "ApiKeySummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "The first 18 characters. The rest is never recoverable."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "organization_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "scopes"
        ]
      },
      "ApiKeyList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKeySummary"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "ApiKeyCreateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "organization_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "inference",
                "usage:read",
                "account:read",
                "account:write",
                "prompt-studio:read",
                "prompt-studio:write",
                "repos:read",
                "repos:write"
              ]
            },
            "description": "Defaults to inference and usage:read."
          },
          "allowed_models": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_ip_cidrs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "rate_limit_per_minute": {
            "type": [
              "integer",
              "null"
            ]
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "concurrency_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "monthly_spend_limit_usd": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "ApiKeyCreated": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "key": {
            "type": "string",
            "description": "The plaintext key. Also available to its owner through the dashboard's copy action."
          }
        },
        "required": [
          "object",
          "name",
          "prefix",
          "key"
        ]
      },
      "ApiKeyRevoked": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key.revoked"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "Channel": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "channel"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "platform": {
            "type": "string",
            "examples": [
              "slack",
              "discord",
              "telegram",
              "email"
            ]
          },
          "workspace_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "integration_active": {
            "type": "boolean"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "report_frequency": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "daily",
              "weekly",
              "monthly",
              "off",
              null
            ]
          },
          "report_hour": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Hour of day, UTC."
          }
        },
        "required": [
          "id",
          "platform",
          "events"
        ]
      },
      "ChannelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Channel"
            }
          },
          "available_events": {
            "type": "array",
            "description": "The valid ids for the `events` field on PATCH, with their labels.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "default_on": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "label"
              ]
            }
          }
        },
        "required": [
          "object",
          "data",
          "available_events"
        ]
      },
      "ChannelUpdateRequest": {
        "type": "object",
        "description": "Both fields are optional; an absent one is left alone. `events: []` unsubscribes from everything, which is different from omitting the field.",
        "properties": {
          "report_frequency": {
            "type": "string",
            "enum": [
              "daily",
              "weekly",
              "monthly",
              "off"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ChannelReportResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "channel.report"
            ]
          },
          "sent": {
            "type": "boolean",
            "description": "False with a `message` when there was no activity in the window. The request succeeded, but there was nothing to send."
          },
          "cadence": {
            "type": "string"
          },
          "window_label": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "sent"
        ]
      },
      "ModelSupply": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "model.supply"
            ]
          },
          "model": {
            "type": "string"
          },
          "min_discount_percent": {
            "type": [
              "number",
              "null"
            ]
          },
          "zdr": {
            "type": "boolean"
          },
          "list_input_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "list_output_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "max_input_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "max_output_per_million": {
            "type": [
              "string",
              "null"
            ]
          },
          "supply_buffer_percent": {
            "type": "number"
          },
          "candidate_count": {
            "type": "integer"
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Opaque per-response aliases: `primary` for the marketplace, `network_a`, `network_b`, ... for the others. Suppliers are never named."
          },
          "primary_market_offers": {
            "type": "integer",
            "nullable": true,
            "description": "How many marketplace provider families can take this request. 0 when the marketplace is not a candidate."
          },
          "primary_market_min_discount_percent": {
            "type": "integer",
            "nullable": true,
            "deprecated": true,
            "description": "Always null. The marketplace minimum discount is now set for each request after ranking, so it has no single value for a model."
          },
          "note": {
            "type": "string"
          }
        }
      },
      "ModelComparison": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "model.comparison"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "requests": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "description": "Cheapest first. Ids that could not be resolved sort last with found:false.",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "string"
                },
                "found": {
                  "type": "boolean"
                },
                "label": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "input_per_m": {
                  "type": "number"
                },
                "output_per_m": {
                  "type": "number"
                },
                "list_price_known": {
                  "type": "boolean"
                },
                "billed_usd": {
                  "type": "number"
                },
                "list_usd": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Null when no going-direct price is known for the model."
                },
                "saved_usd": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "model",
                "found"
              ]
            }
          }
        },
        "required": [
          "object",
          "currency",
          "data"
        ]
      },
      "TopupRequest": {
        "type": "object",
        "properties": {
          "amount_usd": {
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "description": "USD amount. The default minimum is $25; eligible onboarding experiments may assign a different minimum, enforced by the server."
          }
        },
        "required": [
          "amount_usd"
        ]
      },
      "TopupResponse": {
        "type": "object",
        "description": "Creates a Stripe Checkout session and returns its link. Nothing is charged here. The customer completes the payment on Stripe's own page.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "billing.topup"
            ]
          },
          "amount_usd": {
            "type": "number"
          },
          "checkout_url": {
            "type": "string",
            "format": "uri"
          },
          "session_id": {
            "type": "string"
          },
          "min_usd": {
            "type": "number",
            "description": "The server-enforced minimum for this wallet. Defaults to 25 USD; eligible onboarding cohorts may differ."
          },
          "max_usd": {
            "type": "number"
          }
        },
        "required": [
          "object",
          "amount_usd",
          "checkout_url"
        ]
      },
      "WorkspaceAdminPolicy": {
        "type": "object",
        "description": "Five settings on a workspace that its owners and admins edit and that bind everyone in it, owners and admins included. Personal keys are outside it.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "workspace.admin_policy"
            ]
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "description": "Goes up by one on every save. Send it back as `expected_version` to change the policy."
          },
          "task_limit": {
            "type": "object",
            "properties": {
              "default_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "The task limit Keak Code starts a task with. Advisory: the server does not enforce it."
              },
              "max_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "Every task budget opened, raised or renewed on a workspace key is clamped to this, never refused; lowering it lowers every open budget above it."
              },
              "required": {
                "type": "boolean",
                "description": "Keak Code contract requests (with `x-ci-model-lock` or `x-ci-stream-receipt`) are refused with 400 `code: task_budget_required` while their key has no open task budget. Other traffic on the same key is never refused for this. The shipped Keak Code beta (0.1.0) opens no budget in its `local` task-limit mode, so every request it sends from that mode is refused: have members update Keak Code before turning this on."
              }
            },
            "required": [
              "default_usd",
              "max_usd",
              "required"
            ]
          },
          "techniques_locked_off": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Technique ids that never run on this workspace's traffic, whatever a key, the workspace setting, a header or an experiment asks; a receipt lists them as `skipped` with reason `workspace_policy`. Sorted and distinct."
          },
          "prompt_cache_rule": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "on",
              "off",
              "passthrough",
              null
            ],
            "description": "Overrides the `x-ci-prompt-cache` header and every key's default. Zero data retention does not change the mode. Null: no rule."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null until the policy is first saved."
          }
        },
        "required": [
          "object",
          "organization_id",
          "version",
          "task_limit",
          "techniques_locked_off",
          "prompt_cache_rule",
          "updated_at"
        ]
      },
      "WorkspaceAdminPolicyView": {
        "type": "object",
        "description": "The workspace admin policy, and whether the caller may change it.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "workspace.admin_policy"
            ]
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "description": "Goes up by one on every save. Send it back as `expected_version` to change the policy."
          },
          "task_limit": {
            "type": "object",
            "properties": {
              "default_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "The task limit Keak Code starts a task with. Advisory: the server does not enforce it."
              },
              "max_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "Every task budget opened, raised or renewed on a workspace key is clamped to this, never refused; lowering it lowers every open budget above it."
              },
              "required": {
                "type": "boolean",
                "description": "Keak Code contract requests (with `x-ci-model-lock` or `x-ci-stream-receipt`) are refused with 400 `code: task_budget_required` while their key has no open task budget. Other traffic on the same key is never refused for this. The shipped Keak Code beta (0.1.0) opens no budget in its `local` task-limit mode, so every request it sends from that mode is refused: have members update Keak Code before turning this on."
              }
            },
            "required": [
              "default_usd",
              "max_usd",
              "required"
            ]
          },
          "techniques_locked_off": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Technique ids that never run on this workspace's traffic, whatever a key, the workspace setting, a header or an experiment asks; a receipt lists them as `skipped` with reason `workspace_policy`. Sorted and distinct."
          },
          "prompt_cache_rule": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "on",
              "off",
              "passthrough",
              null
            ],
            "description": "Overrides the `x-ci-prompt-cache` header and every key's default. Zero data retention does not change the mode. Null: no rule."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null until the policy is first saved."
          },
          "can_edit": {
            "type": "boolean",
            "description": "True for a workspace owner or admin."
          }
        },
        "required": [
          "object",
          "organization_id",
          "version",
          "task_limit",
          "techniques_locked_off",
          "prompt_cache_rule",
          "updated_at",
          "can_edit"
        ]
      },
      "WorkspaceAdminPolicySaved": {
        "type": "object",
        "description": "The workspace admin policy as saved.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "workspace.admin_policy"
            ]
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "description": "Goes up by one on every save. Send it back as `expected_version` to change the policy."
          },
          "task_limit": {
            "type": "object",
            "properties": {
              "default_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "The task limit Keak Code starts a task with. Advisory: the server does not enforce it."
              },
              "max_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d+\\.\\d{6}$",
                "description": "Every task budget opened, raised or renewed on a workspace key is clamped to this, never refused; lowering it lowers every open budget above it."
              },
              "required": {
                "type": "boolean",
                "description": "Keak Code contract requests (with `x-ci-model-lock` or `x-ci-stream-receipt`) are refused with 400 `code: task_budget_required` while their key has no open task budget. Other traffic on the same key is never refused for this. The shipped Keak Code beta (0.1.0) opens no budget in its `local` task-limit mode, so every request it sends from that mode is refused: have members update Keak Code before turning this on."
              }
            },
            "required": [
              "default_usd",
              "max_usd",
              "required"
            ]
          },
          "techniques_locked_off": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Technique ids that never run on this workspace's traffic, whatever a key, the workspace setting, a header or an experiment asks; a receipt lists them as `skipped` with reason `workspace_policy`. Sorted and distinct."
          },
          "prompt_cache_rule": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "on",
              "off",
              "passthrough",
              null
            ],
            "description": "Overrides the `x-ci-prompt-cache` header and every key's default. Zero data retention does not change the mode. Null: no rule."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null until the policy is first saved."
          },
          "clamped_task_budget_count": {
            "type": "integer",
            "minimum": 0,
            "description": "How many open task budgets a lowered `task_limit_max_usd` lowered to it."
          }
        },
        "required": [
          "object",
          "organization_id",
          "version",
          "task_limit",
          "techniques_locked_off",
          "prompt_cache_rule",
          "updated_at",
          "clamped_task_budget_count"
        ]
      },
      "WorkspaceAdminPolicyInput": {
        "type": "object",
        "description": "The whole policy, every field present (null for a setting that is not set). Strict: any other field is refused with 400.",
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 0,
            "description": "The `version` that was read. A policy saved since then answers 409."
          },
          "task_limit_default_usd": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{1,5}(\\.\\d{1,6})?$",
            "description": "USD as a string, above 0 and at most 10000, at most 6 decimal places; not above the maximum."
          },
          "task_limit_max_usd": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{1,5}(\\.\\d{1,6})?$",
            "description": "USD as a string, above 0 and at most 10000, at most 6 decimal places."
          },
          "task_budget_required": {
            "type": "boolean"
          },
          "techniques_locked_off": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
            },
            "description": "Distinct technique ids from the catalog."
          },
          "prompt_cache_rule": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "on",
              "off",
              "passthrough",
              null
            ]
          }
        },
        "required": [
          "expected_version",
          "task_limit_default_usd",
          "task_limit_max_usd",
          "task_budget_required",
          "techniques_locked_off",
          "prompt_cache_rule"
        ],
        "additionalProperties": false
      },
      "WorkspaceAdminPolicyConflict": {
        "type": "object",
        "description": "The OpenAI error envelope, with the policy as it is now inside `error`.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "workspace_admin_policy_conflict"
                ]
              },
              "current": {
                "$ref": "#/components/schemas/WorkspaceAdminPolicy"
              }
            },
            "required": [
              "message",
              "type",
              "code",
              "current"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "AdminTaskBudget": {
        "type": "object",
        "description": "A task budget in the workspace, as an owner or admin sees it: the member's own view plus whose it is, on which key, and who closed it.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key.task_budget"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "client": {
            "type": "string",
            "enum": [
              "keak-code"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed",
              "expired"
            ],
            "description": "Effective: an open budget past its lease reads `expired`."
          },
          "limit_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "At most the workspace maximum, when the workspace admin policy sets one."
          },
          "reserved_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "Held by requests that have not settled."
          },
          "settled_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$",
            "description": "Billed to requests that settled."
          },
          "remaining_usd": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$"
          },
          "reserved_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Requests held, settled or not."
          },
          "settled_count": {
            "type": "integer",
            "minimum": 0
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "End of the lease. Renew it with PATCH."
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "close_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "client",
              "forced",
              "expired",
              "admin",
              null
            ],
            "description": "`forced`: closed by another task with `force: true`. `admin`: closed by a workspace owner or admin."
          },
          "limit_clamped_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last time the workspace maximum lowered this budget's limit: at an open, raise or renewal above it, or when the maximum was lowered. Null when it never was. A later raise that fits does not clear it, so it can describe an earlier limit; whether an open or update was clamped is `clamped_to_max` on that answer."
          },
          "read_at": {
            "type": "string",
            "format": "date-time",
            "description": "The server's clock when this was read."
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskBudgetHold"
            },
            "description": "With `include=requests` only: up to 500 held requests, oldest first."
          },
          "requests_truncated": {
            "type": "boolean",
            "description": "With `include=requests` only."
          },
          "user_id": {
            "type": "string",
            "format": "uuid",
            "description": "The member who opened it."
          },
          "member_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "member_role": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "owner",
              "admin",
              "member",
              "viewer",
              null
            ],
            "description": "Null once the member has left the workspace."
          },
          "api_key_prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "api_key_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "closed_by_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The owner or admin who closed it (`close_reason: admin`), else null."
          }
        },
        "required": [
          "object",
          "id",
          "api_key_id",
          "task_id",
          "client",
          "status",
          "limit_usd",
          "reserved_usd",
          "settled_usd",
          "remaining_usd",
          "reserved_count",
          "settled_count",
          "opened_at",
          "expires_at",
          "closed_at",
          "close_reason",
          "limit_clamped_at",
          "read_at",
          "user_id",
          "member_email",
          "member_role",
          "api_key_prefix",
          "api_key_name",
          "closed_by_user_id"
        ]
      },
      "AdminTaskBudgetList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminTaskBudget"
            },
            "description": "Newest first."
          },
          "has_more": {
            "type": "boolean",
            "description": "More budgets match than `limit` returned."
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      }
    }
  }
}