diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 6ec78ad..7ec3e1d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: - docChecksum: b1b97e85c6e3464e1fd6e2163c4ebc87 + docChecksum: 4cc4a9d9115d0eca9a5eb4786505579d docVersion: 1.0.0 - speakeasyVersion: 1.658.1 - generationVersion: 2.755.6 - releaseVersion: 0.0.16 - configChecksum: bccceb456c96a46bcbe65fdff6bd5e1f + speakeasyVersion: 1.658.2 + generationVersion: 2.755.9 + releaseVersion: 0.0.19 + configChecksum: 834d5c1cea368e35ab6535ffb2bf9e7a repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true @@ -15,7 +15,7 @@ features: acceptHeaders: 3.0.0 additionalDependencies: 1.0.0 constsAndDefaults: 1.0.5 - core: 5.23.8 + core: 5.23.9 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 devContainers: 3.0.0 @@ -71,6 +71,8 @@ generatedFiles: - docs/components/chatmessagecontentitemimagedetail.md - docs/components/chatmessagecontentitemtext.md - docs/components/chatmessagecontentitemvideo.md + - docs/components/chatmessagecontentitemvideoinputvideo.md + - docs/components/chatmessagecontentitemvideovideourl.md - docs/components/chatmessagetokenlogprob.md - docs/components/chatmessagetokenlogprobs.md - docs/components/chatmessagetoolcall.md @@ -305,6 +307,7 @@ generatedFiles: - docs/components/provider.md - docs/components/providername.md - docs/components/provideroverloadedresponseerrordata.md + - docs/components/providersort.md - docs/components/publicendpoint.md - docs/components/publicendpointquantization.md - docs/components/publicpricing.md @@ -375,7 +378,6 @@ generatedFiles: - docs/components/security.md - docs/components/servicetier.md - docs/components/serviceunavailableresponseerrordata.md - - docs/components/sort.md - docs/components/streamoptions.md - docs/components/systemmessage.md - docs/components/systemmessagecontent.md @@ -414,7 +416,8 @@ generatedFiles: - docs/components/usermessage.md - docs/components/usermessagecontent.md - docs/components/variables.md - - docs/components/videourl.md + - docs/components/videourl1.md + - docs/components/videourl2.md - docs/components/websearchpreviewtooluserlocation.md - docs/components/websearchpreviewtooluserlocationtype.md - docs/components/websearchstatus.md @@ -436,6 +439,9 @@ generatedFiles: - docs/models/utils/retryconfig.md - docs/operations/apitype.md - docs/operations/calldata.md + - docs/operations/content.md + - docs/operations/contentimageurl.md + - docs/operations/contenttext.md - docs/operations/createauthkeyscodecodechallengemethod.md - docs/operations/createauthkeyscodedata.md - docs/operations/createauthkeyscoderequest.md @@ -454,13 +460,10 @@ generatedFiles: - docs/operations/createkeysresponse.md - docs/operations/createresponsesresponse.md - docs/operations/createresponsesresponsebody.md - - docs/operations/datacollection.md - docs/operations/deletekeysrequest.md - docs/operations/deletekeysresponse.md - docs/operations/embedding.md - docs/operations/encodingformat.md - - docs/operations/encodingformatbase64.md - - docs/operations/encodingformatfloat.md - docs/operations/exchangeauthcodeforapikeycodechallengemethod.md - docs/operations/exchangeauthcodeforapikeyrequest.md - docs/operations/exchangeauthcodeforapikeyresponse.md @@ -482,7 +485,9 @@ generatedFiles: - docs/operations/getuseractivityrequest.md - docs/operations/getuseractivityresponse.md - docs/operations/ignore.md + - docs/operations/imageurl.md - docs/operations/input.md + - docs/operations/inputunion.md - docs/operations/listdata.md - docs/operations/listendpointsrequest.md - docs/operations/listendpointsresponse.md @@ -500,9 +505,10 @@ generatedFiles: - docs/operations/order.md - docs/operations/ratelimit.md - docs/operations/sendchatcompletionrequestresponse.md - - docs/operations/sort.md - docs/operations/supportedparameter.md - docs/operations/transferintent.md + - docs/operations/typeimageurl.md + - docs/operations/typetext.md - docs/operations/updatekeysdata.md - docs/operations/updatekeyslimitreset.md - docs/operations/updatekeysrequest.md @@ -543,7 +549,6 @@ generatedFiles: - src/openrouter/components/assistantmessage.py - src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badrequestresponseerrordata.py - - src/openrouter/components/chatcompletionfinishreason.py - src/openrouter/components/chaterror.py - src/openrouter/components/chatgenerationparams.py - src/openrouter/components/chatgenerationtokenusage.py @@ -557,7 +562,6 @@ generatedFiles: - src/openrouter/components/chatmessagetoolcall.py - src/openrouter/components/chatresponse.py - src/openrouter/components/chatresponsechoice.py - - src/openrouter/components/chatstreamingchoice.py - src/openrouter/components/chatstreamingmessagechunk.py - src/openrouter/components/chatstreamingmessagetoolcall.py - src/openrouter/components/chatstreamingresponsechunk.py @@ -568,6 +572,7 @@ generatedFiles: - src/openrouter/components/completionresponse.py - src/openrouter/components/completionusage.py - src/openrouter/components/createchargerequest.py + - src/openrouter/components/datacollection.py - src/openrouter/components/defaultparameters.py - src/openrouter/components/edgenetworktimeoutresponseerrordata.py - src/openrouter/components/endpointstatus.py @@ -637,6 +642,7 @@ generatedFiles: - src/openrouter/components/perrequestlimits.py - src/openrouter/components/providername.py - src/openrouter/components/provideroverloadedresponseerrordata.py + - src/openrouter/components/providersort.py - src/openrouter/components/publicendpoint.py - src/openrouter/components/publicpricing.py - src/openrouter/components/quantization.py @@ -833,7 +839,7 @@ examples: createEmbeddings: speakeasy-default-create-embeddings: requestBody: - application/json: {"input": "", "model": "Taurus", "provider": {"data_collection": "deny", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}} + application/json: {"input": "", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}} responses: "200": application/json: {"object": "list", "data": [], "model": "Land Cruiser"} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index db8247b..c68359b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.0.16 + version: 0.0.19 additionalDependencies: dev: {} main: {} @@ -64,7 +64,7 @@ python: webhooks: "" inputModelSuffix: input legacyPyright: false - license: "" + license: Apache-2.0 maxMethodParams: 999 methodArguments: infer-optional-args moduleName: "" diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml new file mode 100644 index 0000000..82b30d2 --- /dev/null +++ b/.speakeasy/in.openapi.yaml @@ -0,0 +1,8382 @@ +openapi: 3.1.0 +info: + title: OpenRouter API + version: 1.0.0 + description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + contact: + name: OpenRouter Support + url: https://openrouter.ai/docs + email: support@openrouter.ai + license: + name: MIT + url: https://opensource.org/licenses/MIT +components: + schemas: + OpenAIResponsesResponseStatus: + type: string + enum: + - completed + - incomplete + - in_progress + - failed + - cancelled + - queued + FileCitation: + type: object + properties: + type: + type: string + enum: + - file_citation + file_id: + type: string + filename: + type: string + index: + type: number + required: + - type + - file_id + - filename + - index + example: + type: file_citation + file_id: file-abc123 + filename: research_paper.pdf + index: 0 + URLCitation: + type: object + properties: + type: + type: string + enum: + - url_citation + url: + type: string + title: + type: string + start_index: + type: number + end_index: + type: number + required: + - type + - url + - title + - start_index + - end_index + example: + type: url_citation + start_index: 0 + end_index: 42 + title: OpenRouter Documentation + url: https://openrouter.ai/docs + FilePath: + type: object + properties: + type: + type: string + enum: + - file_path + file_id: + type: string + index: + type: number + required: + - type + - file_id + - index + example: + type: file_path + file_id: file-xyz789 + index: 0 + OpenAIResponsesAnnotation: + anyOf: + - $ref: '#/components/schemas/FileCitation' + - $ref: '#/components/schemas/URLCitation' + - $ref: '#/components/schemas/FilePath' + ResponseOutputText: + type: object + properties: + type: + type: string + enum: + - output_text + text: + type: string + annotations: + type: array + items: + $ref: '#/components/schemas/OpenAIResponsesAnnotation' + required: + - type + - text + example: + type: output_text + text: The capital of France is Paris. + annotations: + - type: url_citation + start_index: 0 + end_index: 42 + title: Paris - Wikipedia + url: https://en.wikipedia.org/wiki/Paris + OpenAIResponsesRefusalContent: + type: object + properties: + type: + type: string + enum: + - refusal + refusal: + type: string + required: + - type + - refusal + example: + type: refusal + refusal: I'm sorry, I cannot assist with that request + OutputMessage: + type: object + properties: + id: + type: string + role: + type: string + enum: + - assistant + type: + type: string + enum: + - message + status: + anyOf: + - type: string + enum: + - completed + - type: string + enum: + - incomplete + - type: string + enum: + - in_progress + content: + type: array + items: + anyOf: + - $ref: '#/components/schemas/ResponseOutputText' + - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' + required: + - id + - role + - type + - content + example: + id: msg-abc123 + role: assistant + type: message + status: completed + content: + - type: output_text + text: Hello! How can I help you today? + ResponsesOutputMessage: + allOf: + - $ref: '#/components/schemas/OutputMessage' + - type: object + properties: {} + example: + id: msg-123 + type: message + role: assistant + status: completed + content: + - type: output_text + text: Hello! How can I help you? + annotations: [] + description: An output message item + ReasoningTextContent: + type: object + properties: + type: + type: string + enum: + - reasoning_text + text: + type: string + required: + - type + - text + example: + type: reasoning_text + text: Let me think step by step about this problem... + ReasoningSummaryText: + type: object + properties: + type: + type: string + enum: + - summary_text + text: + type: string + required: + - type + - text + example: + type: summary_text + text: Analyzed the problem using first principles + OutputItemReasoning: + type: object + properties: + type: + type: string + enum: + - reasoning + id: + type: string + content: + type: array + items: + $ref: '#/components/schemas/ReasoningTextContent' + summary: + type: array + items: + $ref: '#/components/schemas/ReasoningSummaryText' + encrypted_content: + type: string + nullable: true + status: + anyOf: + - type: string + enum: + - completed + - type: string + enum: + - incomplete + - type: string + enum: + - in_progress + required: + - type + - id + - summary + example: + type: reasoning + id: reasoning-abc123 + summary: + - type: summary_text + text: Analyzed the problem using first principles + ResponsesOutputItemReasoning: + allOf: + - $ref: '#/components/schemas/OutputItemReasoning' + - type: object + properties: {} + example: + id: reasoning-123 + type: reasoning + status: completed + summary: + - type: summary_text + text: Analyzed the problem and found the optimal solution. + content: + - type: reasoning_text + text: First, we analyze the problem... + description: An output item containing reasoning + OutputItemFunctionCall: + type: object + properties: + type: + type: string + enum: + - function_call + id: + type: string + name: + type: string + arguments: + type: string + call_id: + type: string + status: + anyOf: + - type: string + enum: + - completed + - type: string + enum: + - incomplete + - type: string + enum: + - in_progress + required: + - type + - name + - arguments + - call_id + example: + type: function_call + id: call-abc123 + name: get_weather + arguments: '{"location":"San Francisco","unit":"celsius"}' + call_id: call-abc123 + ResponsesOutputItemFunctionCall: + allOf: + - $ref: '#/components/schemas/OutputItemFunctionCall' + - type: object + properties: {} + example: + type: function_call + id: call-abc123 + name: get_weather + arguments: '{"location":"San Francisco","unit":"celsius"}' + call_id: call-abc123 + WebSearchStatus: + type: string + enum: + - completed + - searching + - in_progress + - failed + example: completed + OutputItemWebSearchCall: + type: object + properties: + type: + type: string + enum: + - web_search_call + id: + type: string + status: + $ref: '#/components/schemas/WebSearchStatus' + required: + - type + - id + - status + example: + type: web_search_call + id: search-abc123 + status: completed + ResponsesWebSearchCallOutput: + allOf: + - $ref: '#/components/schemas/OutputItemWebSearchCall' + - type: object + properties: {} + example: + type: web_search_call + id: search-abc123 + status: completed + OutputItemFileSearchCall: + type: object + properties: + type: + type: string + enum: + - file_search_call + id: + type: string + queries: + type: array + items: + type: string + status: + $ref: '#/components/schemas/WebSearchStatus' + required: + - type + - id + - queries + - status + example: + type: file_search_call + id: filesearch-abc123 + queries: + - machine learning algorithms + - neural networks + status: completed + ResponsesOutputItemFileSearchCall: + allOf: + - $ref: '#/components/schemas/OutputItemFileSearchCall' + - type: object + properties: {} + example: + type: file_search_call + id: filesearch-abc123 + queries: + - machine learning algorithms + - neural networks + status: completed + ImageGenerationStatus: + type: string + enum: + - in_progress + - completed + - generating + - failed + example: completed + OutputItemImageGenerationCall: + type: object + properties: + type: + type: string + enum: + - image_generation_call + id: + type: string + result: + type: string + nullable: true + default: null + status: + $ref: '#/components/schemas/ImageGenerationStatus' + required: + - type + - id + - status + example: + type: image_generation_call + id: imagegen-abc123 + result: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg== + status: completed + ResponsesImageGenerationCall: + allOf: + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + - type: object + properties: {} + example: + type: image_generation_call + id: imagegen-abc123 + result: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg== + status: completed + ResponsesOutputItem: + anyOf: + - $ref: '#/components/schemas/ResponsesOutputMessage' + - $ref: '#/components/schemas/ResponsesOutputItemReasoning' + - $ref: '#/components/schemas/ResponsesOutputItemFunctionCall' + - $ref: '#/components/schemas/ResponsesWebSearchCallOutput' + - $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall' + - $ref: '#/components/schemas/ResponsesImageGenerationCall' + description: An output item from the response + example: + id: msg-abc123 + role: assistant + type: message + status: completed + content: + - type: output_text + text: Hello! How can I help you today? + ResponsesErrorField: + type: object + nullable: true + properties: + code: + type: string + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - vector_store_timeout + - invalid_image + - invalid_image_format + - invalid_base64_image + - invalid_image_url + - image_too_large + - image_too_small + - image_parse_error + - image_content_policy_violation + - invalid_image_mode + - image_file_too_large + - unsupported_image_media_type + - empty_image_file + - failed_to_download_image + - image_file_not_found + message: + type: string + required: + - code + - message + description: Error information returned from the API + example: + code: rate_limit_exceeded + message: Rate limit exceeded. Please try again later. + OpenAIResponsesIncompleteDetails: + type: object + nullable: true + properties: + reason: + type: string + enum: + - max_output_tokens + - content_filter + OpenAIResponsesUsage: + type: object + properties: + input_tokens: + type: number + input_tokens_details: + type: object + properties: + cached_tokens: + type: number + required: + - cached_tokens + output_tokens: + type: number + output_tokens_details: + type: object + properties: + reasoning_tokens: + type: number + required: + - reasoning_tokens + total_tokens: + type: number + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + OpenResponsesUsage: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesUsage' + - type: object + properties: + cost: + type: number + nullable: true + description: Cost of the completion + is_byok: + type: boolean + description: Whether a request was made using a Bring Your Own Key configuration + cost_details: + type: object + properties: + upstream_inference_cost: + type: number + nullable: true + upstream_inference_input_cost: + type: number + upstream_inference_output_cost: + type: number + required: + - upstream_inference_input_cost + - upstream_inference_output_cost + description: Token usage information for the response + example: + input_tokens: 10 + output_tokens: 25 + total_tokens: 35 + input_tokens_details: + cached_tokens: 0 + output_tokens_details: + reasoning_tokens: 0 + cost: 0.0012 + cost_details: + upstream_inference_cost: null + upstream_inference_input_cost: 0.0008 + upstream_inference_output_cost: 0.0004 + ResponseInputText: + type: object + properties: + type: + type: string + enum: + - input_text + text: + type: string + required: + - type + - text + description: Text input content item + example: + type: input_text + text: Hello, how can I help you? + ResponseInputImage: + type: object + properties: + type: + type: string + enum: + - input_image + detail: + type: string + enum: + - auto + - high + - low + image_url: + type: string + nullable: true + required: + - type + - detail + description: Image input content item + example: + type: input_image + detail: auto + image_url: https://example.com/image.jpg + ResponseInputFile: + type: object + properties: + type: + type: string + enum: + - input_file + file_id: + type: string + nullable: true + file_data: + type: string + filename: + type: string + file_url: + type: string + required: + - type + description: File input content item + example: + type: input_file + file_id: file-abc123 + filename: document.pdf + ResponseInputAudio: + type: object + properties: + type: + type: string + enum: + - input_audio + input_audio: + type: object + properties: + data: + type: string + format: + type: string + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio + description: Audio input content item + example: + type: input_audio + input_audio: + data: SGVsbG8gV29ybGQ= + format: mp3 + ToolCallStatus: + type: string + nullable: true + enum: + - in_progress + - completed + - incomplete + example: completed + OpenAIResponsesInput: + anyOf: + - type: string + - type: array + items: + anyOf: + - type: object + properties: + type: + type: string + enum: + - message + role: + anyOf: + - type: string + enum: + - user + - type: string + enum: + - system + - type: string + enum: + - assistant + - type: string + enum: + - developer + content: + anyOf: + - type: array + items: + oneOf: + - $ref: '#/components/schemas/ResponseInputText' + - $ref: '#/components/schemas/ResponseInputImage' + - $ref: '#/components/schemas/ResponseInputFile' + - $ref: '#/components/schemas/ResponseInputAudio' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/ResponseInputText' + input_image: '#/components/schemas/ResponseInputImage' + input_file: '#/components/schemas/ResponseInputFile' + input_audio: '#/components/schemas/ResponseInputAudio' + - type: string + 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/ResponseInputText' + - $ref: '#/components/schemas/ResponseInputImage' + - $ref: '#/components/schemas/ResponseInputFile' + - $ref: '#/components/schemas/ResponseInputAudio' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/ResponseInputText' + input_image: '#/components/schemas/ResponseInputImage' + input_file: '#/components/schemas/ResponseInputFile' + input_audio: '#/components/schemas/ResponseInputAudio' + required: + - id + - role + - content + - type: object + properties: + type: + type: string + enum: + - function_call_output + id: + type: string + nullable: true + call_id: + type: string + output: + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' + 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/ToolCallStatus' + required: + - type + - call_id + - name + - arguments + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + - $ref: '#/components/schemas/OutputMessage' + - nullable: true + OpenResponsesRequestMetadata: + type: object + nullable: true + additionalProperties: + type: string + maxLength: 512 + description: >- + Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must + be ≤512 characters. Maximum 16 pairs allowed. + example: + user_id: '123' + session_id: abc-def-ghi + OpenResponsesFunctionTool: + type: object + properties: + type: + type: string + enum: + - function + name: + type: string + description: + type: string + nullable: true + strict: + type: boolean + nullable: true + parameters: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - type + - name + - parameters + description: Function tool definition + example: + type: function + name: get_weather + description: Get the current weather in a location + parameters: + type: object + properties: + location: + type: string + description: The city and state + unit: + type: string + enum: + - celsius + - fahrenheit + required: + - location + ResponsesSearchContextSize: + type: string + enum: + - low + - medium + - high + description: Size of the search context for web search tools + example: medium + WebSearchPreviewToolUserLocation: + 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 + OpenResponsesWebSearchPreviewTool: + type: object + properties: + type: + type: string + enum: + - web_search_preview + search_context_size: + $ref: '#/components/schemas/ResponsesSearchContextSize' + user_location: + $ref: '#/components/schemas/WebSearchPreviewToolUserLocation' + required: + - type + description: Web search preview tool configuration + example: + type: web_search_preview + OpenResponsesWebSearchPreview20250311Tool: + type: object + properties: + type: + type: string + enum: + - web_search_preview_2025_03_11 + search_context_size: + $ref: '#/components/schemas/ResponsesSearchContextSize' + user_location: + $ref: '#/components/schemas/WebSearchPreviewToolUserLocation' + required: + - type + description: Web search preview tool configuration (2025-03-11 version) + example: + type: web_search_preview_2025_03_11 + ResponsesWebSearchUserLocation: + 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 + description: User location information for web search + example: + type: approximate + city: San Francisco + country: USA + region: California + timezone: America/Los_Angeles + OpenResponsesWebSearchTool: + type: object + properties: + type: + type: string + enum: + - web_search + filters: + type: object + nullable: true + properties: + allowed_domains: + type: array + nullable: true + items: + type: string + search_context_size: + $ref: '#/components/schemas/ResponsesSearchContextSize' + user_location: + $ref: '#/components/schemas/ResponsesWebSearchUserLocation' + required: + - type + description: Web search tool configuration + example: + type: web_search + filters: + allowed_domains: + - example.com + OpenResponsesWebSearch20250826Tool: + type: object + properties: + type: + type: string + enum: + - web_search_2025_08_26 + filters: + type: object + nullable: true + properties: + allowed_domains: + type: array + nullable: true + items: + type: string + search_context_size: + $ref: '#/components/schemas/ResponsesSearchContextSize' + user_location: + $ref: '#/components/schemas/ResponsesWebSearchUserLocation' + required: + - type + description: Web search tool configuration (2025-08-26 version) + example: + type: web_search_2025_08_26 + filters: + allowed_domains: + - example.com + OpenAIResponsesToolChoice: + anyOf: + - type: string + enum: + - auto + - type: string + enum: + - none + - type: string + enum: + - required + - type: object + properties: + type: + type: string + enum: + - function + name: + type: string + required: + - type + - name + - type: object + properties: + type: + anyOf: + - type: string + enum: + - web_search_preview_2025_03_11 + - type: string + enum: + - web_search_preview + required: + - type + OpenAIResponsesPrompt: + type: object + nullable: true + properties: + id: + type: string + variables: + type: object + nullable: true + additionalProperties: + anyOf: + - type: string + - $ref: '#/components/schemas/ResponseInputText' + - $ref: '#/components/schemas/ResponseInputImage' + - $ref: '#/components/schemas/ResponseInputFile' + required: + - id + OpenAIResponsesReasoningEffort: + type: string + nullable: true + enum: + - high + - medium + - low + - minimal + - none + ReasoningSummaryVerbosity: + type: string + enum: + - auto + - concise + - detailed + OpenAIResponsesReasoningConfig: + type: object + nullable: true + properties: + effort: + $ref: '#/components/schemas/OpenAIResponsesReasoningEffort' + summary: + $ref: '#/components/schemas/ReasoningSummaryVerbosity' + OpenAIResponsesServiceTier: + type: string + nullable: true + enum: + - auto + - default + - flex + - priority + - scale + OpenAIResponsesTruncation: + type: string + nullable: true + enum: + - auto + - disabled + ResponsesFormatText: + type: object + properties: + type: + type: string + enum: + - text + required: + - type + description: Plain text response format + example: + type: text + ResponsesFormatJSONObject: + type: object + properties: + type: + type: string + enum: + - json_object + required: + - type + description: JSON object response format + example: + type: json_object + ResponsesFormatTextJSONSchemaConfig: + type: object + properties: + type: + type: string + enum: + - json_schema + name: + type: string + description: + type: string + strict: + type: boolean + nullable: true + schema: + type: object + additionalProperties: + nullable: true + required: + - type + - name + - schema + description: JSON schema constrained response format + example: + type: json_schema + name: user_info + description: User information schema + schema: + type: object + properties: + name: + type: string + age: + type: number + required: + - name + ResponseFormatTextConfig: + anyOf: + - $ref: '#/components/schemas/ResponsesFormatText' + - $ref: '#/components/schemas/ResponsesFormatJSONObject' + - $ref: '#/components/schemas/ResponsesFormatTextJSONSchemaConfig' + description: Text response format configuration + example: + type: text + ResponseTextConfig: + type: object + properties: + format: + $ref: '#/components/schemas/ResponseFormatTextConfig' + verbosity: + type: string + nullable: true + enum: + - high + - low + - medium + description: Text output configuration including format and verbosity + example: + format: + type: text + verbosity: medium + OpenAIResponsesNonStreamingResponse: + type: object + properties: + id: + type: string + object: + type: string + enum: + - response + created_at: + type: number + model: + type: string + status: + $ref: '#/components/schemas/OpenAIResponsesResponseStatus' + output: + type: array + items: + oneOf: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/OutputItemReasoning' + - $ref: '#/components/schemas/OutputItemFunctionCall' + - $ref: '#/components/schemas/OutputItemWebSearchCall' + - $ref: '#/components/schemas/OutputItemFileSearchCall' + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/OutputMessage' + reasoning: '#/components/schemas/OutputItemReasoning' + function_call: '#/components/schemas/OutputItemFunctionCall' + web_search_call: '#/components/schemas/OutputItemWebSearchCall' + file_search_call: '#/components/schemas/OutputItemFileSearchCall' + image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' + user: + type: string + nullable: true + output_text: + type: string + prompt_cache_key: + type: string + nullable: true + safety_identifier: + type: string + nullable: true + error: + $ref: '#/components/schemas/ResponsesErrorField' + incomplete_details: + $ref: '#/components/schemas/OpenAIResponsesIncompleteDetails' + usage: + $ref: '#/components/schemas/OpenAIResponsesUsage' + max_tool_calls: + type: number + nullable: true + top_logprobs: + type: number + max_output_tokens: + type: number + nullable: true + temperature: + type: number + nullable: true + top_p: + type: number + nullable: true + instructions: + $ref: '#/components/schemas/OpenAIResponsesInput' + metadata: + $ref: '#/components/schemas/OpenResponsesRequestMetadata' + tools: + type: array + items: + oneOf: + - allOf: + - $ref: '#/components/schemas/OpenResponsesFunctionTool' + - type: object + properties: {} + description: Function tool definition + example: + type: function + name: get_weather + description: Get the current weather in a location + parameters: + type: object + properties: + location: + type: string + description: The city and state + unit: + type: string + enum: + - celsius + - fahrenheit + required: + - location + - $ref: '#/components/schemas/OpenResponsesWebSearchPreviewTool' + - $ref: '#/components/schemas/OpenResponsesWebSearchPreview20250311Tool' + - $ref: '#/components/schemas/OpenResponsesWebSearchTool' + - $ref: '#/components/schemas/OpenResponsesWebSearch20250826Tool' + tool_choice: + $ref: '#/components/schemas/OpenAIResponsesToolChoice' + parallel_tool_calls: + type: boolean + prompt: + $ref: '#/components/schemas/OpenAIResponsesPrompt' + background: + type: boolean + nullable: true + previous_response_id: + type: string + nullable: true + reasoning: + $ref: '#/components/schemas/OpenAIResponsesReasoningConfig' + service_tier: + $ref: '#/components/schemas/OpenAIResponsesServiceTier' + store: + type: boolean + truncation: + $ref: '#/components/schemas/OpenAIResponsesTruncation' + text: + $ref: '#/components/schemas/ResponseTextConfig' + required: + - id + - object + - created_at + - model + - output + - error + - incomplete_details + - temperature + - top_p + - instructions + - metadata + - tools + - tool_choice + - parallel_tool_calls + OpenResponsesNonStreamingResponse: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + - type: object + properties: + output: + type: array + items: + $ref: '#/components/schemas/ResponsesOutputItem' + usage: + $ref: '#/components/schemas/OpenResponsesUsage' + description: Complete non-streaming response from the Responses API + example: + id: resp-abc123 + object: response + created_at: 1704067200 + model: gpt-4 + status: completed + output: + - type: message + id: msg-abc123 + status: completed + role: assistant + content: + - type: output_text + text: Hello! How can I help you today? + annotations: [] + usage: + input_tokens: 10 + output_tokens: 25 + total_tokens: 35 + input_tokens_details: + cached_tokens: 0 + output_tokens_details: + reasoning_tokens: 0 + tools: [] + tool_choice: auto + parallel_tool_calls: true + error: null + incomplete_details: null + temperature: null + top_p: null + max_output_tokens: null + metadata: null + instructions: null + OpenResponsesCreatedEvent: + type: object + properties: + type: + type: string + enum: + - response.created + response: + $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + sequence_number: + type: number + required: + - type + - response + - sequence_number + 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 + OpenResponsesInProgressEvent: + type: object + properties: + type: + type: string + enum: + - response.in_progress + response: + $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + sequence_number: + type: number + required: + - type + - response + - sequence_number + 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 + OpenResponsesCompletedEvent: + type: object + properties: + type: + type: string + enum: + - response.completed + response: + $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + sequence_number: + type: number + required: + - type + - response + - sequence_number + 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 + OpenResponsesIncompleteEvent: + type: object + properties: + type: + type: string + enum: + - response.incomplete + response: + $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + sequence_number: + type: number + required: + - type + - response + - sequence_number + 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 + OpenResponsesFailedEvent: + type: object + properties: + type: + type: string + enum: + - response.failed + response: + $ref: '#/components/schemas/OpenAIResponsesNonStreamingResponse' + sequence_number: + type: number + required: + - type + - response + - sequence_number + 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 + OpenAIResponsesErrorEvent: + type: object + properties: + type: + type: string + enum: + - error + code: + type: string + nullable: true + message: + type: string + param: + type: string + nullable: true + sequence_number: + type: number + required: + - type + - code + - message + - param + - sequence_number + description: Event emitted when an error occurs during streaming + example: + type: error + code: rate_limit_exceeded + message: Rate limit exceeded. Please try again later. + param: null + sequence_number: 2 + OpenResponsesErrorEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesErrorEvent' + - type: object + properties: {} + description: Event emitted when an error occurs during streaming + example: + type: error + code: rate_limit_exceeded + message: Rate limit exceeded. Please try again later. + param: null + sequence_number: 2 + OpenResponsesOutputItemAddedEvent: + type: object + properties: + type: + type: string + enum: + - response.output_item.added + output_index: + type: number + item: + oneOf: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/OutputItemReasoning' + - $ref: '#/components/schemas/OutputItemFunctionCall' + - $ref: '#/components/schemas/OutputItemWebSearchCall' + - $ref: '#/components/schemas/OutputItemFileSearchCall' + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/OutputMessage' + reasoning: '#/components/schemas/OutputItemReasoning' + function_call: '#/components/schemas/OutputItemFunctionCall' + web_search_call: '#/components/schemas/OutputItemWebSearchCall' + file_search_call: '#/components/schemas/OutputItemFileSearchCall' + image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' + sequence_number: + type: number + required: + - type + - output_index + - item + - sequence_number + 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 + OpenResponsesOutputItemDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.output_item.done + output_index: + type: number + item: + oneOf: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/OutputItemReasoning' + - $ref: '#/components/schemas/OutputItemFunctionCall' + - $ref: '#/components/schemas/OutputItemWebSearchCall' + - $ref: '#/components/schemas/OutputItemFileSearchCall' + - $ref: '#/components/schemas/OutputItemImageGenerationCall' + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/OutputMessage' + reasoning: '#/components/schemas/OutputItemReasoning' + function_call: '#/components/schemas/OutputItemFunctionCall' + web_search_call: '#/components/schemas/OutputItemWebSearchCall' + file_search_call: '#/components/schemas/OutputItemFileSearchCall' + image_generation_call: '#/components/schemas/OutputItemImageGenerationCall' + sequence_number: + type: number + required: + - type + - output_index + - item + - sequence_number + 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 + OpenResponsesContentPartAddedEvent: + type: object + properties: + type: + type: string + enum: + - response.content_part.added + output_index: + type: number + item_id: + type: string + content_index: + type: number + part: + anyOf: + - $ref: '#/components/schemas/ResponseOutputText' + - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - part + - sequence_number + description: Event emitted when a new content part is added to an output item + example: + type: response.content_part.added + output_index: 0 + item_id: item-1 + content_index: 0 + part: + type: output_text + text: '' + annotations: [] + sequence_number: 3 + OpenResponsesContentPartDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.content_part.done + output_index: + type: number + item_id: + type: string + content_index: + type: number + part: + anyOf: + - $ref: '#/components/schemas/ResponseOutputText' + - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - part + - sequence_number + description: Event emitted when a content part is complete + example: + type: response.content_part.done + output_index: 0 + item_id: item-1 + content_index: 0 + part: + type: output_text + text: Hello! How can I help you? + annotations: [] + sequence_number: 7 + OpenResponsesTopLogprobs: + type: object + properties: + token: + type: string + logprob: + type: number + description: Alternative token with its log probability + example: + token: hello + logprob: -0.5 + OpenResponsesLogProbs: + type: object + properties: + logprob: + type: number + token: + type: string + top_logprobs: + type: array + items: + $ref: '#/components/schemas/OpenResponsesTopLogprobs' + required: + - logprob + - token + description: Log probability information for a token + example: + logprob: -0.1 + token: world + top_logprobs: + - token: hello + logprob: -0.5 + OpenResponsesTextDeltaEvent: + type: object + properties: + type: + type: string + enum: + - response.output_text.delta + logprobs: + type: array + items: + $ref: '#/components/schemas/OpenResponsesLogProbs' + output_index: + type: number + item_id: + type: string + content_index: + type: number + delta: + type: string + sequence_number: + type: number + required: + - type + - logprobs + - output_index + - item_id + - content_index + - delta + - sequence_number + description: Event emitted when a text delta is streamed + example: + type: response.output_text.delta + logprobs: [] + output_index: 0 + item_id: item-1 + content_index: 0 + delta: Hello + sequence_number: 4 + OpenResponsesTextDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.output_text.done + output_index: + type: number + item_id: + type: string + content_index: + type: number + text: + type: string + sequence_number: + type: number + logprobs: + type: array + items: + $ref: '#/components/schemas/OpenResponsesLogProbs' + required: + - type + - output_index + - item_id + - content_index + - text + - sequence_number + - logprobs + description: Event emitted when text streaming is complete + example: + type: response.output_text.done + output_index: 0 + item_id: item-1 + content_index: 0 + text: Hello! How can I help you? + sequence_number: 6 + logprobs: [] + OpenResponsesRefusalDeltaEvent: + type: object + properties: + type: + type: string + enum: + - response.refusal.delta + output_index: + type: number + item_id: + type: string + content_index: + type: number + delta: + type: string + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - delta + - sequence_number + description: Event emitted when a refusal delta is streamed + example: + type: response.refusal.delta + output_index: 0 + item_id: item-1 + content_index: 0 + delta: I'm sorry + sequence_number: 4 + OpenResponsesRefusalDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.refusal.done + output_index: + type: number + item_id: + type: string + content_index: + type: number + refusal: + type: string + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - refusal + - sequence_number + description: Event emitted when refusal streaming is complete + example: + type: response.refusal.done + output_index: 0 + item_id: item-1 + content_index: 0 + refusal: I'm sorry, but I can't assist with that request. + sequence_number: 6 + OpenResponsesOutputTextAnnotationAddedEvent: + type: object + properties: + type: + type: string + enum: + - response.output_text.annotation.added + output_index: + type: number + item_id: + type: string + content_index: + type: number + sequence_number: + type: number + annotation_index: + type: number + annotation: + $ref: '#/components/schemas/OpenAIResponsesAnnotation' + required: + - type + - output_index + - item_id + - content_index + - sequence_number + - annotation_index + - annotation + description: Event emitted when a text annotation is added to output + example: + type: response.output_text.annotation.added + output_index: 0 + item_id: item-1 + content_index: 0 + sequence_number: 5 + annotation_index: 0 + annotation: + type: url_citation + url: https://example.com + title: Example + start_index: 0 + end_index: 7 + OpenResponsesFunctionCallArgumentsDeltaEvent: + type: object + properties: + type: + type: string + enum: + - response.function_call_arguments.delta + item_id: + type: string + output_index: + type: number + delta: + type: string + sequence_number: + type: number + required: + - type + - item_id + - output_index + - delta + - sequence_number + description: Event emitted when function call arguments are being streamed + example: + type: response.function_call_arguments.delta + item_id: item-1 + output_index: 0 + delta: '{"city": "San' + sequence_number: 4 + OpenResponsesFunctionCallArgumentsDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.function_call_arguments.done + item_id: + type: string + output_index: + type: number + name: + type: string + arguments: + type: string + sequence_number: + type: number + required: + - type + - item_id + - output_index + - name + - arguments + - sequence_number + description: Event emitted when function call arguments streaming is complete + example: + type: response.function_call_arguments.done + item_id: item-1 + output_index: 0 + name: get_weather + arguments: '{"city": "San Francisco", "units": "celsius"}' + sequence_number: 6 + OpenAIResponsesReasoningDeltaEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_text.delta + output_index: + type: number + item_id: + type: string + content_index: + type: number + delta: + type: string + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - delta + - sequence_number + description: Event emitted when reasoning text delta is streamed + example: + type: response.reasoning_text.delta + output_index: 0 + item_id: item-1 + content_index: 0 + delta: First, we need + sequence_number: 4 + OpenResponsesReasoningDeltaEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningDeltaEvent' + - type: object + properties: {} + description: Event emitted when reasoning text delta is streamed + example: + type: response.reasoning_text.delta + output_index: 0 + item_id: item-1 + content_index: 0 + delta: First, we need + sequence_number: 4 + OpenAIResponsesReasoningDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_text.done + output_index: + type: number + item_id: + type: string + content_index: + type: number + text: + type: string + sequence_number: + type: number + required: + - type + - output_index + - item_id + - content_index + - text + - sequence_number + description: Event emitted when reasoning text streaming is complete + example: + type: response.reasoning_text.done + output_index: 0 + item_id: item-1 + content_index: 0 + text: First, we need to identify the key components and then combine them logically. + sequence_number: 6 + OpenResponsesReasoningDoneEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningDoneEvent' + - type: object + properties: {} + description: Event emitted when reasoning text streaming is complete + example: + type: response.reasoning_text.done + output_index: 0 + item_id: item-1 + content_index: 0 + text: First, we need to identify the key components and then combine them logically. + sequence_number: 6 + OpenAIResponsesReasoningSummaryPartAddedEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_summary_part.added + output_index: + type: number + item_id: + type: string + summary_index: + type: number + part: + $ref: '#/components/schemas/ReasoningSummaryText' + sequence_number: + type: number + required: + - type + - output_index + - item_id + - summary_index + - part + - sequence_number + description: Event emitted when a reasoning summary part is added + example: + type: response.reasoning_summary_part.added + output_index: 0 + item_id: item-1 + summary_index: 0 + part: + type: summary_text + text: '' + sequence_number: 3 + OpenResponsesReasoningSummaryPartAddedEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningSummaryPartAddedEvent' + - type: object + properties: {} + description: Event emitted when a reasoning summary part is added + example: + type: response.reasoning_summary_part.added + output_index: 0 + item_id: item-1 + summary_index: 0 + part: + type: summary_text + text: '' + sequence_number: 3 + OpenResponsesReasoningSummaryPartDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_summary_part.done + output_index: + type: number + item_id: + type: string + summary_index: + type: number + part: + $ref: '#/components/schemas/ReasoningSummaryText' + sequence_number: + type: number + required: + - type + - output_index + - item_id + - summary_index + - part + - sequence_number + description: Event emitted when a reasoning summary part is complete + example: + type: response.reasoning_summary_part.done + output_index: 0 + item_id: item-1 + summary_index: 0 + part: + type: summary_text + text: Analyzing the problem step by step to find the optimal solution. + sequence_number: 7 + OpenAIResponsesReasoningSummaryTextDeltaEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_summary_text.delta + item_id: + type: string + output_index: + type: number + summary_index: + type: number + delta: + type: string + sequence_number: + type: number + required: + - type + - item_id + - output_index + - summary_index + - delta + - sequence_number + description: Event emitted when reasoning summary text delta is streamed + example: + type: response.reasoning_summary_text.delta + item_id: item-1 + output_index: 0 + summary_index: 0 + delta: Analyzing + sequence_number: 4 + OpenResponsesReasoningSummaryTextDeltaEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningSummaryTextDeltaEvent' + - type: object + properties: {} + description: Event emitted when reasoning summary text delta is streamed + example: + type: response.reasoning_summary_text.delta + item_id: item-1 + output_index: 0 + summary_index: 0 + delta: Analyzing + sequence_number: 4 + OpenAIResponsesReasoningSummaryTextDoneEvent: + type: object + properties: + type: + type: string + enum: + - response.reasoning_summary_text.done + item_id: + type: string + output_index: + type: number + summary_index: + type: number + text: + type: string + sequence_number: + type: number + required: + - type + - item_id + - output_index + - summary_index + - text + - sequence_number + description: Event emitted when reasoning summary text streaming is complete + example: + type: response.reasoning_summary_text.done + item_id: item-1 + output_index: 0 + summary_index: 0 + text: Analyzing the problem step by step to find the optimal solution. + sequence_number: 6 + OpenResponsesReasoningSummaryTextDoneEvent: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningSummaryTextDoneEvent' + - type: object + properties: {} + description: Event emitted when reasoning summary text streaming is complete + example: + type: response.reasoning_summary_text.done + item_id: item-1 + output_index: 0 + summary_index: 0 + text: Analyzing the problem step by step to find the optimal solution. + sequence_number: 6 + OpenAIResponsesImageGenCallInProgress: + type: object + properties: + type: + type: string + enum: + - response.image_generation_call.in_progress + item_id: + type: string + output_index: + type: number + sequence_number: + type: number + required: + - type + - item_id + - output_index + - sequence_number + OpenResponsesImageGenCallInProgress: + 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 + OpenAIResponsesImageGenCallGenerating: + type: object + properties: + type: + type: string + enum: + - response.image_generation_call.generating + item_id: + type: string + output_index: + type: number + sequence_number: + type: number + required: + - type + - item_id + - output_index + - sequence_number + OpenResponsesImageGenCallGenerating: + 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 + OpenAIResponsesImageGenCallPartialImage: + type: object + properties: + type: + type: string + enum: + - response.image_generation_call.partial_image + item_id: + type: string + output_index: + type: number + sequence_number: + type: number + partial_image_b64: + type: string + partial_image_index: + type: number + required: + - type + - item_id + - output_index + - sequence_number + - partial_image_b64 + - partial_image_index + OpenResponsesImageGenCallPartialImage: + 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 + sequence_number: 3 + item_id: call-123 + partial_image_b64: base64encodedimage... + partial_image_index: 0 + OpenAIResponsesImageGenCallCompleted: + type: object + properties: + type: + type: string + enum: + - response.image_generation_call.completed + item_id: + type: string + output_index: + type: number + sequence_number: + type: number + required: + - type + - item_id + - output_index + - sequence_number + OpenResponsesImageGenCallCompleted: + 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 + OpenResponsesStreamEvent: + oneOf: + - allOf: + - $ref: '#/components/schemas/OpenResponsesCreatedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + 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/OpenResponsesInProgressEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + 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/OpenResponsesCompletedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + 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/OpenResponsesIncompleteEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + 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/OpenResponsesFailedEvent' + - type: object + properties: + response: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + 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/OpenResponsesErrorEvent' + - allOf: + - $ref: '#/components/schemas/OpenResponsesOutputItemAddedEvent' + - type: object + properties: + item: + $ref: '#/components/schemas/ResponsesOutputItem' + 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/OpenResponsesOutputItemDoneEvent' + - type: object + properties: + item: + $ref: '#/components/schemas/ResponsesOutputItem' + 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 + - allOf: + - $ref: '#/components/schemas/OpenResponsesContentPartAddedEvent' + - type: object + properties: + part: + anyOf: + - $ref: '#/components/schemas/ResponseOutputText' + - $ref: '#/components/schemas/ReasoningTextContent' + - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' + description: Event emitted when a new content part is added to an output item + example: + type: response.content_part.added + output_index: 0 + item_id: item-1 + content_index: 0 + part: + type: output_text + text: '' + annotations: [] + sequence_number: 3 + - allOf: + - $ref: '#/components/schemas/OpenResponsesContentPartDoneEvent' + - type: object + properties: + part: + anyOf: + - $ref: '#/components/schemas/ResponseOutputText' + - $ref: '#/components/schemas/ReasoningTextContent' + - $ref: '#/components/schemas/OpenAIResponsesRefusalContent' + description: Event emitted when a content part is complete + example: + type: response.content_part.done + output_index: 0 + item_id: item-1 + content_index: 0 + part: + type: output_text + text: Hello! How can I help you? + annotations: [] + sequence_number: 7 + - allOf: + - $ref: '#/components/schemas/OpenResponsesTextDeltaEvent' + - type: object + properties: {} + description: Event emitted when a text delta is streamed + example: + type: response.output_text.delta + logprobs: [] + output_index: 0 + item_id: item-1 + content_index: 0 + delta: Hello + sequence_number: 4 + - allOf: + - $ref: '#/components/schemas/OpenResponsesTextDoneEvent' + - type: object + properties: {} + description: Event emitted when text streaming is complete + example: + type: response.output_text.done + output_index: 0 + item_id: item-1 + content_index: 0 + text: Hello! How can I help you? + sequence_number: 6 + logprobs: [] + - allOf: + - $ref: '#/components/schemas/OpenResponsesRefusalDeltaEvent' + - type: object + properties: {} + description: Event emitted when a refusal delta is streamed + example: + type: response.refusal.delta + output_index: 0 + item_id: item-1 + content_index: 0 + delta: I'm sorry + sequence_number: 4 + - allOf: + - $ref: '#/components/schemas/OpenResponsesRefusalDoneEvent' + - type: object + properties: {} + description: Event emitted when refusal streaming is complete + example: + type: response.refusal.done + output_index: 0 + item_id: item-1 + content_index: 0 + refusal: I'm sorry, but I can't assist with that request. + sequence_number: 6 + - allOf: + - $ref: '#/components/schemas/OpenResponsesOutputTextAnnotationAddedEvent' + - type: object + properties: {} + description: Event emitted when a text annotation is added to output + example: + type: response.output_text.annotation.added + output_index: 0 + item_id: item-1 + content_index: 0 + sequence_number: 5 + annotation_index: 0 + annotation: + type: url_citation + url: https://example.com + title: Example + start_index: 0 + end_index: 7 + - allOf: + - $ref: '#/components/schemas/OpenResponsesFunctionCallArgumentsDeltaEvent' + - type: object + properties: {} + description: Event emitted when function call arguments are being streamed + example: + type: response.function_call_arguments.delta + item_id: item-1 + output_index: 0 + delta: '{"city": "San' + sequence_number: 4 + - allOf: + - $ref: '#/components/schemas/OpenResponsesFunctionCallArgumentsDoneEvent' + - type: object + properties: {} + description: Event emitted when function call arguments streaming is complete + example: + type: response.function_call_arguments.done + item_id: item-1 + output_index: 0 + name: get_weather + arguments: '{"city": "San Francisco", "units": "celsius"}' + sequence_number: 6 + - $ref: '#/components/schemas/OpenResponsesReasoningDeltaEvent' + - $ref: '#/components/schemas/OpenResponsesReasoningDoneEvent' + - $ref: '#/components/schemas/OpenResponsesReasoningSummaryPartAddedEvent' + - allOf: + - $ref: '#/components/schemas/OpenResponsesReasoningSummaryPartDoneEvent' + - type: object + properties: {} + description: Event emitted when a reasoning summary part is complete + example: + type: response.reasoning_summary_part.done + output_index: 0 + item_id: item-1 + summary_index: 0 + part: + type: summary_text + text: Analyzing the problem step by step to find the optimal solution. + sequence_number: 7 + - $ref: '#/components/schemas/OpenResponsesReasoningSummaryTextDeltaEvent' + - $ref: '#/components/schemas/OpenResponsesReasoningSummaryTextDoneEvent' + - $ref: '#/components/schemas/OpenResponsesImageGenCallInProgress' + - $ref: '#/components/schemas/OpenResponsesImageGenCallGenerating' + - $ref: '#/components/schemas/OpenResponsesImageGenCallPartialImage' + - $ref: '#/components/schemas/OpenResponsesImageGenCallCompleted' + description: Union of all possible event types emitted during response streaming + 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 + BadRequestResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for BadRequestResponse + example: + code: 400 + message: Invalid request parameters + BadRequestResponse: + type: object + properties: + error: + $ref: '#/components/schemas/BadRequestResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Bad Request - Invalid request parameters or malformed input + example: + error: + code: 400 + message: Invalid request parameters + UnauthorizedResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for UnauthorizedResponse + example: + code: 401 + message: Missing Authentication header + UnauthorizedResponse: + type: object + properties: + error: + $ref: '#/components/schemas/UnauthorizedResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Unauthorized - Authentication required or invalid credentials + example: + error: + code: 401 + message: Missing Authentication header + PaymentRequiredResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for PaymentRequiredResponse + example: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits + PaymentRequiredResponse: + type: object + properties: + error: + $ref: '#/components/schemas/PaymentRequiredResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Payment Required - Insufficient credits or quota to complete request + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits + NotFoundResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for NotFoundResponse + example: + code: 404 + message: Resource not found + NotFoundResponse: + type: object + properties: + error: + $ref: '#/components/schemas/NotFoundResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Not Found - Resource does not exist + example: + error: + code: 404 + message: Resource not found + RequestTimeoutResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for RequestTimeoutResponse + example: + code: 408 + message: Operation timed out. Please try again later. + RequestTimeoutResponse: + type: object + properties: + error: + $ref: '#/components/schemas/RequestTimeoutResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Request Timeout - Operation exceeded time limit + example: + error: + code: 408 + message: Operation timed out. Please try again later. + PayloadTooLargeResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for PayloadTooLargeResponse + example: + code: 413 + message: Request payload too large + PayloadTooLargeResponse: + type: object + properties: + error: + $ref: '#/components/schemas/PayloadTooLargeResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Payload Too Large - Request payload exceeds size limits + example: + error: + code: 413 + message: Request payload too large + UnprocessableEntityResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for UnprocessableEntityResponse + example: + code: 422 + message: Invalid argument + UnprocessableEntityResponse: + type: object + properties: + error: + $ref: '#/components/schemas/UnprocessableEntityResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Unprocessable Entity - Semantic validation failure + example: + error: + code: 422 + message: Invalid argument + TooManyRequestsResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for TooManyRequestsResponse + example: + code: 429 + message: Rate limit exceeded + TooManyRequestsResponse: + type: object + properties: + error: + $ref: '#/components/schemas/TooManyRequestsResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Too Many Requests - Rate limit exceeded + example: + error: + code: 429 + message: Rate limit exceeded + InternalServerResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for InternalServerResponse + example: + code: 500 + message: Internal Server Error + InternalServerResponse: + type: object + properties: + error: + $ref: '#/components/schemas/InternalServerResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Internal Server Error - Unexpected server error + example: + error: + code: 500 + message: Internal Server Error + BadGatewayResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for BadGatewayResponse + example: + code: 502 + message: Provider returned error + BadGatewayResponse: + type: object + properties: + error: + $ref: '#/components/schemas/BadGatewayResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Bad Gateway - Provider/upstream API failure + example: + error: + code: 502 + message: Provider returned error + ServiceUnavailableResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for ServiceUnavailableResponse + example: + code: 503 + message: Service temporarily unavailable + ServiceUnavailableResponse: + type: object + properties: + error: + $ref: '#/components/schemas/ServiceUnavailableResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Service Unavailable - Service temporarily unavailable + example: + error: + code: 503 + message: Service temporarily unavailable + EdgeNetworkTimeoutResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for EdgeNetworkTimeoutResponse + example: + code: 524 + message: Request timed out. Please try again later. + EdgeNetworkTimeoutResponse: + type: object + properties: + error: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Infrastructure Timeout - Provider request timed out at edge network + example: + error: + code: 524 + message: Request timed out. Please try again later. + ProviderOverloadedResponseErrorData: + type: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for ProviderOverloadedResponse + example: + code: 529 + message: Provider returned error + ProviderOverloadedResponse: + type: object + properties: + error: + $ref: '#/components/schemas/ProviderOverloadedResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Provider Overloaded - Provider is temporarily overloaded + example: + error: + code: 529 + message: Provider returned error + OpenResponsesReasoning: + allOf: + - $ref: '#/components/schemas/OutputItemReasoning' + - type: object + properties: + signature: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + example: + type: reasoning + id: reasoning-abc123 + summary: + - type: summary_text + text: Step by step analysis + description: Reasoning output item with signature and format extensions + OpenResponsesEasyInputMessage: + type: object + properties: + type: + type: string + enum: + - message + role: + anyOf: + - type: string + enum: + - user + - type: string + enum: + - system + - type: string + enum: + - assistant + - type: string + enum: + - developer + content: + anyOf: + - type: array + items: + oneOf: + - $ref: '#/components/schemas/ResponseInputText' + - $ref: '#/components/schemas/ResponseInputImage' + - $ref: '#/components/schemas/ResponseInputFile' + - $ref: '#/components/schemas/ResponseInputAudio' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/ResponseInputText' + input_image: '#/components/schemas/ResponseInputImage' + input_file: '#/components/schemas/ResponseInputFile' + input_audio: '#/components/schemas/ResponseInputAudio' + - type: string + required: + - role + - content + OpenResponsesInputMessageItem: + 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/ResponseInputText' + - $ref: '#/components/schemas/ResponseInputImage' + - $ref: '#/components/schemas/ResponseInputFile' + - $ref: '#/components/schemas/ResponseInputAudio' + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/ResponseInputText' + input_image: '#/components/schemas/ResponseInputImage' + input_file: '#/components/schemas/ResponseInputFile' + input_audio: '#/components/schemas/ResponseInputAudio' + required: + - role + - content + OpenResponsesFunctionToolCall: + 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 + - id + description: A function call initiated by the model + example: + id: call-abc123 + type: function_call + call_id: call-abc123 + name: get_weather + arguments: '{"location":"San Francisco"}' + status: completed + OpenResponsesFunctionCallOutput: + type: object + properties: + type: + type: string + enum: + - function_call_output + id: + type: string + nullable: true + call_id: + type: string + output: + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' + required: + - type + - call_id + - output + description: The output from a function call execution + example: + type: function_call_output + id: output-abc123 + call_id: call-abc123 + output: '{"temperature":72,"conditions":"sunny"}' + status: completed + OpenResponsesInput: + anyOf: + - type: string + - type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenResponsesReasoning' + - $ref: '#/components/schemas/OpenResponsesEasyInputMessage' + - $ref: '#/components/schemas/OpenResponsesInputMessageItem' + - $ref: '#/components/schemas/OpenResponsesFunctionToolCall' + - $ref: '#/components/schemas/OpenResponsesFunctionCallOutput' + - $ref: '#/components/schemas/ResponsesOutputMessage' + - $ref: '#/components/schemas/ResponsesOutputItemReasoning' + - $ref: '#/components/schemas/ResponsesOutputItemFunctionCall' + - $ref: '#/components/schemas/ResponsesWebSearchCallOutput' + - $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall' + - $ref: '#/components/schemas/ResponsesImageGenerationCall' + description: Input for a response request - can be a string or array of items + example: + - role: user + content: What is the weather today? + OpenResponsesResponseText: + allOf: + - $ref: '#/components/schemas/ResponseTextConfig' + - type: object + properties: {} + description: Text output configuration including format and verbosity + example: + format: + type: text + verbosity: medium + OpenResponsesReasoningConfig: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesReasoningConfig' + - type: object + nullable: true + properties: + max_tokens: + type: number + nullable: true + enabled: + type: boolean + nullable: true + description: Configuration for reasoning mode in the response + example: + summary: auto + enabled: true + OpenAIResponsesIncludable: + type: string + enum: + - file_search_call.results + - message.input_image.image_url + - computer_call_output.output.image_url + - reasoning.encrypted_content + - code_interpreter_call.outputs + 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: + - AI21 + - AionLabs + - Alibaba + - Amazon Bedrock + - Anthropic + - Arcee + - AtlasCloud + - Avian + - Azure + - BaseTen + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - InferenceNet + - Infermatic + - Inflection + - Liquid + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Relace + - SambaNova + - SiliconFlow + - Stealth + - Switchpoint + - Targon + - Together + - Venice + - WandB + - xAI + - Z.AI + - FakeProvider + example: OpenAI + Quantization: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - unknown + example: fp16 + ProviderSort: + type: string + nullable: true + enum: + - price + - throughput + - latency + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is + performed. + example: price + BigNumberUnion: + anyOf: + - type: number + - type: string + - type: number + example: 1000 + description: A value in string or number format that is a large number + example: 1000 + OpenResponsesRequest: + type: object + properties: + input: + $ref: '#/components/schemas/OpenResponsesInput' + instructions: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/OpenResponsesRequestMetadata' + tools: + type: array + items: + oneOf: + - allOf: + - $ref: '#/components/schemas/OpenResponsesFunctionTool' + - type: object + properties: {} + description: Function tool definition + example: + type: function + name: get_weather + description: Get the current weather in a location + parameters: + type: object + properties: + location: + type: string + description: The city and state + unit: + type: string + enum: + - celsius + - fahrenheit + required: + - location + - $ref: '#/components/schemas/OpenResponsesWebSearchPreviewTool' + - $ref: '#/components/schemas/OpenResponsesWebSearchPreview20250311Tool' + - $ref: '#/components/schemas/OpenResponsesWebSearchTool' + - $ref: '#/components/schemas/OpenResponsesWebSearch20250826Tool' + tool_choice: + $ref: '#/components/schemas/OpenAIResponsesToolChoice' + parallel_tool_calls: + type: boolean + nullable: true + model: + type: string + models: + type: array + items: + type: string + text: + $ref: '#/components/schemas/OpenResponsesResponseText' + reasoning: + $ref: '#/components/schemas/OpenResponsesReasoningConfig' + max_output_tokens: + type: number + nullable: true + temperature: + type: number + nullable: true + minimum: 0 + maximum: 2 + top_p: + type: number + nullable: true + minimum: 0 + top_k: + type: number + prompt_cache_key: + type: string + nullable: true + previous_response_id: + type: string + nullable: true + prompt: + $ref: '#/components/schemas/OpenAIResponsesPrompt' + include: + type: array + nullable: true + items: + $ref: '#/components/schemas/OpenAIResponsesIncludable' + background: + type: boolean + nullable: true + safety_identifier: + type: string + nullable: true + store: + type: boolean + nullable: true + service_tier: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesServiceTier' + - enum: + - auto + - default + - flex + - scale + - priority + example: auto + truncation: + allOf: + - $ref: '#/components/schemas/OpenAIResponsesTruncation' + - example: auto + stream: + 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: + $ref: '#/components/schemas/ProviderSort' + max_price: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + $ref: '#/components/schemas/BigNumberUnion' + image: + $ref: '#/components/schemas/BigNumberUnion' + audio: + $ref: '#/components/schemas/BigNumberUnion' + request: + $ref: '#/components/schemas/BigNumberUnion' + additionalProperties: false + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, + for prompt and completion. + 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: + - moderation + required: + - id + - type: object + properties: + id: + type: string + enum: + - web + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + required: + - id + - type: object + properties: + id: + type: string + enum: + - file-parser + max_files: + type: number + pdf: + type: object + properties: + engine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + required: + - id + description: Plugins you want to enable for this request, including their settings. + user: + type: string + maxLength: 128 + 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 128 characters. + description: Request schema for Responses endpoint + example: + model: anthropic/claude-4.5-sonnet-20250929 + input: + - type: message + content: Hello, how are you? + role: user + temperature: 0.7 + top_p: 0.9 + tools: + - type: function + name: get_current_weather + description: Get the current weather in a given location + parameters: + type: object + properties: + location: + type: string + ActivityItem: + type: object + properties: + 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 + 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 + 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: object + properties: + code: + type: integer + message: + type: string + metadata: + type: object + nullable: true + additionalProperties: + nullable: true + required: + - code + - message + description: Error data for ForbiddenResponse + example: + code: 403 + message: Only provisioning keys can perform this operation + ForbiddenResponse: + type: object + properties: + error: + $ref: '#/components/schemas/ForbiddenResponseErrorData' + user_id: + type: string + nullable: true + required: + - error + description: Forbidden - Authentication successful but insufficient permissions + example: + error: + code: 403 + message: Only provisioning keys can perform this operation + CreateChargeRequest: + type: object + properties: + amount: + type: number + sender: + type: string + chain_id: + type: integer + enum: + - 1 + - 137 + - 8453 + required: + - amount + - sender + - chain_id + description: Create a Coinbase charge for crypto payment + example: + amount: 100 + sender: '0x1234567890123456789012345678901234567890' + chain_id: 1 + PublicPricing: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + $ref: '#/components/schemas/BigNumberUnion' + request: + $ref: '#/components/schemas/BigNumberUnion' + image: + $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' + image_output: + $ref: '#/components/schemas/BigNumberUnion' + audio: + $ref: '#/components/schemas/BigNumberUnion' + input_audio_cache: + $ref: '#/components/schemas/BigNumberUnion' + web_search: + $ref: '#/components/schemas/BigNumberUnion' + internal_reasoning: + $ref: '#/components/schemas/BigNumberUnion' + input_cache_read: + $ref: '#/components/schemas/BigNumberUnion' + input_cache_write: + $ref: '#/components/schemas/BigNumberUnion' + discount: + type: number + required: + - prompt + - completion + additionalProperties: false + 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 + - 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 + 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 + 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: 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 + 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 + - logit_bias + - logprobs + - top_logprobs + - seed + - response_format + - structured_outputs + - stop + - tools + - tool_choice + - parallel_tool_calls + - include_reasoning + - reasoning + - web_search_options + - verbosity + example: temperature + DefaultParameters: + type: object + nullable: true + properties: + temperature: + type: number + nullable: true + minimum: 0 + maximum: 2 + top_p: + type: number + nullable: true + minimum: 0 + maximum: 1 + frequency_penalty: + type: number + nullable: true + minimum: -2 + maximum: 2 + additionalProperties: false + description: Default parameters for this model + example: + temperature: 0.7 + top_p: 0.9 + frequency_penalty: 0 + 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: number + 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: 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' + 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 + 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 + ModelsListResponseData: + type: array + items: + $ref: '#/components/schemas/Model' + description: List of available models + 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 + ModelsCountResponse: + 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 + required: + - data + description: Model count data + 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 + PublicEndpoint: + type: object + properties: + name: + type: string + model_name: + type: string + context_length: + type: number + pricing: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + $ref: '#/components/schemas/BigNumberUnion' + request: + $ref: '#/components/schemas/BigNumberUnion' + image: + $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' + image_output: + $ref: '#/components/schemas/BigNumberUnion' + audio: + $ref: '#/components/schemas/BigNumberUnion' + input_audio_cache: + $ref: '#/components/schemas/BigNumberUnion' + web_search: + $ref: '#/components/schemas/BigNumberUnion' + internal_reasoning: + $ref: '#/components/schemas/BigNumberUnion' + input_cache_read: + $ref: '#/components/schemas/BigNumberUnion' + input_cache_write: + $ref: '#/components/schemas/BigNumberUnion' + discount: + type: number + required: + - prompt + - completion + additionalProperties: false + provider_name: + $ref: '#/components/schemas/ProviderName' + tag: + type: string + quantization: + allOf: + - $ref: '#/components/schemas/Quantization' + - nullable: true + max_completion_tokens: + type: number + nullable: true + max_prompt_tokens: + type: number + nullable: true + supported_parameters: + type: array + items: + $ref: '#/components/schemas/Parameter' + status: + $ref: '#/components/schemas/EndpointStatus' + uptime_last_30m: + type: number + nullable: true + supports_implicit_caching: + type: boolean + required: + - name + - model_name + - context_length + - pricing + - provider_name + - tag + - quantization + - max_completion_tokens + - max_prompt_tokens + - supported_parameters + - uptime_last_30m + - supports_implicit_caching + description: Information about a specific model endpoint + example: + 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 + status: 0 + uptime_last_30m: 99.5 + supports_implicit_caching: true + 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: number + 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 + supports_implicit_caching: true + ModelName: + type: string + ChatMessageContentItemText: + type: object + properties: + type: + type: string + const: text + text: + type: string + required: + - type + - text + ChatMessageContentItemImage: + type: object + properties: + type: + type: string + const: image_url + image_url: + type: object + properties: + url: + type: string + detail: + type: string + enum: + - auto + - low + - high + required: + - url + required: + - type + - image_url + ChatMessageContentItemAudio: + type: object + properties: + type: + type: string + const: input_audio + input_audio: + type: object + properties: + data: + type: string + format: + type: string + enum: + - wav + - mp3 + - flac + - m4a + - ogg + - pcm16 + - pcm24 + required: + - data + - format + required: + - type + - input_audio + ChatMessageContentItemVideo: + oneOf: + - type: object + properties: + type: + type: string + const: input_video + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url + - type: object + properties: + type: + type: string + const: video_url + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url + type: object + ChatMessageContentItem: + oneOf: + - $ref: '#/components/schemas/ChatMessageContentItemText' + - $ref: '#/components/schemas/ChatMessageContentItemImage' + - $ref: '#/components/schemas/ChatMessageContentItemAudio' + - $ref: '#/components/schemas/ChatMessageContentItemVideo' + type: object + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/ChatMessageContentItemText' + image_url: '#/components/schemas/ChatMessageContentItemImage' + input_audio: '#/components/schemas/ChatMessageContentItemAudio' + input_video: '#/components/schemas/ChatMessageContentItemVideo' + video_url: '#/components/schemas/ChatMessageContentItemVideo' + ChatMessageToolCall: + type: object + properties: + id: + type: string + type: + type: string + const: function + function: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + required: + - id + - type + - function + ChatMessageTokenLogprob: + type: object + properties: + token: + type: string + logprob: + type: number + bytes: + anyOf: + - type: array + items: + type: number + - type: 'null' + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + logprob: + type: number + bytes: + anyOf: + - type: array + items: + type: number + - type: 'null' + required: + - token + - logprob + - bytes + required: + - token + - logprob + - bytes + - top_logprobs + ChatMessageTokenLogprobs: + type: object + properties: + content: + anyOf: + - type: array + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + - type: 'null' + refusal: + anyOf: + - type: array + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + - type: 'null' + required: + - content + - refusal + ChatGenerationTokenUsage: + type: object + properties: + completion_tokens: + type: number + prompt_tokens: + type: number + total_tokens: + type: number + completion_tokens_details: + anyOf: + - type: object + properties: + reasoning_tokens: + anyOf: + - type: number + - type: 'null' + audio_tokens: + anyOf: + - type: number + - type: 'null' + accepted_prediction_tokens: + anyOf: + - type: number + - type: 'null' + rejected_prediction_tokens: + anyOf: + - type: number + - type: 'null' + - type: 'null' + prompt_tokens_details: + anyOf: + - type: object + properties: + cached_tokens: + type: number + audio_tokens: + type: number + video_tokens: + type: number + - type: 'null' + required: + - completion_tokens + - prompt_tokens + - total_tokens + ChatCompletionFinishReason: + anyOf: + - type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + - type: 'null' + JSONSchemaConfig: + type: object + properties: + name: + type: string + maxLength: 64 + description: + type: string + schema: + type: object + propertyNames: + type: string + additionalProperties: {} + strict: + anyOf: + - type: boolean + - type: 'null' + required: + - name + ResponseFormatJSONSchema: + type: object + properties: + type: + type: string + const: json_schema + json_schema: + $ref: '#/components/schemas/JSONSchemaConfig' + required: + - type + - json_schema + ResponseFormatTextGrammar: + type: object + properties: + type: + type: string + const: grammar + grammar: + type: string + required: + - type + - grammar + SystemMessage: + type: object + properties: + role: + type: string + const: system + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content + UserMessage: + type: object + properties: + role: + type: string + const: user + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + name: + type: string + required: + - role + - content + AssistantMessage: + type: object + properties: + role: + type: string + const: assistant + content: + anyOf: + - anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + - type: 'null' + name: + type: string + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatMessageToolCall' + refusal: + anyOf: + - type: string + - type: 'null' + reasoning: + anyOf: + - type: string + - type: 'null' + required: + - role + ToolResponseMessage: + type: object + properties: + role: + type: string + const: tool + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + tool_call_id: + type: string + required: + - role + - content + - tool_call_id + Message: + oneOf: + - $ref: '#/components/schemas/SystemMessage' + - $ref: '#/components/schemas/UserMessage' + - type: object + properties: + role: + type: string + const: developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content + - $ref: '#/components/schemas/AssistantMessage' + - $ref: '#/components/schemas/ToolResponseMessage' + type: object + ToolDefinitionJson: + type: object + properties: + type: + type: string + const: function + function: + type: object + properties: + name: + type: string + maxLength: 64 + description: + type: string + parameters: + type: object + propertyNames: + type: string + additionalProperties: {} + strict: + anyOf: + - type: boolean + - type: 'null' + required: + - name + required: + - type + - function + NamedToolChoice: + type: object + properties: + type: + type: string + const: function + function: + type: object + properties: + name: + type: string + required: + - name + required: + - type + - function + ToolChoiceOption: + anyOf: + - type: string + const: none + - type: string + const: auto + - type: string + const: required + - $ref: '#/components/schemas/NamedToolChoice' + ChatStreamOptions: + type: object + properties: + include_usage: + type: boolean + ChatGenerationParams: + type: object + properties: + messages: + minItems: 1 + type: array + items: + $ref: '#/components/schemas/Message' + model: + $ref: '#/components/schemas/ModelName' + models: + type: array + items: + $ref: '#/components/schemas/ModelName' + frequency_penalty: + anyOf: + - type: number + minimum: -2 + maximum: 2 + - type: 'null' + logit_bias: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: + type: number + - type: 'null' + logprobs: + anyOf: + - type: boolean + - type: 'null' + top_logprobs: + anyOf: + - type: number + minimum: 0 + maximum: 20 + - type: 'null' + max_completion_tokens: + anyOf: + - type: number + minimum: 1 + - type: 'null' + max_tokens: + anyOf: + - type: number + minimum: 1 + - type: 'null' + metadata: + type: object + propertyNames: + type: string + additionalProperties: + type: string + presence_penalty: + anyOf: + - type: number + minimum: -2 + maximum: 2 + - type: 'null' + reasoning: + type: object + properties: + effort: + anyOf: + - type: string + enum: + - none + - minimal + - low + - medium + - high + - type: 'null' + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryVerbosity' + - type: 'null' + response_format: + oneOf: + - type: object + properties: + type: + type: string + const: text + required: + - type + - type: object + properties: + type: + type: string + const: json_object + required: + - type + - $ref: '#/components/schemas/ResponseFormatJSONSchema' + - $ref: '#/components/schemas/ResponseFormatTextGrammar' + - type: object + properties: + type: + type: string + const: python + required: + - type + type: object + seed: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: 'null' + stop: + anyOf: + - anyOf: + - type: string + - maxItems: 4 + type: array + items: + type: string + - type: 'null' + stream: + default: false + type: boolean + stream_options: + anyOf: + - $ref: '#/components/schemas/ChatStreamOptions' + - type: 'null' + temperature: + default: 1 + anyOf: + - type: number + minimum: 0 + maximum: 2 + - type: 'null' + tool_choice: + $ref: '#/components/schemas/ToolChoiceOption' + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinitionJson' + top_p: + default: 1 + anyOf: + - type: number + minimum: 0 + maximum: 1 + - type: 'null' + user: + type: string + required: + - messages + ChatResponseChoice: + type: object + properties: + finish_reason: + $ref: '#/components/schemas/ChatCompletionFinishReason' + index: + type: number + message: + $ref: '#/components/schemas/AssistantMessage' + logprobs: + anyOf: + - $ref: '#/components/schemas/ChatMessageTokenLogprobs' + - type: 'null' + required: + - finish_reason + - index + - message + ChatStreamingMessageToolCall: + type: object + properties: + index: + type: number + id: + type: string + type: + type: string + const: function + function: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - index + ChatStreamingMessageChunk: + type: object + properties: + role: + type: string + enum: + - assistant + content: + anyOf: + - type: string + - type: 'null' + reasoning: + anyOf: + - type: string + - type: 'null' + refusal: + anyOf: + - type: string + - type: 'null' + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatStreamingMessageToolCall' + ChatStreamingChoice: + type: object + properties: + delta: + $ref: '#/components/schemas/ChatStreamingMessageChunk' + finish_reason: + $ref: '#/components/schemas/ChatCompletionFinishReason' + index: + type: number + logprobs: + anyOf: + - $ref: '#/components/schemas/ChatMessageTokenLogprobs' + - type: 'null' + required: + - delta + - finish_reason + - index + ChatError: + type: object + properties: + error: + type: object + properties: + code: + anyOf: + - anyOf: + - type: string + - type: number + - type: 'null' + message: + type: string + param: + anyOf: + - type: string + - type: 'null' + type: + anyOf: + - type: string + - type: 'null' + required: + - code + - message + additionalProperties: false + required: + - error + additionalProperties: false + ChatResponse: + type: object + properties: + id: + type: string + choices: + type: array + items: + $ref: '#/components/schemas/ChatResponseChoice' + created: + type: number + model: + type: string + object: + type: string + const: chat.completion + system_fingerprint: + anyOf: + - type: string + - type: 'null' + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + additionalProperties: false + ChatStreamingResponseChunk: + type: object + properties: + data: + type: object + properties: + id: + type: string + choices: + type: array + items: + $ref: '#/components/schemas/ChatStreamingChoice' + created: + type: number + model: + type: string + object: + type: string + const: chat.completion.chunk + system_fingerprint: + anyOf: + - type: string + - type: 'null' + error: + type: object + properties: + message: + type: string + code: + type: number + required: + - message + - code + additionalProperties: false + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + additionalProperties: false + required: + - data + additionalProperties: false + CompletionFinishReason: + anyOf: + - type: string + enum: + - stop + - length + - content_filter + - type: 'null' + CompletionLogprobs: + type: object + properties: + tokens: + type: array + items: + type: string + token_logprobs: + type: array + items: + type: number + top_logprobs: + anyOf: + - type: array + items: + type: object + propertyNames: + type: string + additionalProperties: + type: number + - type: 'null' + text_offset: + type: array + items: + type: number + required: + - tokens + - token_logprobs + - top_logprobs + - text_offset + CompletionUsage: + type: object + properties: + prompt_tokens: + type: number + completion_tokens: + type: number + total_tokens: + type: number + required: + - prompt_tokens + - completion_tokens + - total_tokens + CompletionCreateParams: + type: object + properties: + model: + $ref: '#/components/schemas/ModelName' + models: + type: array + items: + $ref: '#/components/schemas/ModelName' + prompt: + anyOf: + - type: string + - type: array + items: + type: string + - type: array + items: + type: number + - type: array + items: + type: array + items: + type: number + best_of: + anyOf: + - type: integer + minimum: 1 + maximum: 20 + - type: 'null' + echo: + anyOf: + - type: boolean + - type: 'null' + frequency_penalty: + anyOf: + - type: number + minimum: -2 + maximum: 2 + - type: 'null' + logit_bias: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: + type: number + - type: 'null' + logprobs: + anyOf: + - type: integer + minimum: 0 + maximum: 5 + - type: 'null' + max_tokens: + anyOf: + - type: integer + minimum: 1 + maximum: 9007199254740991 + - type: 'null' + 'n': + anyOf: + - type: integer + minimum: 1 + maximum: 128 + - type: 'null' + presence_penalty: + anyOf: + - type: number + minimum: -2 + maximum: 2 + - type: 'null' + seed: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: 'null' + stop: + anyOf: + - anyOf: + - type: string + - type: array + items: + type: string + - type: 'null' + stream: + default: false + type: boolean + stream_options: + anyOf: + - type: object + properties: + include_usage: + anyOf: + - type: boolean + - type: 'null' + - type: 'null' + suffix: + anyOf: + - type: string + - type: 'null' + temperature: + anyOf: + - type: number + minimum: 0 + maximum: 2 + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + - type: 'null' + user: + type: string + metadata: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: + type: string + - type: 'null' + response_format: + anyOf: + - oneOf: + - type: object + properties: + type: + type: string + const: text + required: + - type + - type: object + properties: + type: + type: string + const: json_object + required: + - type + - $ref: '#/components/schemas/ResponseFormatJSONSchema' + - $ref: '#/components/schemas/ResponseFormatTextGrammar' + - type: object + properties: + type: + type: string + const: python + required: + - type + type: object + - type: 'null' + required: + - prompt + CompletionChoice: + type: object + properties: + text: + type: string + index: + type: number + logprobs: + anyOf: + - $ref: '#/components/schemas/CompletionLogprobs' + - type: 'null' + finish_reason: + $ref: '#/components/schemas/CompletionFinishReason' + required: + - text + - index + - logprobs + - finish_reason + CompletionResponse: + type: object + properties: + id: + type: string + object: + type: string + const: text_completion + created: + type: number + model: + type: string + system_fingerprint: + type: string + choices: + type: array + items: + $ref: '#/components/schemas/CompletionChoice' + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - id + - object + - created + - model + - choices + additionalProperties: false + 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/OpenResponsesRequest' + required: true + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OpenResponsesNonStreamingResponse' + text/event-stream: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/OpenResponsesStreamEvent' + 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 + /activity: + get: + tags: + - 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 + 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 + 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 provisioning 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' + /credits: + get: + x-speakeasy-name-override: getCredits + tags: + - Credits + summary: Get remaining credits + operationId: getCredits + description: Get total credits purchased and used for the authenticated user + responses: + '200': + description: Returns the total credits purchased and used + content: + application/json: + schema: + type: object + description: Total credits purchased and used + 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/UnauthorizedResponse' + '403': + description: Forbidden - Only provisioning keys can fetch credits + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenResponse' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + /credits/coinbase: + post: + security: + - bearer: [] + x-speakeasy-name-override: createCoinbaseCharge + tags: + - Credits + summary: Create a Coinbase charge for crypto payment + operationId: createCoinbaseCharge + description: Create a Coinbase charge for crypto payment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChargeRequest' + required: true + responses: + '200': + description: Returns the calldata to fulfill the transaction + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + id: + type: string + created_at: + type: string + expires_at: + type: string + web3_data: + type: object + properties: + transfer_intent: + type: object + properties: + call_data: + type: object + properties: + deadline: + type: string + fee_amount: + type: string + id: + type: string + operator: + type: string + prefix: + type: string + recipient: + type: string + recipient_amount: + type: string + recipient_currency: + type: string + refund_destination: + type: string + signature: + type: string + required: + - deadline + - fee_amount + - id + - operator + - prefix + - recipient + - recipient_amount + - recipient_currency + - refund_destination + - signature + metadata: + type: object + properties: + chain_id: + type: number + contract_address: + type: string + sender: + type: string + required: + - chain_id + - contract_address + - sender + required: + - call_data + - metadata + required: + - transfer_intent + required: + - id + - created_at + - expires_at + - web3_data + required: + - data + '400': + description: Bad Request - Invalid credit amount or request body + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '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' + /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: + 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: + type: array + nullable: true + items: + $ref: '#/components/schemas/Quantization' + description: A list of quantization levels to filter the provider by. + sort: + $ref: '#/components/schemas/ProviderSort' + max_price: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + $ref: '#/components/schemas/BigNumberUnion' + image: + $ref: '#/components/schemas/BigNumberUnion' + audio: + $ref: '#/components/schemas/BigNumberUnion' + request: + $ref: '#/components/schemas/BigNumberUnion' + additionalProperties: false + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million + tokens, for prompt and completion. + input_type: + type: string + required: + - input + - model + required: true + responses: + '200': + description: Embedding response + content: + application/json: + 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 + 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]' + '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' + '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: Cloudflare Timeout - Provider request timed out at CDN edge + 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: 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: Returns a list of embeddings models + content: + application/json: + schema: + $ref: '#/components/schemas/ModelsListResponse' + '400': + description: Bad Request - Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: listEmbeddingsModels + /generation: + get: + tags: + - Generations + summary: Get request & usage metadata for a generation + parameters: + - schema: + type: string + minLength: 1 + required: true + name: id + in: query + responses: + '200': + description: Returns the request metadata for this generation + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + id: + type: string + description: Unique identifier for the generation + example: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + upstream_id: + type: string + nullable: true + description: Upstream provider's identifier for this generation + example: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 + total_cost: + type: number + description: Total cost of the generation in USD + example: 0.0015 + cache_discount: + type: number + nullable: true + description: Discount applied due to caching + example: 0.0002 + upstream_inference_cost: + type: number + nullable: true + description: Cost charged by the upstream provider + example: 0.0012 + created_at: + type: string + description: ISO 8601 timestamp of when the generation was created + example: '2024-07-15T23:33:19.433273+00:00' + model: + type: string + description: Model used for the generation + example: sao10k/l3-stheno-8b + app_id: + type: number + nullable: true + description: ID of the app that made the request + example: 12345 + streamed: + type: boolean + nullable: true + description: Whether the response was streamed + example: true + cancelled: + type: boolean + nullable: true + description: Whether the generation was cancelled + example: false + provider_name: + type: string + nullable: true + description: Name of the provider that served the request + example: Infermatic + latency: + type: number + nullable: true + description: Total latency in milliseconds + example: 1250 + moderation_latency: + type: number + nullable: true + description: Moderation latency in milliseconds + example: 50 + generation_time: + type: number + nullable: true + description: Time taken for generation in milliseconds + example: 1200 + finish_reason: + type: string + nullable: true + description: Reason the generation finished + example: stop + tokens_prompt: + type: number + nullable: true + description: Number of tokens in the prompt + example: 10 + tokens_completion: + type: number + nullable: true + description: Number of tokens in the completion + example: 25 + native_tokens_prompt: + type: number + nullable: true + description: Native prompt tokens as reported by provider + example: 10 + native_tokens_completion: + type: number + nullable: true + description: Native completion tokens as reported by provider + example: 25 + native_tokens_completion_images: + type: number + nullable: true + description: Native completion image tokens as reported by provider + example: 0 + native_tokens_reasoning: + type: number + nullable: true + description: Native reasoning tokens as reported by provider + example: 5 + native_tokens_cached: + type: number + nullable: true + description: Native cached tokens as reported by provider + example: 3 + num_media_prompt: + type: number + nullable: true + description: Number of media items in the prompt + example: 1 + num_input_audio_prompt: + type: number + nullable: true + description: Number of audio inputs in the prompt + example: 0 + num_media_completion: + type: number + nullable: true + description: Number of media items in the completion + example: 0 + num_search_results: + type: number + nullable: true + description: Number of search results included + example: 5 + origin: + type: string + description: Origin URL of the request + example: https://openrouter.ai/ + usage: + type: number + description: Usage amount in USD + example: 0.0015 + is_byok: + type: boolean + description: Whether this used bring-your-own-key + example: false + native_finish_reason: + type: string + nullable: true + description: Native finish reason as reported by provider + example: stop + external_user: + type: string + nullable: true + description: External user identifier + example: user-123 + api_type: + type: string + nullable: true + enum: + - completions + - embeddings + description: Type of API used for the generation + required: + - id + - upstream_id + - total_cost + - cache_discount + - upstream_inference_cost + - created_at + - model + - app_id + - streamed + - cancelled + - provider_name + - latency + - moderation_latency + - generation_time + - finish_reason + - tokens_prompt + - tokens_completion + - native_tokens_prompt + - native_tokens_completion + - native_tokens_completion_images + - native_tokens_reasoning + - native_tokens_cached + - num_media_prompt + - num_input_audio_prompt + - num_media_completion + - num_search_results + - origin + - usage + - is_byok + - native_finish_reason + - external_user + - api_type + description: Generation data + required: + - data + description: Generation response + '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 - Generation not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + '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' + '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: getGeneration + /models/count: + get: + tags: + - Models + x-speakeasy-name-override: count + summary: Get total count of available models + responses: + '200': + description: Returns the total count of available models + content: + application/json: + schema: + $ref: '#/components/schemas/ModelsCountResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: listModelsCount + /models: + get: + tags: + - Models + x-speakeasy-name-override: list + summary: List all models and their properties + parameters: + - schema: + type: string + required: false + name: category + in: query + - schema: + type: string + required: false + name: supported_parameters + in: query + - schema: + type: string + required: false + name: use_rss + in: query + - schema: + type: string + required: false + name: use_rss_chat_links + in: query + responses: + '200': + description: Returns a list of models or RSS feed + content: + application/json: + schema: + $ref: '#/components/schemas/ModelsListResponse' + application/rss+xml: + schema: + type: string + '400': + description: Bad Request - Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: getModels + /models/user: + get: + tags: + - Models + x-speakeasy-name-override: listForUser + summary: List models filtered by user provider preferences + security: + - bearer: [] + responses: + '200': + description: Returns a list of models filtered by user provider preferences + content: + application/json: + schema: + $ref: '#/components/schemas/ModelsListResponse' + '401': + description: Unauthorized - Missing or invalid authentication + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: listModelsUser + /models/{author}/{slug}/endpoints: + get: + tags: + - Endpoints + operationId: listEndpoints + x-speakeasy-name-override: list + summary: List all endpoints for a model + parameters: + - schema: + type: string + required: true + name: author + in: path + - schema: + type: string + required: true + name: slug + in: path + responses: + '200': + description: Returns a list of endpoints + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/ListEndpointsResponse' + required: + - data + '404': + description: Not Found - Model does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + /endpoints/zdr: + get: + tags: + - Endpoints + x-speakeasy-name-override: listZdrEndpoints + summary: Preview the impact of ZDR on the available endpoints + responses: + '200': + description: Returns a list of endpoints + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/PublicEndpoint' + required: + - data + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: listEndpointsZdr + /parameters/{author}/{slug}: + get: + tags: + - Parameters + summary: Get a model's supported parameters and data about which are most popular + security: + - bearer: [] + parameters: + - schema: + type: string + required: true + name: author + in: path + - schema: + type: string + required: true + name: slug + in: path + - schema: + type: string + enum: + - AI21 + - AionLabs + - Alibaba + - Amazon Bedrock + - Anthropic + - Arcee + - AtlasCloud + - Avian + - Azure + - BaseTen + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - InferenceNet + - Infermatic + - Inflection + - Liquid + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Relace + - SambaNova + - SiliconFlow + - Stealth + - Switchpoint + - Targon + - Together + - Venice + - WandB + - xAI + - Z.AI + - FakeProvider + required: false + name: provider + in: query + responses: + '200': + description: Returns the parameters for the specified model + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + model: + type: string + description: Model identifier + example: openai/gpt-4 + supported_parameters: + type: array + items: + 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 + - web_search_options + - verbosity + description: List of parameters supported by this model + example: + - temperature + - top_p + - max_tokens + required: + - model + - supported_parameters + example: + model: openai/gpt-4 + supported_parameters: + - temperature + - top_p + - max_tokens + description: Parameter analytics data + required: + - data + example: + data: + model: openai/gpt-4 + supported_parameters: + - temperature + - top_p + - max_tokens + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - Model or provider does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: getParameters + /providers: + get: + tags: + - Providers + x-speakeasy-name-override: list + summary: List all providers + operationId: listProviders + responses: + '200': + description: Returns a list of providers + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + type: object + properties: + name: + type: string + description: Display name of the provider + example: OpenAI + slug: + type: string + description: URL-friendly identifier for the provider + example: openai + privacy_policy_url: + type: string + nullable: true + description: URL to the provider's privacy policy + example: https://openai.com/privacy + terms_of_service_url: + type: string + nullable: true + description: URL to the provider's terms of service + example: https://openai.com/terms + status_page_url: + type: string + nullable: true + description: URL to the provider's status page + example: https://status.openai.com + required: + - name + - slug + - privacy_policy_url + example: + 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 + required: + - data + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + /keys: + get: + operationId: list + x-speakeasy-name-override: list + tags: + - API Keys + summary: List API keys + parameters: + - schema: + type: string + description: Whether to include disabled API keys in the response + example: 'false' + required: false + description: Whether to include disabled API keys in the response + name: include_disabled + in: query + - schema: + type: string + description: Number of API keys to skip for pagination + example: '0' + required: false + description: Number of API keys to skip for pagination + name: offset + in: query + responses: + '200': + description: List of API keys + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + type: object + properties: + hash: + type: string + description: Unique hash identifier for the API key + example: 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 + 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: Production API Key + 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' + 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 + example: + hash: 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 + 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' + description: List of API keys + required: + - data + example: + data: + - hash: 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 + 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' + '401': + description: Unauthorized - Missing or invalid authentication + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + post: + x-speakeasy-name-override: create + tags: + - API Keys + summary: Create a new API key + 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 + nullable: true + description: Optional spending limit for the API key in USD + example: 50 + limit_reset: + type: string + nullable: true + enum: + - daily + - weekly + - monthly + 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' + 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' + 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: 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 + 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: Production API Key + 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' + 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 + example: + hash: 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 + 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' + 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: 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 + 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' + key: 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 + '400': + description: Bad Request - Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '401': + description: Unauthorized - Missing or invalid authentication + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: createKeys + /keys/{hash}: + patch: + x-speakeasy-name-override: update + tags: + - API Keys + summary: Update an API key + parameters: + - schema: + type: string + description: The hash identifier of the API key to update + example: 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 + required: true + description: The hash identifier of the API key to update + 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 + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + hash: + type: string + description: Unique hash identifier for the API key + example: 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 + 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: Production API Key + 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' + 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 + example: + hash: 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 + 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' + description: The updated API key information + required: + - data + example: + data: + hash: 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 + 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 + '400': + description: Bad Request - Invalid request parameters + 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: Not Found - API key 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' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: updateKeys + delete: + x-speakeasy-name-override: delete + tags: + - API Keys + summary: Delete an API key + parameters: + - schema: + type: string + description: The hash identifier of the API key to delete + example: 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 + 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 + '401': + description: Unauthorized - Missing or invalid authentication + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - API key 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' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: deleteKeys + get: + operationId: getKey + x-speakeasy-name-override: get + tags: + - API Keys + summary: Get a single API key + parameters: + - schema: + type: string + description: The hash identifier of the API key to retrieve + example: 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 + required: true + description: The hash identifier of the API key to retrieve + name: hash + in: path + responses: + '200': + description: API key details + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + hash: + type: string + description: Unique hash identifier for the API key + example: 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 + 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: Production API Key + 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' + 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 + example: + hash: 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 + 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' + description: The API key information + required: + - data + example: + data: + hash: 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 + 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' + '401': + description: Unauthorized - Missing or invalid authentication + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - API key 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' + '500': + description: Internal 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 + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + label: + type: string + description: Human-readable label for the API key + example: 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 + 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_provisioning_key: + type: boolean + description: Whether this is a provisioning key + 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' + 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_provisioning_key + - limit_remaining + - limit_reset + - include_byok_in_limit + - rate_limit + description: Current API key information + example: + label: sk-or-v1-au78b3456789012345678901234567890 + 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_provisioning_key: false + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + expires_at: '2027-12-31T23:59:59Z' + rate_limit: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. + required: + - data + example: + data: + label: sk-or-v1-au78b3456789012345678901234567890 + 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_provisioning_key: false + limit_remaining: 74.5 + limit_reset: monthly + include_byok_in_limit: false + expires_at: '2027-12-31T23:59:59Z' + rate_limit: + requests: 1000 + interval: 1h + note: This field is deprecated and safe to ignore. + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '500': + description: Internal Server Error - Unexpected server error + 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 + example: + code: auth_code_abc123def456 + code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + code_challenge_method: S256 + required: true + responses: + '200': + description: Successfully exchanged code for an API key + 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 + '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' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + /auth/keys/code: + post: + x-speakeasy-name-override: createAuthCode + tags: + - 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: + 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 + required: + - callback_url + example: + callback_url: https://myapp.com/auth/callback + code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: S256 + limit: 100 + required: true + responses: + '200': + description: Successfully created authorization code + content: + application/json: + schema: + type: object + properties: + 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: 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 + example: + id: auth_code_xyz789 + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' + required: + - data + '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' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + operationId: createAuthKeysCode + /chat/completions: + post: + summary: Create a chat completion + operationId: sendChatCompletionRequest + x-speakeasy-group: chat + x-speakeasy-name-override: send + x-speakeasy-stream-request-field: stream + description: >- + Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming + modes. + tags: + - Chat + requestBody: + required: true + description: Chat completion request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/ChatGenerationParams' + responses: + '200': + description: Successful chat completion response + content: + application/json: + schema: + $ref: '#/components/schemas/ChatResponse' + description: Chat completion response + text/event-stream: + x-speakeasy-sse-sentinel: '[DONE]' + schema: + $ref: '#/components/schemas/ChatStreamingResponseChunk' + '400': + description: Bad request - invalid parameters + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '401': + description: Unauthorized - invalid API key + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '429': + description: Too many requests - rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + /completions: + post: + summary: Create a completion + x-speakeasy-group: completions + x-speakeasy-name-override: generate + x-speakeasy-stream-request-field: stream + description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. + tags: + - Completions + requestBody: + required: true + description: Completion request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionCreateParams' + responses: + '200': + description: Successful completion response + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionResponse' + description: Completion response + '400': + description: Bad request - invalid parameters + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '401': + description: Unauthorized - invalid API key + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '429': + description: Too many requests - rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ChatError' + operationId: createCompletions +servers: + - url: https://openrouter.ai/api/v1 + description: Production server + x-speakeasy-server-id: production +security: + - apiKey: [] +externalDocs: + description: OpenRouter Documentation + url: https://openrouter.ai/docs +tags: + - name: API Keys + description: API key management endpoints + - name: Analytics + description: Analytics and usage endpoints + - name: Chat + description: Chat completion endpoints + - name: Completions + description: Text completion endpoints + - name: Credits + description: Credit management endpoints + - name: Embeddings + description: Text embedding endpoints + - name: Endpoints + description: Endpoint information + - name: Generations + description: Generation history endpoints + - name: Models + description: Model information endpoints + - name: OAuth + description: OAuth authentication endpoints + - name: Parameters + description: Parameters endpoints + - name: Providers + description: Provider information endpoints + - name: beta.responses + description: beta.responses endpoints +x-fern-base-path: / +x-retry-strategy: + type: exponential + initialDelay: 500 + maxDelay: 60000 + maxAttempts: 3 diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8cc5737..2987de9 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -1067,6 +1067,7 @@ components: - medium - low - minimal + - none x-speakeasy-unknown-values: allow ReasoningSummaryVerbosity: type: string @@ -3239,6 +3240,7 @@ components: - openai-responses-v1 - xai-responses-v1 - anthropic-claude-v1 + - google-gemini-v1 x-speakeasy-unknown-values: allow example: type: reasoning @@ -3440,47 +3442,44 @@ components: - reasoning.encrypted_content - code_interpreter_call.outputs x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow ProviderName: type: string enum: - - AnyScale - - Cent-ML - - HuggingFace - - Hyperbolic 2 - - Lepton - - Lynn 2 - - Lynn - - Mancer - - Modal - - OctoAI - - Recursal - - Reflection - - Replicate - - SambaNova 2 - - SF Compute - - Together 2 - - 01.AI - AI21 - AionLabs - Alibaba - Amazon Bedrock - Anthropic + - Arcee - AtlasCloud - - Atoma - Avian - Azure - BaseTen + - Black Forest Labs - Cerebras - Chutes - Cirrascale - Clarifai - Cloudflare - Cohere - - CrofAI - Crusoe - DeepInfra - DeepSeek - - Enfer - Featherless - Fireworks - Friendli @@ -3493,12 +3492,8 @@ components: - InferenceNet - Infermatic - Inflection - - InoCloud - - Kluster - - Lambda - Liquid - Mancer 2 - - Meta - Minimax - ModelRun - Mistral @@ -3508,7 +3503,6 @@ components: - NCompass - Nebius - NextBit - - Nineteen - Novita - Nvidia - OpenAI @@ -3523,7 +3517,6 @@ components: - Switchpoint - Targon - Together - - Ubicloud - Venice - WandB - xAI @@ -3545,6 +3538,17 @@ components: - unknown example: fp16 x-speakeasy-unknown-values: allow + ProviderSort: + type: string + nullable: true + enum: + - price + - throughput + - latency + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + example: price + x-speakeasy-unknown-values: allow BigNumberUnion: anyOf: - type: number @@ -3683,20 +3687,7 @@ components: 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 - example: deny - 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. - - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/DataCollection' zdr: type: boolean nullable: true @@ -3743,16 +3734,7 @@ components: $ref: '#/components/schemas/Quantization' description: A list of quantization levels to filter the provider by. sort: - type: string - nullable: true - enum: - - price - - throughput - - latency - example: price - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/ProviderSort' max_price: type: object properties: @@ -3984,6 +3966,8 @@ components: $ref: '#/components/schemas/BigNumberUnion' image: $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' image_output: $ref: '#/components/schemas/BigNumberUnion' audio: @@ -4428,6 +4412,8 @@ components: $ref: '#/components/schemas/BigNumberUnion' image: $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' image_output: $ref: '#/components/schemas/BigNumberUnion' audio: @@ -4611,10 +4597,6 @@ components: status: default uptime_last_30m: 99.5 supports_implicit_caching: true - __schema0: - anyOf: - - $ref: '#/components/schemas/ChatCompletionFinishReason' - - type: 'null' ModelName: type: string ChatMessageContentItemText: @@ -4680,21 +4662,38 @@ components: - type - input_audio ChatMessageContentItemVideo: + oneOf: + - type: object + properties: + type: + type: string + const: input_video + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url + - type: object + properties: + type: + type: string + const: video_url + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url type: object - properties: - type: - type: string - const: input_video - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url ChatMessageContentItem: oneOf: - $ref: '#/components/schemas/ChatMessageContentItemText' @@ -4709,6 +4708,7 @@ components: image_url: '#/components/schemas/ChatMessageContentItemImage' input_audio: '#/components/schemas/ChatMessageContentItemAudio' input_video: '#/components/schemas/ChatMessageContentItemVideo' + video_url: '#/components/schemas/ChatMessageContentItemVideo' ChatMessageToolCall: type: object properties: @@ -4832,14 +4832,16 @@ components: - prompt_tokens - total_tokens ChatCompletionFinishReason: - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - x-speakeasy-unknown-values: allow + anyOf: + - type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + x-speakeasy-unknown-values: allow + - type: 'null' JSONSchemaConfig: type: object properties: @@ -5111,6 +5113,7 @@ components: anyOf: - type: string enum: + - none - minimal - low - medium @@ -5197,7 +5200,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema0' + $ref: '#/components/schemas/ChatCompletionFinishReason' index: type: number message: @@ -5258,7 +5261,7 @@ components: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema0' + $ref: '#/components/schemas/ChatCompletionFinishReason' index: type: number logprobs: @@ -5998,8 +6001,57 @@ paths: 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 + x-speakeasy-unknown-values: allow + dimensions: + type: integer + minimum: 0 + exclusiveMinimum: true + user: + type: string provider: type: object properties: @@ -6019,20 +6071,7 @@ paths: 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 - example: deny - 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. - - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/DataCollection' zdr: type: boolean nullable: true @@ -6079,16 +6118,7 @@ paths: $ref: '#/components/schemas/Quantization' description: A list of quantization levels to filter the provider by. sort: - type: string - nullable: true - enum: - - price - - throughput - - latency - example: price - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/ProviderSort' max_price: type: object properties: @@ -6105,15 +6135,7 @@ paths: additionalProperties: false description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - encoding_format: - anyOf: - - type: string - enum: - - float - - type: string - enum: - - base64 - user: + input_type: type: string required: - input @@ -6709,22 +6731,21 @@ paths: - Alibaba - Amazon Bedrock - Anthropic + - Arcee - AtlasCloud - - Atoma - Avian - Azure - BaseTen + - Black Forest Labs - Cerebras - Chutes - Cirrascale - Clarifai - Cloudflare - Cohere - - CrofAI - Crusoe - DeepInfra - DeepSeek - - Enfer - Featherless - Fireworks - Friendli @@ -6737,11 +6758,8 @@ paths: - InferenceNet - Infermatic - Inflection - - Kluster - - Lambda - Liquid - Mancer 2 - - Meta - Minimax - ModelRun - Mistral @@ -6751,7 +6769,6 @@ paths: - NCompass - Nebius - NextBit - - Nineteen - Novita - Nvidia - OpenAI @@ -6766,7 +6783,6 @@ paths: - Switchpoint - Targon - Together - - Ubicloud - Venice - WandB - xAI diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 270ff94..e8a1112 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,17 @@ -speakeasyVersion: 1.658.1 +speakeasyVersion: 1.658.2 sources: -OAS: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e - sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23 + sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 + sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 tags: - latest - - speakeasy-sdk-regen-1763230596 targets: open-router: source: -OAS sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e - sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23 + sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 + sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/USAGE.md b/USAGE.md index ad55718..4fd5a77 100644 --- a/USAGE.md +++ b/USAGE.md @@ -49,7 +49,7 @@ with OpenRouter( }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ @@ -127,7 +127,7 @@ async def main(): }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ diff --git a/docs/components/chatmessagecontentitem.md b/docs/components/chatmessagecontentitem.md index 52ee47c..7063cdb 100644 --- a/docs/components/chatmessagecontentitem.md +++ b/docs/components/chatmessagecontentitem.md @@ -27,3 +27,9 @@ value: components.ChatMessageContentItemAudio = /* values here */ value: components.ChatMessageContentItemVideo = /* values here */ ``` +### `components.ChatMessageContentItemVideo` + +```python +value: components.ChatMessageContentItemVideo = /* values here */ +``` + diff --git a/docs/components/chatmessagecontentitemvideo.md b/docs/components/chatmessagecontentitemvideo.md index e7c6354..c92a0bb 100644 --- a/docs/components/chatmessagecontentitemvideo.md +++ b/docs/components/chatmessagecontentitemvideo.md @@ -1,9 +1,17 @@ # ChatMessageContentItemVideo -## Fields +## Supported Types + +### `components.ChatMessageContentItemVideoInputVideo` + +```python +value: components.ChatMessageContentItemVideoInputVideo = /* values here */ +``` + +### `components.ChatMessageContentItemVideoVideoURL` + +```python +value: components.ChatMessageContentItemVideoVideoURL = /* values here */ +``` -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | -| `video_url` | [components.VideoURL](../components/videourl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideoinputvideo.md b/docs/components/chatmessagecontentitemvideoinputvideo.md new file mode 100644 index 0000000..4d7dd0e --- /dev/null +++ b/docs/components/chatmessagecontentitemvideoinputvideo.md @@ -0,0 +1,9 @@ +# ChatMessageContentItemVideoInputVideo + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideovideourl.md b/docs/components/chatmessagecontentitemvideovideourl.md new file mode 100644 index 0000000..0585b55 --- /dev/null +++ b/docs/components/chatmessagecontentitemvideovideourl.md @@ -0,0 +1,9 @@ +# ChatMessageContentItemVideoVideoURL + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/datacollection.md b/docs/components/datacollection.md index bb07fc4..a07c6e2 100644 --- a/docs/components/datacollection.md +++ b/docs/components/datacollection.md @@ -2,8 +2,8 @@ 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. +- deny: use only providers which do not collect user data. ## Values diff --git a/docs/components/effort.md b/docs/components/effort.md index b4f7dbb..9d9b0d3 100644 --- a/docs/components/effort.md +++ b/docs/components/effort.md @@ -5,6 +5,7 @@ | Name | Value | | --------- | --------- | +| `NONE` | none | | `MINIMAL` | minimal | | `LOW` | low | | `MEDIUM` | medium | diff --git a/docs/components/openairesponsesreasoningeffort.md b/docs/components/openairesponsesreasoningeffort.md index bce9e5a..f5e1097 100644 --- a/docs/components/openairesponsesreasoningeffort.md +++ b/docs/components/openairesponsesreasoningeffort.md @@ -8,4 +8,5 @@ | `HIGH` | high | | `MEDIUM` | medium | | `LOW` | low | -| `MINIMAL` | minimal | \ No newline at end of file +| `MINIMAL` | minimal | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/openresponsesreasoningformat.md b/docs/components/openresponsesreasoningformat.md index 491cc90..1d3f96a 100644 --- a/docs/components/openresponsesreasoningformat.md +++ b/docs/components/openresponsesreasoningformat.md @@ -8,4 +8,5 @@ | `UNKNOWN` | unknown | | `OPENAI_RESPONSES_V1` | openai-responses-v1 | | `XAI_RESPONSES_V1` | xai-responses-v1 | -| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | \ No newline at end of file +| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | +| `GOOGLE_GEMINI_V1` | google-gemini-v1 | \ No newline at end of file diff --git a/docs/components/pricing.md b/docs/components/pricing.md index 1a44ac7..2c87436 100644 --- a/docs/components/pricing.md +++ b/docs/components/pricing.md @@ -9,6 +9,7 @@ | `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | +| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | diff --git a/docs/components/provider.md b/docs/components/provider.md index b9292f4..55078cc 100644 --- a/docs/components/provider.md +++ b/docs/components/provider.md @@ -9,12 +9,12 @@ When multiple model providers are available, optionally indicate your routing pr | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | 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.
| deny | +| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | 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. | allow | | `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | | `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | | `order` | List[[components.Order](../components/order.md)] | :heavy_minus_sign: | 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` | List[[components.Only](../components/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | | | `ignore` | List[[components.Ignore](../components/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [OptionalNullable[components.Sort]](../components/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `max_price` | [Optional[components.MaxPrice]](../components/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | \ No newline at end of file diff --git a/docs/components/providername.md b/docs/components/providername.md index f29b89d..9c86cd3 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -3,91 +3,67 @@ ## Values -| Name | Value | -| ------------------ | ------------------ | -| `ANY_SCALE` | AnyScale | -| `CENT_ML` | Cent-ML | -| `HUGGING_FACE` | HuggingFace | -| `HYPERBOLIC_2` | Hyperbolic 2 | -| `LEPTON` | Lepton | -| `LYNN_2` | Lynn 2 | -| `LYNN` | Lynn | -| `MANCER` | Mancer | -| `MODAL` | Modal | -| `OCTO_AI` | OctoAI | -| `RECURSAL` | Recursal | -| `REFLECTION` | Reflection | -| `REPLICATE` | Replicate | -| `SAMBA_NOVA_2` | SambaNova 2 | -| `SF_COMPUTE` | SF Compute | -| `TOGETHER_2` | Together 2 | -| `ONE_DOT_AI` | 01.AI | -| `AI21` | AI21 | -| `AION_LABS` | AionLabs | -| `ALIBABA` | Alibaba | -| `AMAZON_BEDROCK` | Amazon Bedrock | -| `ANTHROPIC` | Anthropic | -| `ATLAS_CLOUD` | AtlasCloud | -| `ATOMA` | Atoma | -| `AVIAN` | Avian | -| `AZURE` | Azure | -| `BASE_TEN` | BaseTen | -| `CEREBRAS` | Cerebras | -| `CHUTES` | Chutes | -| `CIRRASCALE` | Cirrascale | -| `CLARIFAI` | Clarifai | -| `CLOUDFLARE` | Cloudflare | -| `COHERE` | Cohere | -| `CROF_AI` | CrofAI | -| `CRUSOE` | Crusoe | -| `DEEP_INFRA` | DeepInfra | -| `DEEP_SEEK` | DeepSeek | -| `ENFER` | Enfer | -| `FEATHERLESS` | Featherless | -| `FIREWORKS` | Fireworks | -| `FRIENDLI` | Friendli | -| `GMI_CLOUD` | GMICloud | -| `GOOGLE` | Google | -| `GOOGLE_AI_STUDIO` | Google AI Studio | -| `GROQ` | Groq | -| `HYPERBOLIC` | Hyperbolic | -| `INCEPTION` | Inception | -| `INFERENCE_NET` | InferenceNet | -| `INFERMATIC` | Infermatic | -| `INFLECTION` | Inflection | -| `INO_CLOUD` | InoCloud | -| `KLUSTER` | Kluster | -| `LAMBDA` | Lambda | -| `LIQUID` | Liquid | -| `MANCER_2` | Mancer 2 | -| `META` | Meta | -| `MINIMAX` | Minimax | -| `MODEL_RUN` | ModelRun | -| `MISTRAL` | Mistral | -| `MODULAR` | Modular | -| `MOONSHOT_AI` | Moonshot AI | -| `MORPH` | Morph | -| `N_COMPASS` | NCompass | -| `NEBIUS` | Nebius | -| `NEXT_BIT` | NextBit | -| `NINETEEN` | Nineteen | -| `NOVITA` | Novita | -| `NVIDIA` | Nvidia | -| `OPEN_AI` | OpenAI | -| `OPEN_INFERENCE` | OpenInference | -| `PARASAIL` | Parasail | -| `PERPLEXITY` | Perplexity | -| `PHALA` | Phala | -| `RELACE` | Relace | -| `SAMBA_NOVA` | SambaNova | -| `SILICON_FLOW` | SiliconFlow | -| `STEALTH` | Stealth | -| `SWITCHPOINT` | Switchpoint | -| `TARGON` | Targon | -| `TOGETHER` | Together | -| `UBICLOUD` | Ubicloud | -| `VENICE` | Venice | -| `WAND_B` | WandB | -| `X_AI` | xAI | -| `Z_AI` | Z.AI | -| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file +| Name | Value | +| ------------------- | ------------------- | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ARCEE` | Arcee | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `BLACK_FOREST_LABS` | Black Forest Labs | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CIRRASCALE` | Cirrascale | +| `CLARIFAI` | Clarifai | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `MANCER_2` | Mancer 2 | +| `MINIMAX` | Minimax | +| `MODEL_RUN` | ModelRun | +| `MISTRAL` | Mistral | +| `MODULAR` | Modular | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NOVITA` | Novita | +| `NVIDIA` | Nvidia | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `RELACE` | Relace | +| `SAMBA_NOVA` | SambaNova | +| `SILICON_FLOW` | SiliconFlow | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/components/sort.md b/docs/components/providersort.md similarity index 95% rename from docs/components/sort.md rename to docs/components/providersort.md index 65b6edb..771741f 100644 --- a/docs/components/sort.md +++ b/docs/components/providersort.md @@ -1,4 +1,4 @@ -# Sort +# ProviderSort The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. diff --git a/docs/components/publicpricing.md b/docs/components/publicpricing.md index 5d92c94..eb441eb 100644 --- a/docs/components/publicpricing.md +++ b/docs/components/publicpricing.md @@ -11,6 +11,7 @@ Pricing information for the model | `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | +| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | diff --git a/docs/components/videourl1.md b/docs/components/videourl1.md new file mode 100644 index 0000000..505c186 --- /dev/null +++ b/docs/components/videourl1.md @@ -0,0 +1,8 @@ +# VideoURL1 + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/videourl2.md b/docs/components/videourl2.md new file mode 100644 index 0000000..b7f2463 --- /dev/null +++ b/docs/components/videourl2.md @@ -0,0 +1,8 @@ +# VideoURL2 + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/content.md b/docs/operations/content.md new file mode 100644 index 0000000..727997f --- /dev/null +++ b/docs/operations/content.md @@ -0,0 +1,17 @@ +# Content + + +## Supported Types + +### `operations.ContentText` + +```python +value: operations.ContentText = /* values here */ +``` + +### `operations.ContentImageURL` + +```python +value: operations.ContentImageURL = /* values here */ +``` + diff --git a/docs/operations/contentimageurl.md b/docs/operations/contentimageurl.md new file mode 100644 index 0000000..3a624d5 --- /dev/null +++ b/docs/operations/contentimageurl.md @@ -0,0 +1,9 @@ +# ContentImageURL + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `type` | [operations.TypeImageURL](../operations/typeimageurl.md) | :heavy_check_mark: | N/A | +| `image_url` | [operations.ImageURL](../operations/imageurl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/contenttext.md b/docs/operations/contenttext.md new file mode 100644 index 0000000..11ffb7a --- /dev/null +++ b/docs/operations/contenttext.md @@ -0,0 +1,9 @@ +# ContentText + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `type` | [operations.TypeText](../operations/typetext.md) | :heavy_check_mark: | N/A | +| `text` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createembeddingsprovider.md b/docs/operations/createembeddingsprovider.md index 1e4c2cd..3fb50f7 100644 --- a/docs/operations/createembeddingsprovider.md +++ b/docs/operations/createembeddingsprovider.md @@ -7,12 +7,12 @@ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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` | [OptionalNullable[operations.DataCollection]](../operations/datacollection.md) | :heavy_minus_sign: | 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.
| deny | +| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | 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. | allow | | `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | | `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | | `order` | List[[operations.Order](../operations/order.md)] | :heavy_minus_sign: | 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` | List[[operations.Only](../operations/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | | | `ignore` | List[[operations.Ignore](../operations/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [OptionalNullable[operations.Sort]](../operations/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `max_price` | [Optional[operations.MaxPrice]](../operations/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | \ No newline at end of file diff --git a/docs/operations/createembeddingsrequest.md b/docs/operations/createembeddingsrequest.md index fc76ee5..2226077 100644 --- a/docs/operations/createembeddingsrequest.md +++ b/docs/operations/createembeddingsrequest.md @@ -5,8 +5,10 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `input` | [operations.Input](../operations/input.md) | :heavy_check_mark: | N/A | +| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A | | `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | | `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/datacollection.md b/docs/operations/datacollection.md deleted file mode 100644 index bb07fc4..0000000 --- a/docs/operations/datacollection.md +++ /dev/null @@ -1,14 +0,0 @@ -# DataCollection - -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. - - - -## Values - -| Name | Value | -| ------- | ------- | -| `DENY` | deny | -| `ALLOW` | allow | \ No newline at end of file diff --git a/docs/operations/encodingformat.md b/docs/operations/encodingformat.md index ba6a041..7d5941c 100644 --- a/docs/operations/encodingformat.md +++ b/docs/operations/encodingformat.md @@ -1,17 +1,9 @@ # EncodingFormat -## Supported Types - -### `operations.EncodingFormatFloat` - -```python -value: operations.EncodingFormatFloat = /* values here */ -``` - -### `operations.EncodingFormatBase64` - -```python -value: operations.EncodingFormatBase64 = /* values here */ -``` +## Values +| Name | Value | +| -------- | -------- | +| `FLOAT` | float | +| `BASE64` | base64 | \ No newline at end of file diff --git a/docs/operations/encodingformatbase64.md b/docs/operations/encodingformatbase64.md deleted file mode 100644 index 859a006..0000000 --- a/docs/operations/encodingformatbase64.md +++ /dev/null @@ -1,8 +0,0 @@ -# EncodingFormatBase64 - - -## Values - -| Name | Value | -| -------- | -------- | -| `BASE64` | base64 | \ No newline at end of file diff --git a/docs/operations/encodingformatfloat.md b/docs/operations/encodingformatfloat.md deleted file mode 100644 index 4d95449..0000000 --- a/docs/operations/encodingformatfloat.md +++ /dev/null @@ -1,8 +0,0 @@ -# EncodingFormatFloat - - -## Values - -| Name | Value | -| ------- | ------- | -| `FLOAT` | float | \ No newline at end of file diff --git a/docs/operations/getparametersprovider.md b/docs/operations/getparametersprovider.md index 233a4ed..21a0244 100644 --- a/docs/operations/getparametersprovider.md +++ b/docs/operations/getparametersprovider.md @@ -3,73 +3,67 @@ ## Values -| Name | Value | -| ------------------ | ------------------ | -| `AI21` | AI21 | -| `AION_LABS` | AionLabs | -| `ALIBABA` | Alibaba | -| `AMAZON_BEDROCK` | Amazon Bedrock | -| `ANTHROPIC` | Anthropic | -| `ATLAS_CLOUD` | AtlasCloud | -| `ATOMA` | Atoma | -| `AVIAN` | Avian | -| `AZURE` | Azure | -| `BASE_TEN` | BaseTen | -| `CEREBRAS` | Cerebras | -| `CHUTES` | Chutes | -| `CIRRASCALE` | Cirrascale | -| `CLARIFAI` | Clarifai | -| `CLOUDFLARE` | Cloudflare | -| `COHERE` | Cohere | -| `CROF_AI` | CrofAI | -| `CRUSOE` | Crusoe | -| `DEEP_INFRA` | DeepInfra | -| `DEEP_SEEK` | DeepSeek | -| `ENFER` | Enfer | -| `FEATHERLESS` | Featherless | -| `FIREWORKS` | Fireworks | -| `FRIENDLI` | Friendli | -| `GMI_CLOUD` | GMICloud | -| `GOOGLE` | Google | -| `GOOGLE_AI_STUDIO` | Google AI Studio | -| `GROQ` | Groq | -| `HYPERBOLIC` | Hyperbolic | -| `INCEPTION` | Inception | -| `INFERENCE_NET` | InferenceNet | -| `INFERMATIC` | Infermatic | -| `INFLECTION` | Inflection | -| `KLUSTER` | Kluster | -| `LAMBDA` | Lambda | -| `LIQUID` | Liquid | -| `MANCER_2` | Mancer 2 | -| `META` | Meta | -| `MINIMAX` | Minimax | -| `MODEL_RUN` | ModelRun | -| `MISTRAL` | Mistral | -| `MODULAR` | Modular | -| `MOONSHOT_AI` | Moonshot AI | -| `MORPH` | Morph | -| `N_COMPASS` | NCompass | -| `NEBIUS` | Nebius | -| `NEXT_BIT` | NextBit | -| `NINETEEN` | Nineteen | -| `NOVITA` | Novita | -| `NVIDIA` | Nvidia | -| `OPEN_AI` | OpenAI | -| `OPEN_INFERENCE` | OpenInference | -| `PARASAIL` | Parasail | -| `PERPLEXITY` | Perplexity | -| `PHALA` | Phala | -| `RELACE` | Relace | -| `SAMBA_NOVA` | SambaNova | -| `SILICON_FLOW` | SiliconFlow | -| `STEALTH` | Stealth | -| `SWITCHPOINT` | Switchpoint | -| `TARGON` | Targon | -| `TOGETHER` | Together | -| `UBICLOUD` | Ubicloud | -| `VENICE` | Venice | -| `WAND_B` | WandB | -| `X_AI` | xAI | -| `Z_AI` | Z.AI | -| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file +| Name | Value | +| ------------------- | ------------------- | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ARCEE` | Arcee | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `BLACK_FOREST_LABS` | Black Forest Labs | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CIRRASCALE` | Cirrascale | +| `CLARIFAI` | Clarifai | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `MANCER_2` | Mancer 2 | +| `MINIMAX` | Minimax | +| `MODEL_RUN` | ModelRun | +| `MISTRAL` | Mistral | +| `MODULAR` | Modular | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NOVITA` | Novita | +| `NVIDIA` | Nvidia | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `RELACE` | Relace | +| `SAMBA_NOVA` | SambaNova | +| `SILICON_FLOW` | SiliconFlow | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/components/videourl.md b/docs/operations/imageurl.md similarity index 96% rename from docs/components/videourl.md rename to docs/operations/imageurl.md index 5bd5dec..cd90c03 100644 --- a/docs/components/videourl.md +++ b/docs/operations/imageurl.md @@ -1,4 +1,4 @@ -# VideoURL +# ImageURL ## Fields diff --git a/docs/operations/input.md b/docs/operations/input.md index e02d970..4559859 100644 --- a/docs/operations/input.md +++ b/docs/operations/input.md @@ -1,29 +1,8 @@ # Input -## Supported Types - -### `str` - -```python -value: str = /* values here */ -``` - -### `List[str]` - -```python -value: List[str] = /* values here */ -``` - -### `List[float]` - -```python -value: List[float] = /* values here */ -``` - -### `List[List[float]]` - -```python -value: List[List[float]] = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `content` | List[[operations.Content](../operations/content.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/inputunion.md b/docs/operations/inputunion.md new file mode 100644 index 0000000..75550b6 --- /dev/null +++ b/docs/operations/inputunion.md @@ -0,0 +1,35 @@ +# InputUnion + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + +### `List[float]` + +```python +value: List[float] = /* values here */ +``` + +### `List[List[float]]` + +```python +value: List[List[float]] = /* values here */ +``` + +### `List[operations.Input]` + +```python +value: List[operations.Input] = /* values here */ +``` + diff --git a/docs/operations/sort.md b/docs/operations/sort.md deleted file mode 100644 index 65b6edb..0000000 --- a/docs/operations/sort.md +++ /dev/null @@ -1,12 +0,0 @@ -# Sort - -The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `PRICE` | price | -| `THROUGHPUT` | throughput | -| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/operations/typeimageurl.md b/docs/operations/typeimageurl.md new file mode 100644 index 0000000..addee7e --- /dev/null +++ b/docs/operations/typeimageurl.md @@ -0,0 +1,8 @@ +# TypeImageURL + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `IMAGE_URL` | image_url | \ No newline at end of file diff --git a/docs/operations/typetext.md b/docs/operations/typetext.md new file mode 100644 index 0000000..fb9c2cf --- /dev/null +++ b/docs/operations/typetext.md @@ -0,0 +1,8 @@ +# TypeText + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | text | \ No newline at end of file diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index 32e9002..0f75d96 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -27,7 +27,7 @@ with OpenRouter( ) as open_router: res = open_router.embeddings.generate(input="", model="Taurus", provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ @@ -54,11 +54,13 @@ with OpenRouter( | Parameter | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `input` | [operations.Input](../../operations/input.md) | :heavy_check_mark: | N/A | +| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A | | `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | | `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index 1ecbbb1..386fd37 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -65,7 +65,7 @@ with OpenRouter( }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ diff --git a/pyproject.toml b/pyproject.toml index e4e024b..e10c064 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.0.16" +version = "0.0.19" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" @@ -11,6 +11,7 @@ dependencies = [ "pydantic >=2.11.2", ] urls.repository = "https://github.com/OpenRouterTeam/python-sdk.git" +license = { text = "Apache-2.0" } [dependency-groups] dev = [ diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index a2d0013..a25d226 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.0.16" +__version__: str = "0.0.19" __openapi_doc_version__: str = "1.0.0" -__gen_version__: str = "2.755.6" -__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.755.6 1.0.0 openrouter" +__gen_version__: str = "2.755.9" +__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 449b9d4..8a34729 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -21,7 +21,6 @@ BadRequestResponseErrorData, BadRequestResponseErrorDataTypedDict, ) - from .chatcompletionfinishreason import ChatCompletionFinishReason from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, @@ -72,9 +71,15 @@ ) from .chatmessagecontentitemvideo import ( ChatMessageContentItemVideo, + ChatMessageContentItemVideoInputVideo, + ChatMessageContentItemVideoInputVideoTypedDict, ChatMessageContentItemVideoTypedDict, - VideoURL, - VideoURLTypedDict, + ChatMessageContentItemVideoVideoURL, + ChatMessageContentItemVideoVideoURLTypedDict, + VideoURL1, + VideoURL1TypedDict, + VideoURL2, + VideoURL2TypedDict, ) from .chatmessagetokenlogprob import ( ChatMessageTokenLogprob, @@ -93,8 +98,13 @@ ChatMessageToolCallTypedDict, ) from .chatresponse import ChatResponse, ChatResponseTypedDict - from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict - from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict + from .chatresponsechoice import ( + ChatCompletionFinishReason, + ChatResponseChoice, + ChatResponseChoiceTypedDict, + ChatStreamingChoice, + ChatStreamingChoiceTypedDict, + ) from .chatstreamingmessagechunk import ( ChatStreamingMessageChunk, ChatStreamingMessageChunkRole, @@ -146,6 +156,7 @@ CreateChargeRequest, CreateChargeRequestTypedDict, ) + from .datacollection import DataCollection from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .edgenetworktimeoutresponseerrordata import ( EdgeNetworkTimeoutResponseErrorData, @@ -408,7 +419,6 @@ OpenResponsesReasoningSummaryTextDoneEventTypedDict, ) from .openresponsesrequest import ( - DataCollection, Engine, IDFileParser, IDModeration, @@ -442,7 +452,6 @@ Provider, ProviderTypedDict, ServiceTier, - Sort, Truncation, ) from .openresponsesresponsetext import ( @@ -581,6 +590,7 @@ ProviderOverloadedResponseErrorData, ProviderOverloadedResponseErrorDataTypedDict, ) + from .providersort import ProviderSort from .publicendpoint import ( Pricing, PricingTypedDict, @@ -821,7 +831,11 @@ "ChatMessageContentItemTextTypedDict", "ChatMessageContentItemTypedDict", "ChatMessageContentItemVideo", + "ChatMessageContentItemVideoInputVideo", + "ChatMessageContentItemVideoInputVideoTypedDict", "ChatMessageContentItemVideoTypedDict", + "ChatMessageContentItemVideoVideoURL", + "ChatMessageContentItemVideoVideoURLTypedDict", "ChatMessageTokenLogprob", "ChatMessageTokenLogprobTypedDict", "ChatMessageTokenLogprobs", @@ -1205,6 +1219,7 @@ "ProviderName", "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", + "ProviderSort", "ProviderTypedDict", "PublicEndpoint", "PublicEndpointQuantization", @@ -1310,7 +1325,6 @@ "ServiceTier", "ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorDataTypedDict", - "Sort", "StreamOptions", "StreamOptionsTypedDict", "SystemMessage", @@ -1366,8 +1380,10 @@ "UserMessageTypedDict", "Variables", "VariablesTypedDict", - "VideoURL", - "VideoURLTypedDict", + "VideoURL1", + "VideoURL1TypedDict", + "VideoURL2", + "VideoURL2TypedDict", "WebSearchPreviewToolUserLocation", "WebSearchPreviewToolUserLocationType", "WebSearchPreviewToolUserLocationTypedDict", @@ -1385,7 +1401,6 @@ "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata", "BadRequestResponseErrorData": ".badrequestresponseerrordata", "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata", - "ChatCompletionFinishReason": ".chatcompletionfinishreason", "ChatErrorError": ".chaterror", "ChatErrorErrorTypedDict": ".chaterror", "Code": ".chaterror", @@ -1426,9 +1441,15 @@ "ChatMessageContentItemText": ".chatmessagecontentitemtext", "ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext", "ChatMessageContentItemVideo": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo", - "VideoURL": ".chatmessagecontentitemvideo", - "VideoURLTypedDict": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo", + "VideoURL1": ".chatmessagecontentitemvideo", + "VideoURL1TypedDict": ".chatmessagecontentitemvideo", + "VideoURL2": ".chatmessagecontentitemvideo", + "VideoURL2TypedDict": ".chatmessagecontentitemvideo", "ChatMessageTokenLogprob": ".chatmessagetokenlogprob", "ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob", "TopLogprob": ".chatmessagetokenlogprob", @@ -1441,10 +1462,11 @@ "ChatMessageToolCallTypedDict": ".chatmessagetoolcall", "ChatResponse": ".chatresponse", "ChatResponseTypedDict": ".chatresponse", + "ChatCompletionFinishReason": ".chatresponsechoice", "ChatResponseChoice": ".chatresponsechoice", "ChatResponseChoiceTypedDict": ".chatresponsechoice", - "ChatStreamingChoice": ".chatstreamingchoice", - "ChatStreamingChoiceTypedDict": ".chatstreamingchoice", + "ChatStreamingChoice": ".chatresponsechoice", + "ChatStreamingChoiceTypedDict": ".chatresponsechoice", "ChatStreamingMessageChunk": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk", @@ -1488,6 +1510,7 @@ "ChainID": ".createchargerequest", "CreateChargeRequest": ".createchargerequest", "CreateChargeRequestTypedDict": ".createchargerequest", + "DataCollection": ".datacollection", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", @@ -1687,7 +1710,6 @@ "OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent", - "DataCollection": ".openresponsesrequest", "Engine": ".openresponsesrequest", "IDFileParser": ".openresponsesrequest", "IDModeration": ".openresponsesrequest", @@ -1721,7 +1743,6 @@ "Provider": ".openresponsesrequest", "ProviderTypedDict": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest", - "Sort": ".openresponsesrequest", "Truncation": ".openresponsesrequest", "OpenResponsesResponseText": ".openresponsesresponsetext", "OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext", @@ -1834,6 +1855,7 @@ "ProviderName": ".providername", "ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata", "ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata", + "ProviderSort": ".providersort", "Pricing": ".publicendpoint", "PricingTypedDict": ".publicendpoint", "PublicEndpoint": ".publicendpoint", diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 7cc6dd7..32fd9ca 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -31,6 +31,7 @@ Effort = Union[ Literal[ + "none", "minimal", "low", "medium", diff --git a/src/openrouter/components/chatmessagecontentitem.py b/src/openrouter/components/chatmessagecontentitem.py index 2ebd348..87547ca 100644 --- a/src/openrouter/components/chatmessagecontentitem.py +++ b/src/openrouter/components/chatmessagecontentitem.py @@ -40,6 +40,7 @@ Annotated[ChatMessageContentItemImage, Tag("image_url")], Annotated[ChatMessageContentItemAudio, Tag("input_audio")], Annotated[ChatMessageContentItemVideo, Tag("input_video")], + Annotated[ChatMessageContentItemVideo, Tag("video_url")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/chatmessagecontentitemvideo.py b/src/openrouter/components/chatmessagecontentitemvideo.py index 023ae67..fccda91 100644 --- a/src/openrouter/components/chatmessagecontentitemvideo.py +++ b/src/openrouter/components/chatmessagecontentitemvideo.py @@ -5,25 +5,47 @@ from openrouter.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing import Literal, Union +from typing_extensions import Annotated, TypeAliasType, TypedDict -class VideoURLTypedDict(TypedDict): +class VideoURL2TypedDict(TypedDict): url: str -class VideoURL(BaseModel): +class VideoURL2(BaseModel): url: str -class ChatMessageContentItemVideoTypedDict(TypedDict): - video_url: VideoURLTypedDict +class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict): + video_url: VideoURL2TypedDict + type: Literal["video_url"] + + +class ChatMessageContentItemVideoVideoURL(BaseModel): + video_url: VideoURL2 + + TYPE: Annotated[ + Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))], + pydantic.Field(alias="type"), + ] = "video_url" + + +class VideoURL1TypedDict(TypedDict): + url: str + + +class VideoURL1(BaseModel): + url: str + + +class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict): + video_url: VideoURL1TypedDict type: Literal["input_video"] -class ChatMessageContentItemVideo(BaseModel): - video_url: VideoURL +class ChatMessageContentItemVideoInputVideo(BaseModel): + video_url: VideoURL1 TYPE: Annotated[ Annotated[ @@ -31,3 +53,18 @@ class ChatMessageContentItemVideo(BaseModel): ], pydantic.Field(alias="type"), ] = "input_video" + + +ChatMessageContentItemVideoTypedDict = TypeAliasType( + "ChatMessageContentItemVideoTypedDict", + Union[ + ChatMessageContentItemVideoInputVideoTypedDict, + ChatMessageContentItemVideoVideoURLTypedDict, + ], +) + + +ChatMessageContentItemVideo = TypeAliasType( + "ChatMessageContentItemVideo", + Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL], +) diff --git a/src/openrouter/components/chatresponsechoice.py b/src/openrouter/components/chatresponsechoice.py index 9592bf1..e59f847 100644 --- a/src/openrouter/components/chatresponsechoice.py +++ b/src/openrouter/components/chatresponsechoice.py @@ -2,24 +2,41 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from .chatcompletionfinishreason import ChatCompletionFinishReason from .chatmessagetokenlogprobs import ( ChatMessageTokenLogprobs, ChatMessageTokenLogprobsTypedDict, ) +from .chatstreamingmessagechunk import ( + ChatStreamingMessageChunk, + ChatStreamingMessageChunkTypedDict, +) from openrouter.types import ( BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL, + UnrecognizedStr, ) from openrouter.utils import validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator +from typing import Literal, Union from typing_extensions import Annotated, NotRequired, TypedDict +ChatCompletionFinishReason = Union[ + Literal[ + "tool_calls", + "stop", + "length", + "content_filter", + "error", + ], + UnrecognizedStr, +] + + class ChatResponseChoiceTypedDict(TypedDict): finish_reason: Nullable[ChatCompletionFinishReason] index: float @@ -67,3 +84,52 @@ def serialize_model(self, handler): m[k] = val return m + + +class ChatStreamingChoiceTypedDict(TypedDict): + delta: ChatStreamingMessageChunkTypedDict + finish_reason: Nullable[ChatCompletionFinishReason] + index: float + logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] + + +class ChatStreamingChoice(BaseModel): + delta: ChatStreamingMessageChunk + + finish_reason: Annotated[ + Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) + ] + + index: float + + logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["logprobs"] + nullable_fields = ["finish_reason", "logprobs"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/components/chatstreamingchoice.py b/src/openrouter/components/chatstreamingchoice.py deleted file mode 100644 index b64b8ff..0000000 --- a/src/openrouter/components/chatstreamingchoice.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .chatcompletionfinishreason import ChatCompletionFinishReason -from .chatmessagetokenlogprobs import ( - ChatMessageTokenLogprobs, - ChatMessageTokenLogprobsTypedDict, -) -from .chatstreamingmessagechunk import ( - ChatStreamingMessageChunk, - ChatStreamingMessageChunkTypedDict, -) -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ChatStreamingChoiceTypedDict(TypedDict): - delta: ChatStreamingMessageChunkTypedDict - finish_reason: Nullable[ChatCompletionFinishReason] - index: float - logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] - - -class ChatStreamingChoice(BaseModel): - delta: ChatStreamingMessageChunk - - finish_reason: Annotated[ - Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] - - index: float - - logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["logprobs"] - nullable_fields = ["finish_reason", "logprobs"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/chatstreamingresponsechunk.py b/src/openrouter/components/chatstreamingresponsechunk.py index 7c32481..0ec76bc 100644 --- a/src/openrouter/components/chatstreamingresponsechunk.py +++ b/src/openrouter/components/chatstreamingresponsechunk.py @@ -5,7 +5,7 @@ ChatGenerationTokenUsage, ChatGenerationTokenUsageTypedDict, ) -from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict +from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from openrouter.types import ( BaseModel, Nullable, diff --git a/src/openrouter/components/datacollection.py b/src/openrouter/components/datacollection.py new file mode 100644 index 0000000..0ab58be --- /dev/null +++ b/src/openrouter/components/datacollection.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +DataCollection = Union[ + Literal[ + "deny", + "allow", + ], + UnrecognizedStr, +] +r"""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. +""" diff --git a/src/openrouter/components/openairesponsesreasoningeffort.py b/src/openrouter/components/openairesponsesreasoningeffort.py index 34d2cf0..4e645d2 100644 --- a/src/openrouter/components/openairesponsesreasoningeffort.py +++ b/src/openrouter/components/openairesponsesreasoningeffort.py @@ -11,6 +11,7 @@ "medium", "low", "minimal", + "none", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/openresponsesreasoning.py b/src/openrouter/components/openresponsesreasoning.py index f115e26..1237605 100644 --- a/src/openrouter/components/openresponsesreasoning.py +++ b/src/openrouter/components/openresponsesreasoning.py @@ -57,6 +57,7 @@ "openai-responses-v1", "xai-responses-v1", "anthropic-claude-v1", + "google-gemini-v1", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 706716f..265f2d5 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .datacollection import DataCollection from .openairesponsesincludable import OpenAIResponsesIncludable from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict from .openairesponsestoolchoice_union import ( @@ -33,6 +34,7 @@ OpenResponsesWebSearchToolTypedDict, ) from .providername import ProviderName +from .providersort import ProviderSort from .quantization import Quantization from openrouter.types import ( BaseModel, @@ -151,20 +153,6 @@ def serialize_model(self, handler): ] -DataCollection = Union[ - Literal[ - "deny", - "allow", - ], - UnrecognizedStr, -] -r"""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. - -""" - - OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str]) @@ -192,17 +180,6 @@ def serialize_model(self, handler): ) -Sort = Union[ - Literal[ - "price", - "throughput", - "latency", - ], - UnrecognizedStr, -] -r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - - class MaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -251,8 +228,8 @@ class ProviderTypedDict(TypedDict): data_collection: NotRequired[Nullable[DataCollection]] r"""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. + - deny: use only providers which do not collect user data. """ zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -266,7 +243,7 @@ class ProviderTypedDict(TypedDict): r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" quantizations: NotRequired[Nullable[List[Quantization]]] r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[Sort]] + sort: NotRequired[Nullable[ProviderSort]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" max_price: NotRequired[MaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -290,8 +267,8 @@ class Provider(BaseModel): ] = UNSET r"""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. + - deny: use only providers which do not collect user data. """ zdr: OptionalNullable[bool] = UNSET @@ -315,7 +292,7 @@ class Provider(BaseModel): r"""A list of quantization levels to filter the provider by.""" sort: Annotated[ - OptionalNullable[Sort], PlainValidator(validate_open_enum(False)) + OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) ] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 035e1b1..21f6345 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -7,44 +7,26 @@ ProviderName = Union[ Literal[ - "AnyScale", - "Cent-ML", - "HuggingFace", - "Hyperbolic 2", - "Lepton", - "Lynn 2", - "Lynn", - "Mancer", - "Modal", - "OctoAI", - "Recursal", - "Reflection", - "Replicate", - "SambaNova 2", - "SF Compute", - "Together 2", - "01.AI", "AI21", "AionLabs", "Alibaba", "Amazon Bedrock", "Anthropic", + "Arcee", "AtlasCloud", - "Atoma", "Avian", "Azure", "BaseTen", + "Black Forest Labs", "Cerebras", "Chutes", "Cirrascale", "Clarifai", "Cloudflare", "Cohere", - "CrofAI", "Crusoe", "DeepInfra", "DeepSeek", - "Enfer", "Featherless", "Fireworks", "Friendli", @@ -57,12 +39,8 @@ "InferenceNet", "Infermatic", "Inflection", - "InoCloud", - "Kluster", - "Lambda", "Liquid", "Mancer 2", - "Meta", "Minimax", "ModelRun", "Mistral", @@ -72,7 +50,6 @@ "NCompass", "Nebius", "NextBit", - "Nineteen", "Novita", "Nvidia", "OpenAI", @@ -87,7 +64,6 @@ "Switchpoint", "Targon", "Together", - "Ubicloud", "Venice", "WandB", "xAI", diff --git a/src/openrouter/components/chatcompletionfinishreason.py b/src/openrouter/components/providersort.py similarity index 52% rename from src/openrouter/components/chatcompletionfinishreason.py rename to src/openrouter/components/providersort.py index 686462c..8a8d415 100644 --- a/src/openrouter/components/chatcompletionfinishreason.py +++ b/src/openrouter/components/providersort.py @@ -5,13 +5,12 @@ from typing import Literal, Union -ChatCompletionFinishReason = Union[ +ProviderSort = Union[ Literal[ - "tool_calls", - "stop", - "length", - "content_filter", - "error", + "price", + "throughput", + "latency", ], UnrecognizedStr, ] +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index da47f2f..5d5664d 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -21,6 +21,8 @@ class PricingTypedDict(TypedDict): r"""A value in string or number format that is a large number""" image: NotRequired[Any] r"""A value in string or number format that is a large number""" + image_token: NotRequired[Any] + r"""A value in string or number format that is a large number""" image_output: NotRequired[Any] r"""A value in string or number format that is a large number""" audio: NotRequired[Any] @@ -51,6 +53,9 @@ class Pricing(BaseModel): image: Optional[Any] = None r"""A value in string or number format that is a large number""" + image_token: Optional[Any] = None + r"""A value in string or number format that is a large number""" + image_output: Optional[Any] = None r"""A value in string or number format that is a large number""" diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 23a48d8..16bb61d 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -17,6 +17,8 @@ class PublicPricingTypedDict(TypedDict): r"""A value in string or number format that is a large number""" image: NotRequired[Any] r"""A value in string or number format that is a large number""" + image_token: NotRequired[Any] + r"""A value in string or number format that is a large number""" image_output: NotRequired[Any] r"""A value in string or number format that is a large number""" audio: NotRequired[Any] @@ -49,6 +51,9 @@ class PublicPricing(BaseModel): image: Optional[Any] = None r"""A value in string or number format that is a large number""" + image_token: Optional[Any] = None + r"""A value in string or number format that is a large number""" + image_output: Optional[Any] = None r"""A value in string or number format that is a large number""" diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 7057c9d..0dec307 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -21,18 +21,18 @@ class Embeddings(BaseSDK): def generate( self, *, - input: Union[operations.Input, operations.InputTypedDict], + input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + encoding_format: Optional[operations.EncodingFormat] = None, + dimensions: Optional[int] = None, + user: Optional[str] = None, provider: Optional[ Union[ operations.CreateEmbeddingsProvider, operations.CreateEmbeddingsProviderTypedDict, ] ] = None, - encoding_format: Optional[ - Union[operations.EncodingFormat, operations.EncodingFormatTypedDict] - ] = None, - user: Optional[str] = None, + input_type: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -45,9 +45,11 @@ def generate( :param input: :param model: - :param provider: :param encoding_format: + :param dimensions: :param user: + :param provider: + :param input_type: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -65,13 +67,15 @@ def generate( base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=input, + input=utils.get_pydantic_model(input, operations.InputUnion), model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, provider=utils.get_pydantic_model( provider, Optional[operations.CreateEmbeddingsProvider] ), - encoding_format=encoding_format, - user=user, + input_type=input_type, ) req = self._build_request( @@ -204,18 +208,18 @@ def generate( async def generate_async( self, *, - input: Union[operations.Input, operations.InputTypedDict], + input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + encoding_format: Optional[operations.EncodingFormat] = None, + dimensions: Optional[int] = None, + user: Optional[str] = None, provider: Optional[ Union[ operations.CreateEmbeddingsProvider, operations.CreateEmbeddingsProviderTypedDict, ] ] = None, - encoding_format: Optional[ - Union[operations.EncodingFormat, operations.EncodingFormatTypedDict] - ] = None, - user: Optional[str] = None, + input_type: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -228,9 +232,11 @@ async def generate_async( :param input: :param model: - :param provider: :param encoding_format: + :param dimensions: :param user: + :param provider: + :param input_type: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -248,13 +254,15 @@ async def generate_async( base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=input, + input=utils.get_pydantic_model(input, operations.InputUnion), model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, provider=utils.get_pydantic_model( provider, Optional[operations.CreateEmbeddingsProvider] ), - encoding_format=encoding_format, - user=user, + input_type=input_type, ) req = self._build_request_async( diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index a00d958..3ba8b45 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -32,6 +32,12 @@ Web3DataTypedDict, ) from .createembeddings import ( + Content, + ContentImageURL, + ContentImageURLTypedDict, + ContentText, + ContentTextTypedDict, + ContentTypedDict, CreateEmbeddingsData, CreateEmbeddingsDataTypedDict, CreateEmbeddingsProvider, @@ -42,17 +48,17 @@ CreateEmbeddingsResponseBody, CreateEmbeddingsResponseBodyTypedDict, CreateEmbeddingsResponseTypedDict, - DataCollection, Embedding, EmbeddingTypedDict, EncodingFormat, - EncodingFormatBase64, - EncodingFormatFloat, - EncodingFormatTypedDict, Ignore, IgnoreTypedDict, + ImageURL, + ImageURLTypedDict, Input, InputTypedDict, + InputUnion, + InputUnionTypedDict, MaxPrice, MaxPriceTypedDict, Object, @@ -61,7 +67,8 @@ OnlyTypedDict, Order, OrderTypedDict, - Sort, + TypeImageURL, + TypeText, Usage, UsageTypedDict, ) @@ -183,6 +190,12 @@ "APIType", "CallData", "CallDataTypedDict", + "Content", + "ContentImageURL", + "ContentImageURLTypedDict", + "ContentText", + "ContentTextTypedDict", + "ContentTypedDict", "CreateAuthKeysCodeCodeChallengeMethod", "CreateAuthKeysCodeData", "CreateAuthKeysCodeDataTypedDict", @@ -217,7 +230,6 @@ "CreateResponsesResponseBody", "CreateResponsesResponseBodyTypedDict", "CreateResponsesResponseTypedDict", - "DataCollection", "DeleteKeysRequest", "DeleteKeysRequestTypedDict", "DeleteKeysResponse", @@ -225,9 +237,6 @@ "Embedding", "EmbeddingTypedDict", "EncodingFormat", - "EncodingFormatBase64", - "EncodingFormatFloat", - "EncodingFormatTypedDict", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod", "ExchangeAuthCodeForAPIKeyRequest", "ExchangeAuthCodeForAPIKeyRequestTypedDict", @@ -268,8 +277,12 @@ "GetUserActivityResponseTypedDict", "Ignore", "IgnoreTypedDict", + "ImageURL", + "ImageURLTypedDict", "Input", "InputTypedDict", + "InputUnion", + "InputUnionTypedDict", "ListData", "ListDataTypedDict", "ListEndpointsRequest", @@ -302,10 +315,11 @@ "RateLimitTypedDict", "SendChatCompletionRequestResponse", "SendChatCompletionRequestResponseTypedDict", - "Sort", "SupportedParameter", "TransferIntent", "TransferIntentTypedDict", + "TypeImageURL", + "TypeText", "UpdateKeysData", "UpdateKeysDataTypedDict", "UpdateKeysLimitReset", @@ -343,6 +357,12 @@ "TransferIntentTypedDict": ".createcoinbasecharge", "Web3Data": ".createcoinbasecharge", "Web3DataTypedDict": ".createcoinbasecharge", + "Content": ".createembeddings", + "ContentImageURL": ".createembeddings", + "ContentImageURLTypedDict": ".createembeddings", + "ContentText": ".createembeddings", + "ContentTextTypedDict": ".createembeddings", + "ContentTypedDict": ".createembeddings", "CreateEmbeddingsData": ".createembeddings", "CreateEmbeddingsDataTypedDict": ".createembeddings", "CreateEmbeddingsProvider": ".createembeddings", @@ -353,17 +373,17 @@ "CreateEmbeddingsResponseBody": ".createembeddings", "CreateEmbeddingsResponseBodyTypedDict": ".createembeddings", "CreateEmbeddingsResponseTypedDict": ".createembeddings", - "DataCollection": ".createembeddings", "Embedding": ".createembeddings", "EmbeddingTypedDict": ".createembeddings", "EncodingFormat": ".createembeddings", - "EncodingFormatBase64": ".createembeddings", - "EncodingFormatFloat": ".createembeddings", - "EncodingFormatTypedDict": ".createembeddings", "Ignore": ".createembeddings", "IgnoreTypedDict": ".createembeddings", + "ImageURL": ".createembeddings", + "ImageURLTypedDict": ".createembeddings", "Input": ".createembeddings", "InputTypedDict": ".createembeddings", + "InputUnion": ".createembeddings", + "InputUnionTypedDict": ".createembeddings", "MaxPrice": ".createembeddings", "MaxPriceTypedDict": ".createembeddings", "Object": ".createembeddings", @@ -372,7 +392,8 @@ "OnlyTypedDict": ".createembeddings", "Order": ".createembeddings", "OrderTypedDict": ".createembeddings", - "Sort": ".createembeddings", + "TypeImageURL": ".createembeddings", + "TypeText": ".createembeddings", "Usage": ".createembeddings", "UsageTypedDict": ".createembeddings", "CreateKeysData": ".createkeys", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index b84d22b..ddd90c3 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -2,7 +2,9 @@ from __future__ import annotations from openrouter.components import ( + datacollection as components_datacollection, providername as components_providername, + providersort as components_providersort, quantization as components_quantization, ) from openrouter.types import ( @@ -20,26 +22,76 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -InputTypedDict = TypeAliasType( - "InputTypedDict", Union[str, List[str], List[float], List[List[float]]] +TypeImageURL = Literal["image_url",] + + +class ImageURLTypedDict(TypedDict): + url: str + + +class ImageURL(BaseModel): + url: str + + +class ContentImageURLTypedDict(TypedDict): + type: TypeImageURL + image_url: ImageURLTypedDict + + +class ContentImageURL(BaseModel): + type: TypeImageURL + + image_url: ImageURL + + +TypeText = Literal["text",] + + +class ContentTextTypedDict(TypedDict): + type: TypeText + text: str + + +class ContentText(BaseModel): + type: TypeText + + text: str + + +ContentTypedDict = TypeAliasType( + "ContentTypedDict", Union[ContentTextTypedDict, ContentImageURLTypedDict] +) + + +Content = TypeAliasType("Content", Union[ContentText, ContentImageURL]) + + +class InputTypedDict(TypedDict): + content: List[ContentTypedDict] + + +class Input(BaseModel): + content: List[Content] + + +InputUnionTypedDict = TypeAliasType( + "InputUnionTypedDict", + Union[str, List[str], List[float], List[List[float]], List[InputTypedDict]], ) -Input = TypeAliasType("Input", Union[str, List[str], List[float], List[List[float]]]) +InputUnion = TypeAliasType( + "InputUnion", Union[str, List[str], List[float], List[List[float]], List[Input]] +) -DataCollection = Union[ +EncodingFormat = Union[ Literal[ - "deny", - "allow", + "float", + "base64", ], UnrecognizedStr, ] -r"""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. - -""" OrderTypedDict = TypeAliasType( @@ -93,17 +145,6 @@ ) -Sort = Union[ - Literal[ - "price", - "throughput", - "latency", - ], - UnrecognizedStr, -] -r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - - class MaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -147,11 +188,11 @@ class CreateEmbeddingsProviderTypedDict(TypedDict): """ require_parameters: NotRequired[Nullable[bool]] r"""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: NotRequired[Nullable[DataCollection]] + data_collection: NotRequired[Nullable[components_datacollection.DataCollection]] r"""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. + - deny: use only providers which do not collect user data. """ zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -165,7 +206,7 @@ class CreateEmbeddingsProviderTypedDict(TypedDict): r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" quantizations: NotRequired[Nullable[List[components_quantization.Quantization]]] r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[Sort]] + sort: NotRequired[Nullable[components_providersort.ProviderSort]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" max_price: NotRequired[MaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -183,12 +224,13 @@ class CreateEmbeddingsProvider(BaseModel): r"""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: Annotated[ - OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False)) + OptionalNullable[components_datacollection.DataCollection], + PlainValidator(validate_open_enum(False)), ] = UNSET r"""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. + - deny: use only providers which do not collect user data. """ zdr: OptionalNullable[bool] = UNSET @@ -217,7 +259,8 @@ class CreateEmbeddingsProvider(BaseModel): r"""A list of quantization levels to filter the provider by.""" sort: Annotated[ - OptionalNullable[Sort], PlainValidator(validate_open_enum(False)) + OptionalNullable[components_providersort.ProviderSort], + PlainValidator(validate_open_enum(False)), ] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" @@ -278,41 +321,33 @@ def serialize_model(self, handler): return m -EncodingFormatBase64 = Literal["base64",] - - -EncodingFormatFloat = Literal["float",] - - -EncodingFormatTypedDict = TypeAliasType( - "EncodingFormatTypedDict", Union[EncodingFormatFloat, EncodingFormatBase64] -) - - -EncodingFormat = TypeAliasType( - "EncodingFormat", Union[EncodingFormatFloat, EncodingFormatBase64] -) - - class CreateEmbeddingsRequestTypedDict(TypedDict): - input: InputTypedDict + input: InputUnionTypedDict model: str - provider: NotRequired[CreateEmbeddingsProviderTypedDict] - encoding_format: NotRequired[EncodingFormatTypedDict] + encoding_format: NotRequired[EncodingFormat] + dimensions: NotRequired[int] user: NotRequired[str] + provider: NotRequired[CreateEmbeddingsProviderTypedDict] + input_type: NotRequired[str] class CreateEmbeddingsRequest(BaseModel): - input: Input + input: InputUnion model: str - provider: Optional[CreateEmbeddingsProvider] = None + encoding_format: Annotated[ + Optional[EncodingFormat], PlainValidator(validate_open_enum(False)) + ] = None - encoding_format: Optional[EncodingFormat] = None + dimensions: Optional[int] = None user: Optional[str] = None + provider: Optional[CreateEmbeddingsProvider] = None + + input_type: Optional[str] = None + Object = Literal["list",] diff --git a/src/openrouter/operations/getparameters.py b/src/openrouter/operations/getparameters.py index 1a94a21..18da669 100644 --- a/src/openrouter/operations/getparameters.py +++ b/src/openrouter/operations/getparameters.py @@ -39,22 +39,21 @@ class GetParametersSecurity(BaseModel): "Alibaba", "Amazon Bedrock", "Anthropic", + "Arcee", "AtlasCloud", - "Atoma", "Avian", "Azure", "BaseTen", + "Black Forest Labs", "Cerebras", "Chutes", "Cirrascale", "Clarifai", "Cloudflare", "Cohere", - "CrofAI", "Crusoe", "DeepInfra", "DeepSeek", - "Enfer", "Featherless", "Fireworks", "Friendli", @@ -67,11 +66,8 @@ class GetParametersSecurity(BaseModel): "InferenceNet", "Infermatic", "Inflection", - "Kluster", - "Lambda", "Liquid", "Mancer 2", - "Meta", "Minimax", "ModelRun", "Mistral", @@ -81,7 +77,6 @@ class GetParametersSecurity(BaseModel): "NCompass", "Nebius", "NextBit", - "Nineteen", "Novita", "Nvidia", "OpenAI", @@ -96,7 +91,6 @@ class GetParametersSecurity(BaseModel): "Switchpoint", "Targon", "Together", - "Ubicloud", "Venice", "WandB", "xAI",