From 4694b939b7e60059497707042b51984ef77ab6ce Mon Sep 17 00:00:00 2001 From: OpenRouter SDK Bot Date: Wed, 8 Apr 2026 21:36:45 +0000 Subject: [PATCH] chore: update OpenAPI spec [sdk-bot] --- .speakeasy/in.openapi.yaml | 23191 ++++++++++++++++------------------- 1 file changed, 10792 insertions(+), 12399 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 17044b7..7a4f61f 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -30,6 +30,7 @@ components: - failed - cancelled - queued + example: completed FileCitation: type: object properties: @@ -42,7 +43,7 @@ components: filename: type: string index: - type: number + type: integer required: - type - file_id @@ -65,9 +66,9 @@ components: title: type: string start_index: - type: number + type: integer end_index: - type: number + type: integer required: - type - url @@ -90,7 +91,7 @@ components: file_id: type: string index: - type: number + type: integer required: - type - file_id @@ -104,6 +105,11 @@ components: - $ref: '#/components/schemas/FileCitation' - $ref: '#/components/schemas/URLCitation' - $ref: '#/components/schemas/FilePath' + example: + type: file_citation + file_id: file-abc123 + filename: research_paper.pdf + index: 0 ResponseOutputText: type: object properties: @@ -127,9 +133,10 @@ components: bytes: type: array items: - type: number + type: integer logprob: type: number + format: double top_logprobs: type: array items: @@ -140,9 +147,10 @@ components: bytes: type: array items: - type: number + type: integer logprob: type: number + format: double required: - token - bytes @@ -280,6 +288,18 @@ components: example: type: summary_text text: Analyzed the problem using first principles + ReasoningFormat: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + - null + example: unknown OutputItemReasoning: type: object properties: @@ -337,17 +357,7 @@ components: description: A signature for the reasoning content, used for verification example: EvcBCkgIChABGAIqQKkSDbRuVEQUk9qN1odC098l9SEj... format: - type: string - nullable: true - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 - description: The format of the reasoning content - example: anthropic-claude-v1 + $ref: '#/components/schemas/ReasoningFormat' example: id: reasoning-123 type: reasoning @@ -404,11 +414,27 @@ components: - type: object properties: {} example: + id: fc-abc123 type: function_call - id: call-abc123 - name: get_weather - arguments: '{"location":"San Francisco","unit":"celsius"}' call_id: call-abc123 + name: get_weather + arguments: '{"location":"San Francisco"}' + status: completed + WebSearchSource: + type: object + properties: + type: + type: string + enum: + - url + url: + type: string + required: + - type + - url + example: + type: url + url: https://example.com/article WebSearchStatus: type: string enum: @@ -443,17 +469,7 @@ components: sources: type: array items: - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url + $ref: '#/components/schemas/WebSearchSource' required: - type - query @@ -502,11 +518,8 @@ components: - type: object properties: {} example: + id: ws-abc123 type: web_search_call - id: search-abc123 - action: - type: search - query: OpenAI API status: completed OutputItemFileSearchCall: type: object @@ -541,12 +554,12 @@ components: - type: object properties: {} example: + id: fs-abc123 type: file_search_call - id: filesearch-abc123 - queries: - - machine learning algorithms - - neural networks status: completed + queries: + - search term + results: [] ImageGenerationStatus: type: string enum: @@ -585,44 +598,86 @@ components: - type: object properties: {} example: + id: img-abc123 type: image_generation_call - id: imagegen-abc123 - result: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg== status: completed - OutputServerToolItem: + result: null + ToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + example: completed + OutputDatetimeItem: type: object properties: + id: + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' type: type: string - pattern: '^openrouter:' - description: Server tool type (e.g. openrouter:datetime, openrouter:web_search) + enum: + - openrouter:datetime + datetime: + type: string + description: ISO 8601 datetime string + timezone: + type: string + description: IANA timezone name + required: + - status + - type + - datetime + - timezone + description: An openrouter:datetime server tool output item + example: + type: openrouter:datetime + id: dt_tmp_abc123 + status: completed + datetime: '2026-03-12T14:30:00.000Z' + timezone: UTC + OutputWebSearchServerToolItem: + type: object + properties: id: type: string status: + $ref: '#/components/schemas/ToolCallStatus' + type: type: string enum: - - completed - - in_progress - - incomplete + - openrouter:web_search required: - - type - status - additionalProperties: - nullable: true - description: A generic OpenRouter server tool output item + - type + description: An openrouter:web_search server tool output item example: type: openrouter:web_search id: ws_tmp_abc123 status: completed OutputItems: - anyOf: + oneOf: - $ref: '#/components/schemas/OutputMessageItem' - $ref: '#/components/schemas/OutputReasoningItem' - $ref: '#/components/schemas/OutputFunctionCallItem' - $ref: '#/components/schemas/OutputWebSearchCallItem' - $ref: '#/components/schemas/OutputFileSearchCallItem' - $ref: '#/components/schemas/OutputImageGenerationCallItem' - - $ref: '#/components/schemas/OutputServerToolItem' + - $ref: '#/components/schemas/OutputDatetimeItem' + - $ref: '#/components/schemas/OutputWebSearchServerToolItem' + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/OutputMessageItem' + reasoning: '#/components/schemas/OutputReasoningItem' + function_call: '#/components/schemas/OutputFunctionCallItem' + web_search_call: '#/components/schemas/OutputWebSearchCallItem' + file_search_call: '#/components/schemas/OutputFileSearchCallItem' + image_generation_call: '#/components/schemas/OutputImageGenerationCallItem' + openrouter:datetime: '#/components/schemas/OutputDatetimeItem' + openrouter:web_search: '#/components/schemas/OutputWebSearchServerToolItem' description: An output item from the response example: id: msg-abc123 @@ -675,35 +730,45 @@ components: enum: - max_output_tokens - content_filter + example: + reason: max_output_tokens OpenAIResponsesUsage: type: object properties: input_tokens: - type: number + type: integer input_tokens_details: type: object properties: cached_tokens: - type: number + type: integer required: - cached_tokens output_tokens: - type: number + type: integer output_tokens_details: type: object properties: reasoning_tokens: - type: number + type: integer required: - reasoning_tokens total_tokens: - type: number + type: integer required: - input_tokens - input_tokens_details - output_tokens - output_tokens_details - total_tokens + example: + input_tokens: 100 + input_tokens_details: + cached_tokens: 0 + output_tokens: 50 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 150 Usage: allOf: - $ref: '#/components/schemas/OpenAIResponsesUsage' @@ -712,7 +777,7 @@ components: properties: cost: type: number - nullable: true + format: double description: Cost of the completion is_byok: type: boolean @@ -722,15 +787,16 @@ components: properties: upstream_inference_cost: type: number - nullable: true + format: double upstream_inference_input_cost: type: number + format: double upstream_inference_output_cost: type: number + format: double required: - upstream_inference_input_cost - upstream_inference_output_cost - description: Token usage information for the response example: input_tokens: 10 output_tokens: 25 @@ -744,6 +810,7 @@ components: upstream_inference_cost: null upstream_inference_input_cost: 0.0008 upstream_inference_output_cost: 0.0004 + description: Token usage information for the response InputText: type: object properties: @@ -836,14 +903,120 @@ components: input_audio: data: SGVsbG8gV29ybGQ= format: mp3 - ToolCallStatusEnum: - type: string - nullable: true - enum: - - in_progress - - completed - - incomplete - example: completed + OpenAIResponseInputMessageItem: + type: object + properties: + id: + type: string + type: + type: string + enum: + - message + role: + anyOf: + - type: string + enum: + - user + - type: string + enum: + - system + - type: string + enum: + - developer + content: + type: array + items: + oneOf: + - $ref: '#/components/schemas/InputText' + - $ref: '#/components/schemas/InputImage' + - $ref: '#/components/schemas/InputFile' + - $ref: '#/components/schemas/InputAudio' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputText' + input_image: '#/components/schemas/InputImage' + input_file: '#/components/schemas/InputFile' + input_audio: '#/components/schemas/InputAudio' + required: + - id + - role + - content + example: + id: msg-abc123 + type: message + role: user + content: + - type: input_text + text: Hello, how are you? + OpenAIResponseFunctionToolCallOutput: + type: object + properties: + type: + type: string + enum: + - function_call_output + id: + type: string + nullable: true + call_id: + type: string + output: + anyOf: + - type: string + - type: array + items: + oneOf: + - $ref: '#/components/schemas/InputText' + - $ref: '#/components/schemas/InputImage' + - $ref: '#/components/schemas/InputFile' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputText' + input_image: '#/components/schemas/InputImage' + input_file: '#/components/schemas/InputFile' + status: + allOf: + - $ref: '#/components/schemas/ToolCallStatus' + - nullable: true + required: + - type + - call_id + - output + example: + type: function_call_output + call_id: call-abc123 + output: '{"temperature":72,"conditions":"sunny"}' + OpenAIResponseFunctionToolCall: + type: object + properties: + type: + type: string + enum: + - function_call + call_id: + type: string + name: + type: string + arguments: + type: string + id: + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' + required: + - type + - call_id + - name + - arguments + example: + type: function_call + call_id: call-abc123 + name: get_weather + arguments: '{"location":"San Francisco"}' + id: fc-abc123 + status: completed BaseInputs: anyOf: - type: string @@ -899,100 +1072,15 @@ components: required: - role - content - - type: object - properties: - id: - type: string - type: - type: string - enum: - - message - role: - anyOf: - - type: string - enum: - - user - - type: string - enum: - - system - - type: string - enum: - - developer - content: - type: array - items: - oneOf: - - $ref: '#/components/schemas/InputText' - - $ref: '#/components/schemas/InputImage' - - $ref: '#/components/schemas/InputFile' - - $ref: '#/components/schemas/InputAudio' - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/InputText' - input_image: '#/components/schemas/InputImage' - input_file: '#/components/schemas/InputFile' - input_audio: '#/components/schemas/InputAudio' - required: - - id - - role - - content - - type: object - properties: - type: - type: string - enum: - - function_call_output - id: - type: string - nullable: true - call_id: - type: string - output: - anyOf: - - type: string - - type: array - items: - oneOf: - - $ref: '#/components/schemas/InputText' - - $ref: '#/components/schemas/InputImage' - - $ref: '#/components/schemas/InputFile' - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/InputText' - input_image: '#/components/schemas/InputImage' - input_file: '#/components/schemas/InputFile' - status: - $ref: '#/components/schemas/ToolCallStatusEnum' - required: - - type - - call_id - - output - - type: object - properties: - type: - type: string - enum: - - function_call - call_id: - type: string - name: - type: string - arguments: - type: string - id: - type: string - status: - $ref: '#/components/schemas/ToolCallStatusEnum' - required: - - type - - call_id - - name - - arguments + - $ref: '#/components/schemas/OpenAIResponseInputMessageItem' + - $ref: '#/components/schemas/OpenAIResponseFunctionToolCallOutput' + - $ref: '#/components/schemas/OpenAIResponseFunctionToolCall' - $ref: '#/components/schemas/OutputItemImageGenerationCall' - $ref: '#/components/schemas/OutputMessage' - nullable: true + example: + - role: user + content: What is the weather today? RequestMetadata: type: object nullable: true @@ -1077,6 +1165,44 @@ components: nullable: true required: - type + example: + type: approximate + city: San Francisco + country: USA + region: California + timezone: America/Los_Angeles + WebSearchEngineEnum: + type: string + enum: + - auto + - native + - exa + - firecrawl + - parallel + description: >- + Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" + forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires + BYOK). "parallel" uses the Parallel search API. + example: auto + WebSearchDomainFilter: + type: object + nullable: true + properties: + allowed_domains: + type: array + nullable: true + items: + type: string + excluded_domains: + type: array + nullable: true + items: + type: string + example: + allowed_domains: + - example.com + excluded_domains: + - spam.com Preview_WebSearchServerTool: type: object properties: @@ -1089,40 +1215,15 @@ components: user_location: $ref: '#/components/schemas/Preview_WebSearchUserLocation' engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl - (requires BYOK). "parallel" uses the Parallel search API. - example: auto + $ref: '#/components/schemas/WebSearchEngineEnum' max_results: - type: number - minimum: 1 - maximum: 25 + type: integer description: >- Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. example: 5 filters: - type: object - nullable: true - properties: - allowed_domains: - type: array - nullable: true - items: - type: string - excluded_domains: - type: array - nullable: true - items: - type: string + $ref: '#/components/schemas/WebSearchDomainFilter' required: - type description: Web search preview tool configuration @@ -1140,40 +1241,15 @@ components: user_location: $ref: '#/components/schemas/Preview_WebSearchUserLocation' engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl - (requires BYOK). "parallel" uses the Parallel search API. - example: auto + $ref: '#/components/schemas/WebSearchEngineEnum' max_results: - type: number - minimum: 1 - maximum: 25 + type: integer description: >- Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. example: 5 filters: - type: object - nullable: true - properties: - allowed_domains: - type: array - nullable: true - items: - type: string - excluded_domains: - type: array - nullable: true - items: - type: string + $ref: '#/components/schemas/WebSearchDomainFilter' required: - type description: Web search preview tool configuration (2025-03-11 version) @@ -1214,40 +1290,15 @@ components: enum: - web_search filters: - type: object - nullable: true - properties: - allowed_domains: - type: array - nullable: true - items: - type: string - excluded_domains: - type: array - nullable: true - items: - type: string + $ref: '#/components/schemas/WebSearchDomainFilter' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' user_location: $ref: '#/components/schemas/WebSearchUserLocation' engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl - (requires BYOK). "parallel" uses the Parallel search API. - example: auto + $ref: '#/components/schemas/WebSearchEngineEnum' max_results: - type: number - minimum: 1 - maximum: 25 + type: integer description: >- Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. @@ -1269,40 +1320,15 @@ components: enum: - web_search_2025_08_26 filters: - type: object - nullable: true - properties: - allowed_domains: - type: array - nullable: true - items: - type: string - excluded_domains: - type: array - nullable: true - items: - type: string + $ref: '#/components/schemas/WebSearchDomainFilter' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' user_location: $ref: '#/components/schemas/WebSearchUserLocation' engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl - (requires BYOK). "parallel" uses the Parallel search API. - example: auto + $ref: '#/components/schemas/WebSearchEngineEnum' max_results: - type: number - minimum: 1 - maximum: 25 + type: integer description: >- Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. @@ -1334,6 +1360,12 @@ components: - type - filters description: A compound filter that combines multiple comparison or compound filters + example: + type: and + filters: + - key: author + type: eq + value: Alice FileSearchServerTool: type: object properties: @@ -1364,12 +1396,14 @@ components: anyOf: - type: string - type: number + format: double - type: boolean - type: array items: anyOf: - type: string - type: number + format: double required: - key - type @@ -1378,8 +1412,6 @@ components: - nullable: true max_num_results: type: integer - minimum: 1 - maximum: 50 ranking_options: type: object properties: @@ -1390,6 +1422,7 @@ components: - default-2024-11-15 score_threshold: type: number + format: double required: - type - vector_store_ids @@ -1406,9 +1439,9 @@ components: enum: - computer_use_preview display_height: - type: number + type: integer display_width: - type: number + type: integer environment: type: string enum: @@ -1456,6 +1489,7 @@ components: - 4g - 16g - 64g + - null required: - type required: @@ -1488,7 +1522,6 @@ components: read_only: type: boolean - nullable: true - - nullable: true authorization: type: string connector_id: @@ -1532,7 +1565,6 @@ components: enum: - never - nullable: true - - nullable: true server_description: type: string server_url: @@ -1564,6 +1596,7 @@ components: enum: - high - low + - null input_image_mask: type: object properties: @@ -1582,7 +1615,7 @@ components: - auto - low output_compression: - type: number + type: integer output_format: type: string enum: @@ -1590,7 +1623,7 @@ components: - webp - jpeg partial_images: - type: number + type: integer quality: type: string enum: @@ -1692,6 +1725,38 @@ components: example: type: custom name: my_tool + ToolChoiceAllowed: + type: object + properties: + type: + type: string + enum: + - allowed_tools + mode: + anyOf: + - type: string + enum: + - auto + - type: string + enum: + - required + tools: + type: array + items: + type: object + additionalProperties: + nullable: true + required: + - type + - mode + - tools + description: Constrains the model to a pre-defined set of allowed tools + example: + type: allowed_tools + mode: auto + tools: + - type: function + name: get_weather OpenAIResponsesToolChoice: anyOf: - type: string @@ -1726,6 +1791,8 @@ components: - web_search_preview required: - type + - $ref: '#/components/schemas/ToolChoiceAllowed' + example: auto StoredPromptTemplate: type: object nullable: true @@ -1743,7 +1810,11 @@ components: - $ref: '#/components/schemas/InputFile' required: - id - ReasoningEffortEnum: + example: + id: prompt-abc123 + variables: + name: John + ReasoningEffort: type: string nullable: true enum: @@ -1753,28 +1824,36 @@ components: - low - minimal - none - ReasoningSummaryVerbosityEnum: + - null + example: medium + ReasoningSummaryVerbosity: type: string nullable: true enum: - auto - concise - detailed + - null example: auto BaseReasoningConfig: type: object nullable: true properties: effort: - $ref: '#/components/schemas/ReasoningEffortEnum' + $ref: '#/components/schemas/ReasoningEffort' summary: - $ref: '#/components/schemas/ReasoningSummaryVerbosityEnum' - TruncationEnum: + $ref: '#/components/schemas/ReasoningSummaryVerbosity' + example: + effort: medium + summary: auto + Truncation: type: string nullable: true enum: - auto - disabled + - null + example: auto FormatTextConfig: type: object properties: @@ -1855,12 +1934,13 @@ components: - high - low - medium + - null description: Text output configuration including format and verbosity example: format: type: text verbosity: medium - ServiceTierEnum: + ServiceTier: type: string nullable: true enum: @@ -1869,6 +1949,8 @@ components: - flex - priority - scale + - null + example: default BaseResponsesResult: type: object properties: @@ -1879,14 +1961,13 @@ components: enum: - response created_at: - type: number + type: integer model: type: string status: $ref: '#/components/schemas/OpenAIResponsesResponseStatus' completed_at: - type: number - nullable: true + type: integer output: type: array items: @@ -1924,25 +2005,23 @@ components: usage: $ref: '#/components/schemas/OpenAIResponsesUsage' max_tool_calls: - type: number - nullable: true + type: integer top_logprobs: - type: number + type: integer max_output_tokens: - type: number - nullable: true + type: integer temperature: type: number - nullable: true + format: double top_p: type: number - nullable: true + format: double presence_penalty: type: number - nullable: true + format: double frequency_penalty: type: number - nullable: true + format: double instructions: $ref: '#/components/schemas/BaseInputs' metadata: @@ -2001,11 +2080,11 @@ components: reasoning: $ref: '#/components/schemas/BaseReasoningConfig' service_tier: - $ref: '#/components/schemas/ServiceTierEnum' + $ref: '#/components/schemas/ServiceTier' store: type: boolean truncation: - $ref: '#/components/schemas/TruncationEnum' + $ref: '#/components/schemas/Truncation' text: $ref: '#/components/schemas/TextConfig' required: @@ -2027,6 +2106,24 @@ components: - tools - tool_choice - parallel_tool_calls + example: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: completed + completed_at: 1704067210 + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null OpenResponsesResult: allOf: - $ref: '#/components/schemas/BaseResponsesResult' @@ -2041,7 +2138,6 @@ components: service_tier: type: string nullable: true - description: Complete non-streaming response from the Responses API example: id: resp-abc123 object: response @@ -2075,6 +2171,7 @@ components: max_output_tokens: null metadata: null instructions: null + description: Complete non-streaming response from the Responses API CreatedEvent: type: object properties: @@ -2085,7 +2182,7 @@ components: response: $ref: '#/components/schemas/BaseResponsesResult' sequence_number: - type: number + type: integer required: - type - response @@ -2111,6 +2208,34 @@ components: top_p: null max_output_tokens: null sequence_number: 0 + OpenResponsesCreatedEvent: + allOf: + - $ref: '#/components/schemas/CreatedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesResult' + description: Event emitted when a response is created + example: + type: response.created + response: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: in_progress + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null + sequence_number: 0 InProgressEvent: type: object properties: @@ -2121,7 +2246,7 @@ components: response: $ref: '#/components/schemas/BaseResponsesResult' sequence_number: - type: number + type: integer required: - type - response @@ -2147,17 +2272,45 @@ components: top_p: null max_output_tokens: null sequence_number: 1 - CompletedEvent: - type: object - properties: - type: - type: string - enum: - - response.completed + OpenResponsesInProgressEvent: + allOf: + - $ref: '#/components/schemas/InProgressEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesResult' + description: Event emitted when a response is in progress + example: + type: response.in_progress + response: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: in_progress + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null + sequence_number: 1 + CompletedEvent: + type: object + properties: + type: + type: string + enum: + - response.completed response: $ref: '#/components/schemas/BaseResponsesResult' sequence_number: - type: number + type: integer required: - type - response @@ -2191,6 +2344,34 @@ components: top_p: null max_output_tokens: null sequence_number: 10 + StreamEventsResponseCompleted: + allOf: + - $ref: '#/components/schemas/CompletedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesResult' + description: Event emitted when a response has completed successfully + example: + type: response.completed + response: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: completed + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null + sequence_number: 10 IncompleteEvent: type: object properties: @@ -2201,7 +2382,7 @@ components: response: $ref: '#/components/schemas/BaseResponsesResult' sequence_number: - type: number + type: integer required: - type - response @@ -2227,6 +2408,34 @@ components: top_p: null max_output_tokens: null sequence_number: 5 + StreamEventsResponseIncomplete: + allOf: + - $ref: '#/components/schemas/IncompleteEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesResult' + description: Event emitted when a response is incomplete + example: + type: response.incomplete + response: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: incomplete + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null + sequence_number: 5 FailedEvent: type: object properties: @@ -2237,7 +2446,7 @@ components: response: $ref: '#/components/schemas/BaseResponsesResult' sequence_number: - type: number + type: integer required: - type - response @@ -2263,6 +2472,34 @@ components: top_p: null max_output_tokens: null sequence_number: 3 + StreamEventsResponseFailed: + allOf: + - $ref: '#/components/schemas/FailedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesResult' + description: Event emitted when a response has failed + example: + type: response.failed + response: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: failed + output: [] + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + metadata: null + instructions: null + temperature: null + top_p: null + max_output_tokens: null + sequence_number: 3 BaseErrorEvent: type: object properties: @@ -2279,7 +2516,7 @@ components: type: string nullable: true sequence_number: - type: number + type: integer required: - type - code @@ -2313,7 +2550,7 @@ components: enum: - response.output_item.added output_index: - type: number + type: integer item: oneOf: - $ref: '#/components/schemas/OutputMessage' @@ -2332,7 +2569,7 @@ components: file_search_call: '#/components/schemas/OutputItemFileSearchCall' image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' sequence_number: - type: number + type: integer required: - type - output_index @@ -2349,6 +2586,24 @@ components: role: assistant content: [] sequence_number: 2 + StreamEventsResponseOutputItemAdded: + allOf: + - $ref: '#/components/schemas/OutputItemAddedEvent' + - type: object + properties: + item: + $ref: '#/components/schemas/OutputItems' + description: Event emitted when a new output item is added to the response + example: + type: response.output_item.added + output_index: 0 + item: + id: item-1 + type: message + status: in_progress + role: assistant + content: [] + sequence_number: 2 OutputItemDoneEvent: type: object properties: @@ -2357,7 +2612,7 @@ components: enum: - response.output_item.done output_index: - type: number + type: integer item: oneOf: - $ref: '#/components/schemas/OutputMessage' @@ -2376,7 +2631,7 @@ components: file_search_call: '#/components/schemas/OutputItemFileSearchCall' image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' sequence_number: - type: number + type: integer required: - type - output_index @@ -2396,6 +2651,27 @@ components: text: Hello! How can I help you? annotations: [] sequence_number: 8 + StreamEventsResponseOutputItemDone: + allOf: + - $ref: '#/components/schemas/OutputItemDoneEvent' + - type: object + properties: + item: + $ref: '#/components/schemas/OutputItems' + description: Event emitted when an output item is complete + example: + type: response.output_item.done + output_index: 0 + item: + id: item-1 + type: message + status: completed + role: assistant + content: + - type: output_text + text: Hello! How can I help you? + annotations: [] + sequence_number: 8 BaseContentPartAddedEvent: type: object properties: @@ -2404,17 +2680,17 @@ components: enum: - response.content_part.added output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer part: anyOf: - $ref: '#/components/schemas/ResponseOutputText' - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' sequence_number: - type: number + type: integer required: - type - output_index @@ -2462,17 +2738,17 @@ components: enum: - response.content_part.done output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer part: anyOf: - $ref: '#/components/schemas/ResponseOutputText' - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' sequence_number: - type: number + type: integer required: - type - output_index @@ -2519,19 +2795,36 @@ components: type: string logprob: type: number + format: double bytes: type: array items: - type: number + type: integer description: Alternative token with its log probability example: token: hello logprob: -0.5 + StreamLogprobTopLogprob: + allOf: + - $ref: '#/components/schemas/OpenResponsesTopLogprobs' + - type: object + properties: {} + description: Alternative token with its log probability + example: + token: Hello + logprob: -0.5 + bytes: + - 72 + - 101 + - 108 + - 108 + - 111 OpenResponsesLogProbs: type: object properties: logprob: type: number + format: double token: type: string top_logprobs: @@ -2541,7 +2834,7 @@ components: bytes: type: array items: - type: number + type: integer required: - logprob - token @@ -2552,6 +2845,26 @@ components: top_logprobs: - token: hello logprob: -0.5 + StreamLogprob: + allOf: + - $ref: '#/components/schemas/OpenResponsesLogProbs' + - type: object + properties: + top_logprobs: + type: array + items: + $ref: '#/components/schemas/StreamLogprobTopLogprob' + description: Log probability information for a token + example: + token: Hello + logprob: -0.5 + bytes: + - 72 + - 101 + - 108 + - 108 + - 111 + top_logprobs: [] BaseTextDeltaEvent: type: object properties: @@ -2564,15 +2877,15 @@ components: items: $ref: '#/components/schemas/OpenResponsesLogProbs' output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer delta: type: string sequence_number: - type: number + type: integer required: - type - logprobs @@ -2598,28 +2911,7 @@ components: logprobs: type: array items: - allOf: - - $ref: '#/components/schemas/OpenResponsesLogProbs' - - type: object - properties: - top_logprobs: - type: array - items: - allOf: - - $ref: '#/components/schemas/OpenResponsesTopLogprobs' - - type: object - properties: {} - description: Alternative token with its log probability - example: - token: hello - logprob: -0.5 - description: Log probability information for a token - example: - logprob: -0.1 - token: world - top_logprobs: - - token: hello - logprob: -0.5 + $ref: '#/components/schemas/StreamLogprob' description: Event emitted when a text delta is streamed example: type: response.output_text.delta @@ -2637,15 +2929,15 @@ components: enum: - response.output_text.done output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer text: type: string sequence_number: - type: number + type: integer logprobs: type: array items: @@ -2675,28 +2967,7 @@ components: logprobs: type: array items: - allOf: - - $ref: '#/components/schemas/OpenResponsesLogProbs' - - type: object - properties: - top_logprobs: - type: array - items: - allOf: - - $ref: '#/components/schemas/OpenResponsesTopLogprobs' - - type: object - properties: {} - description: Alternative token with its log probability - example: - token: hello - logprob: -0.5 - description: Log probability information for a token - example: - logprob: -0.1 - token: world - top_logprobs: - - token: hello - logprob: -0.5 + $ref: '#/components/schemas/StreamLogprob' description: Event emitted when text streaming is complete example: type: response.output_text.done @@ -2714,15 +2985,15 @@ components: enum: - response.refusal.delta output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer delta: type: string sequence_number: - type: number + type: integer required: - type - output_index @@ -2759,15 +3030,15 @@ components: enum: - response.refusal.done output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer refusal: type: string sequence_number: - type: number + type: integer required: - type - output_index @@ -2804,15 +3075,15 @@ components: enum: - response.output_text.annotation.added output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer sequence_number: - type: number + type: integer annotation_index: - type: number + type: integer annotation: $ref: '#/components/schemas/OpenAIResponsesAnnotation' required: @@ -2866,11 +3137,11 @@ components: item_id: type: string output_index: - type: number + type: integer delta: type: string sequence_number: - type: number + type: integer required: - type - item_id @@ -2882,7 +3153,7 @@ components: type: response.function_call_arguments.delta item_id: item-1 output_index: 0 - delta: '{"city": "San' + delta: '{"city": "..."}' sequence_number: 4 FunctionCallArgsDeltaEvent: allOf: @@ -2894,7 +3165,7 @@ components: type: response.function_call_arguments.delta item_id: item-1 output_index: 0 - delta: '{"city": "San' + delta: '{"city": "..."}' sequence_number: 4 BaseFunctionCallArgsDoneEvent: type: object @@ -2906,13 +3177,13 @@ components: item_id: type: string output_index: - type: number + type: integer name: type: string arguments: type: string sequence_number: - type: number + type: integer required: - type - item_id @@ -2949,15 +3220,15 @@ components: enum: - response.reasoning_text.delta output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer delta: type: string sequence_number: - type: number + type: integer required: - type - output_index @@ -2994,15 +3265,15 @@ components: enum: - response.reasoning_text.done output_index: - type: number + type: integer item_id: type: string content_index: - type: number + type: integer text: type: string sequence_number: - type: number + type: integer required: - type - output_index @@ -3039,15 +3310,15 @@ components: enum: - response.reasoning_summary_part.added output_index: - type: number + type: integer item_id: type: string summary_index: - type: number + type: integer part: $ref: '#/components/schemas/ReasoningSummaryText' sequence_number: - type: number + type: integer required: - type - output_index @@ -3088,15 +3359,15 @@ components: enum: - response.reasoning_summary_part.done output_index: - type: number + type: integer item_id: type: string summary_index: - type: number + type: integer part: $ref: '#/components/schemas/ReasoningSummaryText' sequence_number: - type: number + type: integer required: - type - output_index @@ -3139,13 +3410,13 @@ components: item_id: type: string output_index: - type: number + type: integer summary_index: - type: number + type: integer delta: type: string sequence_number: - type: number + type: integer required: - type - item_id @@ -3184,13 +3455,13 @@ components: item_id: type: string output_index: - type: number + type: integer summary_index: - type: number + type: integer text: type: string sequence_number: - type: number + type: integer required: - type - item_id @@ -3229,25 +3500,30 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.image_generation_call.in_progress + item_id: ig_abc123 + output_index: 0 + sequence_number: 1 ImageGenCallInProgressEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesImageGenCallInProgress' - type: object properties: {} - description: Image generation call in progress example: type: response.image_generation_call.in_progress output_index: 0 sequence_number: 1 item_id: call-123 + description: Image generation call in progress OpenAIResponsesImageGenCallGenerating: type: object properties: @@ -3258,25 +3534,30 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.image_generation_call.generating + item_id: ig_abc123 + output_index: 0 + sequence_number: 2 ImageGenCallGeneratingEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesImageGenCallGenerating' - type: object properties: {} - description: Image generation call is generating example: type: response.image_generation_call.generating output_index: 0 sequence_number: 2 item_id: call-123 + description: Image generation call is generating OpenAIResponsesImageGenCallPartialImage: type: object properties: @@ -3287,13 +3568,13 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer partial_image_b64: type: string partial_image_index: - type: number + type: integer required: - type - item_id @@ -3301,12 +3582,18 @@ components: - sequence_number - partial_image_b64 - partial_image_index + example: + type: response.image_generation_call.partial_image + item_id: ig_abc123 + output_index: 0 + sequence_number: 3 + partial_image_b64: iVBORw0KGgo... + partial_image_index: 0 ImageGenCallPartialImageEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesImageGenCallPartialImage' - type: object properties: {} - description: Image generation call with partial image example: type: response.image_generation_call.partial_image output_index: 0 @@ -3314,6 +3601,7 @@ components: item_id: call-123 partial_image_b64: base64encodedimage... partial_image_index: 0 + description: Image generation call with partial image OpenAIResponsesImageGenCallCompleted: type: object properties: @@ -3324,25 +3612,30 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.image_generation_call.completed + item_id: ig_abc123 + output_index: 0 + sequence_number: 4 ImageGenCallCompletedEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesImageGenCallCompleted' - type: object properties: {} - description: Image generation call completed example: type: response.image_generation_call.completed output_index: 0 sequence_number: 4 item_id: call-123 + description: Image generation call completed OpenAIResponsesWebSearchCallInProgress: type: object properties: @@ -3353,25 +3646,30 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.web_search_call.in_progress + item_id: ws_abc123 + output_index: 0 + sequence_number: 1 WebSearchCallInProgressEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesWebSearchCallInProgress' - type: object properties: {} - description: Web search call in progress example: type: response.web_search_call.in_progress output_index: 0 sequence_number: 1 item_id: ws-123 + description: Web search call in progress OpenAIResponsesWebSearchCallSearching: type: object properties: @@ -3382,25 +3680,30 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.web_search_call.searching + item_id: ws_abc123 + output_index: 0 + sequence_number: 2 WebSearchCallSearchingEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesWebSearchCallSearching' - type: object properties: {} - description: Web search call is searching example: type: response.web_search_call.searching output_index: 0 sequence_number: 2 item_id: ws-123 + description: Web search call is searching OpenAIResponsesSearchCompleted: type: object properties: @@ -3411,208 +3714,40 @@ components: item_id: type: string output_index: - type: number + type: integer sequence_number: - type: number + type: integer required: - type - item_id - output_index - sequence_number + example: + type: response.web_search_call.completed + item_id: ws_abc123 + output_index: 0 + sequence_number: 5 WebSearchCallCompletedEvent: allOf: - $ref: '#/components/schemas/OpenAIResponsesSearchCompleted' - type: object properties: {} - description: Web search call completed example: type: response.web_search_call.completed output_index: 0 sequence_number: 3 item_id: ws-123 + description: Web search call completed StreamEvents: oneOf: - - allOf: - - $ref: '#/components/schemas/CreatedEvent' - - type: object - properties: - response: - $ref: '#/components/schemas/OpenResponsesResult' - description: Event emitted when a response is created - example: - type: response.created - response: - id: resp-abc123 - object: response - created_at: 1704067200 - model: gpt-4 - status: in_progress - output: [] - tools: [] - tool_choice: auto - parallel_tool_calls: true - error: null - incomplete_details: null - metadata: null - instructions: null - temperature: null - top_p: null - max_output_tokens: null - sequence_number: 0 - - allOf: - - $ref: '#/components/schemas/InProgressEvent' - - type: object - properties: - response: - $ref: '#/components/schemas/OpenResponsesResult' - description: Event emitted when a response is in progress - example: - type: response.in_progress - response: - id: resp-abc123 - object: response - created_at: 1704067200 - model: gpt-4 - status: in_progress - output: [] - tools: [] - tool_choice: auto - parallel_tool_calls: true - error: null - incomplete_details: null - metadata: null - instructions: null - temperature: null - top_p: null - max_output_tokens: null - sequence_number: 1 - - allOf: - - $ref: '#/components/schemas/CompletedEvent' - - type: object - properties: - response: - $ref: '#/components/schemas/OpenResponsesResult' - description: Event emitted when a response has completed successfully - example: - type: response.completed - response: - id: resp-abc123 - object: response - created_at: 1704067200 - model: gpt-4 - status: completed - output: - - id: item-1 - type: message - status: completed - role: assistant - content: - - type: output_text - text: Hello! How can I help you? - annotations: [] - tools: [] - tool_choice: auto - parallel_tool_calls: true - error: null - incomplete_details: null - metadata: null - instructions: null - temperature: null - top_p: null - max_output_tokens: null - sequence_number: 10 - - allOf: - - $ref: '#/components/schemas/IncompleteEvent' - - type: object - properties: - response: - $ref: '#/components/schemas/OpenResponsesResult' - description: Event emitted when a response is incomplete - example: - type: response.incomplete - response: - id: resp-abc123 - object: response - created_at: 1704067200 - model: gpt-4 - status: incomplete - output: [] - tools: [] - tool_choice: auto - parallel_tool_calls: true - error: null - incomplete_details: null - metadata: null - instructions: null - temperature: null - top_p: null - max_output_tokens: null - sequence_number: 5 - - allOf: - - $ref: '#/components/schemas/FailedEvent' - - type: object - properties: - response: - $ref: '#/components/schemas/OpenResponsesResult' - description: Event emitted when a response has failed - example: - type: response.failed - response: - id: resp-abc123 - object: response - created_at: 1704067200 - model: gpt-4 - status: failed - output: [] - tools: [] - tool_choice: auto - parallel_tool_calls: true - error: null - incomplete_details: null - metadata: null - instructions: null - temperature: null - top_p: null - max_output_tokens: null - sequence_number: 3 + - $ref: '#/components/schemas/OpenResponsesCreatedEvent' + - $ref: '#/components/schemas/OpenResponsesInProgressEvent' + - $ref: '#/components/schemas/StreamEventsResponseCompleted' + - $ref: '#/components/schemas/StreamEventsResponseIncomplete' + - $ref: '#/components/schemas/StreamEventsResponseFailed' - $ref: '#/components/schemas/ErrorEvent' - - allOf: - - $ref: '#/components/schemas/OutputItemAddedEvent' - - type: object - properties: - item: - $ref: '#/components/schemas/OutputItems' - description: Event emitted when a new output item is added to the response - example: - type: response.output_item.added - output_index: 0 - item: - id: item-1 - type: message - status: in_progress - role: assistant - content: [] - sequence_number: 2 - - allOf: - - $ref: '#/components/schemas/OutputItemDoneEvent' - - type: object - properties: - item: - $ref: '#/components/schemas/OutputItems' - description: Event emitted when an output item is complete - example: - type: response.output_item.done - output_index: 0 - item: - id: item-1 - type: message - status: completed - role: assistant - content: - - type: output_text - text: Hello! How can I help you? - annotations: [] - sequence_number: 8 + - $ref: '#/components/schemas/StreamEventsResponseOutputItemAdded' + - $ref: '#/components/schemas/StreamEventsResponseOutputItemDone' - $ref: '#/components/schemas/ContentPartAddedEvent' - $ref: '#/components/schemas/ContentPartDoneEvent' - $ref: '#/components/schemas/TextDeltaEvent' @@ -3635,6 +3770,39 @@ components: - $ref: '#/components/schemas/WebSearchCallInProgressEvent' - $ref: '#/components/schemas/WebSearchCallSearchingEvent' - $ref: '#/components/schemas/WebSearchCallCompletedEvent' + discriminator: + propertyName: type + mapping: + response.created: '#/components/schemas/OpenResponsesCreatedEvent' + response.in_progress: '#/components/schemas/OpenResponsesInProgressEvent' + response.completed: '#/components/schemas/StreamEventsResponseCompleted' + response.incomplete: '#/components/schemas/StreamEventsResponseIncomplete' + response.failed: '#/components/schemas/StreamEventsResponseFailed' + error: '#/components/schemas/ErrorEvent' + response.output_item.added: '#/components/schemas/StreamEventsResponseOutputItemAdded' + response.output_item.done: '#/components/schemas/StreamEventsResponseOutputItemDone' + response.content_part.added: '#/components/schemas/ContentPartAddedEvent' + response.content_part.done: '#/components/schemas/ContentPartDoneEvent' + response.output_text.delta: '#/components/schemas/TextDeltaEvent' + response.output_text.done: '#/components/schemas/TextDoneEvent' + response.refusal.delta: '#/components/schemas/RefusalDeltaEvent' + response.refusal.done: '#/components/schemas/RefusalDoneEvent' + response.output_text.annotation.added: '#/components/schemas/AnnotationAddedEvent' + response.function_call_arguments.delta: '#/components/schemas/FunctionCallArgsDeltaEvent' + response.function_call_arguments.done: '#/components/schemas/FunctionCallArgsDoneEvent' + response.reasoning_text.delta: '#/components/schemas/ReasoningDeltaEvent' + response.reasoning_text.done: '#/components/schemas/ReasoningDoneEvent' + response.reasoning_summary_part.added: '#/components/schemas/ReasoningSummaryPartAddedEvent' + response.reasoning_summary_part.done: '#/components/schemas/ReasoningSummaryPartDoneEvent' + response.reasoning_summary_text.delta: '#/components/schemas/ReasoningSummaryTextDeltaEvent' + response.reasoning_summary_text.done: '#/components/schemas/ReasoningSummaryTextDoneEvent' + response.image_generation_call.in_progress: '#/components/schemas/ImageGenCallInProgressEvent' + response.image_generation_call.generating: '#/components/schemas/ImageGenCallGeneratingEvent' + response.image_generation_call.partial_image: '#/components/schemas/ImageGenCallPartialImageEvent' + response.image_generation_call.completed: '#/components/schemas/ImageGenCallCompletedEvent' + response.web_search_call.in_progress: '#/components/schemas/WebSearchCallInProgressEvent' + response.web_search_call.searching: '#/components/schemas/WebSearchCallSearchingEvent' + response.web_search_call.completed: '#/components/schemas/WebSearchCallCompletedEvent' description: Union of all possible event types emitted during response streaming example: type: response.created @@ -3826,40 +3994,6 @@ components: error: code: 408 message: Operation timed out. Please try again later. - GoneResponseErrorData: - type: object - properties: - code: - type: integer - message: - type: string - metadata: - type: object - nullable: true - additionalProperties: - nullable: true - required: - - code - - message - description: Error data for GoneResponse - example: - code: 410 - message: The Coinbase APIs used by this endpoint have been deprecated, so the Coinbase Commerce credits API has been removed. Use the web credits purchase flow instead. - GoneResponse: - type: object - properties: - error: - $ref: '#/components/schemas/GoneResponseErrorData' - user_id: - type: string - nullable: true - required: - - error - description: Gone - Endpoint has been permanently removed or deprecated - example: - error: - code: 410 - message: The Coinbase APIs used by this endpoint have been deprecated, so the Coinbase Commerce credits API has been removed. Use the web credits purchase flow instead. PayloadTooLargeResponseErrorData: type: object properties: @@ -4146,15 +4280,7 @@ components: type: string nullable: true format: - type: string - nullable: true - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 + $ref: '#/components/schemas/ReasoningFormat' example: type: reasoning id: reasoning-abc123 @@ -4236,6 +4362,9 @@ components: example: final_answer required: - role + example: + role: user + content: What is the weather today? InputMessageItem: type: object properties: @@ -4276,30 +4405,20 @@ components: - $ref: '#/components/schemas/InputVideo' required: - role + example: + id: msg-abc123 + type: message + role: user + content: + - type: input_text + text: Hello, how are you? FunctionCallItem: - type: object - properties: - type: - type: string - enum: - - function_call - call_id: - type: string - name: - type: string - arguments: - type: string - id: - type: string - status: - $ref: '#/components/schemas/ToolCallStatusEnum' - required: - - type - - call_id - - name - - arguments - - id - description: A function call initiated by the model + allOf: + - $ref: '#/components/schemas/OpenAIResponseFunctionToolCall' + - type: object + properties: {} + required: + - id example: id: call-abc123 type: function_call @@ -4307,81 +4426,36 @@ components: name: get_weather arguments: '{"location":"San Francisco"}' status: completed + description: A function call initiated by the model FunctionCallOutputItem: - type: object - properties: - type: - type: string - enum: - - function_call_output - id: - type: string - nullable: true - call_id: - type: string - output: - anyOf: - - type: string - - type: array - items: - oneOf: - - $ref: '#/components/schemas/InputText' - - allOf: - - $ref: '#/components/schemas/InputImage' - - type: object - properties: {} - description: Image input content item - example: - type: input_image - detail: auto - image_url: https://example.com/image.jpg - - $ref: '#/components/schemas/InputFile' - status: - $ref: '#/components/schemas/ToolCallStatusEnum' - required: - - type - - call_id - - output - description: The output from a function call execution + allOf: + - $ref: '#/components/schemas/OpenAIResponseFunctionToolCallOutput' + - type: object + properties: + output: + anyOf: + - type: string + - type: array + items: + oneOf: + - $ref: '#/components/schemas/InputText' + - allOf: + - $ref: '#/components/schemas/InputImage' + - type: object + properties: {} + description: Image input content item + example: + type: input_image + detail: auto + image_url: https://example.com/image.jpg + - $ref: '#/components/schemas/InputFile' example: type: function_call_output id: output-abc123 call_id: call-abc123 output: '{"temperature":72,"conditions":"sunny"}' status: completed - OutputDatetimeItem: - type: object - properties: - type: - type: string - enum: - - openrouter:datetime - id: - type: string - status: - type: string - enum: - - completed - - in_progress - - incomplete - datetime: - type: string - description: ISO 8601 datetime string - timezone: - type: string - description: IANA timezone name - required: - - type - - status - - datetime - - timezone - description: An openrouter:datetime server tool output item - example: - type: openrouter:datetime - id: dt_tmp_abc123 - status: completed - datetime: '2026-03-12T14:30:00.000Z' - timezone: UTC + description: The output from a function call execution Inputs: anyOf: - type: string @@ -4443,7 +4517,7 @@ components: - $ref: '#/components/schemas/OutputFileSearchCallItem' - $ref: '#/components/schemas/OutputImageGenerationCallItem' - $ref: '#/components/schemas/OutputDatetimeItem' - - $ref: '#/components/schemas/OutputServerToolItem' + - $ref: '#/components/schemas/OutputWebSearchServerToolItem' description: Input for a response request - can be a string or array of items example: - role: user @@ -4480,14 +4554,11 @@ components: type: object properties: max_results: - type: number - minimum: 1 - maximum: 25 + type: integer description: Maximum number of search results to return per search call. Defaults to 5. example: 5 max_total_results: - type: number - minimum: 1 + type: integer description: >- Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. @@ -4508,7 +4579,6 @@ components: example: format: type: text - verbosity: medium ReasoningConfig: allOf: - $ref: '#/components/schemas/BaseReasoningConfig' @@ -4516,20 +4586,20 @@ components: nullable: true properties: max_tokens: - type: number - nullable: true + type: integer enabled: type: boolean nullable: true - description: Configuration for reasoning mode in the response example: summary: auto enabled: true + description: Configuration for reasoning mode in the response OutputModalityEnum: type: string enum: - text - image + example: text ResponseIncludesEnum: type: string enum: @@ -4538,28 +4608,15 @@ components: - computer_call_output.output.image_url - reasoning.encrypted_content - code_interpreter_call.outputs + example: file_search_call.results OpenAIResponsesTruncation: type: string nullable: true enum: - auto - disabled + - null example: auto - DataCollection: - type: string - nullable: true - enum: - - deny - - allow - description: >- - Data collection setting. If no available model provider meets the requirement, your request will return an - error. - - - allow: (default) allow providers which store user data non-transiently and may train on it - - - - deny: use only providers which do not collect user data. - example: allow ProviderName: type: string enum: @@ -4673,6 +4730,7 @@ components: - throughput - latency - exacto + - null description: The provider sorting strategy (price, throughput, latency) example: price partition: @@ -4681,6 +4739,7 @@ components: enum: - model - none + - null description: >- Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. @@ -4698,19 +4757,19 @@ components: properties: p50: type: number - nullable: true + format: double description: Minimum p50 throughput (tokens/sec) p75: type: number - nullable: true + format: double description: Minimum p75 throughput (tokens/sec) p90: type: number - nullable: true + format: double description: Minimum p90 throughput (tokens/sec) p99: type: number - nullable: true + format: double description: Minimum p99 throughput (tokens/sec) description: Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred. example: @@ -4719,6 +4778,7 @@ components: PreferredMinThroughput: anyOf: - type: number + format: double - $ref: '#/components/schemas/PercentileThroughputCutoffs' - nullable: true description: >- @@ -4732,19 +4792,19 @@ components: properties: p50: type: number - nullable: true + format: double description: Maximum p50 latency (seconds) p75: type: number - nullable: true + format: double description: Maximum p75 latency (seconds) p90: type: number - nullable: true + format: double description: Maximum p90 latency (seconds) p99: type: number - nullable: true + format: double description: Maximum p99 latency (seconds) description: Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred. example: @@ -4753,6 +4813,7 @@ components: PreferredMaxLatency: anyOf: - type: number + format: double - $ref: '#/components/schemas/PercentileLatencyCutoffs' - nullable: true description: >- @@ -4761,6 +4822,183 @@ components: fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. example: 5 + ProviderPreferences: + type: object + nullable: true + properties: + allow_fallbacks: + type: boolean + nullable: true + description: > + Whether to allow backup providers to serve requests + + - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the + next best provider. + + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + require_parameters: + type: boolean + nullable: true + description: >- + Whether to filter providers to only those that support the parameters you've provided. If this setting is + omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. + data_collection: + type: string + nullable: true + enum: + - deny + - allow + - null + example: allow + description: >- + Data collection setting. If no available model provider meets the requirement, your request will return an + error. + + - allow: (default) allow providers which store user data non-transiently and may train on it + + + - deny: use only providers which do not collect user data. + zdr: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do + not retain prompts will be used. + example: true + enforce_distillable_text: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only models that allow text distillation. When true, only models where the + author has allowed distillation will be used. + example: true + order: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this + list that supports your requested model, and fall back to the next if it is unavailable. If no providers are + available, the request will fail with an error message. + example: + - openai + - anthropic + only: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + 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 + ignore: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider + settings for this request. + example: + - openai + - anthropic + quantizations: + type: array + nullable: true + items: + $ref: '#/components/schemas/Quantization' + description: A list of quantization levels to filter the provider by. + sort: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' + - nullable: true + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is + performed. + example: price + max_price: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens + image: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image + audio: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit + request: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, for + prompt and completion. + preferred_min_throughput: + $ref: '#/components/schemas/PreferredMinThroughput' + preferred_max_latency: + $ref: '#/components/schemas/PreferredMaxLatency' + additionalProperties: false + example: + allow_fallbacks: true + description: When multiple model providers are available, optionally indicate your routing preference. + AutoRouterPlugin: + type: object + properties: + id: + type: string + enum: + - auto-router + enabled: + type: boolean + description: Set to false to disable the auto-router plugin for this request. Defaults to true. + allowed_models: + type: array + items: + type: string + description: >- + List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., + "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. + example: + - anthropic/* + - openai/gpt-4o + - google/* + required: + - id + example: + id: auto-router + enabled: true + allowed_models: + - anthropic/* + - openai/gpt-4o + ModerationPlugin: + type: object + properties: + id: + type: string + enum: + - moderation + required: + - id + example: + id: moderation WebSearchEngine: type: string enum: @@ -4769,6 +5007,51 @@ components: - firecrawl - parallel description: The search engine to use for web search. + example: exa + WebSearchPlugin: + type: object + properties: + id: + type: string + enum: + - web + enabled: + type: boolean + description: Set to false to disable the web-search plugin for this request. Defaults to true. + max_results: + type: integer + search_prompt: + type: string + engine: + $ref: '#/components/schemas/WebSearchEngine' + include_domains: + type: array + items: + type: string + description: >- + A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") and path + filtering (e.g. "openai.com/blog"). + example: + - example.com + - '*.substack.com' + - openai.com/blog + exclude_domains: + type: array + items: + type: string + description: >- + A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") and path + filtering (e.g. "openai.com/blog"). + example: + - example.com + - '*.substack.com' + - openai.com/blog + required: + - id + example: + id: web + enabled: true + max_results: 5 PDFParserEngine: anyOf: - type: string @@ -4782,36 +5065,129 @@ components: description: >- The engine to use for parsing PDF files. "pdf-text" is deprecated and automatically redirected to "cloudflare-ai". + example: cloudflare-ai PDFParserOptions: type: object properties: engine: $ref: '#/components/schemas/PDFParserEngine' description: Options for PDF parsing. + example: + engine: cloudflare-ai + FileParserPlugin: + type: object + properties: + id: + type: string + enum: + - file-parser + enabled: + type: boolean + description: Set to false to disable the file-parser plugin for this request. Defaults to true. + pdf: + $ref: '#/components/schemas/PDFParserOptions' + required: + - id + example: + id: file-parser + enabled: true + pdf: + engine: cloudflare-ai + ResponseHealingPlugin: + type: object + properties: + id: + type: string + enum: + - response-healing + enabled: + type: boolean + description: Set to false to disable the response-healing plugin for this request. Defaults to true. + required: + - id + example: + id: response-healing + enabled: true ContextCompressionEngine: type: string enum: - middle-out description: The compression engine to use. Defaults to "middle-out". - ResponsesRequest: + example: middle-out + ContextCompressionPlugin: type: object properties: - input: - $ref: '#/components/schemas/Inputs' - instructions: + id: type: string - nullable: true - metadata: - $ref: '#/components/schemas/RequestMetadata' - tools: - type: array - items: - anyOf: - - allOf: - - $ref: '#/components/schemas/FunctionTool' - - type: object - properties: {} - description: Function tool definition + enum: + - context-compression + enabled: + type: boolean + description: Set to false to disable the context-compression plugin for this request. Defaults to true. + engine: + $ref: '#/components/schemas/ContextCompressionEngine' + required: + - id + example: + id: context-compression + enabled: true + engine: middle-out + DeprecatedRoute: + type: string + nullable: true + enum: + - fallback + - sort + - null + deprecated: true + description: >- + **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. + Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). + example: fallback + x-speakeasy-deprecation-message: Use providers.sort.partition instead. + x-speakeasy-ignore: true + x-fern-ignore: true + TraceConfig: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + example: + trace_id: trace-abc123 + trace_name: my-app-trace + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, + parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured + broadcast destinations. + ResponsesRequest: + type: object + properties: + input: + $ref: '#/components/schemas/Inputs' + instructions: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/RequestMetadata' + tools: + type: array + items: + anyOf: + - allOf: + - $ref: '#/components/schemas/FunctionTool' + - type: object + properties: {} + description: Function tool definition example: type: function name: get_weather @@ -4860,43 +5236,32 @@ components: reasoning: $ref: '#/components/schemas/ReasoningConfig' max_output_tokens: - type: number - nullable: true + type: integer temperature: type: number - nullable: true - minimum: 0 - maximum: 2 + format: double top_p: type: number - nullable: true - minimum: 0 + format: double top_logprobs: type: integer - nullable: true - minimum: 0 - maximum: 20 max_tool_calls: type: integer - nullable: true presence_penalty: type: number - nullable: true - minimum: -2 - maximum: 2 + format: double frequency_penalty: type: number - nullable: true - minimum: -2 - maximum: 2 + format: double top_k: - type: number + type: integer image_config: type: object additionalProperties: anyOf: - type: string - type: number + format: double description: >- Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details. @@ -4942,6 +5307,7 @@ components: - flex - priority - scale + - null default: auto truncation: $ref: '#/components/schemas/OpenAIResponsesTruncation' @@ -4949,243 +5315,29 @@ components: type: boolean default: false provider: - type: object - nullable: true - properties: - allow_fallbacks: - type: boolean - nullable: true - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use - the next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - require_parameters: - type: boolean - nullable: true - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this setting - is omitted or set to false, then providers will receive only the parameters they support, and ignore the - rest. - data_collection: - $ref: '#/components/schemas/DataCollection' - zdr: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that - do not retain prompts will be used. - example: true - enforce_distillable_text: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only models that allow text distillation. When true, only models where - the author has allowed distillation will be used. - example: true - order: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of - this list that supports your requested model, and fall back to the next if it is unavailable. If no - providers are available, the request will fail with an error message. - only: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - ignore: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - quantizations: - type: array - nullable: true - items: - $ref: '#/components/schemas/Quantization' - description: A list of quantization levels to filter the provider by. - sort: - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - - nullable: true - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing - is performed. - example: price - max_price: - type: object - properties: - prompt: - $ref: '#/components/schemas/BigNumberUnion' - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per million completion tokens - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per image - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per audio unit - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per request - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, - for prompt and completion. - preferred_min_throughput: - $ref: '#/components/schemas/PreferredMinThroughput' - preferred_max_latency: - $ref: '#/components/schemas/PreferredMaxLatency' - additionalProperties: false - description: When multiple model providers are available, optionally indicate your routing preference. + $ref: '#/components/schemas/ProviderPreferences' plugins: type: array items: oneOf: - - type: object - properties: - id: - type: string - enum: - - auto-router - enabled: - type: boolean - description: Set to false to disable the auto-router plugin for this request. Defaults to true. - allowed_models: - type: array - items: - type: string - description: >- - List of model patterns to filter which models the auto-router can route between. Supports - wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default - supported models list. - example: - - anthropic/* - - openai/gpt-4o - - google/* - required: - - id - - type: object - properties: - id: - type: string - enum: - - moderation - required: - - id - - type: object - properties: - id: - type: string - enum: - - web - enabled: - type: boolean - description: Set to false to disable the web-search plugin for this request. Defaults to true. - max_results: - type: number - search_prompt: - type: string - engine: - $ref: '#/components/schemas/WebSearchEngine' - include_domains: - type: array - items: - type: string - description: >- - A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - exclude_domains: - type: array - items: - type: string - description: >- - A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - required: - - id - - type: object - properties: - id: - type: string - enum: - - file-parser - enabled: - type: boolean - description: Set to false to disable the file-parser plugin for this request. Defaults to true. - pdf: - $ref: '#/components/schemas/PDFParserOptions' - required: - - id - - type: object - properties: - id: - type: string - enum: - - response-healing - enabled: - type: boolean - description: Set to false to disable the response-healing plugin for this request. Defaults to true. - required: - - id - - type: object - properties: - id: - type: string - enum: - - context-compression - enabled: - type: boolean - description: Set to false to disable the context-compression plugin for this request. Defaults to true. - engine: - $ref: '#/components/schemas/ContextCompressionEngine' - required: - - id + - $ref: '#/components/schemas/AutoRouterPlugin' + - $ref: '#/components/schemas/ModerationPlugin' + - $ref: '#/components/schemas/WebSearchPlugin' + - $ref: '#/components/schemas/FileParserPlugin' + - $ref: '#/components/schemas/ResponseHealingPlugin' + - $ref: '#/components/schemas/ContextCompressionPlugin' + discriminator: + propertyName: id + mapping: + auto-router: '#/components/schemas/AutoRouterPlugin' + moderation: '#/components/schemas/ModerationPlugin' + web: '#/components/schemas/WebSearchPlugin' + file-parser: '#/components/schemas/FileParserPlugin' + response-healing: '#/components/schemas/ResponseHealingPlugin' + context-compression: '#/components/schemas/ContextCompressionPlugin' description: Plugins you want to enable for this request, including their settings. route: - type: string - nullable: true - enum: - - fallback - - sort - deprecated: true - description: >- - **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for - providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). - x-speakeasy-deprecation-message: Use providers.sort.partition instead. - x-speakeasy-ignore: true - x-fern-ignore: true + $ref: '#/components/schemas/DeprecatedRoute' user: type: string maxLength: 256 @@ -5201,24 +5353,7 @@ components: observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. trace: - type: object - properties: - trace_id: - type: string - trace_name: - type: string - span_name: - type: string - generation_name: - type: string - parent_span_id: - type: string - additionalProperties: - nullable: true - description: >- - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, - parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured - broadcast destinations. + $ref: '#/components/schemas/TraceConfig' description: Request schema for Responses endpoint example: model: anthropic/claude-4.5-sonnet-20250929 @@ -5237,9906 +5372,7307 @@ components: properties: location: type: string - BaseMessagesResult: + AnthropicContainer: type: object + nullable: true properties: id: type: string + expires_at: + type: string + required: + - id + - expires_at + example: + id: ctr_01abc + expires_at: '2026-04-08T00:00:00Z' + AnthropicCitationCharLocation: + type: object + properties: type: type: string enum: - - message - role: + - char_location + cited_text: + type: string + document_index: + type: integer + document_title: + type: string + nullable: true + start_char_index: + type: integer + end_char_index: + type: integer + file_id: + type: string + nullable: true + required: + - type + - cited_text + - document_index + - document_title + - start_char_index + - end_char_index + - file_id + example: + type: char_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_char_index: 0 + end_char_index: 18 + file_id: null + AnthropicCitationPageLocation: + type: object + properties: + type: type: string enum: - - assistant - container: - type: object + - page_location + cited_text: + type: string + document_index: + type: integer + document_title: + type: string nullable: true - properties: - id: - type: string - expires_at: - type: string - required: - - id - - expires_at - content: - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - file_id - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - file_id - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - file_id - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - required: - - type - - text - - citations - - type: object - properties: - type: - type: string - enum: - - tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - thinking - thinking: - type: string - signature: - type: string - required: - - type - - thinking - - signature - - type: object - properties: - type: - type: string - enum: - - redacted_thinking - data: - type: string - required: - - type - - data - - type: object - properties: - type: - type: string - enum: - - server_tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - enum: - - web_search - - web_fetch - - code_execution - - bash_code_execution - - text_editor_code_execution - - tool_search_tool_regex - - tool_search_tool_bm25 - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - tool_use_id: - type: string - content: - anyOf: - - type: array - items: - type: object - properties: - type: - type: string - enum: - - web_search_result - encrypted_content: - type: string - page_age: - type: string - nullable: true - title: - type: string - url: - type: string - required: - - type - - encrypted_content - - page_age - - title - - url - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - max_uses_exceeded - - too_many_requests - - query_too_long - - request_too_large - required: - - type - - error_code - required: - - type - - caller - - tool_use_id - - content - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - content: - oneOf: - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - url_too_long - - url_not_allowed - - url_not_accessible - - unsupported_content_type - - too_many_requests - - max_uses_exceeded - - unavailable - required: - - type - - error_code - - type: object - properties: - content: - type: object - properties: - citations: - type: object - nullable: true - properties: - enabled: - type: boolean - required: - - enabled - source: - anyOf: - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - application/pdf - type: - type: string - enum: - - base64 - required: - - data - - media_type - - type - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - text/plain - type: - type: string - enum: - - text - required: - - data - - media_type - - type - title: - type: string - nullable: true - type: - type: string - enum: - - document - required: - - citations - - source - - title - - type - retrieved_at: - type: string - nullable: true - type: - type: string - enum: - - web_fetch_result - url: - type: string - required: - - content - - retrieved_at - - type - - url - tool_use_id: - type: string - required: - - type - - caller - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - type: - type: string - enum: - - code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - encrypted_stdout: - type: string - return_code: - type: number - stderr: - type: string - type: - type: string - enum: - - encrypted_code_execution_result - required: - - content - - encrypted_stdout - - return_code - - stderr - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - bash_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - output_file_too_large - type: - type: string - enum: - - bash_code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - bash_code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - bash_code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - text_editor_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - file_not_found - error_message: - type: string - nullable: true - type: - type: string - enum: - - text_editor_code_execution_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - content: - type: string - file_type: - type: string - enum: - - text - - image - - pdf - num_lines: - type: number - nullable: true - start_line: - type: number - nullable: true - total_lines: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_view_result - required: - - content - - file_type - - num_lines - - start_line - - total_lines - - type - - type: object - properties: - is_file_update: - type: boolean - type: - type: string - enum: - - text_editor_code_execution_create_result - required: - - is_file_update - - type - - type: object - properties: - lines: - type: array - nullable: true - items: - type: string - new_lines: - type: number - nullable: true - new_start: - type: number - nullable: true - old_lines: - type: number - nullable: true - old_start: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_str_replace_result - required: - - lines - - new_lines - - new_start - - old_lines - - old_start - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - tool_search_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - error_message: - type: string - nullable: true - type: - type: string - enum: - - tool_search_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - tool_references: - type: array - items: - type: object - properties: - tool_name: - type: string - type: - type: string - enum: - - tool_reference - required: - - tool_name - - type - type: - type: string - enum: - - tool_search_tool_search_result - required: - - tool_references - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - container_upload - file_id: - type: string - required: - - type - - file_id - model: - type: string - stop_reason: - type: string - nullable: true - enum: - - end_turn - - max_tokens - - stop_sequence - - tool_use - - pause_turn - - refusal - stop_sequence: - type: string - nullable: true - usage: - type: object - properties: - input_tokens: - type: number - output_tokens: - type: number - cache_creation_input_tokens: - type: number - nullable: true - cache_read_input_tokens: - type: number - nullable: true - cache_creation: - type: object - nullable: true - properties: - ephemeral_5m_input_tokens: - type: number - ephemeral_1h_input_tokens: - type: number - required: - - ephemeral_5m_input_tokens - - ephemeral_1h_input_tokens - inference_geo: - type: string - nullable: true - server_tool_use: - type: object - nullable: true - properties: - web_search_requests: - type: number - web_fetch_requests: - type: number - required: - - web_search_requests - - web_fetch_requests - service_tier: - type: string - nullable: true - enum: - - standard - - priority - - batch - speed: - type: string - nullable: true - enum: - - fast - - standard - required: - - input_tokens - - output_tokens - - cache_creation_input_tokens - - cache_read_input_tokens - - cache_creation - - inference_geo - - server_tool_use - - service_tier - required: - - id - - type - - role - - container - - content - - model - - stop_reason - - stop_sequence - - usage - MessagesResult: - allOf: - - $ref: '#/components/schemas/BaseMessagesResult' - - type: object - properties: - usage: - type: object - properties: - input_tokens: - type: number - output_tokens: - type: number - cache_creation_input_tokens: - type: number - nullable: true - cache_read_input_tokens: - type: number - nullable: true - cache_creation: - type: object - nullable: true - properties: - ephemeral_5m_input_tokens: - type: number - ephemeral_1h_input_tokens: - type: number - required: - - ephemeral_5m_input_tokens - - ephemeral_1h_input_tokens - inference_geo: - type: string - nullable: true - server_tool_use: - type: object - nullable: true - properties: - web_search_requests: - type: number - web_fetch_requests: - type: number - required: - - web_search_requests - - web_fetch_requests - service_tier: - type: string - nullable: true - speed: - type: string - nullable: true - enum: - - fast - - standard - cost: - type: number - nullable: true - is_byok: - type: boolean - cost_details: - type: object - nullable: true - properties: - upstream_inference_cost: - type: number - nullable: true - upstream_inference_prompt_cost: - type: number - upstream_inference_completions_cost: - type: number - required: - - upstream_inference_prompt_cost - - upstream_inference_completions_cost - required: - - input_tokens - - output_tokens - - cache_creation_input_tokens - - cache_read_input_tokens - - cache_creation - - inference_geo - - server_tool_use - - service_tier - provider: - type: string - enum: - - AnyScale - - Atoma - - Cent-ML - - CrofAI - - Enfer - - GoPomelo - - HuggingFace - - Hyperbolic 2 - - InoCloud - - Kluster - - Lambda - - Lepton - - Lynn 2 - - Lynn - - Mancer - - Meta - - Modal - - Nineteen - - OctoAI - - Recursal - - Reflection - - Replicate - - SambaNova 2 - - SF Compute - - Targon - - Together 2 - - Ubicloud - - 01.AI - - AkashML - - AI21 - - AionLabs - - Alibaba - - Ambient - - Amazon Bedrock - - Amazon Nova - - Anthropic - - Arcee AI - - AtlasCloud - - Avian - - Azure - - BaseTen - - BytePlus - - Black Forest Labs - - Cerebras - - Chutes - - Cirrascale - - Clarifai - - Cloudflare - - Cohere - - Crusoe - - DeepInfra - - DeepSeek - - Featherless - - Fireworks - - Friendli - - GMICloud - - Google - - Google AI Studio - - Groq - - Hyperbolic - - Inception - - Inceptron - - InferenceNet - - Ionstream - - Infermatic - - Io Net - - Inflection - - Liquid - - Mara - - Mancer 2 - - Minimax - - ModelRun - - Mistral - - Modular - - Moonshot AI - - Morph - - NCompass - - Nebius - - NextBit - - Novita - - Nvidia - - OpenAI - - OpenInference - - Parasail - - Perplexity - - Phala - - Reka - - Relace - - SambaNova - - Seed - - SiliconFlow - - Sourceful - - StepFun - - Stealth - - StreamLake - - Switchpoint - - Together - - Upstage - - Venice - - WandB - - Xiaomi - - xAI - - Z.AI - - FakeProvider - description: Non-streaming response from the Anthropic Messages API with OpenRouter extensions - example: - id: msg_01XFDUDYJgAACzvnptvVoYEL - type: message - role: assistant - container: null - content: - - type: text - text: Hello! I'm doing well, thank you for asking. - citations: null - model: claude-sonnet-4-5-20250929 - stop_reason: end_turn - stop_sequence: null - usage: - input_tokens: 12 - output_tokens: 15 - cache_creation_input_tokens: null - cache_read_input_tokens: null - cache_creation: null - inference_geo: null - server_tool_use: null - service_tier: standard - MessagesStartEvent: - type: object - properties: - type: - type: string - enum: - - message_start - message: - type: object - properties: - id: - type: string - type: - type: string - enum: - - message - role: - type: string - enum: - - assistant - container: - type: object - nullable: true - properties: - id: - type: string - expires_at: - type: string - required: - - id - - expires_at - content: - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - file_id - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - file_id - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - file_id - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - required: - - type - - text - - citations - - type: object - properties: - type: - type: string - enum: - - tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - thinking - thinking: - type: string - signature: - type: string - required: - - type - - thinking - - signature - - type: object - properties: - type: - type: string - enum: - - redacted_thinking - data: - type: string - required: - - type - - data - - type: object - properties: - type: - type: string - enum: - - server_tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - enum: - - web_search - - web_fetch - - code_execution - - bash_code_execution - - text_editor_code_execution - - tool_search_tool_regex - - tool_search_tool_bm25 - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - tool_use_id: - type: string - content: - anyOf: - - type: array - items: - type: object - properties: - type: - type: string - enum: - - web_search_result - encrypted_content: - type: string - page_age: - type: string - nullable: true - title: - type: string - url: - type: string - required: - - type - - encrypted_content - - page_age - - title - - url - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - max_uses_exceeded - - too_many_requests - - query_too_long - - request_too_large - required: - - type - - error_code - required: - - type - - caller - - tool_use_id - - content - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - content: - oneOf: - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - url_too_long - - url_not_allowed - - url_not_accessible - - unsupported_content_type - - too_many_requests - - max_uses_exceeded - - unavailable - required: - - type - - error_code - - type: object - properties: - content: - type: object - properties: - citations: - type: object - nullable: true - properties: - enabled: - type: boolean - required: - - enabled - source: - anyOf: - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - application/pdf - type: - type: string - enum: - - base64 - required: - - data - - media_type - - type - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - text/plain - type: - type: string - enum: - - text - required: - - data - - media_type - - type - title: - type: string - nullable: true - type: - type: string - enum: - - document - required: - - citations - - source - - title - - type - retrieved_at: - type: string - nullable: true - type: - type: string - enum: - - web_fetch_result - url: - type: string - required: - - content - - retrieved_at - - type - - url - tool_use_id: - type: string - required: - - type - - caller - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - type: - type: string - enum: - - code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - encrypted_stdout: - type: string - return_code: - type: number - stderr: - type: string - type: - type: string - enum: - - encrypted_code_execution_result - required: - - content - - encrypted_stdout - - return_code - - stderr - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - bash_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - output_file_too_large - type: - type: string - enum: - - bash_code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - bash_code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - bash_code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - text_editor_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - file_not_found - error_message: - type: string - nullable: true - type: - type: string - enum: - - text_editor_code_execution_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - content: - type: string - file_type: - type: string - enum: - - text - - image - - pdf - num_lines: - type: number - nullable: true - start_line: - type: number - nullable: true - total_lines: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_view_result - required: - - content - - file_type - - num_lines - - start_line - - total_lines - - type - - type: object - properties: - is_file_update: - type: boolean - type: - type: string - enum: - - text_editor_code_execution_create_result - required: - - is_file_update - - type - - type: object - properties: - lines: - type: array - nullable: true - items: - type: string - new_lines: - type: number - nullable: true - new_start: - type: number - nullable: true - old_lines: - type: number - nullable: true - old_start: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_str_replace_result - required: - - lines - - new_lines - - new_start - - old_lines - - old_start - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - tool_search_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - error_message: - type: string - nullable: true - type: - type: string - enum: - - tool_search_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - tool_references: - type: array - items: - type: object - properties: - tool_name: - type: string - type: - type: string - enum: - - tool_reference - required: - - tool_name - - type - type: - type: string - enum: - - tool_search_tool_search_result - required: - - tool_references - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - container_upload - file_id: - type: string - required: - - type - - file_id - model: - type: string - stop_reason: - nullable: true - stop_sequence: - nullable: true - usage: - type: object - properties: - input_tokens: - type: number - output_tokens: - type: number - cache_creation_input_tokens: - type: number - nullable: true - cache_read_input_tokens: - type: number - nullable: true - cache_creation: - type: object - nullable: true - properties: - ephemeral_5m_input_tokens: - type: number - ephemeral_1h_input_tokens: - type: number - required: - - ephemeral_5m_input_tokens - - ephemeral_1h_input_tokens - inference_geo: - type: string - nullable: true - server_tool_use: - type: object - nullable: true - properties: - web_search_requests: - type: number - web_fetch_requests: - type: number - required: - - web_search_requests - - web_fetch_requests - service_tier: - type: string - nullable: true - enum: - - standard - - priority - - batch - speed: - type: string - nullable: true - enum: - - fast - - standard - required: - - input_tokens - - output_tokens - - cache_creation_input_tokens - - cache_read_input_tokens - - cache_creation - - inference_geo - - server_tool_use - - service_tier - provider: - type: string - enum: - - AnyScale - - Atoma - - Cent-ML - - CrofAI - - Enfer - - GoPomelo - - HuggingFace - - Hyperbolic 2 - - InoCloud - - Kluster - - Lambda - - Lepton - - Lynn 2 - - Lynn - - Mancer - - Meta - - Modal - - Nineteen - - OctoAI - - Recursal - - Reflection - - Replicate - - SambaNova 2 - - SF Compute - - Targon - - Together 2 - - Ubicloud - - 01.AI - - AkashML - - AI21 - - AionLabs - - Alibaba - - Ambient - - Amazon Bedrock - - Amazon Nova - - Anthropic - - Arcee AI - - AtlasCloud - - Avian - - Azure - - BaseTen - - BytePlus - - Black Forest Labs - - Cerebras - - Chutes - - Cirrascale - - Clarifai - - Cloudflare - - Cohere - - Crusoe - - DeepInfra - - DeepSeek - - Featherless - - Fireworks - - Friendli - - GMICloud - - Google - - Google AI Studio - - Groq - - Hyperbolic - - Inception - - Inceptron - - InferenceNet - - Ionstream - - Infermatic - - Io Net - - Inflection - - Liquid - - Mara - - Mancer 2 - - Minimax - - ModelRun - - Mistral - - Modular - - Moonshot AI - - Morph - - NCompass - - Nebius - - NextBit - - Novita - - Nvidia - - OpenAI - - OpenInference - - Parasail - - Perplexity - - Phala - - Reka - - Relace - - SambaNova - - Seed - - SiliconFlow - - Sourceful - - StepFun - - Stealth - - StreamLake - - Switchpoint - - Together - - Upstage - - Venice - - WandB - - Xiaomi - - xAI - - Z.AI - - FakeProvider - required: - - id - - type - - role - - container - - content - - model - - stop_reason - - stop_sequence - - usage - required: - - type - - message - description: Event sent at the start of a streaming message - MessagesStreamEvents: - oneOf: - - $ref: '#/components/schemas/MessagesStartEvent' - - type: object - properties: - type: - type: string - enum: - - message_delta - delta: - type: object - properties: - container: - type: object - nullable: true - properties: - id: - type: string - expires_at: - type: string - required: - - id - - expires_at - stop_reason: - type: string - nullable: true - enum: - - end_turn - - max_tokens - - stop_sequence - - tool_use - - pause_turn - - refusal - stop_sequence: - type: string - nullable: true - required: - - container - - stop_reason - - stop_sequence - usage: - type: object - properties: - input_tokens: - type: number - nullable: true - output_tokens: - type: number - cache_creation_input_tokens: - type: number - nullable: true - cache_read_input_tokens: - type: number - nullable: true - server_tool_use: - type: object - nullable: true - properties: - web_search_requests: - type: number - web_fetch_requests: - type: number - required: - - web_search_requests - - web_fetch_requests - required: - - input_tokens - - output_tokens - - cache_creation_input_tokens - - cache_read_input_tokens - - server_tool_use - required: - - type - - delta - - usage - - type: object - properties: - type: - type: string - enum: - - message_stop - required: - - type - - type: object - properties: - type: - type: string - enum: - - content_block_start - index: - type: number - content_block: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - file_id - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - file_id - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - file_id - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - required: - - type - - text - - citations - - type: object - properties: - type: - type: string - enum: - - tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - thinking - thinking: - type: string - signature: - type: string - required: - - type - - thinking - - signature - - type: object - properties: - type: - type: string - enum: - - redacted_thinking - data: - type: string - required: - - type - - data - - type: object - properties: - type: - type: string - enum: - - server_tool_use - id: - type: string - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - name: - type: string - enum: - - web_search - - web_fetch - - code_execution - - bash_code_execution - - text_editor_code_execution - - tool_search_tool_regex - - tool_search_tool_bm25 - input: - nullable: true - required: - - type - - id - - caller - - name - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - tool_use_id: - type: string - content: - anyOf: - - type: array - items: - type: object - properties: - type: - type: string - enum: - - web_search_result - encrypted_content: - type: string - page_age: - type: string - nullable: true - title: - type: string - url: - type: string - required: - - type - - encrypted_content - - page_age - - title - - url - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - max_uses_exceeded - - too_many_requests - - query_too_long - - request_too_large - required: - - type - - error_code - required: - - type - - caller - - tool_use_id - - content - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result - caller: - oneOf: - - type: object - properties: - type: - type: string - enum: - - direct - required: - - type - - type: object - properties: - type: - type: string - enum: - - code_execution_20250825 - tool_id: - type: string - required: - - type - - tool_id - - type: object - properties: - type: - type: string - enum: - - code_execution_20260120 - tool_id: - type: string - required: - - type - - tool_id - content: - oneOf: - - type: object - properties: - type: - type: string - enum: - - web_fetch_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - url_too_long - - url_not_allowed - - url_not_accessible - - unsupported_content_type - - too_many_requests - - max_uses_exceeded - - unavailable - required: - - type - - error_code - - type: object - properties: - content: - type: object - properties: - citations: - type: object - nullable: true - properties: - enabled: - type: boolean - required: - - enabled - source: - anyOf: - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - application/pdf - type: - type: string - enum: - - base64 - required: - - data - - media_type - - type - - type: object - properties: - data: - type: string - media_type: - type: string - enum: - - text/plain - type: - type: string - enum: - - text - required: - - data - - media_type - - type - title: - type: string - nullable: true - type: - type: string - enum: - - document - required: - - citations - - source - - title - - type - retrieved_at: - type: string - nullable: true - type: - type: string - enum: - - web_fetch_result - url: - type: string - required: - - content - - retrieved_at - - type - - url - tool_use_id: - type: string - required: - - type - - caller - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - type: - type: string - enum: - - code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - code_execution_output - required: - - file_id - - type - encrypted_stdout: - type: string - return_code: - type: number - stderr: - type: string - type: - type: string - enum: - - encrypted_code_execution_result - required: - - content - - encrypted_stdout - - return_code - - stderr - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - bash_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - output_file_too_large - type: - type: string - enum: - - bash_code_execution_tool_result_error - required: - - error_code - - type - - type: object - properties: - content: - type: array - items: - type: object - properties: - file_id: - type: string - type: - type: string - enum: - - bash_code_execution_output - required: - - file_id - - type - return_code: - type: number - stderr: - type: string - stdout: - type: string - type: - type: string - enum: - - bash_code_execution_result - required: - - content - - return_code - - stderr - - stdout - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - text_editor_code_execution_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - - file_not_found - error_message: - type: string - nullable: true - type: - type: string - enum: - - text_editor_code_execution_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - content: - type: string - file_type: - type: string - enum: - - text - - image - - pdf - num_lines: - type: number - nullable: true - start_line: - type: number - nullable: true - total_lines: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_view_result - required: - - content - - file_type - - num_lines - - start_line - - total_lines - - type - - type: object - properties: - is_file_update: - type: boolean - type: - type: string - enum: - - text_editor_code_execution_create_result - required: - - is_file_update - - type - - type: object - properties: - lines: - type: array - nullable: true - items: - type: string - new_lines: - type: number - nullable: true - new_start: - type: number - nullable: true - old_lines: - type: number - nullable: true - old_start: - type: number - nullable: true - type: - type: string - enum: - - text_editor_code_execution_str_replace_result - required: - - lines - - new_lines - - new_start - - old_lines - - old_start - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - tool_search_tool_result - content: - oneOf: - - type: object - properties: - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - too_many_requests - - execution_time_exceeded - error_message: - type: string - nullable: true - type: - type: string - enum: - - tool_search_tool_result_error - required: - - error_code - - error_message - - type - - type: object - properties: - tool_references: - type: array - items: - type: object - properties: - tool_name: - type: string - type: - type: string - enum: - - tool_reference - required: - - tool_name - - type - type: - type: string - enum: - - tool_search_tool_search_result - required: - - tool_references - - type - tool_use_id: - type: string - required: - - type - - content - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - container_upload - file_id: - type: string - required: - - type - - file_id - required: - - type - - index - - content_block - - type: object - properties: - type: - type: string - enum: - - content_block_delta - index: - type: number - delta: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text_delta - text: - type: string - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - input_json_delta - partial_json: - type: string - required: - - type - - partial_json - - type: object - properties: - type: - type: string - enum: - - thinking_delta - thinking: - type: string - required: - - type - - thinking - - type: object - properties: - type: - type: string - enum: - - signature_delta - signature: - type: string - required: - - type - - signature - - type: object - properties: - type: - type: string - enum: - - citations_delta - citation: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - file_id - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - file_id - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - file_id: - type: string - nullable: true - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - file_id - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - required: - - type - - citation - required: - - type - - index - - delta - - type: object - properties: - type: - type: string - enum: - - content_block_stop - index: - type: number - required: - - type - - index - - type: object - properties: - type: - type: string - enum: - - ping - required: - - type - - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - description: Union of all possible streaming events - MessagesMessageParam: - type: object - properties: - role: - type: string - enum: - - user - - assistant - content: - anyOf: - - type: string - - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - image - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - image/jpeg - - image/png - - image/gif - - image/webp - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - - type: object - properties: - type: - type: string - enum: - - document - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - application/pdf - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - text - media_type: - type: string - enum: - - text/plain - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - content - content: - anyOf: - - type: string - - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - image - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - image/jpeg - - image/png - - image/gif - - image/webp - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - required: - - type - - content - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - citations: - type: object - nullable: true - properties: - enabled: - type: boolean - context: - type: string - nullable: true - title: - type: string - nullable: true - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - - type: object - properties: - type: - type: string - enum: - - tool_use - id: - type: string - name: - type: string - input: - nullable: true - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - id - - name - - type: object - properties: - type: - type: string - enum: - - tool_result - tool_use_id: - type: string - content: - anyOf: - - type: string - - type: array - items: - anyOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - image - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - image/jpeg - - image/png - - image/gif - - image/webp - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - - type: object - properties: - type: - type: string - enum: - - tool_reference - tool_name: - type: string - required: - - type - - tool_name - - type: object - properties: - type: - type: string - enum: - - search_result - source: - type: string - title: - type: string - content: - type: array - items: - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - citations: - type: object - properties: - enabled: - type: boolean - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - - title - - content - - type: object - properties: - type: - type: string - enum: - - document - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - application/pdf - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - text - media_type: - type: string - enum: - - text/plain - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - content - content: - anyOf: - - type: string - - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - image - source: - oneOf: - - type: object - properties: - type: - type: string - enum: - - base64 - media_type: - type: string - enum: - - image/jpeg - - image/png - - image/gif - - image/webp - data: - type: string - required: - - type - - media_type - - data - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - required: - - type - - content - - type: object - properties: - type: - type: string - enum: - - url - url: - type: string - required: - - type - - url - citations: - type: object - nullable: true - properties: - enabled: - type: boolean - context: - type: string - nullable: true - title: - type: string - nullable: true - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - is_error: - type: boolean - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - tool_use_id - - type: object - properties: - type: - type: string - enum: - - thinking - thinking: - type: string - signature: - type: string - required: - - type - - thinking - - signature - - type: object - properties: - type: - type: string - enum: - - redacted_thinking - data: - type: string - required: - - type - - data - - type: object - properties: - type: - type: string - enum: - - server_tool_use - id: - type: string - name: - type: string - enum: - - web_search - - web_fetch - - code_execution - - bash_code_execution - - text_editor_code_execution - - tool_search_tool_regex - - tool_search_tool_bm25 - input: - nullable: true - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - id - - name - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result - tool_use_id: - type: string - content: - anyOf: - - type: array - items: - type: object - properties: - type: - type: string - enum: - - web_search_result - encrypted_content: - type: string - title: - type: string - url: - type: string - page_age: - type: string - nullable: true - required: - - type - - encrypted_content - - title - - url - - type: object - properties: - type: - type: string - enum: - - web_search_tool_result_error - error_code: - type: string - enum: - - invalid_tool_input - - unavailable - - max_uses_exceeded - - too_many_requests - - query_too_long - required: - - type - - error_code - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - tool_use_id - - content - - type: object - properties: - type: - type: string - enum: - - search_result - source: - type: string - title: - type: string - content: - type: array - items: - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - citations: - type: object - properties: - enabled: - type: boolean - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - source - - title - - content - required: - - role - - content - description: Anthropic message with OpenRouter extensions - MessagesWebSearchServerTool: - type: object - properties: - type: - type: string - enum: - - openrouter:web_search - parameters: - type: object - properties: - engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses - Firecrawl (requires BYOK). "parallel" uses the Parallel search API. - example: auto - max_results: - type: number - minimum: 1 - maximum: 25 - description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, - and Parallel engines; ignored with native provider search. - example: 5 - max_total_results: - type: number - minimum: 1 - description: >- - Maximum total number of search results across all search calls in a single request. Once this limit is - reached, the tool will stop returning new results. Useful for controlling cost and context size in - agentic loops. - example: 20 - search_context_size: - type: string - enum: - - low - - medium - - high - description: >- - How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the - Exa engine; ignored with native provider search. - user_location: - type: object - properties: - type: - type: string - enum: - - approximate - city: - type: string - region: - type: string - country: - type: string - timezone: - type: string - description: Approximate user location for location-biased results. - allowed_domains: - type: array - items: - type: string - description: >- - Limit search results to these domains. Applies to Exa and Parallel engines. Not supported with Firecrawl - or native provider search. - excluded_domains: - type: array - items: - type: string - description: >- - Exclude search results from these domains. Applies to Exa and Parallel engines. Not supported with - Firecrawl or native provider search. - required: - - type - description: 'OpenRouter built-in server tool: searches the web for current information' - example: - type: openrouter:web_search - parameters: - max_results: 5 - MessagesOutputConfig: - type: object - properties: - effort: - type: string - nullable: true - enum: - - low - - medium - - high - - max - description: >- - How much effort the model should put into its response. Higher effort levels may result in more thorough - analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`. - example: medium - format: - type: object - nullable: true - properties: - type: - type: string - enum: - - json_schema - schema: - type: object - additionalProperties: - nullable: true - required: - - type - - schema - description: >- - A schema to specify Claude's output format in responses. See [structured - outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs). - description: Configuration for controlling output behavior. Supports the effort parameter and structured output format. - MessagesRequest: - type: object - properties: - model: - type: string - max_tokens: - type: number - messages: - type: array - nullable: true - items: - $ref: '#/components/schemas/MessagesMessageParam' - system: - anyOf: - - type: string - - type: array - items: - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - citations: - type: array - nullable: true - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - char_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_char_index: - type: number - end_char_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_char_index - - end_char_index - - type: object - properties: - type: - type: string - enum: - - page_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_page_number: - type: number - end_page_number: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_page_number - - end_page_number - - type: object - properties: - type: - type: string - enum: - - content_block_location - cited_text: - type: string - document_index: - type: number - document_title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - document_index - - document_title - - start_block_index - - end_block_index - - type: object - properties: - type: - type: string - enum: - - web_search_result_location - cited_text: - type: string - encrypted_index: - type: string - title: - type: string - nullable: true - url: - type: string - required: - - type - - cited_text - - encrypted_index - - title - - url - - type: object - properties: - type: - type: string - enum: - - search_result_location - cited_text: - type: string - search_result_index: - type: number - source: - type: string - title: - type: string - nullable: true - start_block_index: - type: number - end_block_index: - type: number - required: - - type - - cited_text - - search_result_index - - source - - title - - start_block_index - - end_block_index - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - text - metadata: - type: object - properties: - user_id: - type: string - nullable: true - stop_sequences: - type: array - items: - type: string - temperature: - type: number - top_p: - type: number - top_k: - type: number - tools: - type: array - items: - anyOf: - - type: object - properties: - name: - type: string - description: - type: string - input_schema: - type: object - properties: - type: - type: string - default: object - properties: - nullable: true - required: - type: array - nullable: true - items: - type: string - additionalProperties: - nullable: true - type: - type: string - enum: - - custom - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - name - - input_schema - - type: object - properties: - type: - type: string - enum: - - bash_20250124 - name: - type: string - enum: - - bash - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - name - - type: object - properties: - type: - type: string - enum: - - text_editor_20250124 - name: - type: string - enum: - - str_replace_editor - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - name - - type: object - properties: - type: - type: string - enum: - - web_search_20250305 - name: - type: string - enum: - - web_search - allowed_domains: - type: array - nullable: true - items: - type: string - blocked_domains: - type: array - nullable: true - items: - type: string - max_uses: - type: number - nullable: true - user_location: - type: object - nullable: true - properties: - type: - type: string - enum: - - approximate - city: - type: string - nullable: true - country: - type: string - nullable: true - region: - type: string - nullable: true - timezone: - type: string - nullable: true - required: - - type - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - name - - type: object - properties: - type: - type: string - enum: - - web_search_20260209 - name: - type: string - enum: - - web_search - allowed_callers: - type: array - items: - type: string - enum: - - direct - - code_execution_20250825 - - code_execution_20260120 - allowed_domains: - type: array - nullable: true - items: - type: string - blocked_domains: - type: array - nullable: true - items: - type: string - max_uses: - type: number - nullable: true - user_location: - type: object - nullable: true - properties: - type: - type: string - enum: - - approximate - city: - type: string - nullable: true - country: - type: string - nullable: true - region: - type: string - nullable: true - timezone: - type: string - nullable: true - required: - - type - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - required: - - type - - name - - $ref: '#/components/schemas/DatetimeServerTool' - - $ref: '#/components/schemas/MessagesWebSearchServerTool' - tool_choice: - oneOf: - - type: object - properties: - type: - type: string - enum: - - auto - disable_parallel_tool_use: - type: boolean - required: - - type - - type: object - properties: - type: - type: string - enum: - - any - disable_parallel_tool_use: - type: boolean - required: - - type - - type: object - properties: - type: - type: string - enum: - - none - required: - - type - - type: object - properties: - type: - type: string - enum: - - tool - name: - type: string - disable_parallel_tool_use: - type: boolean - required: - - type - - name - thinking: - oneOf: - - type: object - properties: - type: - type: string - enum: - - enabled - budget_tokens: - type: number - required: - - type - - budget_tokens - - type: object - properties: - type: - type: string - enum: - - disabled - required: - - type - - type: object - properties: - type: - type: string - enum: - - adaptive - required: - - type - service_tier: + start_page_number: + type: integer + end_page_number: + type: integer + file_id: + type: string + nullable: true + required: + - type + - cited_text + - document_index + - document_title + - start_page_number + - end_page_number + - file_id + example: + type: page_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_page_number: 1 + end_page_number: 2 + file_id: null + AnthropicCitationContentBlockLocation: + type: object + properties: + type: + type: string + enum: + - content_block_location + cited_text: + type: string + document_index: + type: integer + document_title: + type: string + nullable: true + start_block_index: + type: integer + end_block_index: + type: integer + file_id: + type: string + nullable: true + required: + - type + - cited_text + - document_index + - document_title + - start_block_index + - end_block_index + - file_id + example: + type: content_block_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_block_index: 0 + end_block_index: 1 + file_id: null + AnthropicCitationWebSearchResultLocation: + type: object + properties: + type: type: string enum: - - auto - - standard_only - output_config: - $ref: '#/components/schemas/MessagesOutputConfig' - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - stream: - type: boolean - context_management: - type: object + - web_search_result_location + cited_text: + type: string + encrypted_index: + type: string + title: + type: string nullable: true - properties: - edits: - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - clear_tool_uses_20250919 - clear_at_least: - type: object - nullable: true - properties: - type: - type: string - enum: - - input_tokens - value: - type: number - required: - - type - - value - clear_tool_inputs: - anyOf: - - type: boolean - - type: array - items: - type: string - - nullable: true - exclude_tools: - type: array - nullable: true - items: - type: string - keep: - type: object - properties: - type: - type: string - enum: - - tool_uses - value: - type: number - required: - - type - - value - trigger: - oneOf: - - type: object - properties: - type: - type: string - enum: - - input_tokens - value: - type: number - required: - - type - - value - - type: object - properties: - type: - type: string - enum: - - tool_uses - value: - type: number - required: - - type - - value - required: - - type - - type: object - properties: - type: - type: string - enum: - - clear_thinking_20251015 - keep: - anyOf: - - type: object - properties: - type: - type: string - enum: - - thinking_turns - value: - type: number - required: - - type - - value - - type: object - properties: - type: - type: string - enum: - - all - required: - - type - - type: string - enum: - - all - required: - - type - - type: object - properties: - type: - type: string - enum: - - compact_20260112 - instructions: - type: string - nullable: true - pause_after_compaction: - type: boolean - trigger: - type: object - nullable: true - properties: - type: - type: string - enum: - - input_tokens - value: - type: number - required: - - type - - value - required: - - type - provider: - type: object + url: + type: string + required: + - type + - cited_text + - encrypted_index + - title + - url + example: + type: web_search_result_location + cited_text: Example cited text + encrypted_index: enc_idx_0 + title: Example Page + url: https://example.com + AnthropicCitationSearchResultLocation: + type: object + properties: + type: + type: string + enum: + - search_result_location + cited_text: + type: string + search_result_index: + type: integer + source: + type: string + title: + type: string + nullable: true + start_block_index: + type: integer + end_block_index: + type: integer + required: + - type + - cited_text + - search_result_index + - source + - title + - start_block_index + - end_block_index + example: + type: search_result_location + cited_text: Example cited text + search_result_index: 0 + source: example_source + title: Example Result + start_block_index: 0 + end_block_index: 1 + AnthropicTextCitation: + oneOf: + - $ref: '#/components/schemas/AnthropicCitationCharLocation' + - $ref: '#/components/schemas/AnthropicCitationPageLocation' + - $ref: '#/components/schemas/AnthropicCitationContentBlockLocation' + - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + - $ref: '#/components/schemas/AnthropicCitationSearchResultLocation' + discriminator: + propertyName: type + mapping: + char_location: '#/components/schemas/AnthropicCitationCharLocation' + page_location: '#/components/schemas/AnthropicCitationPageLocation' + content_block_location: '#/components/schemas/AnthropicCitationContentBlockLocation' + web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocation' + example: + type: char_location + cited_text: Example text + document_index: 0 + document_title: null + start_char_index: 0 + end_char_index: 10 + file_id: null + AnthropicTextBlock: + type: object + properties: + type: + type: string + enum: + - text + text: + type: string + citations: + type: array + nullable: true + items: + $ref: '#/components/schemas/AnthropicTextCitation' + required: + - type + - text + - citations + example: + type: text + text: Hello, world! + citations: null + AnthropicDirectCaller: + type: object + properties: + type: + type: string + enum: + - direct + required: + - type + example: + type: direct + AnthropicCodeExecution20250825Caller: + type: object + properties: + type: + type: string + enum: + - code_execution_20250825 + tool_id: + type: string + required: + - type + - tool_id + example: + type: code_execution_20250825 + tool_id: toolu_01abc + AnthropicCodeExecution20260120Caller: + type: object + properties: + type: + type: string + enum: + - code_execution_20260120 + tool_id: + type: string + required: + - type + - tool_id + example: + type: code_execution_20260120 + tool_id: toolu_01abc + AnthropicCaller: + oneOf: + - $ref: '#/components/schemas/AnthropicDirectCaller' + - $ref: '#/components/schemas/AnthropicCodeExecution20250825Caller' + - $ref: '#/components/schemas/AnthropicCodeExecution20260120Caller' + discriminator: + propertyName: type + mapping: + direct: '#/components/schemas/AnthropicDirectCaller' + code_execution_20250825: '#/components/schemas/AnthropicCodeExecution20250825Caller' + code_execution_20260120: '#/components/schemas/AnthropicCodeExecution20260120Caller' + example: + type: direct + AnthropicToolUseBlock: + type: object + properties: + type: + type: string + enum: + - tool_use + id: + type: string + caller: + $ref: '#/components/schemas/AnthropicCaller' + name: + type: string + input: + nullable: true + required: + - type + - id + - caller + - name + example: + type: tool_use + id: toolu_01abc + caller: + type: direct + name: get_weather + input: + location: San Francisco + AnthropicThinkingBlock: + type: object + properties: + type: + type: string + enum: + - thinking + thinking: + type: string + signature: + type: string + required: + - type + - thinking + - signature + example: + type: thinking + thinking: Let me think about this... + signature: sig_abc123 + AnthropicRedactedThinkingBlock: + type: object + properties: + type: + type: string + enum: + - redacted_thinking + data: + type: string + required: + - type + - data + example: + type: redacted_thinking + data: cmVkYWN0ZWQ= + AnthropicServerToolName: + type: string + enum: + - web_search + - web_fetch + - code_execution + - bash_code_execution + - text_editor_code_execution + - tool_search_tool_regex + - tool_search_tool_bm25 + example: web_search + AnthropicServerToolUseBlock: + type: object + properties: + type: + type: string + enum: + - server_tool_use + id: + type: string + caller: + $ref: '#/components/schemas/AnthropicCaller' + name: + $ref: '#/components/schemas/AnthropicServerToolName' + input: nullable: true - properties: - allow_fallbacks: - type: boolean - nullable: true - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use - the next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - require_parameters: - type: boolean - nullable: true - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this setting - is omitted or set to false, then providers will receive only the parameters they support, and ignore the - rest. - data_collection: - $ref: '#/components/schemas/DataCollection' - zdr: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that - do not retain prompts will be used. - example: true - enforce_distillable_text: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only models that allow text distillation. When true, only models where - the author has allowed distillation will be used. - example: true - order: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of - this list that supports your requested model, and fall back to the next if it is unavailable. If no - providers are available, the request will fail with an error message. - only: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - ignore: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - quantizations: - type: array - nullable: true + required: + - type + - id + - caller + - name + example: + type: server_tool_use + id: srvtoolu_01abc + caller: + type: direct + name: web_search + input: + query: latest news + AnthropicWebSearchResult: + type: object + properties: + type: + type: string + enum: + - web_search_result + encrypted_content: + type: string + page_age: + type: string + nullable: true + title: + type: string + url: + type: string + required: + - type + - encrypted_content + - page_age + - title + - url + example: + type: web_search_result + encrypted_content: enc_content_0 + page_age: null + title: Example Page + url: https://example.com + AnthropicWebSearchToolResultError: + type: object + properties: + type: + type: string + enum: + - web_search_tool_result_error + error_code: + type: string + enum: + - invalid_tool_input + - unavailable + - max_uses_exceeded + - too_many_requests + - query_too_long + - request_too_large + required: + - type + - error_code + example: + type: web_search_tool_result_error + error_code: unavailable + AnthropicWebSearchToolResult: + type: object + properties: + type: + type: string + enum: + - web_search_tool_result + caller: + $ref: '#/components/schemas/AnthropicCaller' + tool_use_id: + type: string + content: + anyOf: + - type: array items: - $ref: '#/components/schemas/Quantization' - description: A list of quantization levels to filter the provider by. - sort: - allOf: - - $ref: '#/components/schemas/ProviderSort' - - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - - nullable: true - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load - balancing is performed. - max_price: - type: object - properties: - prompt: - $ref: '#/components/schemas/BigNumberUnion' - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per million completion tokens - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per image - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per audio unit - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per request - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, - for prompt and completion. - preferred_min_throughput: - $ref: '#/components/schemas/PreferredMinThroughput' - preferred_max_latency: - $ref: '#/components/schemas/PreferredMaxLatency' - additionalProperties: false - description: When multiple model providers are available, optionally indicate your routing preference. - plugins: - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - enum: - - auto-router - enabled: - type: boolean - description: Set to false to disable the auto-router plugin for this request. Defaults to true. - allowed_models: - type: array - items: - type: string - description: >- - List of model patterns to filter which models the auto-router can route between. Supports - wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default - supported models list. - example: - - anthropic/* - - openai/gpt-4o - - google/* - required: - - id - - type: object - properties: - id: - type: string - enum: - - moderation - required: - - id - - type: object - properties: - id: - type: string - enum: - - web - enabled: - type: boolean - description: Set to false to disable the web-search plugin for this request. Defaults to true. - max_results: - type: number - search_prompt: - type: string - engine: - $ref: '#/components/schemas/WebSearchEngine' - include_domains: - type: array - items: - type: string - description: >- - A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - exclude_domains: - type: array - items: - type: string - description: >- - A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - required: - - id - - type: object - properties: - id: - type: string - enum: - - file-parser - enabled: - type: boolean - description: Set to false to disable the file-parser plugin for this request. Defaults to true. - pdf: - $ref: '#/components/schemas/PDFParserOptions' - required: - - id - - type: object - properties: - id: - type: string - enum: - - response-healing - enabled: - type: boolean - description: Set to false to disable the response-healing plugin for this request. Defaults to true. - required: - - id - - type: object - properties: - id: - type: string - enum: - - context-compression - enabled: - type: boolean - description: Set to false to disable the context-compression plugin for this request. Defaults to true. - engine: - $ref: '#/components/schemas/ContextCompressionEngine' - required: - - id - description: Plugins you want to enable for this request, including their settings. - route: + $ref: '#/components/schemas/AnthropicWebSearchResult' + - $ref: '#/components/schemas/AnthropicWebSearchToolResultError' + required: + - type + - caller + - tool_use_id + - content + example: + type: web_search_tool_result + caller: + type: direct + tool_use_id: srvtoolu_01abc + content: [] + AnthropicWebFetchToolResultError: + type: object + properties: + type: + type: string + enum: + - web_fetch_tool_result_error + error_code: + type: string + enum: + - invalid_tool_input + - url_too_long + - url_not_allowed + - url_not_accessible + - unsupported_content_type + - too_many_requests + - max_uses_exceeded + - unavailable + required: + - type + - error_code + example: + type: web_fetch_tool_result_error + error_code: unavailable + AnthropicCitationsConfig: + type: object + nullable: true + properties: + enabled: + type: boolean + required: + - enabled + example: + enabled: true + AnthropicBase64PdfSource: + type: object + properties: + type: + type: string + enum: + - base64 + media_type: + type: string + enum: + - application/pdf + data: + type: string + required: + - type + - media_type + - data + example: + type: base64 + media_type: application/pdf + data: JVBERi0x... + AnthropicPlainTextSource: + type: object + properties: + type: + type: string + enum: + - text + media_type: + type: string + enum: + - text/plain + data: + type: string + required: + - type + - media_type + - data + example: + type: text + media_type: text/plain + data: Hello, world! + AnthropicDocumentBlock: + type: object + properties: + citations: + $ref: '#/components/schemas/AnthropicCitationsConfig' + source: + anyOf: + - $ref: '#/components/schemas/AnthropicBase64PdfSource' + - $ref: '#/components/schemas/AnthropicPlainTextSource' + title: + type: string + nullable: true + type: + type: string + enum: + - document + required: + - citations + - source + - title + - type + example: + citations: null + source: + data: Hello, world! + media_type: text/plain + type: text + title: null + type: document + AnthropicWebFetchBlock: + type: object + properties: + content: + $ref: '#/components/schemas/AnthropicDocumentBlock' + retrieved_at: + type: string + nullable: true + type: + type: string + enum: + - web_fetch_result + url: + type: string + required: + - content + - retrieved_at + - type + - url + example: + content: + type: document + citations: null + source: + data: '' + media_type: text/plain + type: text + title: null + retrieved_at: null + type: web_fetch_result + url: https://example.com + AnthropicWebFetchContent: + oneOf: + - $ref: '#/components/schemas/AnthropicWebFetchToolResultError' + - $ref: '#/components/schemas/AnthropicWebFetchBlock' + discriminator: + propertyName: type + mapping: + web_fetch_tool_result_error: '#/components/schemas/AnthropicWebFetchToolResultError' + web_fetch_result: '#/components/schemas/AnthropicWebFetchBlock' + example: + type: web_fetch_result + content: + type: document + citations: null + source: + data: '' + media_type: text/plain + type: text + title: null + retrieved_at: null + url: https://example.com + AnthropicWebFetchToolResult: + type: object + properties: + type: + type: string + enum: + - web_fetch_tool_result + caller: + $ref: '#/components/schemas/AnthropicCaller' + content: + $ref: '#/components/schemas/AnthropicWebFetchContent' + tool_use_id: + type: string + required: + - type + - caller + - content + - tool_use_id + example: + type: web_fetch_tool_result + caller: + type: direct + content: + type: web_fetch_result + content: + type: document + citations: null + source: + data: '' + media_type: text/plain + type: text + title: null + retrieved_at: null + url: https://example.com + tool_use_id: srvtoolu_01abc + AnthropicServerToolErrorCode: + type: string + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + example: unavailable + AnthropicCodeExecutionToolResultError: + type: object + properties: + error_code: + $ref: '#/components/schemas/AnthropicServerToolErrorCode' + type: type: string - nullable: true enum: - - fallback - - sort - deprecated: true - description: >- - **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for - providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). - x-speakeasy-deprecation-message: Use providers.sort.partition instead. - x-speakeasy-ignore: true - x-fern-ignore: true - user: + - code_execution_tool_result_error + required: + - error_code + - type + example: + error_code: unavailable + type: code_execution_tool_result_error + AnthropicCodeExecutionOutput: + type: object + properties: + file_id: type: string - maxLength: 256 - description: >- - A unique identifier representing your end-user, which helps distinguish between different users of your app. - This allows your app to identify specific users in case of abuse reports, preventing your entire app from - being affected by the actions of individual users. Maximum of 256 characters. - session_id: + type: type: string - maxLength: 256 - description: >- - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for - observability. If provided in both the request body and the x-session-id header, the body value takes - precedence. Maximum of 256 characters. - trace: - type: object - properties: - trace_id: - type: string - trace_name: - type: string - span_name: - type: string - generation_name: - type: string - parent_span_id: - type: string - additionalProperties: - nullable: true - description: >- - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, - parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured - broadcast destinations. - models: + enum: + - code_execution_output + required: + - file_id + - type + example: + file_id: file_01abc + type: code_execution_output + AnthropicCodeExecutionResult: + type: object + properties: + content: type: array items: - type: string - speed: + $ref: '#/components/schemas/AnthropicCodeExecutionOutput' + return_code: + type: integer + stderr: + type: string + stdout: + type: string + type: type: string enum: - - fast - - standard - description: >- - Controls output generation speed. When set to `fast`, uses a higher-speed inference configuration at premium - pricing. Defaults to `standard` when omitted. - example: fast + - code_execution_result required: - - model - - messages - description: Request schema for Anthropic Messages API endpoint + - content + - return_code + - stderr + - stdout + - type example: - model: anthropic/claude-4.5-sonnet-20250929 - max_tokens: 1024 - messages: - - role: user - content: Hello, how are you? - temperature: 0.7 - ActivityItem: + content: [] + return_code: 0 + stderr: '' + stdout: Hello + type: code_execution_result + AnthropicEncryptedCodeExecutionResult: type: object properties: - date: + content: + type: array + items: + $ref: '#/components/schemas/AnthropicCodeExecutionOutput' + encrypted_stdout: type: string - description: Date of the activity (YYYY-MM-DD format) - example: '2025-08-24' - model: + return_code: + type: integer + stderr: type: string - description: Model slug (e.g., "openai/gpt-4.1") - example: openai/gpt-4.1 - model_permaslug: + type: type: string - description: Model permaslug (e.g., "openai/gpt-4.1-2025-04-14") - example: openai/gpt-4.1-2025-04-14 - endpoint_id: + enum: + - encrypted_code_execution_result + required: + - content + - encrypted_stdout + - return_code + - stderr + - type + example: + content: [] + encrypted_stdout: enc_stdout + return_code: 0 + stderr: '' + type: encrypted_code_execution_result + AnthropicCodeExecutionContent: + oneOf: + - $ref: '#/components/schemas/AnthropicCodeExecutionToolResultError' + - $ref: '#/components/schemas/AnthropicCodeExecutionResult' + - $ref: '#/components/schemas/AnthropicEncryptedCodeExecutionResult' + discriminator: + propertyName: type + mapping: + code_execution_tool_result_error: '#/components/schemas/AnthropicCodeExecutionToolResultError' + code_execution_result: '#/components/schemas/AnthropicCodeExecutionResult' + encrypted_code_execution_result: '#/components/schemas/AnthropicEncryptedCodeExecutionResult' + example: + type: code_execution_result + content: [] + return_code: 0 + stderr: '' + stdout: Hello + AnthropicCodeExecutionToolResult: + type: object + properties: + type: type: string - description: Unique identifier for the endpoint - example: 550e8400-e29b-41d4-a716-446655440000 - provider_name: + enum: + - code_execution_tool_result + content: + $ref: '#/components/schemas/AnthropicCodeExecutionContent' + tool_use_id: type: string - description: Name of the provider serving this endpoint - example: OpenAI - usage: - type: number - description: Total cost in USD (OpenRouter credits spent) - example: 0.015 - byok_usage_inference: - type: number - description: BYOK inference cost in USD (external credits spent) - example: 0.012 - requests: - type: number - description: Number of requests made - example: 5 - prompt_tokens: - type: number - description: Total prompt tokens used - example: 50 - completion_tokens: - type: number - description: Total completion tokens generated - example: 125 - reasoning_tokens: - type: number - description: Total reasoning tokens used - example: 25 required: - - date - - model - - model_permaslug - - endpoint_id - - provider_name - - usage - - byok_usage_inference - - requests - - prompt_tokens - - completion_tokens - - reasoning_tokens + - type + - content + - tool_use_id example: - date: '2025-08-24' - model: openai/gpt-4.1 - model_permaslug: openai/gpt-4.1-2025-04-14 - endpoint_id: 550e8400-e29b-41d4-a716-446655440000 - provider_name: OpenAI - usage: 0.015 - byok_usage_inference: 0.012 - requests: 5 - prompt_tokens: 50 - completion_tokens: 125 - reasoning_tokens: 25 - ForbiddenResponseErrorData: + type: code_execution_tool_result + content: + type: code_execution_result + content: [] + return_code: 0 + stderr: '' + stdout: Hello + tool_use_id: srvtoolu_01abc + AnthropicBashCodeExecutionToolResultError: + type: object + properties: + error_code: + type: string + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + - output_file_too_large + type: + type: string + enum: + - bash_code_execution_tool_result_error + required: + - error_code + - type + example: + error_code: unavailable + type: bash_code_execution_tool_result_error + AnthropicBashCodeExecutionOutput: + type: object + properties: + file_id: + type: string + type: + type: string + enum: + - bash_code_execution_output + required: + - file_id + - type + example: + file_id: file_01abc + type: bash_code_execution_output + AnthropicBashCodeExecutionResult: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/AnthropicBashCodeExecutionOutput' + return_code: + type: integer + stderr: + type: string + stdout: + type: string + type: + type: string + enum: + - bash_code_execution_result + required: + - content + - return_code + - stderr + - stdout + - type + example: + content: [] + return_code: 0 + stderr: '' + stdout: Hello + type: bash_code_execution_result + AnthropicBashCodeExecutionContent: + oneOf: + - $ref: '#/components/schemas/AnthropicBashCodeExecutionToolResultError' + - $ref: '#/components/schemas/AnthropicBashCodeExecutionResult' + discriminator: + propertyName: type + mapping: + bash_code_execution_tool_result_error: '#/components/schemas/AnthropicBashCodeExecutionToolResultError' + bash_code_execution_result: '#/components/schemas/AnthropicBashCodeExecutionResult' + example: + type: bash_code_execution_result + content: [] + return_code: 0 + stderr: '' + stdout: Hello + AnthropicBashCodeExecutionToolResult: + type: object + properties: + type: + type: string + enum: + - bash_code_execution_tool_result + content: + $ref: '#/components/schemas/AnthropicBashCodeExecutionContent' + tool_use_id: + type: string + required: + - type + - content + - tool_use_id + example: + type: bash_code_execution_tool_result + content: + type: bash_code_execution_result + content: [] + return_code: 0 + stderr: '' + stdout: Hello + tool_use_id: srvtoolu_01abc + AnthropicTextEditorCodeExecutionToolResultError: + type: object + properties: + error_code: + type: string + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + - file_not_found + error_message: + type: string + nullable: true + type: + type: string + enum: + - text_editor_code_execution_tool_result_error + required: + - error_code + - error_message + - type + example: + error_code: unavailable + error_message: null + type: text_editor_code_execution_tool_result_error + AnthropicTextEditorCodeExecutionViewResult: + type: object + properties: + content: + type: string + file_type: + type: string + enum: + - text + - image + - pdf + num_lines: + type: integer + start_line: + type: integer + total_lines: + type: integer + type: + type: string + enum: + - text_editor_code_execution_view_result + required: + - content + - file_type + - num_lines + - start_line + - total_lines + - type + example: + content: file content + file_type: text + num_lines: 10 + start_line: 1 + total_lines: 10 + type: text_editor_code_execution_view_result + AnthropicTextEditorCodeExecutionCreateResult: + type: object + properties: + is_file_update: + type: boolean + type: + type: string + enum: + - text_editor_code_execution_create_result + required: + - is_file_update + - type + example: + is_file_update: false + type: text_editor_code_execution_create_result + AnthropicTextEditorCodeExecutionStrReplaceResult: + type: object + properties: + lines: + type: array + nullable: true + items: + type: string + new_lines: + type: integer + new_start: + type: integer + old_lines: + type: integer + old_start: + type: integer + type: + type: string + enum: + - text_editor_code_execution_str_replace_result + required: + - lines + - new_lines + - new_start + - old_lines + - old_start + - type + example: + lines: null + new_lines: null + new_start: null + old_lines: null + old_start: null + type: text_editor_code_execution_str_replace_result + AnthropicTextEditorCodeExecutionContent: + oneOf: + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionToolResultError' + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionViewResult' + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionCreateResult' + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionStrReplaceResult' + discriminator: + propertyName: type + mapping: + text_editor_code_execution_tool_result_error: '#/components/schemas/AnthropicTextEditorCodeExecutionToolResultError' + text_editor_code_execution_view_result: '#/components/schemas/AnthropicTextEditorCodeExecutionViewResult' + text_editor_code_execution_create_result: '#/components/schemas/AnthropicTextEditorCodeExecutionCreateResult' + text_editor_code_execution_str_replace_result: '#/components/schemas/AnthropicTextEditorCodeExecutionStrReplaceResult' + example: + type: text_editor_code_execution_view_result + content: file content + file_type: text + num_lines: 10 + start_line: 1 + total_lines: 10 + AnthropicTextEditorCodeExecutionToolResult: type: object properties: - code: - type: integer - message: + type: + type: string + enum: + - text_editor_code_execution_tool_result + content: + $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionContent' + tool_use_id: type: string - metadata: - type: object - nullable: true - additionalProperties: - nullable: true required: - - code - - message - description: Error data for ForbiddenResponse + - type + - content + - tool_use_id example: - code: 403 - message: Only management keys can perform this operation - ForbiddenResponse: + type: text_editor_code_execution_tool_result + content: + type: text_editor_code_execution_view_result + content: file content + file_type: text + num_lines: 10 + start_line: 1 + total_lines: 10 + tool_use_id: srvtoolu_01abc + AnthropicToolSearchResultError: type: object properties: - error: - $ref: '#/components/schemas/ForbiddenResponseErrorData' - user_id: + error_code: + $ref: '#/components/schemas/AnthropicServerToolErrorCode' + error_message: type: string nullable: true + type: + type: string + enum: + - tool_search_tool_result_error required: - - error - description: Forbidden - Authentication successful but insufficient permissions + - error_code + - error_message + - type example: - error: - code: 403 - message: Only management keys can perform this operation - ChatFinishReasonEnum: - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - example: stop - ChatContentCacheControl: + error_code: unavailable + error_message: null + type: tool_search_tool_result_error + AnthropicToolReference: type: object properties: - type: + tool_name: type: string - enum: - - ephemeral - ttl: + type: type: string enum: - - 5m - - 1h + - tool_reference required: + - tool_name - type - description: Cache control for the content part example: - type: ephemeral - ttl: 5m - ChatContentText: + tool_name: my_tool + type: tool_reference + AnthropicToolSearchResult: type: object properties: + tool_references: + type: array + items: + $ref: '#/components/schemas/AnthropicToolReference' type: type: string enum: - - text - text: - type: string - cache_control: - $ref: '#/components/schemas/ChatContentCacheControl' + - tool_search_tool_search_result required: + - tool_references - type - - text - description: Text content part example: - type: text - text: Hello, world! - ChatContentImage: + tool_references: + - tool_name: my_tool + type: tool_reference + type: tool_search_tool_search_result + AnthropicToolSearchContent: + oneOf: + - $ref: '#/components/schemas/AnthropicToolSearchResultError' + - $ref: '#/components/schemas/AnthropicToolSearchResult' + discriminator: + propertyName: type + mapping: + tool_search_tool_result_error: '#/components/schemas/AnthropicToolSearchResultError' + tool_search_tool_search_result: '#/components/schemas/AnthropicToolSearchResult' + example: + type: tool_search_tool_search_result + tool_references: + - tool_name: my_tool + type: tool_reference + AnthropicToolSearchToolResult: type: object properties: type: type: string enum: - - image_url - image_url: - type: object - properties: - url: - type: string - description: 'URL of the image (data: URLs supported)' - detail: - type: string - enum: - - auto - - low - - high - description: Image detail level for vision models - required: - - url + - tool_search_tool_result + content: + $ref: '#/components/schemas/AnthropicToolSearchContent' + tool_use_id: + type: string required: - type - - image_url - description: Image content part for vision models + - content + - tool_use_id example: - type: image_url - image_url: - url: https://example.com/image.jpg - detail: auto - ChatContentAudio: + type: tool_search_tool_result + content: + type: tool_search_tool_search_result + tool_references: + - tool_name: my_tool + type: tool_reference + tool_use_id: srvtoolu_01abc + AnthropicContainerUpload: type: object properties: type: type: string enum: - - input_audio - input_audio: - type: object - properties: - data: - type: string - description: Base64 encoded audio data - format: - type: string - description: >- - Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by - provider. - required: - - data - - format + - container_upload + file_id: + type: string required: - type - - input_audio - description: Audio input content part. Supported audio formats vary by provider. + - file_id example: - type: input_audio - input_audio: - data: SGVsbG8gV29ybGQ= - format: wav - Legacy_ChatContentVideo: + type: container_upload + file_id: file_01abc + AnthropicCompactionBlock: type: object properties: type: type: string enum: - - input_video - video_url: - $ref: '#/components/schemas/ChatContentVideoInput' + - compaction + content: + type: string + nullable: true required: - type - - video_url - description: Video input content part (legacy format - deprecated) - deprecated: true + - content example: - type: input_video - video_url: - url: https://example.com/video.mp4 - ChatContentVideoInput: + type: compaction + content: Compacted summary of conversation. + ORAnthropicContentBlock: + oneOf: + - $ref: '#/components/schemas/AnthropicTextBlock' + - $ref: '#/components/schemas/AnthropicToolUseBlock' + - $ref: '#/components/schemas/AnthropicThinkingBlock' + - $ref: '#/components/schemas/AnthropicRedactedThinkingBlock' + - $ref: '#/components/schemas/AnthropicServerToolUseBlock' + - $ref: '#/components/schemas/AnthropicWebSearchToolResult' + - $ref: '#/components/schemas/AnthropicWebFetchToolResult' + - $ref: '#/components/schemas/AnthropicCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicBashCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicToolSearchToolResult' + - $ref: '#/components/schemas/AnthropicContainerUpload' + - $ref: '#/components/schemas/AnthropicCompactionBlock' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/AnthropicTextBlock' + tool_use: '#/components/schemas/AnthropicToolUseBlock' + thinking: '#/components/schemas/AnthropicThinkingBlock' + redacted_thinking: '#/components/schemas/AnthropicRedactedThinkingBlock' + server_tool_use: '#/components/schemas/AnthropicServerToolUseBlock' + web_search_tool_result: '#/components/schemas/AnthropicWebSearchToolResult' + web_fetch_tool_result: '#/components/schemas/AnthropicWebFetchToolResult' + code_execution_tool_result: '#/components/schemas/AnthropicCodeExecutionToolResult' + bash_code_execution_tool_result: '#/components/schemas/AnthropicBashCodeExecutionToolResult' + text_editor_code_execution_tool_result: '#/components/schemas/AnthropicTextEditorCodeExecutionToolResult' + tool_search_tool_result: '#/components/schemas/AnthropicToolSearchToolResult' + container_upload: '#/components/schemas/AnthropicContainerUpload' + compaction: '#/components/schemas/AnthropicCompactionBlock' + example: + type: text + text: Hello, world! + citations: null + ORAnthropicStopReason: + type: string + nullable: true + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + - pause_turn + - refusal + - compaction + - null + example: end_turn + AnthropicCacheCreation: type: object + nullable: true properties: - url: + ephemeral_5m_input_tokens: + type: integer + ephemeral_1h_input_tokens: + type: integer + required: + - ephemeral_5m_input_tokens + - ephemeral_1h_input_tokens + example: + ephemeral_5m_input_tokens: 100 + ephemeral_1h_input_tokens: 0 + AnthropicServerToolUsage: + type: object + nullable: true + properties: + web_search_requests: + type: integer + web_fetch_requests: + type: integer + required: + - web_search_requests + - web_fetch_requests + example: + web_search_requests: 1 + web_fetch_requests: 0 + AnthropicSpeed: + type: string + nullable: true + enum: + - fast + - standard + - null + example: standard + AnthropicIterationCacheCreation: + type: object + nullable: true + properties: + ephemeral_5m_input_tokens: + type: integer + ephemeral_1h_input_tokens: + type: integer + default: null + example: + ephemeral_5m_input_tokens: 0 + ephemeral_1h_input_tokens: 0 + AnthropicBaseUsageIteration: + type: object + properties: + input_tokens: + type: integer + output_tokens: + type: integer + cache_creation_input_tokens: + type: integer + cache_read_input_tokens: + type: integer + cache_creation: + $ref: '#/components/schemas/AnthropicIterationCacheCreation' + example: + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: 0 + cache_read_input_tokens: 0 + cache_creation: null + AnthropicCompactionUsageIteration: + allOf: + - $ref: '#/components/schemas/AnthropicBaseUsageIteration' + - type: object + properties: + type: + type: string + enum: + - compaction + required: + - type + example: + type: compaction + input_tokens: 50 + output_tokens: 25 + cache_creation_input_tokens: 0 + cache_read_input_tokens: 0 + cache_creation: null + AnthropicMessageUsageIteration: + allOf: + - $ref: '#/components/schemas/AnthropicBaseUsageIteration' + - type: object + properties: + type: + type: string + enum: + - message + required: + - type + example: + type: message + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: 0 + cache_read_input_tokens: 0 + cache_creation: null + AnthropicUnknownUsageIteration: + allOf: + - $ref: '#/components/schemas/AnthropicBaseUsageIteration' + - type: object + properties: + type: + type: string + required: + - type + example: + type: unknown + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: 0 + cache_read_input_tokens: 0 + cache_creation: null + AnthropicUsageIteration: + anyOf: + - $ref: '#/components/schemas/AnthropicCompactionUsageIteration' + - $ref: '#/components/schemas/AnthropicMessageUsageIteration' + - $ref: '#/components/schemas/AnthropicUnknownUsageIteration' + example: + type: message + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: 0 + cache_read_input_tokens: 0 + cache_creation: null + AnthropicServiceTier: + type: string + nullable: true + enum: + - standard + - priority + - batch + - null + example: standard + AnthropicUsage: + type: object + properties: + input_tokens: + type: integer + output_tokens: + type: integer + cache_creation_input_tokens: + type: integer + cache_read_input_tokens: + type: integer + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' + inference_geo: type: string - description: 'URL of the video (data: URLs supported)' + nullable: true + server_tool_use: + $ref: '#/components/schemas/AnthropicServerToolUsage' + service_tier: + $ref: '#/components/schemas/AnthropicServiceTier' required: - - url - description: Video input object - ChatContentVideo: + - input_tokens + - output_tokens + - cache_creation_input_tokens + - cache_read_input_tokens + - cache_creation + - inference_geo + - server_tool_use + - service_tier + example: + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: null + cache_read_input_tokens: null + cache_creation: null + inference_geo: null + server_tool_use: null + service_tier: standard + BaseMessagesResult: type: object properties: + id: + type: string type: type: string enum: - - video_url - video_url: - $ref: '#/components/schemas/ChatContentVideoInput' + - message + role: + type: string + enum: + - assistant + container: + $ref: '#/components/schemas/AnthropicContainer' + content: + type: array + items: + $ref: '#/components/schemas/ORAnthropicContentBlock' + model: + type: string + stop_reason: + $ref: '#/components/schemas/ORAnthropicStopReason' + stop_sequence: + type: string + nullable: true + usage: + allOf: + - $ref: '#/components/schemas/AnthropicUsage' + - type: object + properties: + speed: + $ref: '#/components/schemas/AnthropicSpeed' + iterations: + type: array + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + example: + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: null + cache_read_input_tokens: null + cache_creation: null + inference_geo: null + server_tool_use: null + service_tier: standard required: + - id - type - - video_url - description: Video input content part + - role + - container + - content + - model + - stop_reason + - stop_sequence + - usage + description: Base Anthropic Messages API response before OpenRouter extensions example: - type: video_url - video_url: - url: https://example.com/video.mp4 - ChatContentFile: + id: msg_01XFDUDYJgAACzvnptvVoYEL + type: message + role: assistant + container: null + content: + - type: text + text: Hello! + citations: null + model: claude-sonnet-4-5-20250929 + stop_reason: end_turn + stop_sequence: null + usage: + input_tokens: 12 + output_tokens: 8 + cache_creation_input_tokens: null + cache_read_input_tokens: null + MessagesResult: + allOf: + - $ref: '#/components/schemas/BaseMessagesResult' + - type: object + properties: + usage: + allOf: + - $ref: '#/components/schemas/AnthropicUsage' + - type: object + properties: + service_tier: + type: string + nullable: true + speed: + $ref: '#/components/schemas/AnthropicSpeed' + iterations: + type: array + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + cost: + type: number + format: double + is_byok: + type: boolean + cost_details: + type: object + nullable: true + properties: + upstream_inference_cost: + type: number + format: double + upstream_inference_prompt_cost: + type: number + format: double + upstream_inference_completions_cost: + type: number + format: double + required: + - upstream_inference_prompt_cost + - upstream_inference_completions_cost + example: + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: null + cache_read_input_tokens: null + cache_creation: null + inference_geo: null + server_tool_use: null + service_tier: standard + provider: + $ref: '#/components/schemas/ProviderName' + description: Non-streaming response from the Anthropic Messages API with OpenRouter extensions + example: + id: msg_01XFDUDYJgAACzvnptvVoYEL + type: message + role: assistant + container: null + content: + - type: text + text: Hello! I'm doing well, thank you for asking. + citations: null + model: claude-sonnet-4-5-20250929 + stop_reason: end_turn + stop_sequence: null + usage: + input_tokens: 12 + output_tokens: 15 + cache_creation_input_tokens: null + cache_read_input_tokens: null + cache_creation: null + inference_geo: null + server_tool_use: null + service_tier: standard + MessagesStartEvent: type: object properties: type: type: string enum: - - file - file: + - message_start + message: type: object properties: - file_data: + id: type: string - description: File content as base64 data URL or URL - file_id: + type: type: string - description: File ID for previously uploaded files - filename: + enum: + - message + role: type: string - description: Original filename - required: - - type - - file - description: File content part for document processing - example: - type: file - file: - file_data: https://example.com/document.pdf - filename: document.pdf - ChatContentItems: - oneOf: - - $ref: '#/components/schemas/ChatContentText' - - $ref: '#/components/schemas/ChatContentImage' - - $ref: '#/components/schemas/ChatContentAudio' - - oneOf: - - $ref: '#/components/schemas/Legacy_ChatContentVideo' - - $ref: '#/components/schemas/ChatContentVideo' - discriminator: - propertyName: type - mapping: - input_video: '#/components/schemas/Legacy_ChatContentVideo' - video_url: '#/components/schemas/ChatContentVideo' - - $ref: '#/components/schemas/ChatContentFile' - discriminator: - propertyName: type - description: Content part for chat completion messages + enum: + - assistant + container: + $ref: '#/components/schemas/AnthropicContainer' + content: + type: array + items: + $ref: '#/components/schemas/ORAnthropicContentBlock' + model: + type: string + stop_reason: + nullable: true + stop_sequence: + nullable: true + usage: + allOf: + - $ref: '#/components/schemas/AnthropicUsage' + - type: object + properties: + speed: + $ref: '#/components/schemas/AnthropicSpeed' + iterations: + type: array + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + example: + input_tokens: 100 + output_tokens: 50 + cache_creation_input_tokens: null + cache_read_input_tokens: null + cache_creation: null + inference_geo: null + server_tool_use: null + service_tier: standard + provider: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AkashML + - AI21 + - AionLabs + - Alibaba + - Ambient + - Amazon Bedrock + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - InferenceNet + - Ionstream + - Infermatic + - Io Net + - Inflection + - Liquid + - Mara + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Reka + - Relace + - SambaNova + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + required: + - id + - type + - role + - container + - content + - model + - stop_reason + - stop_sequence + - usage + required: + - type + - message + description: Event sent at the start of a streaming message example: - type: text - text: Hello, world! - ChatToolCall: + type: message_start + message: + id: msg_01XFDUDYJgAACzvnptvVoYEL + type: message + role: assistant + content: [] + model: claude-sonnet-4-5-20250929 + stop_reason: null + stop_sequence: null + usage: + input_tokens: 12 + output_tokens: 0 + MessagesDeltaEvent: type: object properties: - id: - type: string - description: Tool call identifier type: type: string enum: - - function - function: + - message_delta + delta: type: object properties: - name: - type: string - description: Function name to call - arguments: + container: + $ref: '#/components/schemas/AnthropicContainer' + stop_reason: + $ref: '#/components/schemas/ORAnthropicStopReason' + stop_sequence: type: string - description: Function arguments as JSON string + nullable: true required: - - name - - arguments + - container + - stop_reason + - stop_sequence + usage: + type: object + properties: + input_tokens: + type: integer + nullable: true + output_tokens: + type: integer + cache_creation_input_tokens: + type: integer + nullable: true + cache_read_input_tokens: + type: integer + nullable: true + server_tool_use: + type: object + nullable: true + properties: + web_search_requests: + type: integer + web_fetch_requests: + type: integer + required: + - web_search_requests + - web_fetch_requests + iterations: + type: array + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + required: + - input_tokens + - output_tokens + - cache_creation_input_tokens + - cache_read_input_tokens + - server_tool_use required: - - id - type - - function - description: Tool call made by the assistant + - delta + - usage + description: Event sent when the message metadata changes (e.g., stop_reason) example: - id: call_abc123 - type: function - function: - name: get_current_weather - arguments: '{"location": "Boston, MA"}' - ReasoningDetailSummary: + type: message_delta + delta: + stop_reason: end_turn + stop_sequence: null + usage: + output_tokens: 15 + MessagesStopEvent: type: object properties: type: type: string enum: - - reasoning.summary - summary: - type: string - id: - type: string - nullable: true - format: - type: string - nullable: true - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 - index: - type: number + - message_stop required: - type - - summary - description: Reasoning detail summary schema + description: Event sent when the message is complete example: - type: reasoning.summary - summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... - ReasoningDetailEncrypted: + type: message_stop + MessagesContentBlockStartEvent: type: object properties: type: type: string enum: - - reasoning.encrypted - data: - type: string - id: - type: string - nullable: true - format: - type: string - nullable: true - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 + - content_block_start index: - type: number + type: integer + content_block: + anyOf: + - $ref: '#/components/schemas/AnthropicTextBlock' + - $ref: '#/components/schemas/AnthropicToolUseBlock' + - $ref: '#/components/schemas/AnthropicThinkingBlock' + - $ref: '#/components/schemas/AnthropicRedactedThinkingBlock' + - $ref: '#/components/schemas/AnthropicServerToolUseBlock' + - $ref: '#/components/schemas/AnthropicWebSearchToolResult' + - $ref: '#/components/schemas/AnthropicWebFetchToolResult' + - $ref: '#/components/schemas/AnthropicCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicBashCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicTextEditorCodeExecutionToolResult' + - $ref: '#/components/schemas/AnthropicToolSearchToolResult' + - $ref: '#/components/schemas/AnthropicContainerUpload' + - $ref: '#/components/schemas/AnthropicCompactionBlock' + - type: object + properties: + type: + type: string + enum: + - compaction + content: + type: string + nullable: true + required: + - type + - content required: - type - - data - description: Reasoning detail encrypted schema + - index + - content_block + description: Event sent when a new content block starts example: - type: reasoning.encrypted - data: encrypted data - ReasoningDetailText: + type: content_block_start + index: 0 + content_block: + type: text + text: '' + MessagesContentBlockDeltaEvent: type: object properties: type: type: string enum: - - reasoning.text - text: - type: string - nullable: true - signature: - type: string - nullable: true - id: - type: string - nullable: true - format: - type: string - nullable: true - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 + - content_block_delta index: - type: number + type: integer + delta: + oneOf: + - type: object + properties: + type: + type: string + enum: + - text_delta + text: + type: string + required: + - type + - text + - type: object + properties: + type: + type: string + enum: + - input_json_delta + partial_json: + type: string + required: + - type + - partial_json + - type: object + properties: + type: + type: string + enum: + - thinking_delta + thinking: + type: string + required: + - type + - thinking + - type: object + properties: + type: + type: string + enum: + - signature_delta + signature: + type: string + required: + - type + - signature + - type: object + properties: + type: + type: string + enum: + - citations_delta + citation: + oneOf: + - $ref: '#/components/schemas/AnthropicCitationCharLocation' + - $ref: '#/components/schemas/AnthropicCitationPageLocation' + - $ref: '#/components/schemas/AnthropicCitationContentBlockLocation' + - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + - $ref: '#/components/schemas/AnthropicCitationSearchResultLocation' + discriminator: + propertyName: type + mapping: + char_location: '#/components/schemas/AnthropicCitationCharLocation' + page_location: '#/components/schemas/AnthropicCitationPageLocation' + content_block_location: '#/components/schemas/AnthropicCitationContentBlockLocation' + web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocation' + required: + - type + - citation + - type: object + properties: + type: + type: string + enum: + - compaction_delta + content: + type: string + nullable: true + required: + - type + - content required: - type - description: Reasoning detail text schema - example: - type: reasoning.text - text: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... - signature: signature - ReasoningDetailUnion: - oneOf: - - $ref: '#/components/schemas/ReasoningDetailSummary' - - $ref: '#/components/schemas/ReasoningDetailEncrypted' - - $ref: '#/components/schemas/ReasoningDetailText' - discriminator: - propertyName: type - mapping: - reasoning.summary: '#/components/schemas/ReasoningDetailSummary' - reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' - reasoning.text: '#/components/schemas/ReasoningDetailText' - description: Reasoning detail union schema - example: - type: reasoning.summary - summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... - ChatReasoningDetails: - type: array - items: - $ref: '#/components/schemas/ReasoningDetailUnion' - description: Reasoning details for extended thinking models - ChatAssistantImages: - type: array - items: - type: object - properties: - image_url: - type: object - properties: - url: - type: string - description: URL or base64-encoded data of the generated image - required: - - url - required: - - image_url - description: Generated images from image generation models - example: - - image_url: - url: data:image/png;base64,iVBORw0KGgo... - ChatAudioOutput: - type: object - properties: - id: - type: string - description: Audio output identifier - expires_at: - type: number - description: Audio expiration timestamp - data: - type: string - description: Base64 encoded audio data - transcript: - type: string - description: Audio transcript - description: Audio output data or reference + - index + - delta + description: Event sent when content is added to a content block example: - id: audio_abc123 - expires_at: 1677652400 - data: UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1f - transcript: Hello! How can I help you today? - ChatAssistantMessage: + type: content_block_delta + index: 0 + delta: + type: text_delta + text: Hello + MessagesContentBlockStopEvent: type: object properties: - role: + type: type: string enum: - - assistant - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatContentItems' - - nullable: true - description: Assistant message content - name: - type: string - description: Optional name for the assistant - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatToolCall' - description: Tool calls made by the assistant - refusal: - type: string - nullable: true - description: Refusal message if content was refused - reasoning: - type: string - nullable: true - description: Reasoning output - reasoning_details: - $ref: '#/components/schemas/ChatReasoningDetails' - images: - $ref: '#/components/schemas/ChatAssistantImages' - audio: - $ref: '#/components/schemas/ChatAudioOutput' + - content_block_stop + index: + type: integer required: - - role - description: Assistant message for requests and responses + - type + - index + description: Event sent when a content block is complete example: - role: assistant - content: The capital of France is Paris. - ChatTokenLogprob: + type: content_block_stop + index: 0 + MessagesPingEvent: type: object properties: - token: + type: type: string - description: The token - logprob: - type: number - description: Log probability of the token - bytes: - type: array - nullable: true - items: - type: number - description: UTF-8 bytes of the token - top_logprobs: - type: array - items: - type: object - properties: - token: - type: string - logprob: - type: number - bytes: - type: array - nullable: true - items: - type: number - required: - - token - - logprob - - bytes - description: Top alternative tokens with probabilities + enum: + - ping required: - - token - - logprob - - bytes - - top_logprobs - description: Token log probability information + - type + description: Keep-alive ping event example: - token: ' Hello' - logprob: -0.612345 - bytes: null - top_logprobs: - - token: ' Hello' - logprob: -0.612345 - bytes: null - ChatTokenLogprobs: + type: ping + MessagesErrorEvent: type: object - nullable: true properties: - content: - type: array - nullable: true - items: - $ref: '#/components/schemas/ChatTokenLogprob' - description: Log probabilities for content tokens - refusal: - type: array - nullable: true - items: - $ref: '#/components/schemas/ChatTokenLogprob' - description: Log probabilities for refusal tokens + type: + type: string + enum: + - error + error: + type: object + properties: + type: + type: string + message: + type: string + required: + - type + - message required: - - content - description: Log probabilities for the completion + - type + - error + description: Error event in the stream example: - content: - - token: ' Hello' - logprob: -0.612345 - bytes: null - top_logprobs: [] - refusal: null - ChatChoice: + type: error + error: + type: overloaded_error + message: Overloaded + MessagesStreamEvents: + oneOf: + - $ref: '#/components/schemas/MessagesStartEvent' + - $ref: '#/components/schemas/MessagesDeltaEvent' + - $ref: '#/components/schemas/MessagesStopEvent' + - $ref: '#/components/schemas/MessagesContentBlockStartEvent' + - $ref: '#/components/schemas/MessagesContentBlockDeltaEvent' + - $ref: '#/components/schemas/MessagesContentBlockStopEvent' + - $ref: '#/components/schemas/MessagesPingEvent' + - $ref: '#/components/schemas/MessagesErrorEvent' + discriminator: + propertyName: type + mapping: + message_start: '#/components/schemas/MessagesStartEvent' + message_delta: '#/components/schemas/MessagesDeltaEvent' + message_stop: '#/components/schemas/MessagesStopEvent' + content_block_start: '#/components/schemas/MessagesContentBlockStartEvent' + content_block_delta: '#/components/schemas/MessagesContentBlockDeltaEvent' + content_block_stop: '#/components/schemas/MessagesContentBlockStopEvent' + ping: '#/components/schemas/MessagesPingEvent' + error: '#/components/schemas/MessagesErrorEvent' + description: Union of all possible streaming events + example: + type: content_block_delta + index: 0 + delta: + type: text_delta + text: Hello + MessagesErrorDetail: type: object properties: - finish_reason: - anyOf: - - $ref: '#/components/schemas/ChatFinishReasonEnum' - - nullable: true - - nullable: true - index: - type: number - description: Choice index - example: 0 + type: + type: string message: - $ref: '#/components/schemas/ChatAssistantMessage' - logprobs: - $ref: '#/components/schemas/ChatTokenLogprobs' + type: string required: - - finish_reason - - index + - type - message - description: Chat completion choice example: - finish_reason: stop - index: 0 - message: - role: assistant - content: The capital of France is Paris. - logprobs: null - ChatUsage: + type: invalid_request_error + message: Invalid request parameters + MessagesErrorResponse: type: object properties: - completion_tokens: - type: number - description: Number of tokens in the completion - prompt_tokens: - type: number - description: Number of tokens in the prompt - total_tokens: - type: number - description: Total number of tokens - completion_tokens_details: - type: object - nullable: true - properties: - reasoning_tokens: - type: number - nullable: true - description: Tokens used for reasoning - audio_tokens: - type: number - nullable: true - description: Tokens used for audio output - accepted_prediction_tokens: - type: number - nullable: true - description: Accepted prediction tokens - rejected_prediction_tokens: - type: number - nullable: true - description: Rejected prediction tokens - description: Detailed completion token usage - prompt_tokens_details: - type: object - nullable: true - properties: - cached_tokens: - type: number - description: Cached prompt tokens - cache_write_tokens: - type: number - description: Tokens written to cache. Only returned for models with explicit caching and cache write pricing. - audio_tokens: - type: number - description: Audio input tokens - video_tokens: - type: number - description: Video input tokens - description: Detailed prompt token usage + type: + type: string + enum: + - error + error: + $ref: '#/components/schemas/MessagesErrorDetail' required: - - completion_tokens - - prompt_tokens - - total_tokens - description: Token usage statistics + - type + - error example: - completion_tokens: 15 - prompt_tokens: 10 - total_tokens: 25 - completion_tokens_details: - reasoning_tokens: 5 - prompt_tokens_details: - cached_tokens: 2 - ChatResult: - type: object - properties: - id: - type: string - description: Unique completion identifier - example: chatcmpl-123 - choices: - type: array - items: - $ref: '#/components/schemas/ChatChoice' - description: List of completion choices - created: - type: number - description: Unix timestamp of creation - example: 1677652288 - model: - type: string - description: Model used for completion - example: openai/gpt-4 - object: + type: error + error: + type: invalid_request_error + message: Invalid request parameters + AnthropicCitationCharLocationParam: + type: object + properties: + type: type: string enum: - - chat.completion - system_fingerprint: + - char_location + cited_text: type: string - nullable: true - description: System fingerprint - example: fp_44709d6fcb - service_tier: + document_index: + type: integer + document_title: type: string nullable: true - description: The service tier used by the upstream provider for this request - example: default - usage: - $ref: '#/components/schemas/ChatUsage' + start_char_index: + type: integer + end_char_index: + type: integer required: - - id - - choices - - created - - model - - object - - system_fingerprint - description: Chat completion response + - type + - cited_text + - document_index + - document_title + - start_char_index + - end_char_index example: - id: chatcmpl-123 - object: chat.completion - created: 1677652288 - model: openai/gpt-4 - choices: - - index: 0 - message: - role: assistant - content: The capital of France is Paris. - finish_reason: stop - usage: - prompt_tokens: 10 - completion_tokens: 15 - total_tokens: 25 - ChatStreamToolCall: + type: char_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_char_index: 0 + end_char_index: 18 + AnthropicCitationPageLocationParam: type: object properties: - index: - type: number - description: Tool call index in the array - example: 0 - id: - type: string - description: Tool call identifier - example: call_abc123 type: type: string enum: - - function - description: Tool call type - example: function - function: - type: object - properties: - name: - type: string - description: Function name - example: get_weather - arguments: - type: string - description: Function arguments as JSON string - example: '{"location":' - description: Function call details + - page_location + cited_text: + type: string + document_index: + type: integer + document_title: + type: string + nullable: true + start_page_number: + type: integer + end_page_number: + type: integer required: - - index - description: Tool call delta for streaming responses + - type + - cited_text + - document_index + - document_title + - start_page_number + - end_page_number example: - index: 0 - id: call_abc123 - type: function - function: - name: get_weather - arguments: '{"location":' - ChatStreamDelta: + type: page_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_page_number: 1 + end_page_number: 2 + AnthropicCitationContentBlockLocationParam: type: object properties: - role: + type: type: string enum: - - assistant - description: The role of the message author - example: assistant - content: - type: string - nullable: true - description: Message content delta - example: Hello - reasoning: + - content_block_location + cited_text: type: string - nullable: true - description: Reasoning content delta - example: I need to - refusal: + document_index: + type: integer + document_title: type: string nullable: true - description: Refusal message delta - example: null - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatStreamToolCall' - description: Tool calls delta - reasoning_details: - $ref: '#/components/schemas/ChatReasoningDetails' - audio: - allOf: - - $ref: '#/components/schemas/ChatAudioOutput' - - description: Audio output data - description: Delta changes in streaming response + start_block_index: + type: integer + end_block_index: + type: integer + required: + - type + - cited_text + - document_index + - document_title + - start_block_index + - end_block_index example: - role: assistant - content: Hello - ChatStreamChoice: + type: content_block_location + cited_text: Example cited text + document_index: 0 + document_title: null + start_block_index: 0 + end_block_index: 1 + AnthropicCacheControlTtl: + type: string + enum: + - 5m + - 1h + example: 5m + AnthropicCacheControlDirective: type: object properties: - delta: - $ref: '#/components/schemas/ChatStreamDelta' - finish_reason: - anyOf: - - $ref: '#/components/schemas/ChatFinishReasonEnum' - - nullable: true - - nullable: true - index: - type: number - description: Choice index - example: 0 - logprobs: - $ref: '#/components/schemas/ChatTokenLogprobs' + type: + type: string + enum: + - ephemeral + ttl: + $ref: '#/components/schemas/AnthropicCacheControlTtl' required: - - delta - - finish_reason - - index - description: Streaming completion choice chunk + - type example: - index: 0 - delta: - role: assistant - content: Hello - finish_reason: null - ChatStreamChunk: + type: ephemeral + AnthropicTextBlockParam: type: object properties: - id: + type: type: string - description: Unique chunk identifier - example: chatcmpl-123 - choices: + enum: + - text + text: + type: string + citations: type: array + nullable: true items: - $ref: '#/components/schemas/ChatStreamChoice' - description: List of streaming chunk choices - created: - type: number - description: Unix timestamp of creation - example: 1677652288 - model: - type: string - description: Model used for completion - example: openai/gpt-4 - object: + oneOf: + - $ref: '#/components/schemas/AnthropicCitationCharLocationParam' + - $ref: '#/components/schemas/AnthropicCitationPageLocationParam' + - $ref: '#/components/schemas/AnthropicCitationContentBlockLocationParam' + - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + - $ref: '#/components/schemas/AnthropicCitationSearchResultLocation' + discriminator: + propertyName: type + mapping: + char_location: '#/components/schemas/AnthropicCitationCharLocationParam' + page_location: '#/components/schemas/AnthropicCitationPageLocationParam' + content_block_location: '#/components/schemas/AnthropicCitationContentBlockLocationParam' + web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocation' + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - text + example: + type: text + text: Hello, world! + AnthropicWebSearchToolUserLocation: + type: object + nullable: true + properties: + type: type: string enum: - - chat.completion.chunk - system_fingerprint: + - approximate + city: type: string - description: System fingerprint - example: fp_44709d6fcb - service_tier: + nullable: true + country: + type: string + nullable: true + region: + type: string + nullable: true + timezone: type: string nullable: true - description: The service tier used by the upstream provider for this request - example: default - error: - type: object - properties: - message: - type: string - description: Error message - example: Rate limit exceeded - code: - type: number - description: Error code - example: 429 - required: - - message - - code - description: Error information - example: - message: Rate limit exceeded - code: 429 - usage: - $ref: '#/components/schemas/ChatUsage' required: - - id - - choices - - created - - model - - object - description: Streaming chat completion chunk - x-speakeasy-entity: ChatStreamChunk + - type + example: + type: approximate + city: San Francisco + country: US + region: California + timezone: America/Los_Angeles + SearchQualityLevel: + type: string + enum: + - low + - medium + - high + description: >- + How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa + engine; ignored with native provider search. + example: medium + WebSearchUserLocationServerTool: + type: object + properties: + type: + type: string + enum: + - approximate + city: + type: string + region: + type: string + country: + type: string + timezone: + type: string + description: Approximate user location for location-biased results. + example: + type: approximate + city: San Francisco + region: California + country: US + timezone: America/Los_Angeles + WebSearchConfig: + type: object + properties: + engine: + $ref: '#/components/schemas/WebSearchEngineEnum' + max_results: + type: integer + description: >- + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and + Parallel engines; ignored with native provider search. + example: 5 + max_total_results: + type: integer + description: >- + Maximum total number of search results across all search calls in a single request. Once this limit is + reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic + loops. + example: 20 + search_context_size: + $ref: '#/components/schemas/SearchQualityLevel' + user_location: + $ref: '#/components/schemas/WebSearchUserLocationServerTool' + allowed_domains: + type: array + items: + type: string + description: >- + Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, + OpenAI, xAI). Not supported with Firecrawl or Perplexity. + excluded_domains: + type: array + items: + type: string + description: >- + Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported + with Firecrawl, OpenAI (silently ignored), or Perplexity. example: - id: chatcmpl-123 - object: chat.completion.chunk - created: 1677652288 - model: openai/gpt-4 - choices: - - index: 0 - delta: - role: assistant - content: Hello - finish_reason: null - ChatSystemMessage: + max_results: 5 + search_context_size: medium + OpenRouterWebSearchServerTool: type: object properties: - role: + type: type: string enum: - - system - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatContentText' - description: System message content - example: You are a helpful assistant. - name: - type: string - description: Optional name for the system message - example: Assistant Config + - openrouter:web_search + parameters: + $ref: '#/components/schemas/WebSearchConfig' required: - - role - - content - description: System message for setting behavior + - type + description: 'OpenRouter built-in server tool: searches the web for current information' example: - role: system - content: You are a helpful assistant. - name: Assistant Config - ChatUserMessage: + type: openrouter:web_search + parameters: + max_results: 5 + MessagesOutputConfig: type: object properties: - role: + effort: type: string + nullable: true enum: - - user - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatContentItems' - description: User message content - example: What is the capital of France? - name: - type: string - description: Optional name for the user - example: User - required: - - role - - content - description: User message + - low + - medium + - high + - max + - null + description: >- + How much effort the model should put into its response. Higher effort levels may result in more thorough + analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`. + example: medium + format: + type: object + nullable: true + properties: + type: + type: string + enum: + - json_schema + schema: + type: object + additionalProperties: + nullable: true + required: + - type + - schema + description: >- + A schema to specify Claude's output format in responses. See [structured + outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs). + description: Configuration for controlling output behavior. Supports the effort parameter and structured output format. example: - role: user - content: What is the capital of France? - ChatDeveloperMessage: + effort: medium + AnthropicImageMimeType: + type: string + enum: + - image/jpeg + - image/png + - image/gif + - image/webp + example: image/jpeg + AnthropicBase64ImageSource: type: object properties: - role: + type: type: string enum: - - developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatContentText' - description: Developer message content - example: This is a message from the developer. - name: + - base64 + media_type: + $ref: '#/components/schemas/AnthropicImageMimeType' + data: type: string - description: Optional name for the developer message - example: Developer required: - - role - - content - description: Developer message + - type + - media_type + - data example: - role: developer - content: This is a message from the developer. - ChatToolMessage: + type: base64 + media_type: image/jpeg + data: /9j/4AAQ... + AnthropicUrlImageSource: type: object properties: - role: + type: type: string enum: - - tool - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatContentItems' - description: Tool response content - example: The weather in San Francisco is 72°F and sunny. - tool_call_id: + - url + url: type: string - description: ID of the assistant message tool call this message responds to - example: call_abc123 required: - - role - - content - - tool_call_id - description: Tool response message - example: - role: tool - content: The weather in San Francisco is 72°F and sunny. - tool_call_id: call_abc123 - ChatMessages: - oneOf: - - $ref: '#/components/schemas/ChatSystemMessage' - - $ref: '#/components/schemas/ChatUserMessage' - - $ref: '#/components/schemas/ChatDeveloperMessage' - - $ref: '#/components/schemas/ChatAssistantMessage' - - $ref: '#/components/schemas/ChatToolMessage' - discriminator: - propertyName: role - description: Chat completion message with role-based discrimination - example: - role: user - content: What is the capital of France? - ModelName: - type: string - description: Model to use for completion - example: openai/gpt-4 - ChatModelNames: - type: array - items: - allOf: - - $ref: '#/components/schemas/ModelName' - - description: Available OpenRouter chat completion models - description: Models to use for completion + - type + - url example: - - openai/gpt-4 - - openai/gpt-4o - ChatReasoningSummaryVerbosityEnum: - type: string - enum: - - auto - - concise - - detailed - ChatFormatTextConfig: + type: url + url: https://example.com/image.jpg + AnthropicImageBlockParam: type: object properties: type: type: string enum: - - text + - image + source: + oneOf: + - $ref: '#/components/schemas/AnthropicBase64ImageSource' + - $ref: '#/components/schemas/AnthropicUrlImageSource' + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/AnthropicBase64ImageSource' + url: '#/components/schemas/AnthropicUrlImageSource' + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - type - description: Default text response format + - source example: - type: text - ChatJsonSchemaConfig: + type: image + source: + type: base64 + media_type: image/jpeg + data: /9j/4AAQ... + AnthropicUrlPdfSource: type: object properties: - name: + type: type: string - maxLength: 64 - description: Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) - example: math_response - description: + enum: + - url + url: type: string - description: Schema description for the model - example: A mathematical response - schema: - type: object - additionalProperties: - nullable: true - description: JSON Schema object - example: - type: object - properties: - answer: - type: number - required: - - answer - strict: - type: boolean - nullable: true - description: Enable strict schema adherence - example: false - required: - - name - description: JSON Schema configuration object - example: - name: math_response - description: A mathematical response - schema: - type: object - properties: - answer: - type: number - required: - - answer - strict: true - ChatFormatJsonSchemaConfig: + required: + - type + - url + example: + type: url + url: https://example.com/document.pdf + AnthropicDocumentBlockParam: type: object properties: type: type: string enum: - - json_schema - json_schema: - $ref: '#/components/schemas/ChatJsonSchemaConfig' + - document + source: + oneOf: + - $ref: '#/components/schemas/AnthropicBase64PdfSource' + - $ref: '#/components/schemas/AnthropicPlainTextSource' + - type: object + properties: + type: + type: string + enum: + - content + content: + anyOf: + - type: string + - type: array + items: + oneOf: + - $ref: '#/components/schemas/AnthropicTextBlockParam' + - $ref: '#/components/schemas/AnthropicImageBlockParam' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/AnthropicTextBlockParam' + image: '#/components/schemas/AnthropicImageBlockParam' + required: + - type + - content + - $ref: '#/components/schemas/AnthropicUrlPdfSource' + citations: + type: object + nullable: true + properties: + enabled: + type: boolean + context: + type: string + nullable: true + title: + type: string + nullable: true + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - type - - json_schema - description: JSON Schema response format for structured outputs + - source example: - type: json_schema - json_schema: - name: math_response - schema: - type: object - properties: - answer: - type: number - required: - - answer - ChatFormatGrammarConfig: + type: document + source: + type: text + media_type: text/plain + data: Hello, world! + AnthropicSearchResultBlockParam: type: object properties: type: type: string enum: - - grammar - grammar: + - search_result + source: type: string - description: Custom grammar for text generation - example: root ::= "yes" | "no" + title: + type: string + content: + type: array + items: + $ref: '#/components/schemas/AnthropicTextBlockParam' + citations: + type: object + properties: + enabled: + type: boolean + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - type - - grammar - description: Custom grammar response format + - source + - title + - content example: - type: grammar - grammar: root ::= "yes" | "no" - ChatFormatPythonConfig: + type: search_result + source: example_source + title: Example Result + content: + - type: text + text: Result content + AnthropicWebSearchResultBlockParam: type: object properties: type: type: string enum: - - python + - web_search_result + encrypted_content: + type: string + title: + type: string + url: + type: string + page_age: + type: string + nullable: true required: - type - description: Python code response format + - encrypted_content + - title + - url example: - type: python - ChatStreamOptions: + type: web_search_result + encrypted_content: enc_content_0 + title: Example Page + url: https://example.com + MessagesMessageParam: type: object - nullable: true properties: - include_usage: - type: boolean - description: 'Deprecated: This field has no effect. Full usage details are always included.' - example: true - deprecated: true - description: Streaming configuration options + role: + type: string + enum: + - user + - assistant + content: + anyOf: + - type: string + - type: array + items: + oneOf: + - $ref: '#/components/schemas/AnthropicTextBlockParam' + - $ref: '#/components/schemas/AnthropicImageBlockParam' + - $ref: '#/components/schemas/AnthropicDocumentBlockParam' + - type: object + properties: + type: + type: string + enum: + - tool_use + id: + type: string + name: + type: string + input: + nullable: true + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - id + - name + - type: object + properties: + type: + type: string + enum: + - tool_result + tool_use_id: + type: string + content: + anyOf: + - type: string + - type: array + items: + anyOf: + - $ref: '#/components/schemas/AnthropicTextBlockParam' + - $ref: '#/components/schemas/AnthropicImageBlockParam' + - type: object + properties: + type: + type: string + enum: + - tool_reference + tool_name: + type: string + required: + - type + - tool_name + - $ref: '#/components/schemas/AnthropicSearchResultBlockParam' + - $ref: '#/components/schemas/AnthropicDocumentBlockParam' + is_error: + type: boolean + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - tool_use_id + - type: object + properties: + type: + type: string + enum: + - thinking + thinking: + type: string + signature: + type: string + required: + - type + - thinking + - signature + - type: object + properties: + type: + type: string + enum: + - redacted_thinking + data: + type: string + required: + - type + - data + - type: object + properties: + type: + type: string + enum: + - server_tool_use + id: + type: string + name: + $ref: '#/components/schemas/AnthropicServerToolName' + input: + nullable: true + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - id + - name + - type: object + properties: + type: + type: string + enum: + - web_search_tool_result + tool_use_id: + type: string + content: + anyOf: + - type: array + items: + $ref: '#/components/schemas/AnthropicWebSearchResultBlockParam' + - type: object + properties: + type: + type: string + enum: + - web_search_tool_result_error + error_code: + type: string + enum: + - invalid_tool_input + - unavailable + - max_uses_exceeded + - too_many_requests + - query_too_long + required: + - type + - error_code + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - tool_use_id + - content + - $ref: '#/components/schemas/AnthropicSearchResultBlockParam' + - type: object + properties: + type: + type: string + enum: + - compaction + content: + type: string + nullable: true + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - content + required: + - role + - content + description: Anthropic message with OpenRouter extensions example: - include_usage: true - ChatNamedToolChoice: + role: user + content: Hello, how are you? + AnthropicInputTokensClearAtLeast: type: object + nullable: true properties: type: type: string - enum: - - function - function: - type: object - properties: - name: - type: string - description: Function name to call - example: get_weather - required: - - name + enum: + - input_tokens + value: + type: integer required: - type - - function - description: Named tool choice for specific function + - value example: - type: function - function: - name: get_weather - ChatToolChoice: - anyOf: - - type: string - enum: - - none - - type: string - enum: - - auto - - type: string - enum: - - required - - $ref: '#/components/schemas/ChatNamedToolChoice' - description: Tool choice configuration - example: auto - ChatWebSearchServerTool: + type: input_tokens + value: 50000 + AnthropicToolUsesKeep: type: object properties: type: type: string enum: - - openrouter:web_search - parameters: - type: object - properties: - engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses - Firecrawl (requires BYOK). "parallel" uses the Parallel search API. - example: auto - max_results: - type: number - minimum: 1 - maximum: 25 - description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, - and Parallel engines; ignored with native provider search. - example: 5 - max_total_results: - type: number - minimum: 1 - description: >- - Maximum total number of search results across all search calls in a single request. Once this limit is - reached, the tool will stop returning new results. Useful for controlling cost and context size in - agentic loops. - example: 20 - search_context_size: - type: string - enum: - - low - - medium - - high - description: >- - How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the - Exa engine; ignored with native provider search. - user_location: - type: object - properties: - type: - type: string - enum: - - approximate - city: - type: string - region: - type: string - country: - type: string - timezone: - type: string - description: Approximate user location for location-biased results. - allowed_domains: - type: array - items: - type: string - description: >- - Limit search results to these domains. Applies to Exa and Parallel engines. Not supported with Firecrawl - or native provider search. - excluded_domains: - type: array - items: - type: string - description: >- - Exclude search results from these domains. Applies to Exa and Parallel engines. Not supported with - Firecrawl or native provider search. + - tool_uses + value: + type: integer required: - type - description: 'OpenRouter built-in server tool: searches the web for current information' + - value example: - type: openrouter:web_search - parameters: - engine: auto - max_results: 5 - ChatWebSearchShorthand: + type: tool_uses + value: 5 + AnthropicInputTokensTrigger: type: object properties: type: type: string enum: - - web_search - - web_search_preview - - web_search_preview_2025_03_11 - - web_search_2025_08_26 - engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl - (requires BYOK). "parallel" uses the Parallel search API. - example: auto - max_results: - type: number - minimum: 1 - maximum: 25 - description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and - Parallel engines; ignored with native provider search. - example: 5 - max_total_results: - type: number - minimum: 1 - description: >- - Maximum total number of search results across all search calls in a single request. Once this limit is - reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic - loops. - example: 20 - search_context_size: + - input_tokens + value: + type: integer + required: + - type + - value + example: + type: input_tokens + value: 100000 + AnthropicToolUsesTrigger: + type: object + properties: + type: type: string enum: - - low - - medium - - high - description: >- - How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa - engine; ignored with native provider search. - user_location: - type: object - properties: - type: - type: string - enum: - - approximate - city: - type: string - region: - type: string - country: - type: string - timezone: - type: string - description: Approximate user location for location-biased results. - allowed_domains: - type: array - items: - type: string - description: >- - Limit search results to these domains. Applies to Exa and Parallel engines. Not supported with Firecrawl or - native provider search. - excluded_domains: - type: array - items: - type: string - description: >- - Exclude search results from these domains. Applies to Exa and Parallel engines. Not supported with Firecrawl - or native provider search. - parameters: - type: object - properties: - engine: - type: string - enum: - - auto - - native - - exa - - firecrawl - - parallel - description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. - "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses - Firecrawl (requires BYOK). "parallel" uses the Parallel search API. - example: auto - max_results: - type: number - minimum: 1 - maximum: 25 - description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, - and Parallel engines; ignored with native provider search. - example: 5 - max_total_results: - type: number - minimum: 1 - description: >- - Maximum total number of search results across all search calls in a single request. Once this limit is - reached, the tool will stop returning new results. Useful for controlling cost and context size in - agentic loops. - example: 20 - search_context_size: - type: string - enum: - - low - - medium - - high - description: >- - How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the - Exa engine; ignored with native provider search. - user_location: - type: object - properties: - type: - type: string - enum: - - approximate - city: - type: string - region: - type: string - country: - type: string - timezone: - type: string - description: Approximate user location for location-biased results. - allowed_domains: - type: array - items: - type: string - description: >- - Limit search results to these domains. Applies to Exa and Parallel engines. Not supported with Firecrawl - or native provider search. - excluded_domains: - type: array - items: - type: string - description: >- - Exclude search results from these domains. Applies to Exa and Parallel engines. Not supported with - Firecrawl or native provider search. + - tool_uses + value: + type: integer required: - type - description: Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search. - ChatFunctionTool: - anyOf: - - type: object - properties: - type: - type: string - enum: - - function - function: - type: object - properties: - name: - type: string - maxLength: 64 - description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) - example: get_weather - description: - type: string - description: Function description for the model - example: Get the current weather for a location - parameters: - type: object - additionalProperties: - nullable: true - description: Function parameters as JSON Schema object - example: - type: object - properties: - location: - type: string - description: City name - required: - - location - strict: - type: boolean - nullable: true - description: Enable strict schema adherence - example: false - required: - - name - description: Function definition for tool calling - example: - name: get_weather - description: Get the current weather for a location - parameters: - type: object - properties: - location: - type: string - description: City name - required: - - location - cache_control: - $ref: '#/components/schemas/ChatContentCacheControl' - required: - - type - - function - - $ref: '#/components/schemas/DatetimeServerTool' - - $ref: '#/components/schemas/ChatWebSearchServerTool' - - $ref: '#/components/schemas/ChatWebSearchShorthand' - description: Tool definition for function calling (regular function or OpenRouter built-in server tool) + - value example: - type: function - function: - name: get_weather - description: Get the current weather for a location - parameters: - type: object - properties: - location: - type: string - description: City name - unit: - type: string - enum: - - celsius - - fahrenheit - required: - - location - ChatDebugOptions: + type: tool_uses + value: 10 + AnthropicThinkingTurns: type: object properties: - echo_upstream_body: - type: boolean - description: >- - If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only - works with streaming mode. - example: true - description: Debug options for inspecting request transformations (streaming only) + type: + type: string + enum: + - thinking_turns + value: + type: integer + required: + - type + - value example: - echo_upstream_body: true - ChatRequest: + type: thinking_turns + value: 3 + MessagesRequest: type: object properties: - provider: + model: + type: string + max_tokens: + type: integer + system: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/AnthropicTextBlockParam' + metadata: type: object - nullable: true properties: - allow_fallbacks: - type: boolean - nullable: true - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use - the next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - require_parameters: - type: boolean - nullable: true - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this setting - is omitted or set to false, then providers will receive only the parameters they support, and ignore the - rest. - data_collection: - $ref: '#/components/schemas/DataCollection' - zdr: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that - do not retain prompts will be used. - example: true - enforce_distillable_text: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only models that allow text distillation. When true, only models where - the author has allowed distillation will be used. - example: true - order: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of - this list that supports your requested model, and fall back to the next if it is unavailable. If no - providers are available, the request will fail with an error message. - only: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - ignore: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - quantizations: - type: array + user_id: + type: string nullable: true - items: - $ref: '#/components/schemas/Quantization' - description: A list of quantization levels to filter the provider by. - sort: - allOf: - - $ref: '#/components/schemas/ProviderSort' - - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - - nullable: true - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load - balancing is performed. - max_price: - type: object - properties: - prompt: - $ref: '#/components/schemas/BigNumberUnion' - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per million completion tokens - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per image - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per audio unit - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per request - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, - for prompt and completion. - preferred_min_throughput: - $ref: '#/components/schemas/PreferredMinThroughput' - preferred_max_latency: - $ref: '#/components/schemas/PreferredMaxLatency' - additionalProperties: false - description: When multiple model providers are available, optionally indicate your routing preference. - plugins: + stop_sequences: type: array items: - oneOf: + type: string + temperature: + type: number + format: double + top_p: + type: number + format: double + top_k: + type: integer + tools: + type: array + items: + anyOf: - type: object properties: - id: + name: + type: string + description: + type: string + input_schema: + type: object + properties: + type: + type: string + default: object + properties: + nullable: true + required: + type: array + nullable: true + items: + type: string + additionalProperties: + nullable: true + type: type: string enum: - - auto-router - enabled: - type: boolean - description: Set to false to disable the auto-router plugin for this request. Defaults to true. - allowed_models: - type: array - items: - type: string - description: >- - List of model patterns to filter which models the auto-router can route between. Supports - wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default - supported models list. - example: - - anthropic/* - - openai/gpt-4o - - google/* + - custom + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - - id + - name + - input_schema - type: object properties: - id: + type: + type: string + enum: + - bash_20250124 + name: type: string enum: - - moderation + - bash + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - - id + - type + - name - type: object properties: - id: + type: type: string enum: - - web - enabled: - type: boolean - description: Set to false to disable the web-search plugin for this request. Defaults to true. - max_results: - type: number - search_prompt: + - text_editor_20250124 + name: + type: string + enum: + - str_replace_editor + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + required: + - type + - name + - type: object + properties: + type: + type: string + enum: + - web_search_20250305 + name: type: string - engine: - $ref: '#/components/schemas/WebSearchEngine' - include_domains: + enum: + - web_search + allowed_domains: type: array + nullable: true items: type: string - description: >- - A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - exclude_domains: + blocked_domains: type: array + nullable: true items: type: string - description: >- - A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") - and path filtering (e.g. "openai.com/blog"). - example: - - example.com - - '*.substack.com' - - openai.com/blog - required: - - id - - type: object - properties: - id: - type: string - enum: - - file-parser - enabled: - type: boolean - description: Set to false to disable the file-parser plugin for this request. Defaults to true. - pdf: - $ref: '#/components/schemas/PDFParserOptions' + max_uses: + type: integer + user_location: + $ref: '#/components/schemas/AnthropicWebSearchToolUserLocation' + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - - id + - type + - name - type: object properties: - id: + type: type: string enum: - - response-healing - enabled: - type: boolean - description: Set to false to disable the response-healing plugin for this request. Defaults to true. - required: - - id - - type: object - properties: - id: + - web_search_20260209 + name: type: string enum: - - context-compression - enabled: - type: boolean - description: Set to false to disable the context-compression plugin for this request. Defaults to true. - engine: - $ref: '#/components/schemas/ContextCompressionEngine' + - web_search + allowed_callers: + type: array + items: + type: string + enum: + - direct + - code_execution_20250825 + - code_execution_20260120 + allowed_domains: + type: array + nullable: true + items: + type: string + blocked_domains: + type: array + nullable: true + items: + type: string + max_uses: + type: integer + user_location: + $ref: '#/components/schemas/AnthropicWebSearchToolUserLocation' + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' required: - - id - description: Plugins you want to enable for this request, including their settings. - route: + - type + - name + - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/OpenRouterWebSearchServerTool' + tool_choice: + oneOf: + - type: object + properties: + type: + type: string + enum: + - auto + disable_parallel_tool_use: + type: boolean + required: + - type + - type: object + properties: + type: + type: string + enum: + - any + disable_parallel_tool_use: + type: boolean + required: + - type + - type: object + properties: + type: + type: string + enum: + - none + required: + - type + - type: object + properties: + type: + type: string + enum: + - tool + name: + type: string + disable_parallel_tool_use: + type: boolean + required: + - type + - name + thinking: + oneOf: + - type: object + properties: + type: + type: string + enum: + - enabled + budget_tokens: + type: integer + required: + - type + - budget_tokens + - type: object + properties: + type: + type: string + enum: + - disabled + required: + - type + - type: object + properties: + type: + type: string + enum: + - adaptive + required: + - type + service_tier: type: string - nullable: true enum: - - fallback - - sort - deprecated: true - description: >- - **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for - providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). - x-speakeasy-deprecation-message: Use providers.sort.partition instead. - x-speakeasy-ignore: true - x-fern-ignore: true - user: - type: string - description: Unique user identifier - example: user-123 - session_id: - type: string - maxLength: 256 - description: >- - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for - observability. If provided in both the request body and the x-session-id header, the body value takes - precedence. Maximum of 256 characters. - trace: - type: object - properties: - trace_id: - type: string - trace_name: - type: string - span_name: - type: string - generation_name: - type: string - parent_span_id: - type: string - additionalProperties: - nullable: true - description: >- - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, - parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured - broadcast destinations. + - auto + - standard_only + output_config: + $ref: '#/components/schemas/MessagesOutputConfig' + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' messages: type: array - items: - $ref: '#/components/schemas/ChatMessages' - minItems: 1 - description: List of messages for the conversation - example: - - role: user - content: Hello! - model: - $ref: '#/components/schemas/ModelName' - models: - $ref: '#/components/schemas/ChatModelNames' - frequency_penalty: - type: number - nullable: true - minimum: -2 - maximum: 2 - description: Frequency penalty (-2.0 to 2.0) - example: 0 - logit_bias: - type: object nullable: true - additionalProperties: - type: number - description: Token logit bias adjustments - example: - '50256': -100 - logprobs: + items: + $ref: '#/components/schemas/MessagesMessageParam' + stream: type: boolean - nullable: true - description: Return log probabilities - example: false - top_logprobs: - type: number - nullable: true - minimum: 0 - maximum: 20 - description: Number of top log probabilities to return (0-20) - example: 5 - max_completion_tokens: - type: number - nullable: true - minimum: 1 - description: Maximum tokens in completion - example: 100 - max_tokens: - type: number - nullable: true - minimum: 1 - description: 'Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.' - example: 100 - metadata: + context_management: type: object - additionalProperties: - type: string - description: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) - example: - user_id: user-123 - session_id: session-456 - presence_penalty: - type: number nullable: true - minimum: -2 - maximum: 2 - description: Presence penalty (-2.0 to 2.0) - example: 0 - reasoning: - type: object properties: - effort: - type: string - nullable: true - enum: - - xhigh - - high - - medium - - low - - minimal - - none - description: Constrains effort on reasoning for reasoning models - example: medium - summary: - anyOf: - - $ref: '#/components/schemas/ChatReasoningSummaryVerbosityEnum' - - nullable: true - - nullable: true - description: Configuration options for reasoning models - example: - effort: medium - summary: concise - response_format: - oneOf: - - $ref: '#/components/schemas/ChatFormatTextConfig' - - $ref: '#/components/schemas/FormatJsonObjectConfig' - - $ref: '#/components/schemas/ChatFormatJsonSchemaConfig' - - $ref: '#/components/schemas/ChatFormatGrammarConfig' - - $ref: '#/components/schemas/ChatFormatPythonConfig' - discriminator: - propertyName: type - description: Response format configuration - example: - type: json_object - seed: - type: integer - nullable: true - description: Random seed for deterministic outputs - example: 42 - stop: - anyOf: - - type: string - - type: array + edits: + type: array items: - type: string - maxItems: 4 - - nullable: true - description: Stop sequences (up to 4) - example: - - |+ - - stream: - type: boolean - default: false - description: Enable streaming response - example: false - stream_options: - $ref: '#/components/schemas/ChatStreamOptions' - temperature: - type: number - nullable: true - minimum: 0 - maximum: 2 - default: 1 - description: Sampling temperature (0-2) - example: 0.7 - parallel_tool_calls: - type: boolean - nullable: true - tool_choice: - $ref: '#/components/schemas/ChatToolChoice' - tools: - type: array - items: - $ref: '#/components/schemas/ChatFunctionTool' - description: Available tools for function calling - example: - - type: function - function: - name: get_weather - description: Get weather - top_p: - type: number - nullable: true - minimum: 0 - maximum: 1 - default: 1 - description: Nucleus sampling parameter (0-1) - example: 1 - debug: - $ref: '#/components/schemas/ChatDebugOptions' - image_config: - type: object - additionalProperties: - anyOf: - - type: string - - type: number - - type: array - items: - nullable: true - description: >- - Provider-specific image configuration options. Keys and values vary by model/provider. See - https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. - example: - aspect_ratio: '16:9' - modalities: + oneOf: + - type: object + properties: + type: + type: string + enum: + - clear_tool_uses_20250919 + clear_at_least: + $ref: '#/components/schemas/AnthropicInputTokensClearAtLeast' + clear_tool_inputs: + anyOf: + - type: boolean + - type: array + items: + type: string + - nullable: true + exclude_tools: + type: array + nullable: true + items: + type: string + keep: + $ref: '#/components/schemas/AnthropicToolUsesKeep' + trigger: + oneOf: + - $ref: '#/components/schemas/AnthropicInputTokensTrigger' + - $ref: '#/components/schemas/AnthropicToolUsesTrigger' + discriminator: + propertyName: type + mapping: + input_tokens: '#/components/schemas/AnthropicInputTokensTrigger' + tool_uses: '#/components/schemas/AnthropicToolUsesTrigger' + required: + - type + - type: object + properties: + type: + type: string + enum: + - clear_thinking_20251015 + keep: + anyOf: + - $ref: '#/components/schemas/AnthropicThinkingTurns' + - type: object + properties: + type: + type: string + enum: + - all + required: + - type + - type: string + enum: + - all + required: + - type + - type: object + properties: + type: + type: string + enum: + - compact_20260112 + instructions: + type: string + nullable: true + pause_after_compaction: + type: boolean + trigger: + allOf: + - $ref: '#/components/schemas/AnthropicInputTokensTrigger' + - type: object + nullable: true + properties: {} + example: + type: input_tokens + value: 100000 + required: + - type + provider: + $ref: '#/components/schemas/ProviderPreferences' + plugins: type: array items: - type: string - enum: - - text - - image - - audio - description: Output modalities for the response. Supported values are "text", "image", and "audio". - example: - - text - - image - cache_control: - type: object - properties: - type: - type: string - enum: - - ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type + oneOf: + - $ref: '#/components/schemas/AutoRouterPlugin' + - $ref: '#/components/schemas/ModerationPlugin' + - $ref: '#/components/schemas/WebSearchPlugin' + - $ref: '#/components/schemas/FileParserPlugin' + - $ref: '#/components/schemas/ResponseHealingPlugin' + - $ref: '#/components/schemas/ContextCompressionPlugin' + discriminator: + propertyName: id + mapping: + auto-router: '#/components/schemas/AutoRouterPlugin' + moderation: '#/components/schemas/ModerationPlugin' + web: '#/components/schemas/WebSearchPlugin' + file-parser: '#/components/schemas/FileParserPlugin' + response-healing: '#/components/schemas/ResponseHealingPlugin' + context-compression: '#/components/schemas/ContextCompressionPlugin' + description: Plugins you want to enable for this request, including their settings. + route: + $ref: '#/components/schemas/DeprecatedRoute' + user: + type: string + maxLength: 256 description: >- - Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last - cacheable block in the request. Currently supported for Anthropic Claude models. - service_tier: + A unique identifier representing your end-user, which helps distinguish between different users of your app. + This allows your app to identify specific users in case of abuse reports, preventing your entire app from + being affected by the actions of individual users. Maximum of 256 characters. + session_id: type: string - nullable: true - enum: - - auto - - default - - flex - - priority - - scale - description: The service tier to use for processing this request. - example: auto + maxLength: 256 + description: >- + A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for + observability. If provided in both the request body and the x-session-id header, the body value takes + precedence. Maximum of 256 characters. + trace: + $ref: '#/components/schemas/TraceConfig' + models: + type: array + items: + type: string + speed: + allOf: + - $ref: '#/components/schemas/AnthropicSpeed' + - example: fast + description: >- + Controls output generation speed. When set to `fast`, uses a higher-speed inference configuration at + premium pricing. Defaults to `standard` when omitted. required: + - model - messages - description: Chat completion request parameters + description: Request schema for Anthropic Messages API endpoint example: + model: anthropic/claude-4.5-sonnet-20250929 + max_tokens: 1024 messages: - - role: system - content: You are a helpful assistant. - role: user - content: What is the capital of France? - model: openai/gpt-4 + content: Hello, how are you? temperature: 0.7 - max_tokens: 150 - ProviderPreferences: + ActivityItem: type: object properties: - allow_fallbacks: - type: boolean - nullable: true - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the - next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - require_parameters: - type: boolean - nullable: true - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this setting is - omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. - data_collection: - $ref: '#/components/schemas/DataCollection' - zdr: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do - not retain prompts will be used. - example: true - enforce_distillable_text: - type: boolean - nullable: true - description: >- - Whether to restrict routing to only models that allow text distillation. When true, only models where the - author has allowed distillation will be used. - example: true - order: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this - list that supports your requested model, and fall back to the next if it is unavailable. If no providers are - available, the request will fail with an error message. - only: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider - settings for this request. - ignore: - type: array - nullable: true - items: - anyOf: - - $ref: '#/components/schemas/ProviderName' - - type: string - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider - settings for this request. - quantizations: + date: + type: string + description: Date of the activity (YYYY-MM-DD format) + example: '2025-08-24' + model: + type: string + description: Model slug (e.g., "openai/gpt-4.1") + example: openai/gpt-4.1 + model_permaslug: + type: string + description: Model permaslug (e.g., "openai/gpt-4.1-2025-04-14") + example: openai/gpt-4.1-2025-04-14 + endpoint_id: + type: string + description: Unique identifier for the endpoint + example: 550e8400-e29b-41d4-a716-446655440000 + provider_name: + type: string + description: Name of the provider serving this endpoint + example: OpenAI + usage: + type: number + format: double + description: Total cost in USD (OpenRouter credits spent) + example: 0.015 + byok_usage_inference: + type: number + format: double + description: BYOK inference cost in USD (external credits spent) + example: 0.012 + requests: + type: integer + description: Number of requests made + example: 5 + prompt_tokens: + type: integer + description: Total prompt tokens used + example: 50 + completion_tokens: + type: integer + description: Total completion tokens generated + example: 125 + reasoning_tokens: + type: integer + description: Total reasoning tokens used + example: 25 + required: + - date + - model + - model_permaslug + - endpoint_id + - provider_name + - usage + - byok_usage_inference + - requests + - prompt_tokens + - completion_tokens + - reasoning_tokens + example: + date: '2025-08-24' + model: openai/gpt-4.1 + model_permaslug: openai/gpt-4.1-2025-04-14 + endpoint_id: 550e8400-e29b-41d4-a716-446655440000 + provider_name: OpenAI + usage: 0.015 + byok_usage_inference: 0.012 + requests: 5 + prompt_tokens: 50 + completion_tokens: 125 + reasoning_tokens: 25 + ActivityResponse: + type: object + properties: + data: type: array - nullable: true items: - $ref: '#/components/schemas/Quantization' - description: A list of quantization levels to filter the provider by. - sort: - allOf: - - $ref: '#/components/schemas/ProviderSort' - - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - - nullable: true - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing - is performed. - max_price: + $ref: '#/components/schemas/ActivityItem' + description: List of activity items + required: + - data + example: + data: + - date: '2025-08-24' + model: openai/gpt-4.1 + model_permaslug: openai/gpt-4.1-2025-04-14 + endpoint_id: 550e8400-e29b-41d4-a716-446655440000 + provider_name: OpenAI + usage: 0.015 + byok_usage_inference: 0.012 + requests: 5 + prompt_tokens: 50 + completion_tokens: 125 + reasoning_tokens: 25 + ForbiddenResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: type: object - properties: - prompt: - $ref: '#/components/schemas/BigNumberUnion' - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per million completion tokens - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per image - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per audio unit - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: Price per request - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for - prompt and completion. - preferred_min_throughput: - $ref: '#/components/schemas/PreferredMinThroughput' - preferred_max_latency: - $ref: '#/components/schemas/PreferredMaxLatency' - description: Provider routing preferences for the request. - PublicPricing: + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for ForbiddenResponse + example: + code: 403 + message: Only management keys can perform this operation + ForbiddenResponse: type: object properties: - prompt: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image_token: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image_output: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - audio_output: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_audio_cache: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - web_search: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - internal_reasoning: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_cache_read: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_cache_write: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - discount: - type: number + error: + $ref: '#/components/schemas/ForbiddenResponseErrorData' + user_id: + type: string + nullable: true required: - - prompt - - completion - description: Pricing information for the model + - error + description: Forbidden - Authentication successful but insufficient permissions example: - prompt: '0.00003' - completion: '0.00006' - request: '0' - image: '0' - ModelGroup: - type: string - enum: - - Router - - Media - - Other - - GPT - - Claude - - Gemini - - Grok - - Cohere - - Nova - - Qwen - - Yi - - DeepSeek - - Mistral - - Llama2 - - Llama3 - - Llama4 - - PaLM - - RWKV - - Qwen3 - example: GPT - description: Tokenizer type used by the model - InputModality: - type: string - enum: - - text - - image - - file - - audio - - video - example: text - OutputModality: + error: + code: 403 + message: Only management keys can perform this operation + ChatFinishReasonEnum: type: string + nullable: true enum: + - tool_calls + - stop + - length + - content_filter + - error + - null + example: stop + ChatContentCacheControl: + allOf: + - $ref: '#/components/schemas/AnthropicCacheControlDirective' + - type: object + properties: {} + example: + type: ephemeral + ttl: 5m + description: Cache control for the content part + ChatContentText: + type: object + properties: + type: + type: string + enum: + - text + text: + type: string + cache_control: + $ref: '#/components/schemas/ChatContentCacheControl' + required: + - type - text - - image - - embeddings - - audio - - video - example: text - ModelArchitecture: + description: Text content part + example: + type: text + text: Hello, world! + ChatContentImage: type: object properties: - tokenizer: - $ref: '#/components/schemas/ModelGroup' - instruct_type: + type: type: string - nullable: true enum: - - none - - airoboros - - alpaca - - alpaca-modif - - chatml - - claude - - code-llama - - gemma - - llama2 - - llama3 - - mistral - - nemotron - - neural - - openchat - - phi3 - - rwkv - - vicuna - - zephyr - - deepseek-r1 - - deepseek-v3.1 - - qwq - - qwen3 - example: chatml - description: Instruction format type - modality: + - image_url + image_url: + type: object + properties: + url: + type: string + description: 'URL of the image (data: URLs supported)' + detail: + type: string + enum: + - auto + - low + - high + description: Image detail level for vision models + required: + - url + required: + - type + - image_url + description: Image content part for vision models + example: + type: image_url + image_url: + url: https://example.com/image.jpg + detail: auto + ChatContentAudio: + type: object + properties: + type: type: string - nullable: true - description: Primary modality of the model - example: text->text - input_modalities: - type: array - items: - $ref: '#/components/schemas/InputModality' - description: Supported input modalities - output_modalities: - type: array - items: - $ref: '#/components/schemas/OutputModality' - description: Supported output modalities + enum: + - input_audio + input_audio: + type: object + properties: + data: + type: string + description: Base64 encoded audio data + format: + type: string + description: >- + Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by + provider. + required: + - data + - format + required: + - type + - input_audio + description: Audio input content part. Supported audio formats vary by provider. + example: + type: input_audio + input_audio: + data: SGVsbG8gV29ybGQ= + format: wav + Legacy_ChatContentVideo: + type: object + properties: + type: + type: string + enum: + - input_video + video_url: + $ref: '#/components/schemas/ChatContentVideoInput' required: - - modality - - input_modalities - - output_modalities - description: Model architecture information + - type + - video_url + description: Video input content part (legacy format - deprecated) + deprecated: true example: - tokenizer: GPT - instruct_type: chatml - modality: text->text - input_modalities: - - text - output_modalities: - - text - TopProviderInfo: + type: input_video + video_url: + url: https://example.com/video.mp4 + ChatContentVideoInput: type: object properties: - context_length: - type: number - nullable: true - description: Context length from the top provider - example: 8192 - max_completion_tokens: - type: number - nullable: true - description: Maximum completion tokens from the top provider - example: 4096 - is_moderated: - type: boolean - description: Whether the top provider moderates content - example: true + url: + type: string + description: 'URL of the video (data: URLs supported)' required: - - is_moderated - description: Information about the top provider for this model + - url + description: Video input object example: - context_length: 8192 - max_completion_tokens: 4096 - is_moderated: true - PerRequestLimits: + url: https://example.com/video.mp4 + ChatContentVideo: type: object - nullable: true properties: - prompt_tokens: - type: number - example: 1000 - description: Maximum prompt tokens per request - completion_tokens: - type: number - example: 1000 - description: Maximum completion tokens per request + type: + type: string + enum: + - video_url + video_url: + $ref: '#/components/schemas/ChatContentVideoInput' required: - - prompt_tokens - - completion_tokens - description: Per-request token limits + - type + - video_url + description: Video input content part example: - prompt_tokens: 1000 - completion_tokens: 1000 - Parameter: - type: string - enum: - - temperature - - top_p - - top_k - - min_p - - top_a - - frequency_penalty - - presence_penalty - - repetition_penalty - - max_tokens - - logit_bias - - logprobs - - top_logprobs - - seed - - response_format - - structured_outputs - - stop - - tools - - tool_choice - - parallel_tool_calls - - include_reasoning - - reasoning - - reasoning_effort - - web_search_options - - verbosity - example: temperature - DefaultParameters: + type: video_url + video_url: + url: https://example.com/video.mp4 + ChatContentFile: type: object - nullable: true properties: - temperature: - type: number - nullable: true - minimum: 0 - maximum: 2 - top_p: - type: number - nullable: true - minimum: 0 - maximum: 1 - top_k: - type: integer - nullable: true - minimum: 0 - frequency_penalty: - type: number - nullable: true - minimum: -2 - maximum: 2 - presence_penalty: - type: number - nullable: true - minimum: -2 - maximum: 2 - repetition_penalty: - type: number - nullable: true - minimum: 0 - maximum: 2 - additionalProperties: false - description: Default parameters for this model + type: + type: string + enum: + - file + file: + type: object + properties: + file_data: + type: string + description: File content as base64 data URL or URL + file_id: + type: string + description: File ID for previously uploaded files + filename: + type: string + description: Original filename + required: + - type + - file + description: File content part for document processing example: - temperature: 0.7 - top_p: 0.9 - top_k: 0 - frequency_penalty: 0 - presence_penalty: 0 - repetition_penalty: 1 - Model: + type: file + file: + file_data: https://example.com/document.pdf + filename: document.pdf + ChatContentItems: + oneOf: + - $ref: '#/components/schemas/ChatContentText' + - $ref: '#/components/schemas/ChatContentImage' + - $ref: '#/components/schemas/ChatContentAudio' + - $ref: '#/components/schemas/Legacy_ChatContentVideo' + - $ref: '#/components/schemas/ChatContentVideo' + - $ref: '#/components/schemas/ChatContentFile' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/ChatContentText' + image_url: '#/components/schemas/ChatContentImage' + input_audio: '#/components/schemas/ChatContentAudio' + input_video: '#/components/schemas/Legacy_ChatContentVideo' + video_url: '#/components/schemas/ChatContentVideo' + file: '#/components/schemas/ChatContentFile' + description: Content part for chat completion messages + example: + type: text + text: Hello, world! + ChatToolCall: type: object properties: id: type: string - description: Unique identifier for the model - example: openai/gpt-4 - canonical_slug: - type: string - description: Canonical slug for the model - example: openai/gpt-4 - hugging_face_id: - type: string - nullable: true - description: Hugging Face model identifier, if applicable - example: microsoft/DialoGPT-medium - name: + description: Tool call identifier + type: type: string - description: Display name of the model - example: GPT-4 - created: - type: number - description: Unix timestamp of when the model was created - example: 1692901234 - description: + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + arguments: + type: string + description: Function arguments as JSON string + required: + - name + - arguments + required: + - id + - type + - function + description: Tool call made by the assistant + example: + id: call_abc123 + type: function + function: + name: get_current_weather + arguments: '{"location": "Boston, MA"}' + ReasoningDetailSummary: + type: object + properties: + type: type: string - description: Description of the model - example: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. - pricing: - $ref: '#/components/schemas/PublicPricing' - context_length: - type: number - nullable: true - description: Maximum context length in tokens - example: 8192 - architecture: - $ref: '#/components/schemas/ModelArchitecture' - top_provider: - $ref: '#/components/schemas/TopProviderInfo' - per_request_limits: - $ref: '#/components/schemas/PerRequestLimits' - supported_parameters: - type: array - items: - $ref: '#/components/schemas/Parameter' - description: List of supported parameters for this model - default_parameters: - $ref: '#/components/schemas/DefaultParameters' - knowledge_cutoff: + enum: + - reasoning.summary + summary: type: string - nullable: true - description: The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. - example: '2024-10-01' - expiration_date: + id: type: string nullable: true - description: The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. - example: '2025-06-01' + format: + $ref: '#/components/schemas/ReasoningFormat' + index: + type: integer required: - - id - - canonical_slug - - name - - created - - pricing - - context_length - - architecture - - top_provider - - per_request_limits - - supported_parameters - - default_parameters - description: Information about an AI model available on OpenRouter + - type + - summary + description: Reasoning detail summary schema example: - id: openai/gpt-4 - canonical_slug: openai/gpt-4 - name: GPT-4 - created: 1692901234 - description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. - pricing: - prompt: '0.00003' - completion: '0.00006' - request: '0' - image: '0' - context_length: 8192 - architecture: - tokenizer: GPT - instruct_type: chatml - modality: text->text - input_modalities: - - text - output_modalities: - - text - top_provider: - context_length: 8192 - max_completion_tokens: 4096 - is_moderated: true - per_request_limits: null - supported_parameters: - - temperature - - top_p - - max_tokens - default_parameters: null - knowledge_cutoff: null - expiration_date: null - ModelsListResponseData: - type: array - items: - $ref: '#/components/schemas/Model' - description: List of available models - ModelsListResponse: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + ReasoningDetailEncrypted: type: object properties: + type: + type: string + enum: + - reasoning.encrypted data: - $ref: '#/components/schemas/ModelsListResponseData' + type: string + id: + type: string + nullable: true + format: + $ref: '#/components/schemas/ReasoningFormat' + index: + type: integer required: + - type - data - description: List of available models + description: Reasoning detail encrypted schema example: - data: - - id: openai/gpt-4 - canonical_slug: openai/gpt-4 - name: GPT-4 - created: 1692901234 - description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. - pricing: - prompt: '0.00003' - completion: '0.00006' - request: '0' - image: '0' - context_length: 8192 - architecture: - tokenizer: GPT - instruct_type: chatml - modality: text->text - input_modalities: - - text - output_modalities: - - text - top_provider: - context_length: 8192 - max_completion_tokens: 4096 - is_moderated: true - per_request_limits: null - supported_parameters: - - temperature - - top_p - - max_tokens - - frequency_penalty - - presence_penalty - default_parameters: null - knowledge_cutoff: null - expiration_date: null - ModelsCountResponse: + type: reasoning.encrypted + data: encrypted data + ReasoningDetailText: type: object properties: - data: - type: object - properties: - count: - type: number - description: Total number of available models - example: 150 - required: - - count - description: Model count data - example: - count: 150 + type: + type: string + enum: + - reasoning.text + text: + type: string + nullable: true + signature: + type: string + nullable: true + id: + type: string + nullable: true + format: + $ref: '#/components/schemas/ReasoningFormat' + index: + type: integer required: - - data - description: Model count data + - type + description: Reasoning detail text schema example: - data: - count: 150 - InstructType: - type: string - nullable: true - enum: - - none - - airoboros - - alpaca - - alpaca-modif - - chatml - - claude - - code-llama - - gemma - - llama2 - - llama3 - - mistral - - nemotron - - neural - - openchat - - phi3 - - rwkv - - vicuna - - zephyr - - deepseek-r1 - - deepseek-v3.1 - - qwq - - qwen3 - description: Instruction format type - EndpointStatus: - type: integer - enum: - - 0 - - -1 - - -2 - - -3 - - -5 - - -10 - example: 0 - PercentileStats: + type: reasoning.text + text: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + signature: signature + ReasoningDetailUnion: + oneOf: + - $ref: '#/components/schemas/ReasoningDetailSummary' + - $ref: '#/components/schemas/ReasoningDetailEncrypted' + - $ref: '#/components/schemas/ReasoningDetailText' + discriminator: + propertyName: type + mapping: + reasoning.summary: '#/components/schemas/ReasoningDetailSummary' + reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' + reasoning.text: '#/components/schemas/ReasoningDetailText' + description: Reasoning detail union schema + example: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + ChatReasoningDetails: + type: array + items: + $ref: '#/components/schemas/ReasoningDetailUnion' + description: Reasoning details for extended thinking models + example: + - type: thinking + thinking: Let me work through this step by step... + ChatAssistantImages: + type: array + items: + type: object + properties: + image_url: + type: object + properties: + url: + type: string + description: URL or base64-encoded data of the generated image + required: + - url + required: + - image_url + description: Generated images from image generation models + example: + - image_url: + url: data:image/png;base64,iVBORw0KGgo... + ChatAudioOutput: type: object - nullable: true properties: - p50: - type: number - description: Median (50th percentile) - example: 25.5 - p75: - type: number - description: 75th percentile - example: 35.2 - p90: - type: number - description: 90th percentile - example: 48.7 - p99: - type: number - description: 99th percentile - example: 85.3 - required: - - p50 - - p75 - - p90 - - p99 - description: >- - Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible - when authenticated with an API key or cookie; returns null for unauthenticated requests. - PublicEndpoint: + id: + type: string + description: Audio output identifier + expires_at: + type: integer + description: Audio expiration timestamp + data: + type: string + description: Base64 encoded audio data + transcript: + type: string + description: Audio transcript + description: Audio output data or reference + example: + id: audio_abc123 + expires_at: 1677652400 + data: UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1f + transcript: Hello! How can I help you today? + ChatAssistantMessage: type: object properties: + role: + type: string + enum: + - assistant + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatContentItems' + - nullable: true + description: Assistant message content name: type: string - model_id: + description: Optional name for the assistant + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatToolCall' + description: Tool calls made by the assistant + refusal: type: string - description: The unique identifier for the model (permaslug) - example: openai/gpt-4 - model_name: + nullable: true + description: Refusal message if content was refused + reasoning: type: string - context_length: - type: number - pricing: - type: object - properties: - prompt: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - completion: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - request: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image_token: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - image_output: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - audio: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - audio_output: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_audio_cache: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - web_search: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - internal_reasoning: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_cache_read: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - input_cache_write: - allOf: - - $ref: '#/components/schemas/BigNumberUnion' - - description: A number or string value representing a large number - discount: - type: number - required: - - prompt - - completion - provider_name: - $ref: '#/components/schemas/ProviderName' - tag: + nullable: true + description: Reasoning output + reasoning_details: + $ref: '#/components/schemas/ChatReasoningDetails' + images: + $ref: '#/components/schemas/ChatAssistantImages' + audio: + $ref: '#/components/schemas/ChatAudioOutput' + required: + - role + description: Assistant message for requests and responses + example: + role: assistant + content: The capital of France is Paris. + ChatTokenLogprob: + type: object + properties: + token: type: string - quantization: - allOf: - - $ref: '#/components/schemas/Quantization' - - nullable: true - max_completion_tokens: + description: The token + logprob: type: number + format: double + description: Log probability of the token + bytes: + type: array nullable: true - max_prompt_tokens: - type: number + items: + type: integer + description: UTF-8 bytes of the token + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + logprob: + type: number + format: double + bytes: + type: array + nullable: true + items: + type: integer + required: + - token + - logprob + - bytes + description: Top alternative tokens with probabilities + required: + - token + - logprob + - bytes + - top_logprobs + description: Token log probability information + example: + token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: + - token: ' Hello' + logprob: -0.612345 + bytes: null + ChatTokenLogprobs: + type: object + nullable: true + properties: + content: + type: array nullable: true - supported_parameters: + items: + $ref: '#/components/schemas/ChatTokenLogprob' + description: Log probabilities for content tokens + refusal: type: array + nullable: true items: - $ref: '#/components/schemas/Parameter' - status: - $ref: '#/components/schemas/EndpointStatus' - uptime_last_30m: - type: number + $ref: '#/components/schemas/ChatTokenLogprob' + description: Log probabilities for refusal tokens + required: + - content + description: Log probabilities for the completion + example: + content: + - token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: [] + refusal: null + ChatChoice: + type: object + properties: + finish_reason: + $ref: '#/components/schemas/ChatFinishReasonEnum' + index: + type: integer + description: Choice index + example: 0 + message: + $ref: '#/components/schemas/ChatAssistantMessage' + logprobs: + $ref: '#/components/schemas/ChatTokenLogprobs' + required: + - finish_reason + - index + - message + description: Chat completion choice + example: + finish_reason: stop + index: 0 + message: + role: assistant + content: The capital of France is Paris. + logprobs: null + ChatUsage: + type: object + properties: + completion_tokens: + type: integer + description: Number of tokens in the completion + prompt_tokens: + type: integer + description: Number of tokens in the prompt + total_tokens: + type: integer + description: Total number of tokens + completion_tokens_details: + type: object nullable: true - supports_implicit_caching: - type: boolean - latency_last_30m: - $ref: '#/components/schemas/PercentileStats' - throughput_last_30m: - allOf: - - $ref: '#/components/schemas/PercentileStats' - - description: >- - Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token - generation speed. Only visible when authenticated with an API key or cookie; returns null for - unauthenticated requests. + properties: + reasoning_tokens: + type: integer + description: Tokens used for reasoning + audio_tokens: + type: integer + description: Tokens used for audio output + accepted_prediction_tokens: + type: integer + description: Accepted prediction tokens + rejected_prediction_tokens: + type: integer + description: Rejected prediction tokens + description: Detailed completion token usage + prompt_tokens_details: + type: object + nullable: true + properties: + cached_tokens: + type: integer + description: Cached prompt tokens + cache_write_tokens: + type: integer + description: Tokens written to cache. Only returned for models with explicit caching and cache write pricing. + audio_tokens: + type: integer + description: Audio input tokens + video_tokens: + type: integer + description: Video input tokens + description: Detailed prompt token usage required: - - name - - model_id - - model_name - - context_length - - pricing - - provider_name - - tag - - quantization - - max_completion_tokens - - max_prompt_tokens - - supported_parameters - - uptime_last_30m - - supports_implicit_caching - - latency_last_30m - - throughput_last_30m - description: Information about a specific model endpoint + - completion_tokens + - prompt_tokens + - total_tokens + description: Token usage statistics example: - name: 'OpenAI: GPT-4' - model_id: openai/gpt-4 - model_name: GPT-4 - context_length: 8192 - pricing: - prompt: '0.00003' - completion: '0.00006' - request: '0' - image: '0' - provider_name: OpenAI - tag: openai - quantization: fp16 - max_completion_tokens: 4096 - max_prompt_tokens: 8192 - supported_parameters: - - temperature - - top_p - - max_tokens - status: 0 - uptime_last_30m: 99.5 - supports_implicit_caching: true - latency_last_30m: - p50: 0.25 - p75: 0.35 - p90: 0.48 - p99: 0.85 - throughput_last_30m: - p50: 45.2 - p75: 38.5 - p90: 28.3 - p99: 15.1 - ListEndpointsResponse: + completion_tokens: 15 + prompt_tokens: 10 + total_tokens: 25 + completion_tokens_details: + reasoning_tokens: 5 + prompt_tokens_details: + cached_tokens: 2 + ChatResult: type: object properties: id: type: string - description: Unique identifier for the model + description: Unique completion identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatChoice' + description: List of completion choices + created: + type: integer + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion example: openai/gpt-4 - name: + object: type: string - description: Display name of the model - example: GPT-4 - created: - type: number - description: Unix timestamp of when the model was created - example: 1692901234 - description: + enum: + - chat.completion + system_fingerprint: type: string - description: Description of the model - example: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. - architecture: - allOf: - - $ref: '#/components/schemas/ModelArchitecture' - - properties: - tokenizer: - allOf: - - $ref: '#/components/schemas/ModelGroup' - - nullable: true - instruct_type: - $ref: '#/components/schemas/InstructType' - modality: - type: string - nullable: true - description: Primary modality of the model - example: text - input_modalities: - type: array - items: - $ref: '#/components/schemas/InputModality' - description: Supported input modalities - output_modalities: - type: array - items: - $ref: '#/components/schemas/OutputModality' - description: Supported output modalities - required: - - tokenizer - - instruct_type - - modality - - input_modalities - - output_modalities - example: - tokenizer: GPT - instruct_type: chatml - modality: text - endpoints: - type: array - items: - $ref: '#/components/schemas/PublicEndpoint' - description: List of available endpoints for this model + nullable: true + description: System fingerprint + example: fp_44709d6fcb + service_tier: + type: string + nullable: true + description: The service tier used by the upstream provider for this request + example: default + usage: + $ref: '#/components/schemas/ChatUsage' required: - id - - name + - choices - created - - description - - architecture - - endpoints - description: List of available endpoints for a model + - model + - object + - system_fingerprint + description: Chat completion response example: - id: openai/gpt-4 - name: GPT-4 - created: 1692901234 - description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. - architecture: - tokenizer: GPT - instruct_type: chatml - modality: text->text - input_modalities: - - text - output_modalities: - - text - endpoints: - - name: 'OpenAI: GPT-4' - model_name: GPT-4 - context_length: 8192 - pricing: - prompt: '0.00003' - completion: '0.00006' - request: '0' - image: '0' - provider_name: OpenAI - tag: openai - quantization: fp16 - max_completion_tokens: 4096 - max_prompt_tokens: 8192 - supported_parameters: - - temperature - - top_p - - max_tokens - - frequency_penalty - - presence_penalty - status: default - uptime_last_30m: 99.5 - supports_implicit_caching: true - latency_last_30m: - p50: 0.25 - p75: 0.35 - p90: 0.48 - p99: 0.85 - throughput_last_30m: - p50: 45.2 - p75: 38.5 - p90: 28.3 - p99: 15.1 - ConflictResponseErrorData: + id: chatcmpl-123 + object: chat.completion + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + message: + role: assistant + content: The capital of France is Paris. + finish_reason: stop + usage: + prompt_tokens: 10 + completion_tokens: 15 + total_tokens: 25 + ChatStreamToolCall: + type: object + properties: + index: + type: integer + description: Tool call index in the array + example: 0 + id: + type: string + description: Tool call identifier + example: call_abc123 + type: + type: string + enum: + - function + description: Tool call type + example: function + function: + type: object + properties: + name: + type: string + description: Function name + example: get_weather + arguments: + type: string + description: Function arguments as JSON string + example: '{"location": "..."}' + description: Function call details + required: + - index + description: Tool call delta for streaming responses + example: + index: 0 + id: call_abc123 + type: function + function: + name: get_weather + arguments: '{"location": "..."}' + ChatStreamReasoningDetails: + type: array + items: + $ref: '#/components/schemas/ReasoningDetailUnion' + description: Reasoning details for extended thinking models + example: + - type: text + text: Let me think about this... + ChatStreamDelta: type: object properties: - code: - type: integer - message: + role: + type: string + enum: + - assistant + description: The role of the message author + example: assistant + content: type: string - metadata: - type: object nullable: true - additionalProperties: - nullable: true + description: Message content delta + example: Hello + reasoning: + type: string + nullable: true + description: Reasoning content delta + example: I need to + refusal: + type: string + nullable: true + description: Refusal message delta + example: null + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatStreamToolCall' + description: Tool calls delta + reasoning_details: + $ref: '#/components/schemas/ChatStreamReasoningDetails' + audio: + allOf: + - $ref: '#/components/schemas/ChatAudioOutput' + - description: Audio output data + description: Delta changes in streaming response + example: + role: assistant + content: Hello + ChatStreamChoice: + type: object + properties: + delta: + $ref: '#/components/schemas/ChatStreamDelta' + finish_reason: + $ref: '#/components/schemas/ChatFinishReasonEnum' + index: + type: integer + description: Choice index + example: 0 + logprobs: + $ref: '#/components/schemas/ChatTokenLogprobs' required: - - code - - message - description: Error data for ConflictResponse + - delta + - finish_reason + - index + description: Streaming completion choice chunk example: - code: 409 - message: Resource conflict. Please try again later. - ConflictResponse: + index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + ChatStreamChunk: type: object properties: - error: - $ref: '#/components/schemas/ConflictResponseErrorData' - user_id: + id: + type: string + description: Unique chunk identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatStreamChoice' + description: List of streaming chunk choices + created: + type: integer + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion + example: openai/gpt-4 + object: + type: string + enum: + - chat.completion.chunk + system_fingerprint: + type: string + description: System fingerprint + example: fp_44709d6fcb + service_tier: type: string nullable: true - required: - - error - description: Conflict - Resource conflict or concurrent modification - example: + description: The service tier used by the upstream provider for this request + example: default error: - code: 409 - message: Resource conflict. Please try again later. - parameters: {} - securitySchemes: - apiKey: - type: http - scheme: bearer - description: API key as bearer token in Authorization header - bearer: - type: http - scheme: bearer - description: API key as bearer token in Authorization header -paths: - /responses: - post: - x-speakeasy-name-override: send - x-speakeasy-stream-request-field: stream - tags: - - beta.responses - summary: Create a response - description: Creates a streaming or non-streaming response using OpenResponses API format - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/ResponsesRequest' - required: true - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OpenResponsesResult' - text/event-stream: - schema: - type: object - properties: - data: - $ref: '#/components/schemas/StreamEvents' - required: - - data - x-speakeasy-sse-sentinel: '[DONE]' - '400': - description: Bad Request - Invalid request parameters or malformed input - content: - application/json: - schema: - $ref: '#/components/schemas/BadRequestResponse' - '401': - description: Unauthorized - Authentication required or invalid credentials - content: - application/json: - schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '402': - description: Payment Required - Insufficient credits or quota to complete request - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentRequiredResponse' - '404': - description: Not Found - Resource does not exist - content: - application/json: - schema: - $ref: '#/components/schemas/NotFoundResponse' - '408': - description: Request Timeout - Operation exceeded time limit - content: - application/json: - schema: - $ref: '#/components/schemas/RequestTimeoutResponse' - '413': - description: Payload Too Large - Request payload exceeds size limits - content: - application/json: - schema: - $ref: '#/components/schemas/PayloadTooLargeResponse' - '422': - description: Unprocessable Entity - Semantic validation failure - content: - application/json: - schema: - $ref: '#/components/schemas/UnprocessableEntityResponse' - '429': - description: Too Many Requests - Rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsResponse' - '500': - description: Internal Server Error - Unexpected server error - content: - application/json: - schema: - $ref: '#/components/schemas/InternalServerResponse' - '502': - description: Bad Gateway - Provider/upstream API failure - content: - application/json: - schema: - $ref: '#/components/schemas/BadGatewayResponse' - '503': - description: Service Unavailable - Service temporarily unavailable - content: - application/json: - schema: - $ref: '#/components/schemas/ServiceUnavailableResponse' - '524': - description: Infrastructure Timeout - Request timed out at our edge network - content: - application/json: - schema: - $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' - '529': - description: Provider Overloaded - Provider is temporarily overloaded - content: - application/json: - schema: - $ref: '#/components/schemas/ProviderOverloadedResponse' - operationId: createResponses - /messages: - post: - x-speakeasy-ignore: true - x-speakeasy-name-override: create - x-speakeasy-stream-request-field: stream - tags: - - Anthropic Messages - summary: Create a message - description: >- - Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended - thinking. - requestBody: + type: object + properties: + message: + type: string + description: Error message + example: Rate limit exceeded + code: + type: integer + format: int32 + description: Error code + example: 429 + required: + - message + - code + description: Error information + example: + message: Rate limit exceeded + code: 429 + usage: + $ref: '#/components/schemas/ChatUsage' + required: + - id + - choices + - created + - model + - object + description: Streaming chat completion chunk + x-speakeasy-entity: ChatStreamChunk + example: + id: chatcmpl-123 + object: chat.completion.chunk + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + ChatSystemMessage: + type: object + properties: + role: + type: string + enum: + - system content: - application/json: - schema: - $ref: '#/components/schemas/MessagesRequest' - required: true - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/MessagesResult' - text/event-stream: - schema: - type: object - properties: - event: - type: string - data: - $ref: '#/components/schemas/MessagesStreamEvents' - required: - - event - - data - x-speakeasy-sse-sentinel: '[DONE]' - '400': - description: Invalid request error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '401': - description: Authentication error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '403': - description: Permission denied error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '404': - description: Not found error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '429': - description: Rate limit error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '500': - description: API error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '503': - description: Overloaded error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: - type: object - properties: - type: - type: string - message: - type: string - required: - - type - - message - required: - - type - - error - '529': - description: Overloaded error - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - error - error: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatContentText' + description: System message content + example: You are a helpful assistant. + name: + type: string + description: Optional name for the system message + example: Assistant Config + required: + - role + - content + description: System message for setting behavior + example: + role: system + content: You are a helpful assistant. + name: Assistant Config + ChatUserMessage: + type: object + properties: + role: + type: string + enum: + - user + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatContentItems' + description: User message content + example: What is the capital of France? + name: + type: string + description: Optional name for the user + example: User + required: + - role + - content + description: User message + example: + role: user + content: What is the capital of France? + ChatDeveloperMessage: + type: object + properties: + role: + type: string + enum: + - developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatContentText' + description: Developer message content + example: This is a message from the developer. + name: + type: string + description: Optional name for the developer message + example: Developer + required: + - role + - content + description: Developer message + example: + role: developer + content: This is a message from the developer. + ChatToolMessage: + type: object + properties: + role: + type: string + enum: + - tool + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatContentItems' + description: Tool response content + example: The weather in San Francisco is 72°F and sunny. + tool_call_id: + type: string + description: ID of the assistant message tool call this message responds to + example: call_abc123 + required: + - role + - content + - tool_call_id + description: Tool response message + example: + role: tool + content: The weather in San Francisco is 72°F and sunny. + tool_call_id: call_abc123 + ChatMessages: + oneOf: + - $ref: '#/components/schemas/ChatSystemMessage' + - $ref: '#/components/schemas/ChatUserMessage' + - $ref: '#/components/schemas/ChatDeveloperMessage' + - $ref: '#/components/schemas/ChatAssistantMessage' + - $ref: '#/components/schemas/ChatToolMessage' + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/ChatSystemMessage' + user: '#/components/schemas/ChatUserMessage' + developer: '#/components/schemas/ChatDeveloperMessage' + assistant: '#/components/schemas/ChatAssistantMessage' + tool: '#/components/schemas/ChatToolMessage' + description: Chat completion message with role-based discrimination + example: + role: user + content: What is the capital of France? + ModelName: + type: string + description: Model to use for completion + example: openai/gpt-4 + ChatModelNames: + type: array + items: + allOf: + - $ref: '#/components/schemas/ModelName' + - description: Available OpenRouter chat completion models + description: Models to use for completion + example: + - openai/gpt-4 + - openai/gpt-4o + ChatReasoningSummaryVerbosityEnum: + type: string + nullable: true + enum: + - auto + - concise + - detailed + - null + example: concise + ChatFormatTextConfig: + type: object + properties: + type: + type: string + enum: + - text + required: + - type + description: Default text response format + example: + type: text + ChatJsonSchemaConfig: + type: object + properties: + name: + type: string + maxLength: 64 + description: Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: math_response + description: + type: string + description: Schema description for the model + example: A mathematical response + schema: + type: object + additionalProperties: + nullable: true + description: JSON Schema object + example: + type: object + properties: + answer: + type: number + required: + - answer + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: JSON Schema configuration object + example: + name: math_response + description: A mathematical response + schema: + type: object + properties: + answer: + type: number + required: + - answer + strict: true + ChatFormatJsonSchemaConfig: + type: object + properties: + type: + type: string + enum: + - json_schema + json_schema: + $ref: '#/components/schemas/ChatJsonSchemaConfig' + required: + - type + - json_schema + description: JSON Schema response format for structured outputs + example: + type: json_schema + json_schema: + name: math_response + schema: + type: object + properties: + answer: + type: number + required: + - answer + ChatFormatGrammarConfig: + type: object + properties: + type: + type: string + enum: + - grammar + grammar: + type: string + description: Custom grammar for text generation + example: root ::= "yes" | "no" + required: + - type + - grammar + description: Custom grammar response format + example: + type: grammar + grammar: root ::= "yes" | "no" + ChatFormatPythonConfig: + type: object + properties: + type: + type: string + enum: + - python + required: + - type + description: Python code response format + example: + type: python + ChatStreamOptions: + type: object + nullable: true + properties: + include_usage: + type: boolean + description: 'Deprecated: This field has no effect. Full usage details are always included.' + example: true + deprecated: true + description: Streaming configuration options + example: + include_usage: true + ChatNamedToolChoice: + type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + example: get_weather + required: + - name + required: + - type + - function + description: Named tool choice for specific function + example: + type: function + function: + name: get_weather + ChatToolChoice: + anyOf: + - type: string + enum: + - none + - type: string + enum: + - auto + - type: string + enum: + - required + - $ref: '#/components/schemas/ChatNamedToolChoice' + description: Tool choice configuration + example: auto + ChatWebSearchShorthand: + type: object + properties: + type: + type: string + enum: + - web_search + - web_search_preview + - web_search_preview_2025_03_11 + - web_search_2025_08_26 + engine: + $ref: '#/components/schemas/WebSearchEngineEnum' + max_results: + type: integer + description: >- + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and + Parallel engines; ignored with native provider search. + example: 5 + max_total_results: + type: integer + description: >- + Maximum total number of search results across all search calls in a single request. Once this limit is + reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic + loops. + example: 20 + search_context_size: + $ref: '#/components/schemas/SearchQualityLevel' + user_location: + $ref: '#/components/schemas/WebSearchUserLocationServerTool' + allowed_domains: + type: array + items: + type: string + description: >- + Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, + OpenAI, xAI). Not supported with Firecrawl or Perplexity. + excluded_domains: + type: array + items: + type: string + description: >- + Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported + with Firecrawl, OpenAI (silently ignored), or Perplexity. + parameters: + $ref: '#/components/schemas/WebSearchConfig' + required: + - type + description: Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search. + example: + type: web_search_preview + ChatFunctionTool: + anyOf: + - type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + maxLength: 64 + description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: get_weather + description: + type: string + description: Function description for the model + example: Get the current weather for a location + parameters: + type: object + additionalProperties: + nullable: true + description: Function parameters as JSON Schema object + example: type: object properties: - type: - type: string - message: + location: type: string + description: City name required: - - type - - message - required: - - type - - error - operationId: createMessages - /activity: - get: - tags: - - Analytics - operationId: getUserActivity - summary: Get user activity grouped by endpoint + - location + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: Function definition for tool calling + example: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + required: + - location + cache_control: + $ref: '#/components/schemas/ChatContentCacheControl' + required: + - type + - function + - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/OpenRouterWebSearchServerTool' + - $ref: '#/components/schemas/ChatWebSearchShorthand' + description: Tool definition for function calling (regular function or OpenRouter built-in server tool) + example: + type: function + function: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + unit: + type: string + enum: + - celsius + - fahrenheit + required: + - location + ChatDebugOptions: + type: object + properties: + echo_upstream_body: + type: boolean + description: >- + If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only + works with streaming mode. + example: true + description: Debug options for inspecting request transformations (streaming only) + example: + echo_upstream_body: true + ChatRequest: + type: object + properties: + provider: + $ref: '#/components/schemas/ProviderPreferences' + plugins: + type: array + items: + oneOf: + - $ref: '#/components/schemas/AutoRouterPlugin' + - $ref: '#/components/schemas/ModerationPlugin' + - $ref: '#/components/schemas/WebSearchPlugin' + - $ref: '#/components/schemas/FileParserPlugin' + - $ref: '#/components/schemas/ResponseHealingPlugin' + - $ref: '#/components/schemas/ContextCompressionPlugin' + discriminator: + propertyName: id + mapping: + auto-router: '#/components/schemas/AutoRouterPlugin' + moderation: '#/components/schemas/ModerationPlugin' + web: '#/components/schemas/WebSearchPlugin' + file-parser: '#/components/schemas/FileParserPlugin' + response-healing: '#/components/schemas/ResponseHealingPlugin' + context-compression: '#/components/schemas/ContextCompressionPlugin' + description: Plugins you want to enable for this request, including their settings. + route: + $ref: '#/components/schemas/DeprecatedRoute' + user: + type: string + description: Unique user identifier + example: user-123 + session_id: + type: string + maxLength: 256 + description: >- + A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for + observability. If provided in both the request body and the x-session-id header, the body value takes + precedence. Maximum of 256 characters. + trace: + $ref: '#/components/schemas/TraceConfig' + messages: + type: array + items: + $ref: '#/components/schemas/ChatMessages' + minItems: 1 + description: List of messages for the conversation + example: + - role: user + content: Hello! + model: + $ref: '#/components/schemas/ModelName' + models: + $ref: '#/components/schemas/ChatModelNames' + frequency_penalty: + type: number + format: double + description: Frequency penalty (-2.0 to 2.0) + example: 0 + logit_bias: + type: object + nullable: true + additionalProperties: + type: number + format: double + description: Token logit bias adjustments + example: + '50256': -100 + logprobs: + type: boolean + nullable: true + description: Return log probabilities + example: false + top_logprobs: + type: integer + description: Number of top log probabilities to return (0-20) + example: 5 + max_completion_tokens: + type: integer + description: Maximum tokens in completion + example: 100 + max_tokens: + type: integer + description: 'Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.' + example: 100 + metadata: + type: object + additionalProperties: + type: string + description: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + example: + user_id: user-123 + session_id: session-456 + presence_penalty: + type: number + format: double + description: Presence penalty (-2.0 to 2.0) + example: 0 + reasoning: + type: object + properties: + effort: + type: string + nullable: true + enum: + - xhigh + - high + - medium + - low + - minimal + - none + - null + description: Constrains effort on reasoning for reasoning models + example: medium + summary: + $ref: '#/components/schemas/ChatReasoningSummaryVerbosityEnum' + description: Configuration options for reasoning models + example: + effort: medium + summary: concise + response_format: + oneOf: + - $ref: '#/components/schemas/ChatFormatTextConfig' + - $ref: '#/components/schemas/FormatJsonObjectConfig' + - $ref: '#/components/schemas/ChatFormatJsonSchemaConfig' + - $ref: '#/components/schemas/ChatFormatGrammarConfig' + - $ref: '#/components/schemas/ChatFormatPythonConfig' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/ChatFormatTextConfig' + json_object: '#/components/schemas/FormatJsonObjectConfig' + json_schema: '#/components/schemas/ChatFormatJsonSchemaConfig' + grammar: '#/components/schemas/ChatFormatGrammarConfig' + python: '#/components/schemas/ChatFormatPythonConfig' + description: Response format configuration + example: + type: json_object + seed: + type: integer + description: Random seed for deterministic outputs + example: 42 + stop: + anyOf: + - type: string + - type: array + items: + type: string + maxItems: 4 + - nullable: true + description: Stop sequences (up to 4) + example: + - |+ + + stream: + type: boolean + default: false + description: Enable streaming response + example: false + stream_options: + $ref: '#/components/schemas/ChatStreamOptions' + temperature: + type: number + format: double + description: Sampling temperature (0-2) + example: 0.7 + parallel_tool_calls: + type: boolean + nullable: true + description: >- + Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool + calls in a single response. + example: true + tool_choice: + $ref: '#/components/schemas/ChatToolChoice' + tools: + type: array + items: + $ref: '#/components/schemas/ChatFunctionTool' + description: Available tools for function calling + example: + - type: function + function: + name: get_weather + description: Get weather + top_p: + type: number + format: double + description: Nucleus sampling parameter (0-1) + example: 1 + debug: + $ref: '#/components/schemas/ChatDebugOptions' + image_config: + type: object + additionalProperties: + anyOf: + - type: string + - type: number + format: double + - type: array + items: + nullable: true + description: >- + Provider-specific image configuration options. Keys and values vary by model/provider. See + https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + example: + aspect_ratio: '16:9' + modalities: + type: array + items: + type: string + enum: + - text + - image + - audio + description: Output modalities for the response. Supported values are "text", "image", and "audio". + example: + - text + - image + cache_control: + allOf: + - $ref: '#/components/schemas/AnthropicCacheControlDirective' + - description: >- + Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the + last cacheable block in the request. Currently supported for Anthropic Claude models. + service_tier: + type: string + nullable: true + enum: + - auto + - default + - flex + - priority + - scale + - null + description: The service tier to use for processing this request. + example: auto + required: + - messages + description: Chat completion request parameters + example: + messages: + - role: system + content: You are a helpful assistant. + - role: user + content: What is the capital of France? + model: openai/gpt-4 + temperature: 0.7 + max_tokens: 150 + GoneResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for GoneResponse + example: + code: 410 + message: >- + The Coinbase APIs used by this endpoint have been deprecated, so the Coinbase Commerce credits API has been + removed. Use the web credits purchase flow instead. + GoneResponse: + type: object + properties: + error: + $ref: '#/components/schemas/GoneResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Gone - Endpoint has been permanently removed or deprecated + example: + error: + code: 410 + message: >- + The Coinbase APIs used by this endpoint have been deprecated, so the Coinbase Commerce credits API has been + removed. Use the web credits purchase flow instead. + ProviderResponse: + type: object + properties: + id: + type: string + description: Upstream provider response identifier + example: chatcmpl-abc123 + endpoint_id: + type: string + description: Internal endpoint identifier + example: ep_abc123 + model_permaslug: + type: string + description: Canonical model slug + example: openai/gpt-4 + provider_name: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AkashML + - AI21 + - AionLabs + - Alibaba + - Ambient + - Amazon Bedrock + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - InferenceNet + - Ionstream + - Infermatic + - Io Net + - Inflection + - Liquid + - Mara + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Reka + - Relace + - SambaNova + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + description: Name of the provider + example: OpenAI + status: + type: number + nullable: true + description: HTTP status code from the provider + example: 200 + latency: + type: number + description: Response latency in milliseconds + example: 1200 + is_byok: + type: boolean + description: Whether the request used a bring-your-own-key + example: false + required: + - status + description: Details of a provider response for a generation attempt + example: + id: chatcmpl-abc123 + endpoint_id: ep_abc123 + model_permaslug: openai/gpt-4 + provider_name: OpenAI + status: 200 + latency: 1200 + is_byok: false + ModelsCountResponse: + type: object + properties: + data: + type: object + properties: + count: + type: integer + description: Total number of available models + example: 150 + required: + - count + description: Model count data + example: + count: 150 + required: + - data + description: Model count data + example: + data: + count: 150 + PublicPricing: + type: object + properties: + prompt: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + completion: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + request: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image_token: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image_output: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + audio: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + audio_output: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_audio_cache: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + web_search: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + internal_reasoning: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_cache_read: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_cache_write: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + discount: + type: number + required: + - prompt + - completion + description: Pricing information for the model + example: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + ModelGroup: + type: string + enum: + - Router + - Media + - Other + - GPT + - Claude + - Gemini + - Gemma + - Grok + - Cohere + - Nova + - Qwen + - Yi + - DeepSeek + - Mistral + - Llama2 + - Llama3 + - Llama4 + - PaLM + - RWKV + - Qwen3 + example: GPT + description: Tokenizer type used by the model + InputModality: + type: string + enum: + - text + - image + - file + - audio + - video + example: text + OutputModality: + type: string + enum: + - text + - image + - embeddings + - audio + - video + - rerank + example: text + ModelArchitecture: + type: object + properties: + tokenizer: + $ref: '#/components/schemas/ModelGroup' + instruct_type: + type: string + nullable: true + enum: + - none + - airoboros + - alpaca + - alpaca-modif + - chatml + - claude + - code-llama + - gemma + - llama2 + - llama3 + - mistral + - nemotron + - neural + - openchat + - phi3 + - rwkv + - vicuna + - zephyr + - deepseek-r1 + - deepseek-v3.1 + - qwq + - qwen3 + - null + example: chatml + description: Instruction format type + modality: + type: string + nullable: true + description: Primary modality of the model + example: text->text + input_modalities: + type: array + items: + $ref: '#/components/schemas/InputModality' + description: Supported input modalities + output_modalities: + type: array + items: + $ref: '#/components/schemas/OutputModality' + description: Supported output modalities + required: + - modality + - input_modalities + - output_modalities + description: Model architecture information + example: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + TopProviderInfo: + type: object + properties: + context_length: + type: integer + description: Context length from the top provider + example: 8192 + max_completion_tokens: + type: integer + description: Maximum completion tokens from the top provider + example: 4096 + is_moderated: + type: boolean + description: Whether the top provider moderates content + example: true + required: + - is_moderated + description: Information about the top provider for this model + example: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + PerRequestLimits: + type: object + nullable: true + properties: + prompt_tokens: + type: number + example: 1000 + description: Maximum prompt tokens per request + completion_tokens: + type: number + example: 1000 + description: Maximum completion tokens per request + required: + - prompt_tokens + - completion_tokens + description: Per-request token limits + example: + prompt_tokens: 1000 + completion_tokens: 1000 + Parameter: + type: string + enum: + - temperature + - top_p + - top_k + - min_p + - top_a + - frequency_penalty + - presence_penalty + - repetition_penalty + - max_tokens + - max_completion_tokens + - logit_bias + - logprobs + - top_logprobs + - seed + - response_format + - structured_outputs + - stop + - tools + - tool_choice + - parallel_tool_calls + - include_reasoning + - reasoning + - reasoning_effort + - web_search_options + - verbosity + example: temperature + DefaultParameters: + type: object + nullable: true + properties: + temperature: + type: number + format: double + top_p: + type: number + format: double + top_k: + type: integer + nullable: true + minimum: 0 + frequency_penalty: + type: number + format: double + presence_penalty: + type: number + format: double + repetition_penalty: + type: number + format: double + additionalProperties: false + description: Default parameters for this model + example: + temperature: 0.7 + top_p: 0.9 + top_k: 0 + frequency_penalty: 0 + presence_penalty: 0 + repetition_penalty: 1 + ModelLinks: + type: object + properties: + details: + type: string + description: URL for the model details/endpoints API + example: /api/v1/models/openai/gpt-5.4/endpoints + required: + - details + description: Related API endpoints and resources for this model. + example: + details: /api/v1/models/openai/gpt-5.4/endpoints + Model: + type: object + properties: + id: + type: string + description: Unique identifier for the model + example: openai/gpt-4 + canonical_slug: + type: string + description: Canonical slug for the model + example: openai/gpt-4 + hugging_face_id: + type: string + nullable: true + description: Hugging Face model identifier, if applicable + example: microsoft/DialoGPT-medium + name: + type: string + description: Display name of the model + example: GPT-4 + created: + type: integer + description: Unix timestamp of when the model was created + example: 1692901234 + description: + type: string + description: Description of the model + example: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + $ref: '#/components/schemas/PublicPricing' + context_length: + type: integer + description: Maximum context length in tokens + example: 8192 + architecture: + $ref: '#/components/schemas/ModelArchitecture' + top_provider: + $ref: '#/components/schemas/TopProviderInfo' + per_request_limits: + $ref: '#/components/schemas/PerRequestLimits' + supported_parameters: + type: array + items: + $ref: '#/components/schemas/Parameter' + description: List of supported parameters for this model + default_parameters: + $ref: '#/components/schemas/DefaultParameters' + knowledge_cutoff: + type: string + nullable: true + description: The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. + example: '2024-10-01' + expiration_date: + type: string + nullable: true + description: The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. + example: '2025-06-01' + links: + $ref: '#/components/schemas/ModelLinks' + required: + - id + - canonical_slug + - name + - created + - pricing + - context_length + - architecture + - top_provider + - per_request_limits + - supported_parameters + - default_parameters + - links + description: Information about an AI model available on OpenRouter + example: + id: openai/gpt-4 + canonical_slug: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + top_provider: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + per_request_limits: null + supported_parameters: + - temperature + - top_p + - max_tokens + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/gpt-5.4/endpoints + ModelsListResponseData: + type: array + items: + $ref: '#/components/schemas/Model' + description: List of available models + example: + - id: openai/gpt-4 + canonical_slug: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + top_provider: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + per_request_limits: null + supported_parameters: + - temperature + - top_p + - max_tokens + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/gpt-5.4/endpoints + ModelsListResponse: + type: object + properties: + data: + $ref: '#/components/schemas/ModelsListResponseData' + required: + - data + description: List of available models + example: + data: + - id: openai/gpt-4 + canonical_slug: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + top_provider: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + per_request_limits: null + supported_parameters: + - temperature + - top_p + - max_tokens + - frequency_penalty + - presence_penalty + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/gpt-5.4/endpoints + InstructType: + type: string + nullable: true + enum: + - none + - airoboros + - alpaca + - alpaca-modif + - chatml + - claude + - code-llama + - gemma + - llama2 + - llama3 + - mistral + - nemotron + - neural + - openchat + - phi3 + - rwkv + - vicuna + - zephyr + - deepseek-r1 + - deepseek-v3.1 + - qwq + - qwen3 + - null + example: chatml + description: Instruction format type + EndpointStatus: + type: integer + enum: + - 0 + - -1 + - -2 + - -3 + - -5 + - -10 + example: 0 + PercentileStats: + type: object + nullable: true + properties: + p50: + type: number + format: double + description: Median (50th percentile) + example: 25.5 + p75: + type: number + format: double + description: 75th percentile + example: 35.2 + p90: + type: number + format: double + description: 90th percentile + example: 48.7 + p99: + type: number + format: double + description: 99th percentile + example: 85.3 + required: + - p50 + - p75 + - p90 + - p99 + example: + p50: 25.5 + p75: 35.2 + p90: 48.7 + p99: 85.3 description: >- - Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: + Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible + when authenticated with an API key or cookie; returns null for unauthenticated requests. + PublicEndpoint: + type: object + properties: + name: + type: string + model_id: + type: string + description: The unique identifier for the model (permaslug) + example: openai/gpt-4 + model_name: + type: string + context_length: + type: integer + pricing: + type: object + properties: + prompt: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + completion: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + request: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image_token: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + image_output: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + audio: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + audio_output: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_audio_cache: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + web_search: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + internal_reasoning: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_cache_read: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + input_cache_write: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number + discount: + type: number + required: + - prompt + - completion + provider_name: + $ref: '#/components/schemas/ProviderName' + tag: + type: string + quantization: + allOf: + - $ref: '#/components/schemas/Quantization' + - nullable: true + max_completion_tokens: + type: integer + max_prompt_tokens: + type: integer + supported_parameters: + type: array + items: + $ref: '#/components/schemas/Parameter' + status: + $ref: '#/components/schemas/EndpointStatus' + uptime_last_30m: + type: number + format: double + uptime_last_5m: + type: number + format: double + description: >- + Uptime percentage over the last 5 minutes, calculated as successful requests / (successful + error requests) + * 100. Rate-limited requests are excluded. Returns null if insufficient data. + uptime_last_1d: + type: number + format: double + description: >- + Uptime percentage over the last 1 day, calculated as successful requests / (successful + error requests) * + 100. Rate-limited requests are excluded. Returns null if insufficient data. + supports_implicit_caching: + type: boolean + latency_last_30m: + $ref: '#/components/schemas/PercentileStats' + throughput_last_30m: + allOf: + - $ref: '#/components/schemas/PercentileStats' + - description: >- + Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token + generation speed. Only visible when authenticated with an API key or cookie; returns null for + unauthenticated requests. + required: + - name + - model_id + - model_name + - context_length + - pricing + - provider_name + - tag + - quantization + - max_completion_tokens + - max_prompt_tokens + - supported_parameters + - uptime_last_30m + - uptime_last_5m + - uptime_last_1d + - supports_implicit_caching + - latency_last_30m + - throughput_last_30m + description: Information about a specific model endpoint + example: + name: 'OpenAI: GPT-4' + model_id: openai/gpt-4 + model_name: GPT-4 + context_length: 8192 + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + provider_name: OpenAI + tag: openai + quantization: fp16 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + supported_parameters: + - temperature + - top_p + - max_tokens + status: 0 + uptime_last_30m: 99.5 + uptime_last_5m: 100 + uptime_last_1d: 99.8 + supports_implicit_caching: true + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + ListEndpointsResponse: + type: object + properties: + id: + type: string + description: Unique identifier for the model + example: openai/gpt-4 + name: + type: string + description: Display name of the model + example: GPT-4 + created: + type: integer + description: Unix timestamp of when the model was created + example: 1692901234 + description: + type: string + description: Description of the model + example: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + architecture: + allOf: + - $ref: '#/components/schemas/ModelArchitecture' + - properties: + tokenizer: + allOf: + - $ref: '#/components/schemas/ModelGroup' + - nullable: true + instruct_type: + $ref: '#/components/schemas/InstructType' + modality: + type: string + nullable: true + description: Primary modality of the model + example: text + input_modalities: + type: array + items: + $ref: '#/components/schemas/InputModality' + description: Supported input modalities + output_modalities: + type: array + items: + $ref: '#/components/schemas/OutputModality' + description: Supported output modalities + required: + - tokenizer + - instruct_type + - modality + - input_modalities + - output_modalities + example: + tokenizer: GPT + instruct_type: chatml + modality: text + endpoints: + type: array + items: + $ref: '#/components/schemas/PublicEndpoint' + description: List of available endpoints for this model + required: + - id + - name + - created + - description + - architecture + - endpoints + description: List of available endpoints for a model + example: + id: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + endpoints: + - name: 'OpenAI: GPT-4' + model_name: GPT-4 + context_length: 8192 + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + provider_name: OpenAI + tag: openai + quantization: fp16 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + supported_parameters: + - temperature + - top_p + - max_tokens + - frequency_penalty + - presence_penalty + status: default + uptime_last_30m: 99.5 + uptime_last_5m: 100 + uptime_last_1d: 99.8 + supports_implicit_caching: true + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + GuardrailInterval: + type: string + nullable: true + enum: + - daily + - weekly + - monthly + - null + description: Interval at which the limit resets (daily, weekly, monthly) + example: monthly + Guardrail: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the guardrail + example: 550e8400-e29b-41d4-a716-446655440000 + name: + type: string + description: Name of the guardrail + example: Production Guardrail + description: + type: string + nullable: true + description: Description of the guardrail + example: Guardrail for production environment + limit_usd: + type: number + format: double + description: Spending limit in USD + example: 100 + reset_interval: + $ref: '#/components/schemas/GuardrailInterval' + allowed_providers: + type: array + nullable: true + items: + type: string + description: List of allowed provider IDs + example: + - openai + - anthropic + - google + ignored_providers: + type: array + nullable: true + items: + type: string + description: List of provider IDs to exclude from routing + example: + - azure + allowed_models: + type: array + nullable: true + items: + type: string + description: Array of model canonical_slugs (immutable identifiers) + example: + - openai/gpt-5.2-20251211 + - anthropic/claude-4.5-opus-20251124 + - deepseek/deepseek-r1-0528:free + enforce_zdr: + type: boolean + nullable: true + description: Whether to enforce zero data retention + example: false + created_at: + type: string + description: ISO 8601 timestamp of when the guardrail was created + example: '2025-08-24T10:30:00Z' + updated_at: + type: string + nullable: true + description: ISO 8601 timestamp of when the guardrail was last updated + example: '2025-08-24T15:45:00Z' + required: + - id + - name + - created_at + example: + id: 550e8400-e29b-41d4-a716-446655440000 + name: Production Guardrail + description: Guardrail for production environment + limit_usd: 100 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + ListGuardrailsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Guardrail' + description: List of guardrails + total_count: + type: integer + description: Total number of guardrails + example: 25 + required: + - data + - total_count + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + name: Production Guardrail + description: Guardrail for production environment + limit_usd: 100 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + total_count: 1 + CreateGuardrailResponse: + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/Guardrail' + - description: The created guardrail + required: + - data + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: My New Guardrail + description: A guardrail for limiting API usage + limit_usd: 50 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: null + CreateGuardrailRequest: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 200 + description: Name for the new guardrail + example: My New Guardrail + description: + type: string + nullable: true + maxLength: 1000 + description: Description of the guardrail + example: A guardrail for limiting API usage + limit_usd: + type: number + format: double + description: Spending limit in USD + example: 50 + reset_interval: + $ref: '#/components/schemas/GuardrailInterval' + allowed_providers: + type: array + nullable: true + items: + type: string + minItems: 1 + description: List of allowed provider IDs + example: + - openai + - anthropic + - deepseek + ignored_providers: + type: array + nullable: true + items: + type: string + minItems: 1 + description: List of provider IDs to exclude from routing + example: + - azure + allowed_models: + type: array + nullable: true + items: + type: string + minItems: 1 + description: Array of model identifiers (slug or canonical_slug accepted) + example: + - openai/gpt-5.2 + - anthropic/claude-4.5-opus-20251124 + - deepseek/deepseek-r1-0528:free + enforce_zdr: + type: boolean + nullable: true + description: Whether to enforce zero data retention + example: false + required: + - name + example: + name: My New Guardrail + description: A guardrail for limiting API usage + limit_usd: 50 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - deepseek + ignored_providers: null + allowed_models: null + enforce_zdr: false + GetGuardrailResponse: + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/Guardrail' + - description: The guardrail + required: + - data + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: Production Guardrail + description: Guardrail for production environment + limit_usd: 100 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + UpdateGuardrailResponse: + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/Guardrail' + - description: The updated guardrail + required: + - data + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: Updated Guardrail Name + description: Updated description + limit_usd: 75 + reset_interval: weekly + allowed_providers: + - openai + ignored_providers: null + allowed_models: null + enforce_zdr: true + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T16:00:00Z' + UpdateGuardrailRequest: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 200 + description: New name for the guardrail + example: Updated Guardrail Name + description: + type: string + nullable: true + maxLength: 1000 + description: New description for the guardrail + example: Updated description + limit_usd: + type: number + format: double + description: New spending limit in USD + example: 75 + reset_interval: + $ref: '#/components/schemas/GuardrailInterval' + allowed_providers: + type: array + nullable: true + items: type: string - description: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). - example: '2025-08-24' - required: false - description: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). - name: date - in: query - responses: - '200': - description: Returns user activity data grouped by endpoint - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/ActivityItem' - description: List of activity items - required: - - data - example: - data: - - date: '2025-08-24' - model: openai/gpt-4.1 - model_permaslug: openai/gpt-4.1-2025-04-14 - endpoint_id: 550e8400-e29b-41d4-a716-446655440000 - provider_name: OpenAI - usage: 0.015 - byok_usage_inference: 0.012 - requests: 5 - prompt_tokens: 50 - completion_tokens: 125 - reasoning_tokens: 25 - '400': - description: Bad Request - Invalid date format or date range - content: - application/json: - schema: - $ref: '#/components/schemas/BadRequestResponse' - '401': - description: Unauthorized - Authentication required or invalid credentials - content: - application/json: - schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '403': - description: Forbidden - Only management keys can fetch activity - content: - application/json: - schema: - $ref: '#/components/schemas/ForbiddenResponse' - '500': - description: Internal Server Error - Unexpected server error - content: - application/json: - schema: - $ref: '#/components/schemas/InternalServerResponse' - /chat/completions: + minItems: 1 + description: New list of allowed provider IDs + example: + - openai + - anthropic + - deepseek + ignored_providers: + type: array + nullable: true + items: + type: string + minItems: 1 + description: List of provider IDs to exclude from routing + example: + - azure + allowed_models: + type: array + nullable: true + items: + type: string + minItems: 1 + description: Array of model identifiers (slug or canonical_slug accepted) + example: + - openai/gpt-5.2 + enforce_zdr: + type: boolean + nullable: true + description: Whether to enforce zero data retention + example: true + example: + name: Updated Guardrail Name + description: Updated description + limit_usd: 75 + reset_interval: weekly + DeleteGuardrailResponse: + type: object + properties: + deleted: + type: boolean + const: true + description: Confirmation that the guardrail was deleted + example: true + required: + - deleted + example: + deleted: true + KeyAssignment: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the assignment + example: 550e8400-e29b-41d4-a716-446655440000 + key_hash: + type: string + description: Hash of the assigned API key + example: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + guardrail_id: + type: string + format: uuid + description: ID of the guardrail + example: 550e8400-e29b-41d4-a716-446655440001 + key_name: + type: string + description: Name of the API key + example: Production Key + key_label: + type: string + description: Label of the API key + example: prod-key + assigned_by: + type: string + nullable: true + description: User ID of who made the assignment + example: user_abc123 + created_at: + type: string + description: ISO 8601 timestamp of when the assignment was created + example: '2025-08-24T10:30:00Z' + required: + - id + - key_hash + - guardrail_id + - key_name + - key_label + - assigned_by + - created_at + example: + id: 550e8400-e29b-41d4-a716-446655440000 + key_hash: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + key_name: Production Key + key_label: prod-key + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + ListKeyAssignmentsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/KeyAssignment' + description: List of key assignments + total_count: + type: integer + description: Total number of key assignments for this guardrail + example: 25 + required: + - data + - total_count + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + key_hash: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + key_name: Production Key + key_label: prod-key + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + total_count: 1 + MemberAssignment: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the assignment + example: 550e8400-e29b-41d4-a716-446655440000 + user_id: + type: string + description: Clerk user ID of the assigned member + example: user_abc123 + organization_id: + type: string + description: Organization ID + example: org_xyz789 + guardrail_id: + type: string + format: uuid + description: ID of the guardrail + example: 550e8400-e29b-41d4-a716-446655440001 + assigned_by: + type: string + nullable: true + description: User ID of who made the assignment + example: user_abc123 + created_at: + type: string + description: ISO 8601 timestamp of when the assignment was created + example: '2025-08-24T10:30:00Z' + required: + - id + - user_id + - organization_id + - guardrail_id + - assigned_by + - created_at + example: + id: 550e8400-e29b-41d4-a716-446655440000 + user_id: user_abc123 + organization_id: org_xyz789 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + ListMemberAssignmentsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/MemberAssignment' + description: List of member assignments + total_count: + type: integer + description: Total number of member assignments + example: 10 + required: + - data + - total_count + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + user_id: user_abc123 + organization_id: org_xyz789 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + total_count: 1 + BulkAssignKeysResponse: + type: object + properties: + assigned_count: + type: integer + description: Number of keys successfully assigned + example: 3 + required: + - assigned_count + example: + assigned_count: 3 + BulkAssignKeysRequest: + type: object + properties: + key_hashes: + type: array + items: + type: string + minLength: 1 + minItems: 1 + description: Array of API key hashes to assign to the guardrail + example: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + required: + - key_hashes + example: + key_hashes: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + BulkAssignMembersResponse: + type: object + properties: + assigned_count: + type: integer + description: Number of members successfully assigned + example: 2 + required: + - assigned_count + example: + assigned_count: 2 + BulkAssignMembersRequest: + type: object + properties: + member_user_ids: + type: array + items: + type: string + minLength: 1 + minItems: 1 + description: Array of member user IDs to assign to the guardrail + example: + - user_abc123 + - user_def456 + required: + - member_user_ids + example: + member_user_ids: + - user_abc123 + - user_def456 + BulkUnassignKeysResponse: + type: object + properties: + unassigned_count: + type: integer + description: Number of keys successfully unassigned + example: 3 + required: + - unassigned_count + example: + unassigned_count: 3 + BulkUnassignKeysRequest: + type: object + properties: + key_hashes: + type: array + items: + type: string + minLength: 1 + minItems: 1 + description: Array of API key hashes to unassign from the guardrail + example: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + required: + - key_hashes + example: + key_hashes: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + BulkUnassignMembersResponse: + type: object + properties: + unassigned_count: + type: integer + description: Number of members successfully unassigned + example: 2 + required: + - unassigned_count + example: + unassigned_count: 2 + BulkUnassignMembersRequest: + type: object + properties: + member_user_ids: + type: array + items: + type: string + minLength: 1 + minItems: 1 + description: Array of member user IDs to unassign from the guardrail + example: + - user_abc123 + - user_def456 + required: + - member_user_ids + example: + member_user_ids: + - user_abc123 + - user_def456 + ConflictResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for ConflictResponse + example: + code: 409 + message: Resource conflict. Please try again later. + ConflictResponse: + type: object + properties: + error: + $ref: '#/components/schemas/ConflictResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Conflict - Resource conflict or concurrent modification + example: + error: + code: 409 + message: Resource conflict. Please try again later. + parameters: {} + securitySchemes: + apiKey: + type: http + scheme: bearer + description: API key as bearer token in Authorization header + bearer: + type: http + scheme: bearer + description: API key as bearer token in Authorization header +paths: + /responses: post: - x-speakeasy-group: chat x-speakeasy-name-override: send x-speakeasy-stream-request-field: stream tags: - - Chat - summary: Create a chat completion - operationId: sendChatCompletionRequest - description: >- - Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming - modes. + - beta.responses + summary: Create a response + description: Creates a streaming or non-streaming response using OpenResponses API format requestBody: content: application/json: schema: - $ref: '#/components/schemas/ChatRequest' + $ref: '#/components/schemas/ResponsesRequest' + example: + model: openai/gpt-4o + input: Tell me a joke required: true responses: '200': - description: Successful chat completion response + description: Successful response content: application/json: schema: - $ref: '#/components/schemas/ChatResult' + $ref: '#/components/schemas/OpenResponsesResult' + example: + id: resp_abc123 + object: response + created_at: 1700000000 + status: completed + output: + - type: message + role: assistant + content: + - type: output_text + text: Why did the chicken cross the road? To get to the other side! + model: openai/gpt-4o + usage: + prompt_tokens: 10 + completion_tokens: 20 + total_tokens: 30 text/event-stream: schema: type: object properties: data: - $ref: '#/components/schemas/ChatStreamChunk' + $ref: '#/components/schemas/StreamEvents' required: - data x-speakeasy-sse-sentinel: '[DONE]' + example: + data: + type: response.output_text.delta + delta: Hello '400': description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '402': description: Payment Required - Insufficient credits or quota to complete request content: application/json: schema: $ref: '#/components/schemas/PaymentRequiredResponse' + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits '404': description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '408': description: Request Timeout - Operation exceeded time limit content: application/json: schema: $ref: '#/components/schemas/RequestTimeoutResponse' + example: + error: + code: 408 + message: Operation timed out. Please try again later. '413': description: Payload Too Large - Request payload exceeds size limits content: application/json: schema: $ref: '#/components/schemas/PayloadTooLargeResponse' + example: + error: + code: 413 + message: Request payload too large '422': description: Unprocessable Entity - Semantic validation failure content: application/json: schema: $ref: '#/components/schemas/UnprocessableEntityResponse' + example: + error: + code: 422 + message: Invalid argument '429': description: Too Many Requests - Rate limit exceeded content: application/json: schema: $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error '502': description: Bad Gateway - Provider/upstream API failure content: application/json: schema: $ref: '#/components/schemas/BadGatewayResponse' + example: + error: + code: 502 + message: Provider returned error '503': description: Service Unavailable - Service temporarily unavailable content: application/json: schema: $ref: '#/components/schemas/ServiceUnavailableResponse' + example: + error: + code: 503 + message: Service temporarily unavailable '524': - description: Infrastructure Timeout - Request timed out at our edge network + description: Infrastructure Timeout - Provider request timed out at edge network content: application/json: schema: $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + example: + error: + code: 524 + message: Request timed out. Please try again later. '529': description: Provider Overloaded - Provider is temporarily overloaded content: application/json: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' - /credits: - get: - x-speakeasy-name-override: getCredits + example: + error: + code: 529 + message: Provider returned error + operationId: createResponses + /messages: + post: + x-speakeasy-ignore: true + x-speakeasy-name-override: create + x-speakeasy-stream-request-field: stream tags: - - Credits - summary: Get remaining credits - operationId: getCredits + - Anthropic Messages + summary: Create a message description: >- - Get total credits purchased and used for the authenticated user. [Management - key](/docs/guides/overview/auth/management-api-keys) required. + Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended + thinking. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesRequest' + example: + model: anthropic/claude-sonnet-4 + max_tokens: 1024 + messages: + - role: user + content: Hello, how are you? + required: true responses: '200': - description: Returns the total credits purchased and used + description: Successful response content: application/json: + schema: + $ref: '#/components/schemas/MessagesResult' + example: + id: msg_abc123 + type: message + role: assistant + content: + - type: text + text: I'm doing well, thank you for asking! How can I help you today? + model: anthropic/claude-sonnet-4 + stop_reason: end_turn + usage: + input_tokens: 12 + output_tokens: 18 + text/event-stream: schema: type: object properties: + event: + type: string data: - type: object - properties: - total_credits: - type: number - description: Total credits purchased - example: 100.5 - total_usage: - type: number - description: Total credits used - example: 25.75 - required: - - total_credits - - total_usage - example: - total_credits: 100.5 - total_usage: 25.75 + $ref: '#/components/schemas/MessagesStreamEvents' required: + - event - data - description: Total credits purchased and used - example: - data: - total_credits: 100.5 - total_usage: 25.75 + x-speakeasy-sse-sentinel: '[DONE]' + example: + event: content_block_delta + data: + type: content_block_delta + index: 0 + delta: + type: text_delta + text: Hello + '400': + description: Invalid request error + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: invalid_request_error + message: 'Invalid request: messages is required' '401': - description: Unauthorized - Authentication required or invalid credentials + description: Authentication error content: application/json: schema: - $ref: '#/components/schemas/UnauthorizedResponse' + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: authentication_error + message: Invalid API key '403': - description: Forbidden - Only management keys can fetch credits + description: Permission denied error content: application/json: schema: - $ref: '#/components/schemas/ForbiddenResponse' + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: permission_error + message: Permission denied + '404': + description: Not found error + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: not_found_error + message: Model not found + '429': + description: Rate limit error + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: rate_limit_error + message: Rate limit exceeded '500': - description: Internal Server Error - Unexpected server error + description: API error content: application/json: schema: - $ref: '#/components/schemas/InternalServerResponse' - /credits/coinbase: - post: - security: [] - x-speakeasy-name-override: createCoinbaseCharge - deprecated: true + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: api_error + message: Internal server error + '503': + description: Overloaded error + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: overloaded_error + message: Service temporarily overloaded + '529': + description: Overloaded error + content: + application/json: + schema: + $ref: '#/components/schemas/MessagesErrorResponse' + example: + type: error + error: + type: overloaded_error + message: Provider is temporarily overloaded + operationId: createMessages + /activity: + get: tags: - - Credits - summary: Deprecated Coinbase Commerce charge endpoint - operationId: createCoinbaseCharge - description: Deprecated. The Coinbase APIs used by this endpoint have been deprecated, so Coinbase Commerce charges have been removed. Use the web credits purchase flow instead. + - Analytics + operationId: getUserActivity + summary: Get user activity grouped by endpoint + description: >- + Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + parameters: + - schema: + type: string + description: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). + example: '2025-08-24' + required: false + description: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). + name: date + in: query + - schema: + type: string + description: Filter by API key hash (SHA-256 hex string, as returned by the keys API). + example: abc123def456... + required: false + description: Filter by API key hash (SHA-256 hex string, as returned by the keys API). + name: api_key_hash + in: query + - schema: + type: string + description: Filter by org member user ID. Only applicable for organization accounts. + example: user_abc123 + required: false + description: Filter by org member user ID. Only applicable for organization accounts. + name: user_id + in: query responses: - '410': - description: Gone - Coinbase Commerce charge creation has been removed + '200': + description: Returns user activity data grouped by endpoint content: application/json: schema: - $ref: '#/components/schemas/GoneResponse' - /embeddings: - post: - x-speakeasy-name-override: generate - tags: - - Embeddings - summary: Submit an embedding request - description: Submits an embedding request to the embeddings router - requestBody: - content: - application/json: - schema: - type: object - properties: - input: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - type: number - - type: array - items: - type: array - items: - type: number - - type: array - items: - type: object - properties: - content: - type: array - items: - oneOf: - - type: object - properties: - type: - type: string - enum: - - text - text: - type: string - required: - - type - - text - - type: object - properties: - type: - type: string - enum: - - image_url - image_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - image_url - required: - - content - model: - type: string - encoding_format: - type: string - enum: - - float - - base64 - dimensions: - type: integer - minimum: 0 - exclusiveMinimum: true - user: - type: string - provider: - $ref: '#/components/schemas/ProviderPreferences' - input_type: - type: string - required: - - input - - model + $ref: '#/components/schemas/ActivityResponse' + example: + data: + - date: '2025-08-24' + model: openai/gpt-4.1 + model_permaslug: openai/gpt-4.1-2025-04-14 + endpoint_id: 550e8400-e29b-41d4-a716-446655440000 + provider_name: OpenAI + usage: 0.015 + byok_usage_inference: 0.012 + requests: 5 + prompt_tokens: 50 + completion_tokens: 125 + reasoning_tokens: 25 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '403': + description: Forbidden - Authentication successful but insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenResponse' + example: + error: + code: 403 + message: Only management keys can perform this operation + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /chat/completions: + post: + x-speakeasy-group: chat + x-speakeasy-name-override: send + x-speakeasy-stream-request-field: stream + tags: + - Chat + summary: Create a chat completion + operationId: sendChatCompletionRequest + description: >- + Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming + modes. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatRequest' + example: + model: openai/gpt-4 + messages: + - role: system + content: You are a helpful assistant. + - role: user + content: What is the capital of France? + temperature: 0.7 + max_tokens: 150 required: true responses: '200': - description: Embedding response + description: Successful chat completion response content: application/json: + schema: + $ref: '#/components/schemas/ChatResult' + example: + id: chatcmpl-123 + object: chat.completion + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + message: + role: assistant + content: The capital of France is Paris. + finish_reason: stop + usage: + prompt_tokens: 25 + completion_tokens: 10 + total_tokens: 35 + text/event-stream: schema: type: object properties: - id: - type: string - object: - type: string - enum: - - list data: - type: array - items: - type: object - properties: - object: - type: string - enum: - - embedding - embedding: - anyOf: - - type: array - items: - type: number - - type: string - index: - type: number - required: - - object - - embedding - model: - type: string - usage: - type: object - properties: - prompt_tokens: - type: number - total_tokens: - type: number - cost: - type: number - required: - - prompt_tokens - - total_tokens + $ref: '#/components/schemas/ChatStreamChunk' required: - - object - data - - model - text/event-stream: - schema: - type: string - description: Not used for embeddings - embeddings do not support streaming x-speakeasy-sse-sentinel: '[DONE]' + example: + data: + id: chatcmpl-123 + object: chat.completion.chunk + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + delta: + role: assistant + content: Hello + finish_reason: null '400': description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '402': description: Payment Required - Insufficient credits or quota to complete request content: application/json: schema: $ref: '#/components/schemas/PaymentRequiredResponse' + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits '404': description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '408': + description: Request Timeout - Operation exceeded time limit + content: + application/json: + schema: + $ref: '#/components/schemas/RequestTimeoutResponse' + example: + error: + code: 408 + message: Operation timed out. Please try again later. + '413': + description: Payload Too Large - Request payload exceeds size limits + content: + application/json: + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + example: + error: + code: 413 + message: Request payload too large + '422': + description: Unprocessable Entity - Semantic validation failure + content: + application/json: + schema: + $ref: '#/components/schemas/UnprocessableEntityResponse' + example: + error: + code: 422 + message: Invalid argument '429': description: Too Many Requests - Rate limit exceeded content: application/json: schema: $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error '502': description: Bad Gateway - Provider/upstream API failure content: application/json: schema: $ref: '#/components/schemas/BadGatewayResponse' + example: + error: + code: 502 + message: Provider returned error '503': description: Service Unavailable - Service temporarily unavailable content: application/json: schema: $ref: '#/components/schemas/ServiceUnavailableResponse' + example: + error: + code: 503 + message: Service temporarily unavailable '524': - description: Cloudflare Timeout - Provider request timed out at CDN edge + description: Infrastructure Timeout - Provider request timed out at edge network content: application/json: schema: $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + example: + error: + code: 524 + message: Request timed out. Please try again later. '529': description: Provider Overloaded - Provider is temporarily overloaded content: application/json: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' - operationId: createEmbeddings - /embeddings/models: + example: + error: + code: 529 + message: Provider returned error + /credits: get: + x-speakeasy-name-override: getCredits tags: - - Embeddings - x-speakeasy-name-override: listModels - summary: List all embeddings models - description: Returns a list of all available embeddings models and their properties + - Credits + summary: Get remaining credits + operationId: getCredits + description: >- + Get total credits purchased and used for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. responses: '200': - description: Returns a list of embeddings models + description: Returns the total credits purchased and used content: application/json: schema: - $ref: '#/components/schemas/ModelsListResponse' - '400': - description: Bad Request - Invalid request parameters + type: object + properties: + data: + type: object + properties: + total_credits: + type: number + format: double + description: Total credits purchased + example: 100.5 + total_usage: + type: number + format: double + description: Total credits used + example: 25.75 + required: + - total_credits + - total_usage + example: + total_credits: 100.5 + total_usage: 25.75 + required: + - data + description: Total credits purchased and used + example: + data: + total_credits: 100.5 + total_usage: 25.75 + example: + data: + total_credits: 100.5 + total_usage: 25.75 + '401': + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: - $ref: '#/components/schemas/BadRequestResponse' + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '403': + description: Forbidden - Authentication successful but insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenResponse' + example: + error: + code: 403 + message: Only management keys can perform this operation '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - operationId: listEmbeddingsModels + example: + error: + code: 500 + message: Internal Server Error + /credits/coinbase: + post: + security: [] + x-speakeasy-name-override: createCoinbaseCharge + x-speakeasy-ignore: true + x-fern-ignore: true + deprecated: true + tags: + - Credits + summary: Deprecated Coinbase Commerce charge endpoint + operationId: createCoinbaseCharge + description: >- + Deprecated. The Coinbase APIs used by this endpoint have been deprecated, so Coinbase Commerce charges have been + removed. Use the web credits purchase flow instead. + responses: + '200': + description: This endpoint is deprecated and will never return a 200 response. + '410': + description: Gone - Endpoint has been permanently removed or deprecated + content: + application/json: + schema: + $ref: '#/components/schemas/GoneResponse' + example: + error: + code: 410 + message: >- + The Coinbase APIs used by this endpoint have been deprecated, so the Coinbase Commerce credits API + has been removed. Use the web credits purchase flow instead. /generation: get: tags: @@ -15146,7 +12682,10 @@ paths: - schema: type: string minLength: 1 + description: The generation ID + example: gen-1234567890 required: true + description: The generation ID name: id in: query responses: @@ -15171,16 +12710,17 @@ paths: example: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 total_cost: type: number + format: double description: Total cost of the generation in USD example: 0.0015 cache_discount: type: number - nullable: true + format: double description: Discount applied due to caching example: 0.0002 upstream_inference_cost: type: number - nullable: true + format: double description: Cost charged by the upstream provider example: 0.0012 created_at: @@ -15192,8 +12732,7 @@ paths: description: Model used for the generation example: sao10k/l3-stheno-8b app_id: - type: number - nullable: true + type: integer description: ID of the app that made the request example: 12345 streamed: @@ -15213,17 +12752,17 @@ paths: example: Infermatic latency: type: number - nullable: true + format: double description: Total latency in milliseconds example: 1250 moderation_latency: type: number - nullable: true + format: double description: Moderation latency in milliseconds example: 50 generation_time: type: number - nullable: true + format: double description: Time taken for generation in milliseconds example: 1200 finish_reason: @@ -15232,58 +12771,47 @@ paths: description: Reason the generation finished example: stop tokens_prompt: - type: number - nullable: true + type: integer description: Number of tokens in the prompt example: 10 tokens_completion: - type: number - nullable: true + type: integer description: Number of tokens in the completion example: 25 native_tokens_prompt: - type: number - nullable: true + type: integer description: Native prompt tokens as reported by provider example: 10 native_tokens_completion: - type: number - nullable: true + type: integer description: Native completion tokens as reported by provider example: 25 native_tokens_completion_images: - type: number - nullable: true + type: integer description: Native completion image tokens as reported by provider example: 0 native_tokens_reasoning: - type: number - nullable: true + type: integer description: Native reasoning tokens as reported by provider example: 5 native_tokens_cached: - type: number - nullable: true + type: integer description: Native cached tokens as reported by provider example: 3 num_media_prompt: - type: number - nullable: true + type: integer description: Number of media items in the prompt example: 1 num_input_audio_prompt: - type: number - nullable: true + type: integer description: Number of audio inputs in the prompt example: 0 num_media_completion: - type: number - nullable: true + type: integer description: Number of media items in the completion example: 0 num_search_results: - type: number - nullable: true + type: integer description: Number of search results included example: 5 origin: @@ -15292,6 +12820,7 @@ paths: example: https://openrouter.ai/ usage: type: number + format: double description: Usage amount in USD example: 0.0015 is_byok: @@ -15314,7 +12843,9 @@ paths: enum: - completions - embeddings + - rerank - video + - null description: Type of API used for the generation router: type: string @@ -15325,130 +12856,7 @@ paths: type: array nullable: true items: - type: object - properties: - id: - type: string - endpoint_id: - type: string - model_permaslug: - type: string - provider_name: - type: string - enum: - - AnyScale - - Atoma - - Cent-ML - - CrofAI - - Enfer - - GoPomelo - - HuggingFace - - Hyperbolic 2 - - InoCloud - - Kluster - - Lambda - - Lepton - - Lynn 2 - - Lynn - - Mancer - - Meta - - Modal - - Nineteen - - OctoAI - - Recursal - - Reflection - - Replicate - - SambaNova 2 - - SF Compute - - Targon - - Together 2 - - Ubicloud - - 01.AI - - AkashML - - AI21 - - AionLabs - - Alibaba - - Ambient - - Amazon Bedrock - - Amazon Nova - - Anthropic - - Arcee AI - - AtlasCloud - - Avian - - Azure - - BaseTen - - BytePlus - - Black Forest Labs - - Cerebras - - Chutes - - Cirrascale - - Clarifai - - Cloudflare - - Cohere - - Crusoe - - DeepInfra - - DeepSeek - - Featherless - - Fireworks - - Friendli - - GMICloud - - Google - - Google AI Studio - - Groq - - Hyperbolic - - Inception - - Inceptron - - InferenceNet - - Ionstream - - Infermatic - - Io Net - - Inflection - - Liquid - - Mara - - Mancer 2 - - Minimax - - ModelRun - - Mistral - - Modular - - Moonshot AI - - Morph - - NCompass - - Nebius - - NextBit - - Novita - - Nvidia - - OpenAI - - OpenInference - - Parasail - - Perplexity - - Phala - - Reka - - Relace - - SambaNova - - Seed - - SiliconFlow - - Sourceful - - StepFun - - Stealth - - StreamLake - - Switchpoint - - Together - - Upstage - - Venice - - WandB - - Xiaomi - - xAI - - Z.AI - - FakeProvider - status: - type: number - nullable: true - latency: - type: number - is_byok: - type: boolean - required: - - status + $ref: '#/components/schemas/ProviderResponse' description: List of provider responses for this generation, including fallback attempts user_agent: type: string @@ -15458,6 +12866,15 @@ paths: type: string nullable: true description: Referer header from the request + request_id: + type: string + nullable: true + description: Unique identifier grouping all generations from a single API request + example: req-1727282430-aBcDeFgHiJkLmNoPqRsT + session_id: + type: string + nullable: true + description: Session identifier grouping multiple generations in the same session required: - id - upstream_id @@ -15499,54 +12916,125 @@ paths: required: - data description: Generation response + example: + data: + id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + upstream_id: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 + total_cost: 0.0015 + cache_discount: 0.0002 + upstream_inference_cost: 0.0012 + created_at: '2024-07-15T23:33:19.433273+00:00' + model: sao10k/l3-stheno-8b + app_id: 12345 + streamed: true + cancelled: false + provider_name: Infermatic + latency: 1250 + moderation_latency: 50 + generation_time: 1200 + finish_reason: stop + tokens_prompt: 10 + tokens_completion: 25 + native_tokens_prompt: 10 + native_tokens_completion: 25 + native_tokens_completion_images: 0 + native_tokens_reasoning: 5 + native_tokens_cached: 3 + num_media_prompt: 1 + num_input_audio_prompt: 0 + num_media_completion: 0 + num_search_results: 5 + origin: https://openrouter.ai/ + usage: 0.0015 + is_byok: false + native_finish_reason: stop + external_user: user-123 + api_type: null + router: null + provider_responses: null + user_agent: null + http_referer: null + request_id: req-1727282430-aBcDeFgHiJkLmNoPqRsT '401': description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '402': description: Payment Required - Insufficient credits or quota to complete request content: application/json: schema: $ref: '#/components/schemas/PaymentRequiredResponse' + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits '404': - description: Not Found - Generation not found + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '429': description: Too Many Requests - Rate limit exceeded content: application/json: schema: $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error '502': description: Bad Gateway - Provider/upstream API failure content: application/json: schema: $ref: '#/components/schemas/BadGatewayResponse' + example: + error: + code: 502 + message: Provider returned error '524': - description: Infrastructure Timeout - Request timed out at our edge network + description: Infrastructure Timeout - Provider request timed out at edge network content: application/json: schema: $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + example: + error: + code: 524 + message: Request timed out. Please try again later. '529': description: Provider Overloaded - Provider is temporarily overloaded content: application/json: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' + example: + error: + code: 529 + message: Provider returned error operationId: getGeneration /models/count: get: @@ -15574,18 +13062,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ModelsCountResponse' + example: + data: + count: 150 '400': - description: Bad Request - Invalid output_modalities value + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error operationId: listModelsCount /models: get: @@ -15617,7 +13116,10 @@ paths: in: query - schema: type: string + description: Filter models by supported parameter (comma-separated) + example: temperature required: false + description: Filter models by supported parameter (comma-separated) name: supported_parameters in: query - schema: @@ -15634,12 +13136,18 @@ paths: in: query - schema: type: string + description: Return results as RSS feed + example: 'true' required: false + description: Return results as RSS feed name: use_rss in: query - schema: type: string + description: Use chat links in RSS feed items + example: 'true' required: false + description: Use chat links in RSS feed items name: use_rss_chat_links in: query responses: @@ -15649,21 +13157,67 @@ paths: application/json: schema: $ref: '#/components/schemas/ModelsListResponse' + example: + data: + - id: openai/gpt-4 + canonical_slug: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + top_provider: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + per_request_limits: null + supported_parameters: + - temperature + - top_p + - max_tokens + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/gpt-5.4/endpoints application/rss+xml: schema: type: string + example: >- + OpenRouter + Models '400': - description: Bad Request - Invalid request parameters + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error operationId: getModels /models/user: get: @@ -15672,10 +13226,10 @@ paths: x-speakeasy-name-override: listForUser description: >- List models filtered by user provider preferences, [privacy - settings](https://openrouter.ai/docs/guides/privacy/logging), and + settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region - routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). summary: List models filtered by user provider preferences, privacy settings, and guardrails security: - bearer: [] @@ -15686,24 +13240,71 @@ paths: application/json: schema: $ref: '#/components/schemas/ModelsListResponse' + example: + data: + - id: openai/gpt-4 + canonical_slug: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + top_provider: + context_length: 8192 + max_completion_tokens: 4096 + is_moderated: true + per_request_limits: null + supported_parameters: + - temperature + - top_p + - max_tokens + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/gpt-5.4/endpoints '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - No eligible endpoints found + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error operationId: listModelsUser /models/{author}/{slug}/endpoints: get: @@ -15715,12 +13316,18 @@ paths: parameters: - schema: type: string + description: The author/organization of the model + example: openai required: true + description: The author/organization of the model name: author in: path - schema: type: string + description: The model slug + example: gpt-4 required: true + description: The model slug name: slug in: path responses: @@ -15735,18 +13342,89 @@ paths: $ref: '#/components/schemas/ListEndpointsResponse' required: - data + example: + data: + id: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + endpoints: + - name: 'OpenAI: GPT-4' + model_id: openai/gpt-4 + model_name: GPT-4 + context_length: 8192 + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + provider_name: OpenAI + tag: openai + quantization: fp16 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + supported_parameters: + - temperature + - top_p + - max_tokens + status: default + uptime_last_30m: 99.5 + uptime_last_5m: 100 + uptime_last_1d: 99.8 + supports_implicit_caching: true + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + example: + data: + id: openai/gpt-4 + name: GPT-4 + created: 1692901234 + description: GPT-4 is a large multimodal model. + architecture: + tokenizer: GPT + instruct_type: chatml + modality: text->text + input_modalities: + - text + output_modalities: + - text + endpoints: [] '404': - description: Not Found - Model does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error /endpoints/zdr: get: tags: @@ -15767,12 +13445,86 @@ paths: $ref: '#/components/schemas/PublicEndpoint' required: - data + example: + data: + - name: 'OpenAI: GPT-4' + model_id: openai/gpt-4 + model_name: GPT-4 + context_length: 8192 + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + provider_name: OpenAI + tag: openai + quantization: fp16 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + supported_parameters: + - temperature + - top_p + - max_tokens + status: default + uptime_last_30m: 99.5 + uptime_last_5m: 100 + uptime_last_1d: 99.8 + supports_implicit_caching: true + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + example: + data: + - name: 'OpenAI: GPT-4' + model_id: openai/gpt-4 + model_name: GPT-4 + context_length: 8192 + pricing: + prompt: '0.00003' + completion: '0.00006' + request: '0' + image: '0' + provider_name: OpenAI + tag: openai + quantization: fp16 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + supported_parameters: + - temperature + - top_p + - max_tokens + status: default + uptime_last_30m: 99.5 + uptime_last_5m: 100 + uptime_last_1d: 99.8 + supports_implicit_caching: true + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error operationId: listEndpointsZdr /providers: get: @@ -16070,6 +13822,7 @@ paths: - ZA - ZM - ZW + - null description: ISO 3166-1 Alpha-2 country code of the provider headquarters example: US datacenters: @@ -16347,12 +14100,38 @@ paths: - IE required: - data + example: + data: + - name: OpenAI + slug: openai + privacy_policy_url: https://openai.com/privacy + terms_of_service_url: https://openai.com/terms + status_page_url: https://status.openai.com + headquarters: US + datacenters: + - US + - IE + example: + data: + - name: OpenAI + slug: openai + privacy_policy_url: https://openai.com/privacy + terms_of_service_url: https://openai.com/terms + status_page_url: https://status.openai.com + headquarters: US + datacenters: + - US + - IE '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error /keys: get: operationId: list @@ -16368,14 +14147,16 @@ paths: type: string description: Whether to include disabled API keys in the response example: 'false' + x-openrouter-type: boolean required: false description: Whether to include disabled API keys in the response name: include_disabled in: query - schema: - type: string + type: integer + minimum: 0 description: Number of API keys to skip for pagination - example: '0' + example: 0 required: false description: Number of API keys to skip for pagination name: offset @@ -16411,12 +14192,12 @@ paths: example: false limit: type: number - nullable: true + format: double description: Spending limit for the API key in USD example: 100 limit_remaining: type: number - nullable: true + format: double description: Remaining spending limit in USD example: 74.5 limit_reset: @@ -16430,34 +14211,42 @@ paths: example: false usage: type: number + format: double description: Total OpenRouter credit usage (in USD) for the API key example: 25.5 usage_daily: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC day example: 25.5 usage_weekly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) example: 25.5 usage_monthly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC month example: 25.5 byok_usage: type: number + format: double description: Total external BYOK usage (in USD) for the API key example: 17.38 byok_usage_daily: type: number + format: double description: External BYOK usage (in USD) for the current UTC day example: 17.38 byok_usage_weekly: type: number + format: double description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) example: 17.38 byok_usage_monthly: type: number + format: double description: External BYOK usage (in USD) for current UTC month example: 17.38 created_at: @@ -16530,7 +14319,279 @@ paths: data: - hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 name: My Production Key - label: Production API Key + label: Production API Key + disabled: false + limit: 100 + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + example: + data: + - hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: My Production Key + label: Production API Key + disabled: false + limit: 100 + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + post: + x-speakeasy-name-override: create + tags: + - API Keys + summary: Create a new API key + description: >- + Create a new API key for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + minLength: 1 + description: Name for the new API key + example: My New API Key + limit: + type: number + format: double + description: Optional spending limit for the API key in USD + example: 50 + limit_reset: + type: string + nullable: true + enum: + - daily + - weekly + - monthly + - null + description: >- + Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen + automatically at midnight UTC, and weeks are Monday through Sunday. + example: monthly + include_byok_in_limit: + type: boolean + description: Whether to include BYOK usage in the limit + example: true + expires_at: + type: string + nullable: true + format: date-time + description: >- + Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be + rejected + example: '2027-12-31T23:59:59Z' + creator_user_id: + type: string + nullable: true + minLength: 1 + description: >- + Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific + member is creating the key. + example: user_2dHFtVWx2n56w6HkM0000000000 + required: + - name + example: + name: My New API Key + limit: 50 + limit_reset: monthly + include_byok_in_limit: true + expires_at: '2027-12-31T23:59:59Z' + example: + name: My New API Key + limit: 50 + limit_reset: monthly + include_byok_in_limit: true + expires_at: '2027-12-31T23:59:59Z' + required: true + responses: + '201': + description: API key created successfully + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + hash: + type: string + description: Unique hash identifier for the API key + example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: + type: string + description: Name of the API key + example: My Production Key + label: + type: string + description: Human-readable label for the API key + example: sk-or-v1-0e6...1c96 + disabled: + type: boolean + description: Whether the API key is disabled + example: false + limit: + type: number + format: double + description: Spending limit for the API key in USD + example: 100 + limit_remaining: + type: number + format: double + description: Remaining spending limit in USD + example: 74.5 + limit_reset: + type: string + nullable: true + description: Type of limit reset for the API key + example: monthly + include_byok_in_limit: + type: boolean + description: Whether to include external BYOK usage in the credit limit + example: false + usage: + type: number + format: double + description: Total OpenRouter credit usage (in USD) for the API key + example: 25.5 + usage_daily: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC day + example: 25.5 + usage_weekly: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) + example: 25.5 + usage_monthly: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC month + example: 25.5 + byok_usage: + type: number + format: double + description: Total external BYOK usage (in USD) for the API key + example: 17.38 + byok_usage_daily: + type: number + format: double + description: External BYOK usage (in USD) for the current UTC day + example: 17.38 + byok_usage_weekly: + type: number + format: double + description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) + example: 17.38 + byok_usage_monthly: + type: number + format: double + description: External BYOK usage (in USD) for current UTC month + example: 17.38 + created_at: + type: string + description: ISO 8601 timestamp of when the API key was created + example: '2025-08-24T10:30:00Z' + updated_at: + type: string + nullable: true + description: ISO 8601 timestamp of when the API key was last updated + example: '2025-08-24T15:45:00Z' + expires_at: + type: string + nullable: true + format: date-time + description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration + example: '2027-12-31T23:59:59Z' + creator_user_id: + type: string + nullable: true + description: >- + The user ID of the key creator. For organization-owned keys, this is the member who created + the key. For individual users, this is the user's own ID. + example: user_2dHFtVWx2n56w6HkM0000000000 + required: + - hash + - name + - label + - disabled + - limit + - limit_remaining + - limit_reset + - include_byok_in_limit + - usage + - usage_daily + - usage_weekly + - usage_monthly + - byok_usage + - byok_usage_daily + - byok_usage_weekly + - byok_usage_monthly + - created_at + - updated_at + - creator_user_id + example: + hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: My Production Key + label: sk-or-v1-0e6...1c96 disabled: false limit: 100 limit_remaining: 74.5 @@ -16548,32 +14609,117 @@ paths: updated_at: '2025-08-24T15:45:00Z' expires_at: '2027-12-31T23:59:59Z' creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + description: The created API key information + key: + type: string + description: The actual API key string (only shown once) + example: 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 + required: + - data + - key + example: + data: + hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: My New API Key + label: My New API Key + disabled: false + limit: 50 + limit_remaining: 50 + limit_reset: monthly + include_byok_in_limit: true + usage: 0 + usage_daily: 0 + usage_weekly: 0 + usage_monthly: 0 + byok_usage: 0 + byok_usage_daily: 0 + byok_usage_weekly: 0 + byok_usage_monthly: 0 + created_at: '2025-08-24T10:30:00Z' + updated_at: null + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + key: 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 + example: + data: + hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: My New API Key + label: My New API Key + disabled: false + limit: 50 + limit_remaining: 50 + limit_reset: monthly + include_byok_in_limit: true + usage: 0 + usage_daily: 0 + usage_weekly: 0 + usage_monthly: 0 + byok_usage: 0 + byok_usage_daily: 0 + byok_usage_weekly: 0 + byok_usage_monthly: 0 + created_at: '2025-08-24T10:30:00Z' + updated_at: null + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + key: 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 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '429': description: Too Many Requests - Rate limit exceeded content: application/json: schema: $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - post: - x-speakeasy-name-override: create + example: + error: + code: 500 + message: Internal Server Error + operationId: createKeys + /keys/{hash}: + patch: + x-speakeasy-name-override: update tags: - API Keys - summary: Create a new API key - description: >- - Create a new API key for the authenticated user. [Management - key](/docs/guides/overview/auth/management-api-keys) required. + summary: Update an API key + description: Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. + parameters: + - schema: + type: string + description: The hash identifier of the API key to update + example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + required: true + description: The hash identifier of the API key to update + name: hash + in: path requestBody: content: application/json: @@ -16582,14 +14728,17 @@ paths: properties: name: type: string - minLength: 1 - description: Name for the new API key - example: My New API Key + description: New name for the API key + example: Updated API Key Name + disabled: + type: boolean + description: Whether to disable the API key + example: false limit: type: number - nullable: true - description: Optional spending limit for the API key in USD - example: 50 + format: double + description: New spending limit for the API key in USD + example: 75 limit_reset: type: string nullable: true @@ -16597,34 +14746,31 @@ paths: - daily - weekly - monthly + - null description: >- - Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen + New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. - example: monthly + example: daily include_byok_in_limit: type: boolean description: Whether to include BYOK usage in the limit example: true - expires_at: - type: string - nullable: true - format: date-time - description: >- - Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be - rejected - example: '2027-12-31T23:59:59Z' - required: - - name example: - name: My New API Key - limit: 50 - limit_reset: monthly + name: Updated API Key Name + disabled: false + limit: 75 + limit_reset: daily include_byok_in_limit: true - expires_at: '2027-12-31T23:59:59Z' + example: + name: Updated API Key Name + disabled: false + limit: 75 + limit_reset: daily + include_byok_in_limit: true required: true responses: - '201': - description: API key created successfully + '200': + description: API key updated successfully content: application/json: schema: @@ -16651,12 +14797,12 @@ paths: example: false limit: type: number - nullable: true + format: double description: Spending limit for the API key in USD example: 100 limit_remaining: type: number - nullable: true + format: double description: Remaining spending limit in USD example: 74.5 limit_reset: @@ -16670,34 +14816,42 @@ paths: example: false usage: type: number + format: double description: Total OpenRouter credit usage (in USD) for the API key example: 25.5 usage_daily: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC day example: 25.5 usage_weekly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) example: 25.5 usage_monthly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC month example: 25.5 byok_usage: type: number + format: double description: Total external BYOK usage (in USD) for the API key example: 17.38 byok_usage_daily: type: number + format: double description: External BYOK usage (in USD) for the current UTC day example: 17.38 byok_usage_weekly: type: number + format: double description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) example: 17.38 byok_usage_monthly: type: number + format: double description: External BYOK usage (in USD) for current UTC month example: 17.38 created_at: @@ -16763,122 +14917,198 @@ paths: updated_at: '2025-08-24T15:45:00Z' expires_at: '2027-12-31T23:59:59Z' creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - description: The created API key information - key: - type: string - description: The actual API key string (only shown once) - example: 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 + description: The updated API key information required: - data - - key example: data: hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 - name: My New API Key - label: My New API Key + name: Updated API Key Name + label: Updated API Key Name disabled: false - limit: 50 - limit_remaining: 50 - limit_reset: monthly + limit: 75 + limit_remaining: 49.5 + limit_reset: daily include_byok_in_limit: true - usage: 0 - usage_daily: 0 - usage_weekly: 0 - usage_monthly: 0 - byok_usage: 0 - byok_usage_daily: 0 - byok_usage_weekly: 0 - byok_usage_monthly: 0 + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 created_at: '2025-08-24T10:30:00Z' - updated_at: null - expires_at: '2027-12-31T23:59:59Z' + updated_at: '2025-08-24T16:00:00Z' + expires_at: null creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - key: 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 + example: + data: + hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: Updated API Key Name + label: Updated API Key Name + disabled: false + limit: 75 + limit_remaining: 49.5 + limit_reset: daily + include_byok_in_limit: true + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T16:00:00Z' + expires_at: null + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 '400': - description: Bad Request - Invalid request parameters + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + operationId: updateKeys + delete: + x-speakeasy-name-override: delete + tags: + - API Keys + summary: Delete an API key + description: Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. + parameters: + - schema: + type: string + description: The hash identifier of the API key to delete + example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + required: true + description: The hash identifier of the API key to delete + name: hash + in: path + responses: + '200': + description: API key deleted successfully + content: + application/json: + schema: + type: object + properties: + deleted: + type: boolean + const: true + description: Confirmation that the API key was deleted + example: true + required: + - deleted + example: + deleted: true + example: + deleted: true '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '429': description: Too Many Requests - Rate limit exceeded content: application/json: schema: $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - operationId: createKeys - /keys/{hash}: - patch: - x-speakeasy-name-override: update + example: + error: + code: 500 + message: Internal Server Error + operationId: deleteKeys + get: + operationId: getKey + x-speakeasy-name-override: get tags: - API Keys - summary: Update an API key - description: Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. + summary: Get a single API key + description: Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string - description: The hash identifier of the API key to update + description: The hash identifier of the API key to retrieve example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 required: true - description: The hash identifier of the API key to update + description: The hash identifier of the API key to retrieve name: hash in: path - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: New name for the API key - example: Updated API Key Name - disabled: - type: boolean - description: Whether to disable the API key - example: false - limit: - type: number - nullable: true - description: New spending limit for the API key in USD - example: 75 - limit_reset: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: >- - New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen - automatically at midnight UTC, and weeks are Monday through Sunday. - example: daily - include_byok_in_limit: - type: boolean - description: Whether to include BYOK usage in the limit - example: true - example: - name: Updated API Key Name - disabled: false - limit: 75 - limit_reset: daily - include_byok_in_limit: true - required: true responses: '200': - description: API key updated successfully + description: API key details content: application/json: schema: @@ -16905,12 +15135,12 @@ paths: example: false limit: type: number - nullable: true + format: double description: Spending limit for the API key in USD example: 100 limit_remaining: type: number - nullable: true + format: double description: Remaining spending limit in USD example: 74.5 limit_reset: @@ -16924,34 +15154,42 @@ paths: example: false usage: type: number + format: double description: Total OpenRouter credit usage (in USD) for the API key example: 25.5 usage_daily: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC day example: 25.5 usage_weekly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) example: 25.5 usage_monthly: type: number + format: double description: OpenRouter credit usage (in USD) for the current UTC month example: 25.5 byok_usage: type: number + format: double description: Total external BYOK usage (in USD) for the API key example: 17.38 byok_usage_daily: type: number + format: double description: External BYOK usage (in USD) for the current UTC day example: 17.38 byok_usage_weekly: type: number + format: double description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) example: 17.38 byok_usage_monthly: type: number + format: double description: External BYOK usage (in USD) for current UTC month example: 17.38 created_at: @@ -17017,19 +15255,19 @@ paths: updated_at: '2025-08-24T15:45:00Z' expires_at: '2027-12-31T23:59:59Z' creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - description: The updated API key information + description: The API key information required: - data example: data: hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 - name: Updated API Key Name - label: Updated API Key Name + name: My Production Key + label: Production API Key disabled: false - limit: 75 - limit_remaining: 49.5 - limit_reset: daily - include_byok_in_limit: true + limit: 100 + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false usage: 25.5 usage_daily: 25.5 usage_weekly: 25.5 @@ -17039,1349 +15277,1173 @@ paths: byok_usage_weekly: 17.38 byok_usage_monthly: 17.38 created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T16:00:00Z' - expires_at: null + updated_at: '2025-08-24T15:45:00Z' + expires_at: '2027-12-31T23:59:59Z' creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - '400': - description: Bad Request - Invalid request parameters + example: + data: + hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + name: My Production Key + label: Production API Key + disabled: false + limit: 100 + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + '401': + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: - $ref: '#/components/schemas/BadRequestResponse' + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /organization/members: + get: + operationId: listOrganizationMembers + x-speakeasy-name-override: listMembers + tags: + - Organization + summary: List organization members + description: >- + List all members of the organization associated with the authenticated management key. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data + parameters: + - schema: + type: integer + minimum: 0 + description: Number of records to skip for pagination + example: 0 + required: false + description: Number of records to skip for pagination + name: offset + in: query + - schema: + type: integer + minimum: 1 + maximum: 100 + description: Maximum number of records to return (max 100) + example: 50 + required: false + description: Maximum number of records to return (max 100) + name: limit + in: query + responses: + '200': + description: List of organization members + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: User ID of the organization member + example: user_2dHFtVWx2n56w6HkM0000000000 + first_name: + type: string + nullable: true + description: First name of the member + example: Jane + last_name: + type: string + nullable: true + description: Last name of the member + example: Doe + email: + type: string + description: Email address of the member + example: jane.doe@example.com + role: + type: string + enum: + - org:admin + - org:member + description: Role of the member in the organization + example: org:member + required: + - id + - first_name + - last_name + - email + - role + description: List of organization members + total_count: + type: integer + description: Total number of members in the organization + example: 25 + required: + - data + - total_count + example: + data: + - id: user_2dHFtVWx2n56w6HkM0000000000 + first_name: Jane + last_name: Doe + email: jane.doe@example.com + role: member + total_count: 25 '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - API key does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' - '429': - description: Too Many Requests - Rate limit exceeded + example: + error: + code: 404 + message: Resource not found + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /guardrails: + get: + operationId: listGuardrails + x-speakeasy-name-override: list + tags: + - Guardrails + summary: List guardrails + description: >- + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) + required. + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data + parameters: + - schema: + type: integer + minimum: 0 + description: Number of records to skip for pagination + example: 0 + required: false + description: Number of records to skip for pagination + name: offset + in: query + - schema: + type: integer + minimum: 1 + maximum: 100 + description: Maximum number of records to return (max 100) + example: 50 + required: false + description: Maximum number of records to return (max 100) + name: limit + in: query + responses: + '200': + description: List of guardrails + content: + application/json: + schema: + $ref: '#/components/schemas/ListGuardrailsResponse' + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + name: Production Guardrail + description: Guardrail for production environment + limit_usd: 100 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' + total_count: 1 + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + post: + operationId: createGuardrail + x-speakeasy-name-override: create + tags: + - Guardrails + summary: Create a guardrail + description: >- + Create a new guardrail for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGuardrailRequest' + example: + name: My New Guardrail + description: A guardrail for limiting API usage + limit_usd: 50 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - deepseek + ignored_providers: null + allowed_models: null + enforce_zdr: false + required: true + responses: + '201': + description: Guardrail created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGuardrailResponse' + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: My New Guardrail + description: A guardrail for limiting API usage + limit_usd: 50 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: null + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters + '401': + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: - $ref: '#/components/schemas/TooManyRequestsResponse' + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - operationId: updateKeys - delete: - x-speakeasy-name-override: delete + example: + error: + code: 500 + message: Internal Server Error + /guardrails/{id}: + get: + operationId: getGuardrail + x-speakeasy-name-override: get tags: - - API Keys - summary: Delete an API key - description: Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. + - Guardrails + summary: Get a guardrail + description: Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string - description: The hash identifier of the API key to delete - example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + format: uuid + description: The unique identifier of the guardrail to retrieve + example: 550e8400-e29b-41d4-a716-446655440000 required: true - description: The hash identifier of the API key to delete - name: hash + description: The unique identifier of the guardrail to retrieve + name: id in: path responses: '200': - description: API key deleted successfully + description: Guardrail details content: application/json: schema: - type: object - properties: - deleted: - type: boolean - const: true - description: Confirmation that the API key was deleted - example: true - required: - - deleted - example: - deleted: true + $ref: '#/components/schemas/GetGuardrailResponse' + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: Production Guardrail + description: Guardrail for production environment + limit_usd: 100 + reset_interval: monthly + allowed_providers: + - openai + - anthropic + - google + ignored_providers: null + allowed_models: null + enforce_zdr: false + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T15:45:00Z' '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - API key does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' - '429': - description: Too Many Requests - Rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - operationId: deleteKeys - get: - operationId: getKey - x-speakeasy-name-override: get + example: + error: + code: 500 + message: Internal Server Error + patch: + operationId: updateGuardrail + x-speakeasy-name-override: update tags: - - API Keys - summary: Get a single API key - description: Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. + - Guardrails + summary: Update a guardrail + description: Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string - description: The hash identifier of the API key to retrieve - example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 + format: uuid + description: The unique identifier of the guardrail to update + example: 550e8400-e29b-41d4-a716-446655440000 required: true - description: The hash identifier of the API key to retrieve - name: hash + description: The unique identifier of the guardrail to update + name: id in: path + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateGuardrailRequest' + example: + name: Updated Guardrail Name + description: Updated description + limit_usd: 75 + reset_interval: weekly + required: true responses: '200': - description: API key details + description: Guardrail updated successfully content: application/json: schema: - type: object - properties: - data: - type: object - properties: - hash: - type: string - description: Unique hash identifier for the API key - example: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 - name: - type: string - description: Name of the API key - example: My Production Key - label: - type: string - description: Human-readable label for the API key - example: sk-or-v1-0e6...1c96 - disabled: - type: boolean - description: Whether the API key is disabled - example: false - limit: - type: number - nullable: true - description: Spending limit for the API key in USD - example: 100 - limit_remaining: - type: number - nullable: true - description: Remaining spending limit in USD - example: 74.5 - limit_reset: - type: string - nullable: true - description: Type of limit reset for the API key - example: monthly - include_byok_in_limit: - type: boolean - description: Whether to include external BYOK usage in the credit limit - example: false - usage: - type: number - description: Total OpenRouter credit usage (in USD) for the API key - example: 25.5 - usage_daily: - type: number - description: OpenRouter credit usage (in USD) for the current UTC day - example: 25.5 - usage_weekly: - type: number - description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) - example: 25.5 - usage_monthly: - type: number - description: OpenRouter credit usage (in USD) for the current UTC month - example: 25.5 - byok_usage: - type: number - description: Total external BYOK usage (in USD) for the API key - example: 17.38 - byok_usage_daily: - type: number - description: External BYOK usage (in USD) for the current UTC day - example: 17.38 - byok_usage_weekly: - type: number - description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) - example: 17.38 - byok_usage_monthly: - type: number - description: External BYOK usage (in USD) for current UTC month - example: 17.38 - created_at: - type: string - description: ISO 8601 timestamp of when the API key was created - example: '2025-08-24T10:30:00Z' - updated_at: - type: string - nullable: true - description: ISO 8601 timestamp of when the API key was last updated - example: '2025-08-24T15:45:00Z' - expires_at: - type: string - nullable: true - format: date-time - description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration - example: '2027-12-31T23:59:59Z' - creator_user_id: - type: string - nullable: true - description: >- - The user ID of the key creator. For organization-owned keys, this is the member who created - the key. For individual users, this is the user's own ID. - example: user_2dHFtVWx2n56w6HkM0000000000 - required: - - hash - - name - - label - - disabled - - limit - - limit_remaining - - limit_reset - - include_byok_in_limit - - usage - - usage_daily - - usage_weekly - - usage_monthly - - byok_usage - - byok_usage_daily - - byok_usage_weekly - - byok_usage_monthly - - created_at - - updated_at - - creator_user_id - example: - hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 - name: My Production Key - label: sk-or-v1-0e6...1c96 - disabled: false - limit: 100 - limit_remaining: 74.5 - limit_reset: monthly - include_byok_in_limit: false - usage: 25.5 - usage_daily: 25.5 - usage_weekly: 25.5 - usage_monthly: 25.5 - byok_usage: 17.38 - byok_usage_daily: 17.38 - byok_usage_weekly: 17.38 - byok_usage_monthly: 17.38 - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - expires_at: '2027-12-31T23:59:59Z' - creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - description: The API key information - required: - - data - example: - data: - hash: f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 - name: My Production Key - label: Production API Key - disabled: false - limit: 100 - limit_remaining: 74.5 - limit_reset: monthly - include_byok_in_limit: false - usage: 25.5 - usage_daily: 25.5 - usage_weekly: 25.5 - usage_monthly: 25.5 - byok_usage: 17.38 - byok_usage_daily: 17.38 - byok_usage_weekly: 17.38 - byok_usage_monthly: 17.38 - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - expires_at: '2027-12-31T23:59:59Z' - creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + $ref: '#/components/schemas/UpdateGuardrailResponse' + example: + data: + id: 550e8400-e29b-41d4-a716-446655440000 + name: Updated Guardrail Name + description: Updated description + limit_usd: 75 + reset_interval: weekly + allowed_providers: + - openai + ignored_providers: null + allowed_models: null + enforce_zdr: true + created_at: '2025-08-24T10:30:00Z' + updated_at: '2025-08-24T16:00:00Z' + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - API key does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' - '429': - description: Too Many Requests - Rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails: - get: - operationId: listGuardrails - x-speakeasy-name-override: list + example: + error: + code: 500 + message: Internal Server Error + delete: + operationId: deleteGuardrail + x-speakeasy-name-override: delete tags: - Guardrails - summary: List guardrails - description: >- - List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) - required. + summary: Delete a guardrail + description: Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string - description: Number of records to skip for pagination - example: '0' - required: false - description: Number of records to skip for pagination - name: offset - in: query - - schema: - type: string - description: Maximum number of records to return (max 100) - example: '50' - required: false - description: Maximum number of records to return (max 100) - name: limit - in: query + format: uuid + description: The unique identifier of the guardrail to delete + example: 550e8400-e29b-41d4-a716-446655440000 + required: true + description: The unique identifier of the guardrail to delete + name: id + in: path responses: '200': - description: List of guardrails + description: Guardrail deleted successfully content: application/json: schema: - type: object - properties: - data: - type: array - items: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - name: - type: string - description: Name of the guardrail - example: Production Guardrail - description: - type: string - nullable: true - description: Description of the guardrail - example: Guardrail for production environment - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: Spending limit in USD - example: 100 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - description: List of allowed provider IDs - example: - - openai - - anthropic - - google - ignored_providers: - type: array - nullable: true - items: - type: string - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - description: Array of model canonical_slugs (immutable identifiers) - example: - - openai/gpt-5.2-20251211 - - anthropic/claude-4.5-opus-20251124 - - deepseek/deepseek-r1-0528:free - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: false - created_at: - type: string - description: ISO 8601 timestamp of when the guardrail was created - example: '2025-08-24T10:30:00Z' - updated_at: - type: string - nullable: true - description: ISO 8601 timestamp of when the guardrail was last updated - example: '2025-08-24T15:45:00Z' - required: - - id - - name - - created_at - example: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - description: List of guardrails - total_count: - type: number - description: Total number of guardrails - example: 25 - required: - - data - - total_count - example: - data: - - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - total_count: 1 + $ref: '#/components/schemas/DeleteGuardrailResponse' + example: + deleted: true '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - post: - operationId: createGuardrail - x-speakeasy-name-override: create + example: + error: + code: 500 + message: Internal Server Error + /guardrails/assignments/keys: + get: + operationId: listKeyAssignments + x-speakeasy-name-override: listKeyAssignments tags: - Guardrails - summary: Create a guardrail + summary: List all key assignments description: >- - Create a new guardrail for the authenticated user. [Management + List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - minLength: 1 - maxLength: 200 - description: Name for the new guardrail - example: My New Guardrail - description: - type: string - nullable: true - maxLength: 1000 - description: Description of the guardrail - example: A guardrail for limiting API usage - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: Spending limit in USD - example: 50 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - minItems: 1 - description: List of allowed provider IDs - example: - - openai - - anthropic - - deepseek - ignored_providers: - type: array - nullable: true - items: - type: string - minItems: 1 - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - minItems: 1 - description: Array of model identifiers (slug or canonical_slug accepted) - example: - - openai/gpt-5.2 - - anthropic/claude-4.5-opus-20251124 - - deepseek/deepseek-r1-0528:free - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: false - required: - - name - example: - name: My New Guardrail - description: A guardrail for limiting API usage - limit_usd: 50 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - deepseek - ignored_providers: null - allowed_models: null - enforce_zdr: false - required: true - responses: - '201': - description: Guardrail created successfully - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - name: - type: string - description: Name of the guardrail - example: Production Guardrail - description: - type: string - nullable: true - description: Description of the guardrail - example: Guardrail for production environment - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: Spending limit in USD - example: 100 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - description: List of allowed provider IDs - example: - - openai - - anthropic - - google - ignored_providers: - type: array - nullable: true - items: - type: string - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - description: Array of model canonical_slugs (immutable identifiers) - example: - - openai/gpt-5.2-20251211 - - anthropic/claude-4.5-opus-20251124 - - deepseek/deepseek-r1-0528:free - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: false - created_at: - type: string - description: ISO 8601 timestamp of when the guardrail was created - example: '2025-08-24T10:30:00Z' - updated_at: - type: string - nullable: true - description: ISO 8601 timestamp of when the guardrail was last updated - example: '2025-08-24T15:45:00Z' - required: - - id - - name - - created_at - example: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - description: The created guardrail - required: - - data - example: - data: - id: 550e8400-e29b-41d4-a716-446655440000 - name: My New Guardrail - description: A guardrail for limiting API usage - limit_usd: 50 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: null - '400': - description: Bad Request - Invalid request parameters + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data + parameters: + - schema: + type: integer + minimum: 0 + description: Number of records to skip for pagination + example: 0 + required: false + description: Number of records to skip for pagination + name: offset + in: query + - schema: + type: integer + minimum: 1 + maximum: 100 + description: Maximum number of records to return (max 100) + example: 50 + required: false + description: Maximum number of records to return (max 100) + name: limit + in: query + responses: + '200': + description: List of key assignments content: application/json: schema: - $ref: '#/components/schemas/BadRequestResponse' + $ref: '#/components/schemas/ListKeyAssignmentsResponse' + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + key_hash: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + key_name: Production Key + key_label: prod-key + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + total_count: 1 '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/{id}: + example: + error: + code: 500 + message: Internal Server Error + /guardrails/assignments/members: get: - operationId: getGuardrail - x-speakeasy-name-override: get + operationId: listMemberAssignments + x-speakeasy-name-override: listMemberAssignments tags: - Guardrails - summary: Get a guardrail - description: Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + summary: List all member assignments + description: >- + List all organization member guardrail assignments for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data parameters: - schema: - type: string - format: uuid - description: The unique identifier of the guardrail to retrieve - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail to retrieve - name: id - in: path + type: integer + minimum: 0 + description: Number of records to skip for pagination + example: 0 + required: false + description: Number of records to skip for pagination + name: offset + in: query + - schema: + type: integer + minimum: 1 + maximum: 100 + description: Maximum number of records to return (max 100) + example: 50 + required: false + description: Maximum number of records to return (max 100) + name: limit + in: query responses: '200': - description: Guardrail details + description: List of member assignments content: application/json: schema: - type: object - properties: - data: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - name: - type: string - description: Name of the guardrail - example: Production Guardrail - description: - type: string - nullable: true - description: Description of the guardrail - example: Guardrail for production environment - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: Spending limit in USD - example: 100 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - description: List of allowed provider IDs - example: - - openai - - anthropic - - google - ignored_providers: - type: array - nullable: true - items: - type: string - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - description: Array of model canonical_slugs (immutable identifiers) - example: - - openai/gpt-5.2-20251211 - - anthropic/claude-4.5-opus-20251124 - - deepseek/deepseek-r1-0528:free - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: false - created_at: - type: string - description: ISO 8601 timestamp of when the guardrail was created - example: '2025-08-24T10:30:00Z' - updated_at: - type: string - nullable: true - description: ISO 8601 timestamp of when the guardrail was last updated - example: '2025-08-24T15:45:00Z' - required: - - id - - name - - created_at - example: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - description: The guardrail - required: - - data - example: - data: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false + $ref: '#/components/schemas/ListMemberAssignmentsResponse' + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + user_id: user_abc123 + organization_id: org_xyz789 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + assigned_by: user_abc123 created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' + total_count: 1 '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Not Found - Guardrail does not exist - content: - application/json: - schema: - $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 401 + message: Missing Authentication header '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - patch: - operationId: updateGuardrail - x-speakeasy-name-override: update + example: + error: + code: 500 + message: Internal Server Error + /guardrails/{id}/assignments/keys: + get: + operationId: listGuardrailKeyAssignments + x-speakeasy-name-override: listGuardrailKeyAssignments tags: - Guardrails - summary: Update a guardrail - description: Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + summary: List key assignments for a guardrail + description: >- + List all API key assignments for a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data parameters: - schema: type: string format: uuid - description: The unique identifier of the guardrail to update - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail to update - name: id - in: path - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - minLength: 1 - maxLength: 200 - description: New name for the guardrail - example: Updated Guardrail Name - description: - type: string - nullable: true - maxLength: 1000 - description: New description for the guardrail - example: Updated description - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: New spending limit in USD - example: 75 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - minItems: 1 - description: New list of allowed provider IDs - example: - - openai - - anthropic - - deepseek - ignored_providers: - type: array - nullable: true - items: - type: string - minItems: 1 - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - minItems: 1 - description: Array of model identifiers (slug or canonical_slug accepted) - example: - - openai/gpt-5.2 - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: true - example: - name: Updated Guardrail Name - description: Updated description - limit_usd: 75 - reset_interval: weekly - required: true - responses: - '200': - description: Guardrail updated successfully - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - name: - type: string - description: Name of the guardrail - example: Production Guardrail - description: - type: string - nullable: true - description: Description of the guardrail - example: Guardrail for production environment - limit_usd: - type: number - nullable: true - minimum: 0 - exclusiveMinimum: true - description: Spending limit in USD - example: 100 - reset_interval: - type: string - nullable: true - enum: - - daily - - weekly - - monthly - description: Interval at which the limit resets (daily, weekly, monthly) - example: monthly - allowed_providers: - type: array - nullable: true - items: - type: string - description: List of allowed provider IDs - example: - - openai - - anthropic - - google - ignored_providers: - type: array - nullable: true - items: - type: string - description: List of provider IDs to exclude from routing - example: - - azure - allowed_models: - type: array - nullable: true - items: - type: string - description: Array of model canonical_slugs (immutable identifiers) - example: - - openai/gpt-5.2-20251211 - - anthropic/claude-4.5-opus-20251124 - - deepseek/deepseek-r1-0528:free - enforce_zdr: - type: boolean - nullable: true - description: Whether to enforce zero data retention - example: false - created_at: - type: string - description: ISO 8601 timestamp of when the guardrail was created - example: '2025-08-24T10:30:00Z' - updated_at: - type: string - nullable: true - description: ISO 8601 timestamp of when the guardrail was last updated - example: '2025-08-24T15:45:00Z' - required: - - id - - name - - created_at - example: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Production Guardrail - description: Guardrail for production environment - limit_usd: 100 - reset_interval: monthly - allowed_providers: - - openai - - anthropic - - google - ignored_providers: null - allowed_models: null - enforce_zdr: false - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T15:45:00Z' - description: The updated guardrail - required: - - data - example: - data: - id: 550e8400-e29b-41d4-a716-446655440000 - name: Updated Guardrail Name - description: Updated description - limit_usd: 75 - reset_interval: weekly - allowed_providers: - - openai - ignored_providers: null - allowed_models: null - enforce_zdr: true - created_at: '2025-08-24T10:30:00Z' - updated_at: '2025-08-24T16:00:00Z' - '400': - description: Bad Request - Invalid request parameters + description: The unique identifier of the guardrail + example: 550e8400-e29b-41d4-a716-446655440000 + required: true + description: The unique identifier of the guardrail + name: id + in: path + - schema: + type: integer + minimum: 0 + description: Number of records to skip for pagination + example: 0 + required: false + description: Number of records to skip for pagination + name: offset + in: query + - schema: + type: integer + minimum: 1 + maximum: 100 + description: Maximum number of records to return (max 100) + example: 50 + required: false + description: Maximum number of records to return (max 100) + name: limit + in: query + responses: + '200': + description: List of key assignments content: application/json: schema: - $ref: '#/components/schemas/BadRequestResponse' + $ref: '#/components/schemas/ListKeyAssignmentsResponse' + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + key_hash: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + key_name: Production Key + key_label: prod-key + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + total_count: 1 '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - Guardrail does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - delete: - operationId: deleteGuardrail - x-speakeasy-name-override: delete + example: + error: + code: 500 + message: Internal Server Error + post: + operationId: bulkAssignKeysToGuardrail + x-speakeasy-name-override: bulkAssignKeys tags: - Guardrails - summary: Delete a guardrail - description: Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + summary: Bulk assign keys to a guardrail + description: >- + Assign multiple API keys to a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string format: uuid - description: The unique identifier of the guardrail to delete + description: The unique identifier of the guardrail example: 550e8400-e29b-41d4-a716-446655440000 required: true - description: The unique identifier of the guardrail to delete + description: The unique identifier of the guardrail name: id in: path + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkAssignKeysRequest' + example: + key_hashes: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + required: true responses: '200': - description: Guardrail deleted successfully + description: Assignment result content: application/json: schema: - type: object - properties: - deleted: - type: boolean - const: true - description: Confirmation that the guardrail was deleted - example: true - required: - - deleted - example: - deleted: true + $ref: '#/components/schemas/BulkAssignKeysResponse' + example: + assigned_count: 3 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header '404': - description: Not Found - Guardrail does not exist + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/assignments/keys: + example: + error: + code: 500 + message: Internal Server Error + /guardrails/{id}/assignments/members: get: - operationId: listKeyAssignments - x-speakeasy-name-override: listKeyAssignments + operationId: listGuardrailMemberAssignments + x-speakeasy-name-override: listGuardrailMemberAssignments tags: - Guardrails - summary: List all key assignments + summary: List member assignments for a guardrail description: >- - List all API key guardrail assignments for the authenticated user. [Management + List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + x-speakeasy-pagination: + type: offsetLimit + inputs: + - name: offset + in: parameters + type: offset + - name: limit + in: parameters + type: limit + outputs: + results: $.data parameters: - schema: type: string + format: uuid + description: The unique identifier of the guardrail + example: 550e8400-e29b-41d4-a716-446655440000 + required: true + description: The unique identifier of the guardrail + name: id + in: path + - schema: + type: integer + minimum: 0 description: Number of records to skip for pagination - example: '0' + example: 0 required: false description: Number of records to skip for pagination name: offset in: query - schema: - type: string + type: integer + minimum: 1 + maximum: 100 description: Maximum number of records to return (max 100) - example: '50' + example: 50 required: false description: Maximum number of records to return (max 100) name: limit in: query responses: '200': - description: List of key assignments + description: List of member assignments content: application/json: schema: - type: object - properties: - data: - type: array - items: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the assignment - example: 550e8400-e29b-41d4-a716-446655440000 - key_hash: - type: string - description: Hash of the assigned API key - example: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 - guardrail_id: - type: string - format: uuid - description: ID of the guardrail - example: 550e8400-e29b-41d4-a716-446655440001 - key_name: - type: string - description: Name of the API key - example: Production Key - key_label: - type: string - description: Label of the API key - example: prod-key - assigned_by: - type: string - nullable: true - description: User ID of who made the assignment - example: user_abc123 - created_at: - type: string - description: ISO 8601 timestamp of when the assignment was created - example: '2025-08-24T10:30:00Z' - required: - - id - - key_hash - - guardrail_id - - key_name - - key_label - - assigned_by - - created_at - description: List of key assignments - total_count: - type: number - description: Total number of key assignments for this guardrail - example: 25 - required: - - data - - total_count + $ref: '#/components/schemas/ListMemberAssignmentsResponse' + example: + data: + - id: 550e8400-e29b-41d4-a716-446655440000 + user_id: user_abc123 + organization_id: org_xyz789 + guardrail_id: 550e8400-e29b-41d4-a716-446655440001 + assigned_by: user_abc123 + created_at: '2025-08-24T10:30:00Z' + total_count: 1 '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/assignments/members: - get: - operationId: listMemberAssignments - x-speakeasy-name-override: listMemberAssignments + example: + error: + code: 500 + message: Internal Server Error + post: + operationId: bulkAssignMembersToGuardrail + x-speakeasy-name-override: bulkAssignMembers tags: - Guardrails - summary: List all member assignments + summary: Bulk assign members to a guardrail description: >- - List all organization member guardrail assignments for the authenticated user. [Management + Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string - description: Number of records to skip for pagination - example: '0' - required: false - description: Number of records to skip for pagination - name: offset - in: query + format: uuid + description: The unique identifier of the guardrail + example: 550e8400-e29b-41d4-a716-446655440000 + required: true + description: The unique identifier of the guardrail + name: id + in: path + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkAssignMembersRequest' + example: + member_user_ids: + - user_abc123 + - user_def456 + required: true + responses: + '200': + description: Assignment result + content: + application/json: + schema: + $ref: '#/components/schemas/BulkAssignMembersResponse' + example: + assigned_count: 2 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /guardrails/{id}/assignments/keys/remove: + post: + operationId: bulkUnassignKeysFromGuardrail + x-speakeasy-name-override: bulkUnassignKeys + tags: + - Guardrails + summary: Bulk unassign keys from a guardrail + description: >- + Unassign multiple API keys from a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + parameters: - schema: type: string - description: Maximum number of records to return (max 100) - example: '50' - required: false - description: Maximum number of records to return (max 100) - name: limit - in: query + format: uuid + description: The unique identifier of the guardrail + example: 550e8400-e29b-41d4-a716-446655440000 + required: true + description: The unique identifier of the guardrail + name: id + in: path + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkUnassignKeysRequest' + example: + key_hashes: + - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + required: true responses: '200': - description: List of member assignments + description: Unassignment result content: application/json: - schema: - type: object - properties: - data: - type: array - items: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the assignment - example: 550e8400-e29b-41d4-a716-446655440000 - user_id: - type: string - description: Clerk user ID of the assigned member - example: user_abc123 - organization_id: - type: string - description: Organization ID - example: org_xyz789 - guardrail_id: - type: string - format: uuid - description: ID of the guardrail - example: 550e8400-e29b-41d4-a716-446655440001 - assigned_by: - type: string - nullable: true - description: User ID of who made the assignment - example: user_abc123 - created_at: - type: string - description: ISO 8601 timestamp of when the assignment was created - example: '2025-08-24T10:30:00Z' - required: - - id - - user_id - - organization_id - - guardrail_id - - assigned_by - - created_at - description: List of member assignments - total_count: - type: number - description: Total number of member assignments - example: 10 - required: - - data - - total_count + schema: + $ref: '#/components/schemas/BulkUnassignKeysResponse' + example: + unassigned_count: 3 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/{id}/assignments/keys: - get: - operationId: listGuardrailKeyAssignments - x-speakeasy-name-override: listGuardrailKeyAssignments + example: + error: + code: 500 + message: Internal Server Error + /guardrails/{id}/assignments/members/remove: + post: + operationId: bulkUnassignMembersFromGuardrail + x-speakeasy-name-override: bulkUnassignMembers tags: - Guardrails - summary: List key assignments for a guardrail + summary: Bulk unassign members from a guardrail description: >- - List all API key assignments for a specific guardrail. [Management + Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: @@ -18393,926 +16455,1243 @@ paths: description: The unique identifier of the guardrail name: id in: path - - schema: - type: string - description: Number of records to skip for pagination - example: '0' - required: false - description: Number of records to skip for pagination - name: offset - in: query - - schema: - type: string - description: Maximum number of records to return (max 100) - example: '50' - required: false - description: Maximum number of records to return (max 100) - name: limit - in: query + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkUnassignMembersRequest' + example: + member_user_ids: + - user_abc123 + - user_def456 + required: true responses: '200': - description: List of key assignments + description: Unassignment result + content: + application/json: + schema: + $ref: '#/components/schemas/BulkUnassignMembersResponse' + example: + unassigned_count: 2 + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /key: + get: + operationId: getCurrentKey + x-speakeasy-name-override: getCurrentKeyMetadata + tags: + - API Keys + summary: Get current API key + description: Get information on the API key associated with the current authentication session + responses: + '200': + description: API key details content: application/json: schema: type: object properties: data: - type: array - items: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the assignment - example: 550e8400-e29b-41d4-a716-446655440000 - key_hash: - type: string - description: Hash of the assigned API key - example: c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 - guardrail_id: - type: string - format: uuid - description: ID of the guardrail - example: 550e8400-e29b-41d4-a716-446655440001 - key_name: - type: string - description: Name of the API key - example: Production Key - key_label: - type: string - description: Label of the API key - example: prod-key - assigned_by: - type: string - nullable: true - description: User ID of who made the assignment - example: user_abc123 - created_at: - type: string - description: ISO 8601 timestamp of when the assignment was created - example: '2025-08-24T10:30:00Z' - required: - - id - - key_hash - - guardrail_id - - key_name - - key_label - - assigned_by - - created_at - description: List of key assignments - total_count: - type: number - description: Total number of key assignments for this guardrail - example: 25 + type: object + properties: + label: + type: string + description: Human-readable label for the API key + example: sk-or-v1-0e6...1c96 + limit: + type: number + format: double + description: Spending limit for the API key in USD + example: 100 + usage: + type: number + format: double + description: Total OpenRouter credit usage (in USD) for the API key + example: 25.5 + usage_daily: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC day + example: 25.5 + usage_weekly: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) + example: 25.5 + usage_monthly: + type: number + format: double + description: OpenRouter credit usage (in USD) for the current UTC month + example: 25.5 + byok_usage: + type: number + format: double + description: Total external BYOK usage (in USD) for the API key + example: 17.38 + byok_usage_daily: + type: number + format: double + description: External BYOK usage (in USD) for the current UTC day + example: 17.38 + byok_usage_weekly: + type: number + format: double + description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) + example: 17.38 + byok_usage_monthly: + type: number + format: double + description: External BYOK usage (in USD) for current UTC month + example: 17.38 + is_free_tier: + type: boolean + description: Whether this is a free tier API key + example: false + is_management_key: + type: boolean + description: Whether this is a management key + example: false + is_provisioning_key: + type: boolean + description: Whether this is a management key + deprecated: true + example: false + limit_remaining: + type: number + format: double + description: Remaining spending limit in USD + example: 74.5 + limit_reset: + type: string + nullable: true + description: Type of limit reset for the API key + example: monthly + include_byok_in_limit: + type: boolean + description: Whether to include external BYOK usage in the credit limit + example: false + expires_at: + type: string + nullable: true + format: date-time + description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration + example: '2027-12-31T23:59:59Z' + creator_user_id: + type: string + nullable: true + description: >- + The user ID of the key creator. For organization-owned keys, this is the member who created + the key. For individual users, this is the user's own ID. + example: user_2dHFtVWx2n56w6HkM0000000000 + rate_limit: + type: object + properties: + requests: + type: integer + description: Number of requests allowed per interval + example: 1000 + interval: + type: string + description: Rate limit interval + example: 1h + note: + type: string + description: Note about the rate limit + example: This field is deprecated and safe to ignore. + required: + - requests + - interval + - note + description: Legacy rate limit information about a key. Will always return -1. + deprecated: true + example: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. + required: + - label + - limit + - usage + - usage_daily + - usage_weekly + - usage_monthly + - byok_usage + - byok_usage_daily + - byok_usage_weekly + - byok_usage_monthly + - is_free_tier + - is_management_key + - is_provisioning_key + - limit_remaining + - limit_reset + - include_byok_in_limit + - creator_user_id + - rate_limit + description: Current API key information + example: + label: sk-or-v1-au7...890 + limit: 100 + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + is_free_tier: false + is_management_key: false + is_provisioning_key: false + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + rate_limit: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. required: - data - - total_count - '401': - description: Unauthorized - Missing or invalid authentication - content: - application/json: - schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Guardrail not found - content: - application/json: - schema: - $ref: '#/components/schemas/NotFoundResponse' - '500': - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/InternalServerResponse' - post: - operationId: bulkAssignKeysToGuardrail - x-speakeasy-name-override: bulkAssignKeys - tags: - - Guardrails - summary: Bulk assign keys to a guardrail - description: >- - Assign multiple API keys to a specific guardrail. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: - type: string - format: uuid - description: The unique identifier of the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail - name: id - in: path - requestBody: - content: - application/json: - schema: - type: object - properties: - key_hashes: - type: array - items: - type: string - minLength: 1 - minItems: 1 - description: Array of API key hashes to assign to the guardrail - example: - - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 - required: - - key_hashes - required: true - responses: - '200': - description: Assignment result - content: - application/json: - schema: - type: object - properties: - assigned_count: - type: number - description: Number of keys successfully assigned - example: 3 - required: - - assigned_count - '400': - description: Bad Request - Invalid input - content: - application/json: - schema: - $ref: '#/components/schemas/BadRequestResponse' - '401': - description: Unauthorized - Missing or invalid authentication - content: - application/json: - schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Guardrail not found - content: - application/json: - schema: - $ref: '#/components/schemas/NotFoundResponse' - '500': - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/InternalServerResponse' - /guardrails/{id}/assignments/members: - get: - operationId: listGuardrailMemberAssignments - x-speakeasy-name-override: listGuardrailMemberAssignments - tags: - - Guardrails - summary: List member assignments for a guardrail - description: >- - List all organization member assignments for a specific guardrail. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: - type: string - format: uuid - description: The unique identifier of the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail - name: id - in: path - - schema: - type: string - description: Number of records to skip for pagination - example: '0' - required: false - description: Number of records to skip for pagination - name: offset - in: query - - schema: - type: string - description: Maximum number of records to return (max 100) - example: '50' - required: false - description: Maximum number of records to return (max 100) - name: limit - in: query - responses: - '200': - description: List of member assignments - content: - application/json: - schema: - type: object - properties: + example: data: - type: array - items: - type: object - properties: - id: - type: string - format: uuid - description: Unique identifier for the assignment - example: 550e8400-e29b-41d4-a716-446655440000 - user_id: - type: string - description: Clerk user ID of the assigned member - example: user_abc123 - organization_id: - type: string - description: Organization ID - example: org_xyz789 - guardrail_id: - type: string - format: uuid - description: ID of the guardrail - example: 550e8400-e29b-41d4-a716-446655440001 - assigned_by: - type: string - nullable: true - description: User ID of who made the assignment - example: user_abc123 - created_at: - type: string - description: ISO 8601 timestamp of when the assignment was created - example: '2025-08-24T10:30:00Z' - required: - - id - - user_id - - organization_id - - guardrail_id - - assigned_by - - created_at - description: List of member assignments - total_count: - type: number - description: Total number of member assignments - example: 10 - required: - - data - - total_count + label: sk-or-v1-au7...890 + limit: 100 + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + is_free_tier: false + is_management_key: false + is_provisioning_key: false + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + rate_limit: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. + example: + data: + label: sk-or-v1-au7...890 + limit: 100 + usage: 25.5 + usage_daily: 25.5 + usage_weekly: 25.5 + usage_monthly: 25.5 + byok_usage: 17.38 + byok_usage_daily: 17.38 + byok_usage_weekly: 17.38 + byok_usage_monthly: 17.38 + is_free_tier: false + is_management_key: false + is_provisioning_key: false + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + expires_at: '2027-12-31T23:59:59Z' + creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 + rate_limit: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Guardrail not found - content: - application/json: - schema: - $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 401 + message: Missing Authentication header '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + example: + error: + code: 500 + message: Internal Server Error + /auth/keys: post: - operationId: bulkAssignMembersToGuardrail - x-speakeasy-name-override: bulkAssignMembers + operationId: exchangeAuthCodeForAPIKey tags: - - Guardrails - summary: Bulk assign members to a guardrail - description: >- - Assign multiple organization members to a specific guardrail. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: - type: string - format: uuid - description: The unique identifier of the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail - name: id - in: path + - OAuth + summary: Exchange authorization code for API key + description: Exchange an authorization code from the PKCE flow for a user-controlled API key requestBody: content: application/json: schema: type: object properties: - member_user_ids: - type: array - items: - type: string - minLength: 1 - minItems: 1 - description: Array of member user IDs to assign to the guardrail - example: - - user_abc123 - - user_def456 + code: + type: string + description: The authorization code received from the OAuth redirect + example: auth_code_abc123def456 + code_verifier: + type: string + description: The code verifier if code_challenge was used in the authorization request + example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + code_challenge_method: + type: string + nullable: true + enum: + - S256 + - plain + - null + description: The method used to generate the code challenge + example: S256 required: - - member_user_ids + - code + example: + code: auth_code_abc123def456 + code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + code_challenge_method: S256 + example: + code: auth_code_abc123def456 + code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + code_challenge_method: S256 required: true responses: '200': - description: Assignment result + description: Successfully exchanged code for an API key content: application/json: schema: type: object properties: - assigned_count: - type: number - description: Number of members successfully assigned - example: 2 + key: + type: string + description: The API key to use for OpenRouter requests + example: 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 + user_id: + type: string + nullable: true + description: User ID associated with the API key + example: user_2yOPcMpKoQhcd4bVgSMlELRaIah required: - - assigned_count + - key + - user_id + example: + key: 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 + user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah + example: + key: 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 + user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah '400': - description: Bad Request - Invalid input + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' - '401': - description: Unauthorized - Missing or invalid authentication - content: - application/json: - schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Guardrail not found + example: + error: + code: 400 + message: Invalid request parameters + '403': + description: Forbidden - Authentication successful but insufficient permissions content: application/json: schema: - $ref: '#/components/schemas/NotFoundResponse' + $ref: '#/components/schemas/ForbiddenResponse' + example: + error: + code: 403 + message: Only management keys can perform this operation '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/{id}/assignments/keys/remove: + example: + error: + code: 500 + message: Internal Server Error + /auth/keys/code: post: - operationId: bulkUnassignKeysFromGuardrail - x-speakeasy-name-override: bulkUnassignKeys + x-speakeasy-name-override: createAuthCode tags: - - Guardrails - summary: Bulk unassign keys from a guardrail - description: >- - Unassign multiple API keys from a specific guardrail. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: - type: string - format: uuid - description: The unique identifier of the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail - name: id - in: path + - OAuth + summary: Create authorization code + description: Create an authorization code for the PKCE flow to generate a user-controlled API key requestBody: content: application/json: schema: type: object properties: - key_hashes: - type: array - items: - type: string - minLength: 1 - minItems: 1 - description: Array of API key hashes to unassign from the guardrail - example: - - c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 + callback_url: + type: string + format: uri + description: >- + The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are + allowed. + example: https://myapp.com/auth/callback + code_challenge: + type: string + description: PKCE code challenge for enhanced security + example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: + type: string + enum: + - S256 + - plain + description: The method used to generate the code challenge + example: S256 + limit: + type: number + format: double + description: Credit limit for the API key to be created + example: 100 + expires_at: + type: string + nullable: true + format: date-time + description: Optional expiration time for the API key to be created + example: '2027-12-31T23:59:59Z' + key_label: + type: string + maxLength: 100 + description: Optional custom label for the API key. Defaults to the app name if not provided. + example: My Custom Key + usage_limit_type: + type: string + enum: + - daily + - weekly + - monthly + description: Optional credit limit reset interval. When set, the credit limit resets on this interval. + example: monthly + spawn_agent: + type: string + description: Agent identifier for spawn telemetry + example: my-agent + x-speakeasy-ignore: true + x-fern-ignore: true + spawn_cloud: + type: string + description: Cloud identifier for spawn telemetry + example: aws-us-east-1 + x-speakeasy-ignore: true + x-fern-ignore: true required: - - key_hashes + - callback_url + example: + callback_url: https://myapp.com/auth/callback + code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: S256 + limit: 100 + example: + callback_url: https://myapp.com/auth/callback + code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: S256 + limit: 100 required: true responses: '200': - description: Unassignment result + description: Successfully created authorization code content: application/json: schema: type: object properties: - unassigned_count: - type: number - description: Number of keys successfully unassigned - example: 3 + data: + type: object + properties: + id: + type: string + description: The authorization code ID to use in the exchange request + example: auth_code_xyz789 + app_id: + type: integer + description: The application ID associated with this auth code + example: 12345 + created_at: + type: string + description: ISO 8601 timestamp of when the auth code was created + example: '2025-08-24T10:30:00Z' + required: + - id + - app_id + - created_at + description: Auth code data + example: + id: auth_code_xyz789 + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' required: - - unassigned_count + - data + example: + data: + id: auth_code_xyz789 + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' + example: + data: + id: auth_code_xyz789 + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' '400': - description: Bad Request - Invalid input + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' - '404': - description: Guardrail not found + example: + error: + code: 401 + message: Missing Authentication header + '409': + description: Conflict - Resource conflict or concurrent modification content: application/json: schema: - $ref: '#/components/schemas/NotFoundResponse' + $ref: '#/components/schemas/ConflictResponse' + example: + error: + code: 409 + message: Resource conflict. Please try again later. '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /guardrails/{id}/assignments/members/remove: + example: + error: + code: 500 + message: Internal Server Error + operationId: createAuthKeysCode + /embeddings: post: - operationId: bulkUnassignMembersFromGuardrail - x-speakeasy-name-override: bulkUnassignMembers + x-speakeasy-name-override: generate tags: - - Guardrails - summary: Bulk unassign members from a guardrail - description: >- - Unassign multiple organization members from a specific guardrail. [Management - key](/docs/guides/overview/auth/management-api-keys) required. - parameters: - - schema: - type: string - format: uuid - description: The unique identifier of the guardrail - example: 550e8400-e29b-41d4-a716-446655440000 - required: true - description: The unique identifier of the guardrail - name: id - in: path + - Embeddings + summary: Submit an embedding request + description: Submits an embedding request to the embeddings router requestBody: content: application/json: schema: type: object properties: - member_user_ids: - type: array - items: - type: string - minLength: 1 - minItems: 1 - description: Array of member user IDs to unassign from the guardrail - example: - - user_abc123 - - user_def456 + input: + anyOf: + - type: string + - type: array + items: + type: string + - type: array + items: + type: number + - type: array + items: + type: array + items: + type: number + - type: array + items: + type: object + properties: + content: + type: array + items: + oneOf: + - type: object + properties: + type: + type: string + enum: + - text + text: + type: string + required: + - type + - text + - type: object + properties: + type: + type: string + enum: + - image_url + image_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - image_url + required: + - content + description: Text, token, or multimodal input(s) to embed + example: The quick brown fox jumps over the lazy dog + model: + type: string + description: The model to use for embeddings + example: openai/text-embedding-3-small + encoding_format: + type: string + enum: + - float + - base64 + description: The format of the output embeddings + example: float + dimensions: + type: integer + minimum: 0 + exclusiveMinimum: 0 + description: The number of dimensions for the output embeddings + example: 1536 + user: + type: string + description: A unique identifier for the end-user + example: user-1234 + provider: + allOf: + - $ref: '#/components/schemas/ProviderPreferences' + - description: Provider routing preferences for the request. + input_type: + type: string + description: The type of input (e.g. search_query, search_document) + example: search_query required: - - member_user_ids + - input + - model + description: Embeddings request input + example: + model: openai/text-embedding-3-small + input: The quick brown fox jumps over the lazy dog + dimensions: 1536 + example: + model: openai/text-embedding-3-small + input: The quick brown fox jumps over the lazy dog required: true responses: '200': - description: Unassignment result + description: Embedding response content: application/json: schema: type: object properties: - unassigned_count: - type: number - description: Number of members successfully unassigned - example: 2 + id: + type: string + description: Unique identifier for the embeddings response + example: embd-1234567890 + object: + type: string + enum: + - list + data: + type: array + items: + type: object + properties: + object: + type: string + enum: + - embedding + embedding: + anyOf: + - type: array + items: + type: number + - type: string + description: Embedding vector as an array of floats or a base64 string + example: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: + type: integer + description: Index of the embedding in the input list + example: 0 + required: + - object + - embedding + description: A single embedding object + example: + object: embedding + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + description: List of embedding objects + example: + - object: embedding + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + model: + type: string + description: The model used for embeddings + example: openai/text-embedding-3-small + usage: + type: object + properties: + prompt_tokens: + type: integer + description: Number of tokens in the input + example: 8 + total_tokens: + type: integer + description: Total number of tokens used + example: 8 + cost: + type: number + format: double + description: Cost of the request in credits + example: 0.0001 + required: + - prompt_tokens + - total_tokens + description: Token usage statistics + example: + prompt_tokens: 8 + total_tokens: 8 required: - - unassigned_count + - object + - data + - model + description: Embeddings response containing embedding vectors + example: + object: list + data: + - object: embedding + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + model: openai/text-embedding-3-small + usage: + prompt_tokens: 8 + total_tokens: 8 + example: + object: list + data: + - object: embedding + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + model: openai/text-embedding-3-small + usage: + prompt_tokens: 8 + total_tokens: 8 + text/event-stream: + schema: + type: string + description: Not used for embeddings - embeddings do not support streaming + example: 'data: [DONE]' + x-speakeasy-sse-sentinel: '[DONE]' '400': - description: Bad Request - Invalid input + description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': - description: Unauthorized - Missing or invalid authentication + description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + example: + error: + code: 401 + message: Missing Authentication header + '402': + description: Payment Required - Insufficient credits or quota to complete request + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits '404': - description: Guardrail not found + description: Not Found - Resource does not exist content: application/json: schema: $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': - description: Internal Server Error + description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /key: - get: - operationId: getCurrentKey - x-speakeasy-name-override: getCurrentKeyMetadata - tags: - - API Keys - summary: Get current API key - description: Get information on the API key associated with the current authentication session - responses: - '200': - description: API key details + example: + error: + code: 500 + message: Internal Server Error + '502': + description: Bad Gateway - Provider/upstream API failure content: application/json: schema: - type: object - properties: - data: - type: object - properties: - label: - type: string - description: Human-readable label for the API key - example: sk-or-v1-0e6...1c96 - limit: - type: number - nullable: true - description: Spending limit for the API key in USD - example: 100 - usage: - type: number - description: Total OpenRouter credit usage (in USD) for the API key - example: 25.5 - usage_daily: - type: number - description: OpenRouter credit usage (in USD) for the current UTC day - example: 25.5 - usage_weekly: - type: number - description: OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) - example: 25.5 - usage_monthly: - type: number - description: OpenRouter credit usage (in USD) for the current UTC month - example: 25.5 - byok_usage: - type: number - description: Total external BYOK usage (in USD) for the API key - example: 17.38 - byok_usage_daily: - type: number - description: External BYOK usage (in USD) for the current UTC day - example: 17.38 - byok_usage_weekly: - type: number - description: External BYOK usage (in USD) for the current UTC week (Monday-Sunday) - example: 17.38 - byok_usage_monthly: - type: number - description: External BYOK usage (in USD) for current UTC month - example: 17.38 - is_free_tier: - type: boolean - description: Whether this is a free tier API key - example: false - is_management_key: - type: boolean - description: Whether this is a management key - example: false - is_provisioning_key: - type: boolean - description: Whether this is a management key - deprecated: true - example: false - limit_remaining: - type: number - nullable: true - description: Remaining spending limit in USD - example: 74.5 - limit_reset: - type: string - nullable: true - description: Type of limit reset for the API key - example: monthly - include_byok_in_limit: - type: boolean - description: Whether to include external BYOK usage in the credit limit - example: false - expires_at: - type: string - nullable: true - format: date-time - description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration - example: '2027-12-31T23:59:59Z' - creator_user_id: - type: string - nullable: true - description: >- - The user ID of the key creator. For organization-owned keys, this is the member who created - the key. For individual users, this is the user's own ID. - example: user_2dHFtVWx2n56w6HkM0000000000 - rate_limit: - type: object - properties: - requests: - type: number - description: Number of requests allowed per interval - example: 1000 - interval: - type: string - description: Rate limit interval - example: 1h - note: - type: string - description: Note about the rate limit - example: This field is deprecated and safe to ignore. - required: - - requests - - interval - - note - description: Legacy rate limit information about a key. Will always return -1. - deprecated: true - example: - requests: 1000 - interval: 1h - note: This field is deprecated and safe to ignore. - required: - - label - - limit - - usage - - usage_daily - - usage_weekly - - usage_monthly - - byok_usage - - byok_usage_daily - - byok_usage_weekly - - byok_usage_monthly - - is_free_tier - - is_management_key - - is_provisioning_key - - limit_remaining - - limit_reset - - include_byok_in_limit - - creator_user_id - - rate_limit - description: Current API key information - example: - label: sk-or-v1-au7...890 - limit: 100 - usage: 25.5 - usage_daily: 25.5 - usage_weekly: 25.5 - usage_monthly: 25.5 - byok_usage: 17.38 - byok_usage_daily: 17.38 - byok_usage_weekly: 17.38 - byok_usage_monthly: 17.38 - is_free_tier: false - is_management_key: false - is_provisioning_key: false - limit_remaining: 74.5 - limit_reset: monthly - include_byok_in_limit: false - expires_at: '2027-12-31T23:59:59Z' - creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - rate_limit: - requests: 1000 - interval: 1h - note: This field is deprecated and safe to ignore. - required: - - data - example: - data: - label: sk-or-v1-au7...890 - limit: 100 - usage: 25.5 - usage_daily: 25.5 - usage_weekly: 25.5 - usage_monthly: 25.5 - byok_usage: 17.38 - byok_usage_daily: 17.38 - byok_usage_weekly: 17.38 - byok_usage_monthly: 17.38 - is_free_tier: false - is_management_key: false - is_provisioning_key: false - limit_remaining: 74.5 - limit_reset: monthly - include_byok_in_limit: false - expires_at: '2027-12-31T23:59:59Z' - creator_user_id: user_2dHFtVWx2n56w6HkM0000000000 - rate_limit: - requests: 1000 - interval: 1h - note: This field is deprecated and safe to ignore. - '401': - description: Unauthorized - Authentication required or invalid credentials + $ref: '#/components/schemas/BadGatewayResponse' + example: + error: + code: 502 + message: Provider returned error + '503': + description: Service Unavailable - Service temporarily unavailable content: application/json: schema: - $ref: '#/components/schemas/UnauthorizedResponse' - '500': - description: Internal Server Error - Unexpected server error + $ref: '#/components/schemas/ServiceUnavailableResponse' + example: + error: + code: 503 + message: Service temporarily unavailable + '524': + description: Infrastructure Timeout - Provider request timed out at edge network + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + example: + error: + code: 524 + message: Request timed out. Please try again later. + '529': + description: Provider Overloaded - Provider is temporarily overloaded content: application/json: schema: - $ref: '#/components/schemas/InternalServerResponse' - /auth/keys: - post: - operationId: exchangeAuthCodeForAPIKey - tags: - - OAuth - summary: Exchange authorization code for API key - description: Exchange an authorization code from the PKCE flow for a user-controlled API key - requestBody: - content: - application/json: - schema: - type: object - properties: - code: - type: string - description: The authorization code received from the OAuth redirect - example: auth_code_abc123def456 - code_verifier: - type: string - description: The code verifier if code_challenge was used in the authorization request - example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk - code_challenge_method: - type: string - nullable: true - enum: - - S256 - - plain - description: The method used to generate the code challenge - example: S256 - required: - - code + $ref: '#/components/schemas/ProviderOverloadedResponse' example: - code: auth_code_abc123def456 - code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk - code_challenge_method: S256 - required: true + error: + code: 529 + message: Provider returned error + operationId: createEmbeddings + /embeddings/models: + get: + tags: + - Embeddings + x-speakeasy-name-override: listModels + summary: List all embeddings models + description: Returns a list of all available embeddings models and their properties responses: '200': - description: Successfully exchanged code for an API key + description: Returns a list of embeddings models content: application/json: schema: - type: object - properties: - key: - type: string - description: The API key to use for OpenRouter requests - example: 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 - user_id: - type: string - nullable: true - description: User ID associated with the API key - example: user_2yOPcMpKoQhcd4bVgSMlELRaIah - required: - - key - - user_id - example: - key: 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 - user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah + $ref: '#/components/schemas/ModelsListResponse' + example: + data: + - id: openai/text-embedding-3-small + canonical_slug: openai/text-embedding-3-small + name: Text Embedding 3 Small + created: 1692901234 + description: OpenAI text embedding model optimized for performance. + pricing: + prompt: '0.00000002' + completion: '0' + request: '0' + image: '0' + context_length: 8192 + architecture: + tokenizer: GPT + instruct_type: null + modality: text->text + input_modalities: + - text + output_modalities: + - embeddings + top_provider: + context_length: 8192 + max_completion_tokens: null + is_moderated: false + per_request_limits: null + supported_parameters: [] + default_parameters: null + knowledge_cutoff: null + expiration_date: null + links: + details: /api/v1/models/openai/text-embedding-3-small/endpoints '400': description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' - '403': - description: Forbidden - Authentication successful but insufficient permissions - content: - application/json: - schema: - $ref: '#/components/schemas/ForbiddenResponse' + example: + error: + code: 400 + message: Invalid request parameters '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - /auth/keys/code: + example: + error: + code: 500 + message: Internal Server Error + operationId: listEmbeddingsModels + /rerank: post: - x-speakeasy-name-override: createAuthCode + x-speakeasy-name-override: rerank tags: - - OAuth - summary: Create authorization code - description: Create an authorization code for the PKCE flow to generate a user-controlled API key + - Rerank + summary: Submit a rerank request + description: Submits a rerank request to the rerank router requestBody: content: application/json: schema: type: object properties: - callback_url: - type: string - format: uri - description: >- - The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are - allowed. - example: https://myapp.com/auth/callback - code_challenge: - type: string - description: PKCE code challenge for enhanced security - example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM - code_challenge_method: - type: string - enum: - - S256 - - plain - description: The method used to generate the code challenge - example: S256 - limit: - type: number - description: Credit limit for the API key to be created - example: 100 - expires_at: - type: string - nullable: true - format: date-time - description: Optional expiration time for the API key to be created - key_label: - type: string - maxLength: 100 - description: Optional custom label for the API key. Defaults to the app name if not provided. - example: My Custom Key - usage_limit_type: - type: string - enum: - - daily - - weekly - - monthly - description: Optional credit limit reset interval. When set, the credit limit resets on this interval. - example: monthly - spawn_agent: + model: type: string - description: Agent identifier for spawn telemetry - x-speakeasy-ignore: true - x-fern-ignore: true - spawn_cloud: + description: The rerank model to use + example: cohere/rerank-v3.5 + query: type: string - description: Cloud identifier for spawn telemetry - x-speakeasy-ignore: true - x-fern-ignore: true + description: The search query to rerank documents against + example: What is the capital of France? + documents: + type: array + items: + type: string + description: The list of documents to rerank + example: + - Paris is the capital of France. + - Berlin is the capital of Germany. + top_n: + type: integer + minimum: 0 + exclusiveMinimum: 0 + description: Number of most relevant documents to return + example: 3 + provider: + allOf: + - $ref: '#/components/schemas/ProviderPreferences' + - description: Provider routing preferences for the request. required: - - callback_url + - model + - query + - documents + description: Rerank request input example: - callback_url: https://myapp.com/auth/callback - code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM - code_challenge_method: S256 - limit: 100 + model: cohere/rerank-v3.5 + query: What is the capital of France? + documents: + - Paris is the capital of France. + - Berlin is the capital of Germany. + top_n: 3 + example: + model: cohere/rerank-v3.5 + query: What is the capital of France? + documents: + - Paris is the capital of France. + - Berlin is the capital of Germany. + - Madrid is the capital of Spain. required: true responses: '200': - description: Successfully created authorization code + description: Rerank response content: application/json: schema: type: object properties: - data: + id: + type: string + description: Unique identifier for the rerank response (ORID format) + example: gen-rerank-1234567890-abc + model: + type: string + description: The model used for reranking + example: cohere/rerank-v3.5 + provider: + type: string + description: The provider that served the rerank request + example: Cohere + results: + type: array + items: + type: object + properties: + index: + type: integer + description: Index of the document in the original input list + example: 0 + relevance_score: + type: number + format: double + description: Relevance score of the document to the query + example: 0.98 + document: + type: object + properties: + text: + type: string + description: The document text + example: Paris is the capital of France. + required: + - text + description: The document object containing the original text + required: + - index + - relevance_score + - document + description: A single rerank result + example: + index: 0 + relevance_score: 0.98 + document: + text: Paris is the capital of France. + description: List of rerank results sorted by relevance + example: + - index: 0 + relevance_score: 0.98 + document: + text: Paris is the capital of France. + usage: type: object properties: - id: - type: string - description: The authorization code ID to use in the exchange request - example: auth_code_xyz789 - app_id: + total_tokens: + type: integer + description: Total number of tokens used + example: 150 + search_units: + type: integer + description: Number of search units consumed (Cohere billing) + example: 1 + cost: type: number - description: The application ID associated with this auth code - example: 12345 - created_at: - type: string - description: ISO 8601 timestamp of when the auth code was created - example: '2025-08-24T10:30:00Z' - required: - - id - - app_id - - created_at - description: Auth code data + format: double + description: Cost of the request in credits + example: 0.001 + description: Usage statistics example: - id: auth_code_xyz789 - app_id: 12345 - created_at: '2025-08-24T10:30:00Z' + total_tokens: 150 + search_units: 1 required: - - data + - model + - results + description: Rerank response containing ranked results + example: + id: gen-rerank-1234567890-abc + model: cohere/rerank-v3.5 + results: + - index: 0 + relevance_score: 0.98 + document: + text: Paris is the capital of France. + usage: + total_tokens: 150 + search_units: 1 + example: + id: gen-rerank-1234567890-abc + model: cohere/rerank-v3.5 + results: + - index: 0 + relevance_score: 0.98 + document: + text: Paris is the capital of France. + usage: + total_tokens: 150 + search_units: 1 + text/event-stream: + schema: + type: string + description: Not used for rerank - rerank does not support streaming + example: 'data: [DONE]' + x-speakeasy-sse-sentinel: '[DONE]' '400': description: Bad Request - Invalid request parameters or malformed input content: application/json: schema: $ref: '#/components/schemas/BadRequestResponse' + example: + error: + code: 400 + message: Invalid request parameters '401': description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' - '409': - description: Conflict - App upsert conflict during auth code creation + example: + error: + code: 401 + message: Missing Authentication header + '402': + description: Payment Required - Insufficient credits or quota to complete request content: application/json: schema: - $ref: '#/components/schemas/ConflictResponse' + $ref: '#/components/schemas/PaymentRequiredResponse' + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + example: + error: + code: 404 + message: Resource not found + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + example: + error: + code: 429 + message: Rate limit exceeded '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' - operationId: createAuthKeysCode + example: + error: + code: 500 + message: Internal Server Error + '502': + description: Bad Gateway - Provider/upstream API failure + content: + application/json: + schema: + $ref: '#/components/schemas/BadGatewayResponse' + example: + error: + code: 502 + message: Provider returned error + '503': + description: Service Unavailable - Service temporarily unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + example: + error: + code: 503 + message: Service temporarily unavailable + '524': + description: Infrastructure Timeout - Provider request timed out at edge network + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + example: + error: + code: 524 + message: Request timed out. Please try again later. + '529': + description: Provider Overloaded - Provider is temporarily overloaded + content: + application/json: + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' + example: + error: + code: 529 + message: Provider returned error + operationId: createRerank tags: - name: API Keys description: API key management endpoints @@ -19336,8 +17715,12 @@ tags: description: Model information endpoints - name: OAuth description: OAuth authentication endpoints + - name: Organization + description: Organization endpoints - name: Providers description: Provider information endpoints + - name: Rerank + description: Reranking endpoints - name: beta.responses description: beta.responses endpoints x-fern-base-path: / @@ -19346,3 +17729,13 @@ x-retry-strategy: initialDelay: 500 maxDelay: 60000 maxAttempts: 3 +x-speakeasy-retries: + strategy: backoff + backoff: + initialInterval: 500 + maxInterval: 60000 + maxElapsedTime: 3600000 + exponent: 1.5 + statusCodes: + - 5XX + retryConnectionErrors: true