From bd1779157bd69ed9422cdea98bffcc5926135fa0 Mon Sep 17 00:00:00 2001 From: OpenRouter SDK Bot Date: Fri, 25 Sep 2026 20:53:03 +0000 Subject: [PATCH] chore: update OpenAPI spec [sdk-bot] --- .speakeasy/in.openapi.yaml | 1955 ++++++++++++++++++++++++++++++++++++ 1 file changed, 1955 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 124561bf..8517f218 100755 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4353,6 +4353,1486 @@ components: oneOf: - $ref: '#/components/schemas/ContainerAutoEnvironment' - $ref: '#/components/schemas/ContainerReferenceEnvironment' + BatchDeletedObject: + description: 'Confirms a terminal batch was removed from the API and its OpenRouter-held artifacts purged. Deletion is not cancellation and does not erase billing or audit records.' + example: + deletion: + openrouter: 'deleted' + upstream: + provider: 'OpenAI' + status: 'unsupported' + id: 'batch_abc123' + object: 'batch' + properties: + deletion: + $ref: '#/components/schemas/BatchDeletionTargets' + id: + example: 'batch_abc123' + type: 'string' + object: + enum: + - 'batch' + type: 'string' + required: + - 'id' + - 'object' + - 'deletion' + type: 'object' + BatchDeletionOutcome: + description: 'Outcome for one deletion target: `deleted` (removed), `unsupported` (the provider has no batch-delete API; supported file cleanup still runs), or `not_applicable` (the batch never reached that target).' + enum: + - 'deleted' + - 'unsupported' + - 'not_applicable' + example: 'deleted' + type: 'string' + BatchDeletionTargets: + additionalProperties: false + description: 'OpenRouter cleanup and, when a provider was assigned, the upstream batch deletion outcome.' + example: + openrouter: 'deleted' + upstream: + provider: 'Anthropic' + status: 'deleted' + properties: + openrouter: + description: 'OpenRouter-held request and result artifacts were purged.' + enum: + - 'deleted' + type: 'string' + upstream: + additionalProperties: false + description: 'The upstream batch deletion outcome; omitted when no provider was assigned.' + properties: + provider: + description: 'The provider name stored on the batch.' + example: 'OpenAI' + minLength: 1 + type: 'string' + status: + $ref: '#/components/schemas/BatchDeletionOutcome' + required: + - 'provider' + - 'status' + type: 'object' + required: + - 'openrouter' + type: 'object' + BatchErrorResponse: + example: + error: + code: 400 + message: 'custom_id is required on requests[0].' + properties: + error: + properties: + code: + type: 'integer' + message: + type: 'string' + required: + - 'code' + - 'message' + type: 'object' + required: + - 'error' + type: 'object' + BatchListItem: + description: 'Metadata-only batch object. `results` is always `null` in list responses.' + properties: + completion_window: + enum: + - '24h' + type: 'string' + created_at: + type: 'integer' + endpoint: + type: 'string' + error: + properties: + message: + type: 'string' + required: + - 'message' + type: + - 'object' + - 'null' + finalized_at: + type: + - 'integer' + - 'null' + id: + type: 'string' + model: + type: 'string' + object: + enum: + - 'batch' + type: 'string' + request_counts: + properties: + completed: + type: 'integer' + failed: + type: 'integer' + total: + type: 'integer' + required: + - 'total' + - 'completed' + - 'failed' + type: 'object' + results: + description: 'Always null: retrieve the batch with `GET /batches/{id}` to access its results.' + type: 'null' + status: + enum: + - 'validating' + - 'in_progress' + - 'finalizing' + - 'completed' + - 'failed' + - 'expired' + - 'cancelling' + - 'cancelled' + type: 'string' + usage: + properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' + completion_tokens: + description: 'The tokens generated' + type: 'integer' + completion_tokens_details: + properties: + audio_tokens: + description: 'Tokens generated by the model for audio output.' + type: + - 'integer' + - 'null' + image_tokens: + description: 'Tokens generated by the model for image output.' + type: + - 'integer' + - 'null' + reasoning_tokens: + description: 'Tokens generated by the model for reasoning.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + cost: + description: 'Cost of the completion' + format: 'double' + type: + - 'number' + - 'null' + cost_details: + $ref: '#/components/schemas/CostDetails' + is_byok: + description: 'Whether a request was made using a Bring Your Own Key configuration' + type: 'boolean' + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: + - 'array' + - 'null' + prompt_tokens: + description: 'Including images, input audio, and tools if any' + type: 'integer' + prompt_tokens_details: + description: 'Breakdown of tokens used in the prompt.' + properties: + audio_tokens: + description: 'Tokens used for input audio.' + type: + - 'integer' + - 'null' + cache_write_tokens: + description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' + type: + - 'integer' + - 'null' + cached_tokens: + description: 'Tokens cached by the endpoint.' + type: + - 'integer' + - 'null' + file_tokens: + description: 'Tokens used for input files/documents.' + type: + - 'integer' + - 'null' + video_tokens: + description: 'Tokens used for input video.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + service_tier: + description: 'The service tier used by the upstream provider for this request' + type: + - 'string' + - 'null' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: + - 'object' + - 'null' + required: + - 'id' + - 'object' + - 'endpoint' + - 'model' + - 'completion_window' + - 'status' + - 'created_at' + - 'finalized_at' + - 'request_counts' + - 'usage' + - 'error' + - 'results' + type: 'object' + BatchListResponse: + description: 'A newest-first page of metadata-only batch objects.' + example: + data: [] + first_id: null + has_more: false + last_id: null + object: 'list' + properties: + data: + items: + $ref: '#/components/schemas/BatchListItem' + type: 'array' + first_id: + type: + - 'string' + - 'null' + has_more: + type: 'boolean' + last_id: + type: + - 'string' + - 'null' + object: + enum: + - 'list' + type: 'string' + required: + - 'object' + - 'data' + - 'first_id' + - 'last_id' + - 'has_more' + type: 'object' + BatchListStatus: + description: 'A batch status that is durably represented by the list data source. `finalizing` and `cancelling` are not accepted because stored jobs collapse those phases into `in_progress`.' + enum: + - 'validating' + - 'in_progress' + - 'completed' + - 'failed' + - 'expired' + - 'cancelled' + example: 'completed' + type: 'string' + BatchListTimestamp: + anyOf: + - pattern: '^\d+$' + type: 'string' + - anyOf: + - format: 'date' + type: 'string' + - format: 'date-time' + type: 'string' + description: 'Only include batches created strictly after this timestamp.' + example: '2026-08-20T00:00:00Z' + BatchObject: + properties: + completion_window: + enum: + - '24h' + type: 'string' + created_at: + type: 'integer' + endpoint: + type: 'string' + error: + properties: + message: + type: 'string' + required: + - 'message' + type: + - 'object' + - 'null' + finalized_at: + type: + - 'integer' + - 'null' + id: + type: 'string' + model: + type: 'string' + object: + enum: + - 'batch' + type: 'string' + request_counts: + properties: + completed: + type: 'integer' + failed: + type: 'integer' + total: + type: 'integer' + required: + - 'total' + - 'completed' + - 'failed' + type: 'object' + results: + items: + properties: + custom_id: + type: 'string' + error: + properties: + error_type: + $ref: '#/components/schemas/ApiErrorType' + message: + type: 'string' + param: + type: + - 'string' + - 'null' + type: + type: 'string' + required: + - 'type' + - 'message' + - 'param' + type: + - 'object' + - 'null' + id: + type: 'string' + response: + properties: + body: + anyOf: + - properties: + choices: + items: + properties: + finish_reason: + $ref: '#/components/schemas/FinishReason' + index: + type: 'integer' + logprobs: + properties: + content: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + top_logprobs: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + required: + - 'token' + - 'bytes' + - 'logprob' + type: 'object' + type: 'array' + required: + - 'token' + - 'bytes' + - 'logprob' + - 'top_logprobs' + type: 'object' + type: + - 'array' + - 'null' + refusal: + default: null + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + top_logprobs: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + required: + - 'token' + - 'bytes' + - 'logprob' + type: 'object' + type: 'array' + required: + - 'token' + - 'bytes' + - 'logprob' + - 'top_logprobs' + type: 'object' + type: + - 'array' + - 'null' + required: + - 'content' + type: + - 'object' + - 'null' + message: + properties: + annotations: + items: + oneOf: + - properties: + file: + properties: + content: + items: + oneOf: + - properties: + text: + type: 'string' + type: + enum: + - 'text' + type: 'string' + required: + - 'type' + - 'text' + type: 'object' + - properties: + image_url: + properties: + url: + type: 'string' + required: + - 'url' + type: 'object' + type: + enum: + - 'image_url' + type: 'string' + required: + - 'type' + - 'image_url' + type: 'object' + type: 'array' + hash: + type: 'string' + name: + type: 'string' + required: + - 'hash' + - 'content' + type: 'object' + type: + enum: + - 'file' + type: 'string' + required: + - 'type' + - 'file' + type: 'object' + - properties: + type: + enum: + - 'url_citation' + type: 'string' + url_citation: + properties: + content: + type: 'string' + end_index: + type: 'integer' + start_index: + type: 'integer' + title: + type: 'string' + url: + type: 'string' + required: + - 'url' + - 'start_index' + - 'end_index' + - 'title' + type: 'object' + required: + - 'type' + - 'url_citation' + type: 'object' + - properties: + type: + enum: + - 'web_search_citation' + type: 'string' + web_search_citation: + properties: + cited_text: + type: 'string' + encrypted_index: + type: 'string' + title: + type: + - 'string' + - 'null' + url: + type: 'string' + required: + - 'url' + - 'title' + type: 'object' + required: + - 'type' + - 'web_search_citation' + type: 'object' + type: 'array' + content: + type: + - 'string' + - 'null' + images: + items: + properties: + image_url: + properties: + url: + minLength: 1 + type: 'string' + required: + - 'url' + type: 'object' + type: + enum: + - 'image_url' + type: 'string' + required: + - 'type' + - 'image_url' + type: 'object' + type: + - 'array' + - 'null' + reasoning: + type: + - 'string' + - 'null' + reasoning_details: + items: + anyOf: + - $ref: '#/components/schemas/ReasoningDetailSummary' + - $ref: '#/components/schemas/ReasoningDetailEncrypted' + - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: '#/components/schemas/ReasoningDetailServerToolCall' + - type: 'null' + - type: 'null' + type: + - 'array' + - 'null' + refusal: + type: + - 'string' + - 'null' + role: + enum: + - 'assistant' + type: 'string' + tool_calls: + items: + properties: + function: + properties: + arguments: + type: 'string' + name: + type: 'string' + required: + - 'name' + - 'arguments' + type: 'object' + id: + type: 'string' + index: + type: 'integer' + type: + enum: + - 'function' + type: 'string' + required: + - 'index' + - 'id' + - 'type' + - 'function' + type: 'object' + type: 'array' + required: + - 'role' + - 'content' + - 'refusal' + type: 'object' + native_finish_reason: + type: + - 'string' + - 'null' + required: + - 'index' + - 'message' + - 'finish_reason' + - 'native_finish_reason' + - 'logprobs' + type: 'object' + type: 'array' + created: + type: 'integer' + debug: + additionalProperties: {} + properties: + echo_upstream_body: + additionalProperties: {} + type: 'object' + timings: + properties: + epoch_ms: + type: 'integer' + event: + enum: + - 'adapter_request' + - 'upstream_headers_received' + - 'first_token_received' + - 'upstream_body_ended' + type: 'string' + start_ms: + type: 'integer' + required: + - 'start_ms' + - 'event' + - 'epoch_ms' + type: 'object' + type: 'object' + id: + type: 'string' + model: + type: 'string' + object: + enum: + - 'chat.completion' + type: 'string' + openrouter_metadata: + $ref: '#/components/schemas/OpenRouterMetadata' + provider: + type: + - 'string' + - 'null' + service_tier: + type: + - 'string' + - 'null' + system_fingerprint: + type: + - 'string' + - 'null' + usage: + properties: + completion_tokens: + description: 'The tokens generated' + type: 'integer' + completion_tokens_details: + properties: + audio_tokens: + description: 'Tokens generated by the model for audio output.' + type: + - 'integer' + - 'null' + image_tokens: + description: 'Tokens generated by the model for image output.' + type: + - 'integer' + - 'null' + reasoning_tokens: + description: 'Tokens generated by the model for reasoning.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + prompt_tokens: + description: 'Including images, input audio, and tools if any' + type: 'integer' + prompt_tokens_details: + description: 'Breakdown of tokens used in the prompt.' + properties: + audio_tokens: + description: 'Tokens used for input audio.' + type: + - 'integer' + - 'null' + cache_write_tokens: + description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' + type: + - 'integer' + - 'null' + cached_tokens: + description: 'Tokens cached by the endpoint.' + type: + - 'integer' + - 'null' + file_tokens: + description: 'Tokens used for input files/documents.' + type: + - 'integer' + - 'null' + video_tokens: + description: 'Tokens used for input video.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use_details: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: 'object' + required: + - 'model' + - 'id' + - 'created' + - 'object' + - 'choices' + type: 'object' + - $ref: '#/components/schemas/OpenResponsesResult' + - properties: + container: + $ref: '#/components/schemas/AnthropicContainer' + content: + items: + $ref: '#/components/schemas/ORAnthropicContentBlock' + type: 'array' + id: + type: 'string' + input_transformations: + items: + $ref: '#/components/schemas/AnthropicInputTransformation' + type: + - 'array' + - 'null' + model: + type: 'string' + role: + enum: + - 'assistant' + type: 'string' + stop_details: + $ref: '#/components/schemas/AnthropicRefusalStopDetails' + stop_reason: + $ref: '#/components/schemas/ORAnthropicStopReason' + stop_sequence: + type: + - 'string' + - 'null' + type: + enum: + - 'message' + type: 'string' + usage: + allOf: + - $ref: '#/components/schemas/AnthropicUsage' + - properties: + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: 'array' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + type: 'object' + example: + cache_creation: null + cache_creation_input_tokens: null + cache_read_input_tokens: null + inference_geo: null + input_tokens: 100 + output_tokens: 50 + output_tokens_details: null + server_tool_use: null + service_tier: 'standard' + required: + - 'id' + - 'type' + - 'role' + - 'container' + - 'content' + - 'model' + - 'stop_reason' + - 'stop_details' + - 'stop_sequence' + - 'usage' + type: 'object' + - description: 'Embeddings response containing embedding vectors' + example: + data: + - embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + model: 'openai/text-embedding-3-small' + object: 'list' + usage: + prompt_tokens: 8 + total_tokens: 8 + properties: + data: + description: 'List of embedding objects' + example: + - embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + items: + description: 'A single embedding object' + example: + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + properties: + embedding: + anyOf: + - items: + type: 'number' + type: 'array' + - type: 'string' + description: 'Embedding vector as an array of floats or a base64 string' + example: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: + description: 'Index of the embedding in the input list' + example: 0 + type: 'integer' + object: + enum: + - 'embedding' + type: 'string' + required: + - 'object' + - 'embedding' + type: 'object' + type: 'array' + id: + description: 'Unique identifier for the embeddings response' + example: 'embd-1234567890' + type: 'string' + model: + description: 'The model used for embeddings' + example: 'openai/text-embedding-3-small' + type: 'string' + object: + enum: + - 'list' + type: 'string' + usage: + description: 'Token usage statistics' + example: + prompt_tokens: 8 + total_tokens: 8 + properties: + cost: + description: 'Cost of the request in credits' + example: 0.0001 + format: 'double' + type: 'number' + cost_details: + $ref: '#/components/schemas/CostDetails' + is_byok: + description: 'Whether a request was made using a Bring Your Own Key configuration' + type: 'boolean' + prompt_tokens: + description: 'Number of tokens in the input' + example: 8 + type: 'integer' + prompt_tokens_details: + description: 'Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.' + properties: + audio_tokens: + description: 'Number of audio tokens in the input' + type: 'integer' + file_tokens: + description: 'Number of file/document tokens in the input' + type: 'integer' + image_tokens: + description: 'Number of image tokens in the input' + example: 258 + type: 'integer' + text_tokens: + description: 'Number of text tokens in the input' + example: 8 + type: 'integer' + video_tokens: + description: 'Number of video tokens in the input' + type: 'integer' + type: 'object' + total_tokens: + description: 'Total number of tokens used' + example: 8 + type: 'integer' + required: + - 'prompt_tokens' + - 'total_tokens' + type: 'object' + required: + - 'object' + - 'data' + - 'model' + type: 'object' + request_id: + type: + - 'string' + - 'null' + status_code: + type: 'integer' + required: + - 'status_code' + - 'request_id' + - 'body' + type: + - 'object' + - 'null' + required: + - 'id' + - 'custom_id' + - 'response' + - 'error' + type: 'object' + type: + - 'array' + - 'null' + status: + enum: + - 'validating' + - 'in_progress' + - 'finalizing' + - 'completed' + - 'failed' + - 'expired' + - 'cancelling' + - 'cancelled' + type: 'string' + usage: + properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' + completion_tokens: + description: 'The tokens generated' + type: 'integer' + completion_tokens_details: + properties: + audio_tokens: + description: 'Tokens generated by the model for audio output.' + type: + - 'integer' + - 'null' + image_tokens: + description: 'Tokens generated by the model for image output.' + type: + - 'integer' + - 'null' + reasoning_tokens: + description: 'Tokens generated by the model for reasoning.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + cost: + description: 'Cost of the completion' + format: 'double' + type: + - 'number' + - 'null' + cost_details: + $ref: '#/components/schemas/CostDetails' + is_byok: + description: 'Whether a request was made using a Bring Your Own Key configuration' + type: 'boolean' + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: + - 'array' + - 'null' + prompt_tokens: + description: 'Including images, input audio, and tools if any' + type: 'integer' + prompt_tokens_details: + description: 'Breakdown of tokens used in the prompt.' + properties: + audio_tokens: + description: 'Tokens used for input audio.' + type: + - 'integer' + - 'null' + cache_write_tokens: + description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' + type: + - 'integer' + - 'null' + cached_tokens: + description: 'Tokens cached by the endpoint.' + type: + - 'integer' + - 'null' + file_tokens: + description: 'Tokens used for input files/documents.' + type: + - 'integer' + - 'null' + video_tokens: + description: 'Tokens used for input video.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + service_tier: + description: 'The service tier used by the upstream provider for this request' + type: + - 'string' + - 'null' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: + - 'object' + - 'null' + required: + - 'id' + - 'object' + - 'endpoint' + - 'model' + - 'completion_window' + - 'status' + - 'created_at' + - 'finalized_at' + - 'request_counts' + - 'usage' + - 'results' + - 'error' + type: 'object' + BatchPaymentRequiredResponse: + description: 'Batch metadata with results withheld (results: null) plus the standard error envelope. Add credits to unlock the already-computed results; the batch is not re-run.' + properties: + completion_window: + enum: + - '24h' + type: 'string' + created_at: + type: 'integer' + endpoint: + type: 'string' + error: + properties: + code: + type: 'integer' + message: + type: 'string' + required: + - 'code' + - 'message' + type: 'object' + finalized_at: + type: + - 'integer' + - 'null' + id: + type: 'string' + model: + type: 'string' + object: + enum: + - 'batch' + type: 'string' + request_counts: + properties: + completed: + type: 'integer' + failed: + type: 'integer' + total: + type: 'integer' + required: + - 'total' + - 'completed' + - 'failed' + type: 'object' + results: + description: 'Always null: results are withheld until the batch charge is covered.' + type: 'null' + status: + enum: + - 'validating' + - 'in_progress' + - 'finalizing' + - 'completed' + - 'failed' + - 'expired' + - 'cancelling' + - 'cancelled' + type: 'string' + usage: + properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' + completion_tokens: + description: 'The tokens generated' + type: 'integer' + completion_tokens_details: + properties: + audio_tokens: + description: 'Tokens generated by the model for audio output.' + type: + - 'integer' + - 'null' + image_tokens: + description: 'Tokens generated by the model for image output.' + type: + - 'integer' + - 'null' + reasoning_tokens: + description: 'Tokens generated by the model for reasoning.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + cost: + description: 'Cost of the completion' + format: 'double' + type: + - 'number' + - 'null' + cost_details: + $ref: '#/components/schemas/CostDetails' + is_byok: + description: 'Whether a request was made using a Bring Your Own Key configuration' + type: 'boolean' + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: + - 'array' + - 'null' + prompt_tokens: + description: 'Including images, input audio, and tools if any' + type: 'integer' + prompt_tokens_details: + description: 'Breakdown of tokens used in the prompt.' + properties: + audio_tokens: + description: 'Tokens used for input audio.' + type: + - 'integer' + - 'null' + cache_write_tokens: + description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' + type: + - 'integer' + - 'null' + cached_tokens: + description: 'Tokens cached by the endpoint.' + type: + - 'integer' + - 'null' + file_tokens: + description: 'Tokens used for input files/documents.' + type: + - 'integer' + - 'null' + video_tokens: + description: 'Tokens used for input video.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + service_tier: + description: 'The service tier used by the upstream provider for this request' + type: + - 'string' + - 'null' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: + - 'object' + - 'null' + required: + - 'id' + - 'object' + - 'endpoint' + - 'model' + - 'completion_window' + - 'status' + - 'created_at' + - 'finalized_at' + - 'request_counts' + - 'usage' + - 'results' + - 'error' + type: 'object' + BatchProviderPreferences: + additionalProperties: false + description: 'Batch provider routing preferences. Only `provider.only` is supported.' + example: + only: + - 'google-vertex' + properties: + only: + description: 'List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.' + example: + - 'openai' + - 'anthropic' + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: 'string' + type: + - 'array' + - 'null' + type: + - 'object' + - 'null' + BatchSubmitBody: + description: 'Batch submit request body.' + properties: + completion_window: + default: '24h' + enum: + - '24h' + type: 'string' + endpoint: + enum: + - '/v1/chat/completions' + - '/v1/responses' + - '/v1/messages' + - '/v1/embeddings' + type: 'string' + model: + minLength: 1 + type: 'string' + provider: + $ref: '#/components/schemas/BatchProviderPreferences' + requests: + items: + properties: + body: + additionalProperties: true + description: 'Request payload for the batch `endpoint`.' + type: 'object' + custom_id: + minLength: 1 + type: 'string' + required: + - 'custom_id' + - 'body' + type: 'object' + minItems: 1 + type: 'array' + required: + - 'endpoint' + - 'model' + - 'requests' + type: 'object' BooleanCapability: description: 'A supported-or-not flag. Present means the parameter is accepted.' example: @@ -9148,6 +10628,15 @@ components: example: {} properties: {} type: 'object' + FinishReason: + enum: + - 'stop' + - 'length' + - 'tool_calls' + - 'content_filter' + - 'function_call' + example: 'stop' + type: 'string' ForbiddenResponse: description: 'Forbidden - Authentication successful but insufficient permissions' example: @@ -31331,6 +32820,470 @@ paths: tags: - 'OAuth' x-speakeasy-name-override: 'createAuthCode' + /batches: + get: + description: 'Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page''s `last_id` as `after`. List items omit `results`. Use `GET /batches/{id}` to get them. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'listBatches' + parameters: + - description: 'Maximum number of batches to return, from 1 through 100.' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of batches to return, from 1 through 100.' + example: 20 + type: 'integer' + - description: 'Batch id from the previous page''s `last_id`.' + in: 'query' + name: 'after' + required: false + schema: + description: 'Batch id from the previous page''s `last_id`.' + example: 'batch_7a4b02' + minLength: 1 + type: 'string' + - description: 'Repeat this parameter to include more than one status.' + explode: true + in: 'query' + name: 'status' + required: false + schema: + description: 'Repeat this parameter to include more than one status.' + example: + - 'completed' + - 'failed' + items: + $ref: '#/components/schemas/BatchListStatus' + type: 'array' + style: 'form' + - description: 'Only include batches created strictly after this timestamp.' + in: 'query' + name: 'created_after' + required: false + schema: + $ref: '#/components/schemas/BatchListTimestamp' + - description: 'Only include batches created strictly before this timestamp.' + in: 'query' + name: 'created_before' + required: false + schema: + allOf: + - $ref: '#/components/schemas/BatchListTimestamp' + - description: 'Only include batches created strictly before this timestamp.' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchListResponse' + description: 'A newest-first page of batches.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid batch list query.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Malformed or unsupported batch list query parameters.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'No auth credentials found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Missing or invalid API key.' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch API rate limit exceeded for the billable entity.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal server error.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Unexpected error in the ingress or upstream batch-api.' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Upstream batch-api is unavailable.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' + summary: 'List batches' + tags: + - 'Batch' + x-speakeasy-name-override: 'list' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'after' + type: 'cursor' + outputs: + nextCursor: '$.last_id' + results: '$.data' + type: 'cursor' + post: + description: 'Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'createBatches' + requestBody: + content: + application/json: + examples: + chatCompletions: + summary: 'Chat completions batch' + value: + endpoint: '/v1/chat/completions' + model: 'openai/gpt-4o' + requests: + - body: + messages: + - content: 'Summarize ...' + role: 'user' + model: 'openai/gpt-4o' + custom_id: 'req-0001' + messages: + summary: 'Messages batch' + value: + endpoint: '/v1/messages' + model: 'openai/gpt-5-nano' + requests: + - body: + max_tokens: 1024 + messages: + - content: 'Summarize ...' + role: 'user' + model: 'openai/gpt-5-nano' + custom_id: 'req-0001' + providerPinned: + summary: 'Batch pinned to Vertex' + value: + endpoint: '/v1/chat/completions' + model: 'google/gemini-3.6-flash' + provider: + only: + - 'google-vertex' + requests: + - body: + messages: + - content: 'Summarize ...' + role: 'user' + model: 'google/gemini-3.6-flash' + custom_id: 'req-0001' + responses: + summary: 'Responses batch' + value: + endpoint: '/v1/responses' + model: 'openai/gpt-4o' + requests: + - body: + input: + - content: + - text: 'Summarize ...' + type: 'input_text' + role: 'user' + model: 'openai/gpt-4o' + custom_id: 'req-0001' + schema: + $ref: '#/components/schemas/BatchSubmitBody' + description: 'The batch to create. Each item in `requests` has a unique `custom_id` and a `body` in the request format of the chosen `endpoint`.' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchObject' + description: 'Batch payload durably persisted and queued for asynchronous validation and provider submission (`status: "validating"`).' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'custom_id is required on requests[0].' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Malformed batch input or an unknown/incompatible batch model.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'No auth credentials found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Missing or invalid API key.' + '402': + content: + application/json: + example: + error: + code: 402 + message: 'Insufficient balance for this batch.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The estimated batch cost exceeds the available balance.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'The selected provider or model is not allowed.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The resolved batch endpoint is blocked by account policy.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Batch not found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'No batch exists for the given id.' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Batch input exceeds the 200 MB payload limit.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch input exceeds the maximum payload size.' + '422': + content: + application/json: + example: + error: + code: 422 + message: 'The batch request could not be processed.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The requested model variant or custom IDs violate Batch API constraints.' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch API rate limit exceeded for the billable entity.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal server error.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Unexpected error in the ingress or upstream batch-api.' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Upstream batch-api is unavailable.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' + summary: 'Create a batch' + tags: + - 'Batch' + x-speakeasy-retries: + retryConnectionErrors: false + statusCodes: + - '429' + strategy: 'backoff' + /batches/{id}: + delete: + description: 'Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'deleteBatch' + parameters: + - description: 'The batch job id returned from submit.' + in: 'path' + name: 'id' + required: true + schema: + description: 'The batch job id returned from submit.' + example: 'batch_abc123' + minLength: 1 + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDeletedObject' + description: 'The batch was deleted; per-target outcomes are reported under `deletion`.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'No auth credentials found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Missing or invalid API key.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Batch not found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'No batch exists for the given id.' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Only completed, failed, expired, or cancelled batches can be deleted. Wait for the batch to finish and try again.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch is still processing, its required provider key is unavailable, or its state changed during deletion.' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch API rate limit exceeded for the billable entity.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal server error.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Unexpected error in the ingress or upstream batch-api.' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Upstream batch-api is unavailable.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' + summary: 'Delete a batch' + tags: + - 'Batch' + x-speakeasy-name-override: 'delete' + get: + description: 'Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'getBatches' + parameters: + - description: 'The batch job id returned from submit.' + in: 'path' + name: 'id' + required: true + schema: + description: 'The batch job id returned from submit.' + example: 'batch_abc123' + minLength: 1 + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchObject' + description: 'The current batch job status.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'No auth credentials found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Missing or invalid API key.' + '402': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchPaymentRequiredResponse' + description: 'The finalized batch cost exceeds the available balance; metadata is returned with `results: null`. Top up credits and poll again to receive the persisted results.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Batch not found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'No batch exists for the given id.' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch API rate limit exceeded for the billable entity.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal server error.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Unexpected error in the ingress or upstream batch-api.' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Upstream batch-api is unavailable.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' + summary: 'Get a batch' + tags: + - 'Batch' /benchmarks: get: description: 'Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena, and OpenRouter''s own tau-bench, GPQA, and web-search evals). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Use task_type=search (or a search_* benchmark_type) for OpenRouter''s search benchmarks, which publish each model''s highest-scoring eligible evaluation configuration with same-configuration runs combined by task-weighted mean. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.' @@ -46916,6 +48869,8 @@ tags: name: 'Anthropic Messages' - description: 'BYOK endpoints' name: 'BYOK' + - description: 'Submit, list, poll, and delete asynchronous batches of inference requests. See https://openrouter.ai/docs/batch-quickstart.' + name: 'Batch' - description: 'Benchmarks endpoints' name: 'Benchmarks' - description: 'Chat completion endpoints'