diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7ec3e1d..a859182 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: 4cc4a9d9115d0eca9a5eb4786505579d + docChecksum: 7c3a22e3f6b8d7c91ff063e2951aed2f docVersion: 1.0.0 - speakeasyVersion: 1.658.2 - generationVersion: 2.755.9 - releaseVersion: 0.0.19 - configChecksum: 834d5c1cea368e35ab6535ffb2bf9e7a + speakeasyVersion: 1.666.0 + generationVersion: 2.768.0 + releaseVersion: 0.1.1 + configChecksum: 1206f35a1f0802441ea1b8674cd04f00 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.9 + core: 5.23.13 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 devContainers: 3.0.0 @@ -27,6 +27,7 @@ features: globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 globalServerURLs: 3.2.0 + globals: 3.0.0 groups: 3.0.1 methodArguments: 1.0.2 methodSecurity: 3.0.1 @@ -34,8 +35,8 @@ features: nullables: 1.0.1 openEnums: 1.0.1 responseFormat: 1.0.1 - retries: 3.0.2 - sdkHooks: 1.1.0 + retries: 3.0.3 + sdkHooks: 1.2.0 serverEvents: 1.0.11 serverEventsSentinels: 0.1.0 serverIDs: 3.0.0 @@ -65,8 +66,8 @@ generatedFiles: - docs/components/chatgenerationtokenusage.md - docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitemaudio.md - - docs/components/chatmessagecontentitemaudioformat.md - docs/components/chatmessagecontentitemaudioinputaudio.md + - docs/components/chatmessagecontentitemcachecontrol.md - docs/components/chatmessagecontentitemimage.md - docs/components/chatmessagecontentitemimagedetail.md - docs/components/chatmessagecontentitemtext.md @@ -105,6 +106,7 @@ generatedFiles: - docs/components/costdetails.md - docs/components/createchargerequest.md - docs/components/datacollection.md + - docs/components/debug.md - docs/components/defaultparameters.md - docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/effort.md @@ -117,6 +119,7 @@ generatedFiles: - docs/components/forbiddenresponseerrordata.md - docs/components/idfileparser.md - docs/components/idmoderation.md + - docs/components/idresponsehealing.md - docs/components/idweb.md - docs/components/ignore.md - docs/components/imagegenerationstatus.md @@ -300,6 +303,7 @@ generatedFiles: - docs/components/plugin.md - docs/components/pluginfileparser.md - docs/components/pluginmoderation.md + - docs/components/pluginresponsehealing.md - docs/components/pluginweb.md - docs/components/pricing.md - docs/components/prompt.md @@ -391,6 +395,7 @@ generatedFiles: - docs/components/toplogprob.md - docs/components/topproviderinfo.md - docs/components/truncation.md + - docs/components/ttl.md - docs/components/type.md - docs/components/typeresponsecompleted.md - docs/components/typeresponsecontentpartadded.md @@ -436,6 +441,7 @@ generatedFiles: - docs/errors/toomanyrequestsresponseerror.md - docs/errors/unauthorizedresponseerror.md - docs/errors/unprocessableentityresponseerror.md + - docs/models/internal/globals.md - docs/models/utils/retryconfig.md - docs/operations/apitype.md - docs/operations/calldata.md @@ -453,7 +459,6 @@ generatedFiles: - docs/operations/createembeddingsprovider.md - docs/operations/createembeddingsrequest.md - docs/operations/createembeddingsresponse.md - - docs/operations/createembeddingsresponsebody.md - docs/operations/createkeysdata.md - docs/operations/createkeyslimitreset.md - docs/operations/createkeysrequest.md @@ -467,6 +472,7 @@ generatedFiles: - docs/operations/exchangeauthcodeforapikeycodechallengemethod.md - docs/operations/exchangeauthcodeforapikeyrequest.md - docs/operations/exchangeauthcodeforapikeyresponse.md + - docs/operations/getcreditsdata.md - docs/operations/getcreditsresponse.md - docs/operations/getcurrentkeydata.md - docs/operations/getcurrentkeyresponse.md @@ -549,11 +555,13 @@ 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 - src/openrouter/components/chatmessagecontentitem.py - src/openrouter/components/chatmessagecontentitemaudio.py + - src/openrouter/components/chatmessagecontentitemcachecontrol.py - src/openrouter/components/chatmessagecontentitemimage.py - src/openrouter/components/chatmessagecontentitemtext.py - src/openrouter/components/chatmessagecontentitemvideo.py @@ -562,6 +570,7 @@ 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 @@ -711,6 +720,9 @@ generatedFiles: - src/openrouter/errors/unprocessableentityresponse_error.py - src/openrouter/generations.py - src/openrouter/httpclient.py + - src/openrouter/models/__init__.py + - src/openrouter/models/internal/__init__.py + - src/openrouter/models/internal/globals.py - src/openrouter/models_.py - src/openrouter/oauth.py - src/openrouter/operations/__init__.py @@ -764,7 +776,7 @@ examples: createResponses: speakeasy-default-create-responses: requestBody: - application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "stream": false} + application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "store": false, "service_tier": "auto", "stream": false} responses: "200": application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "status": "completed", "content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]}], "error": null, "incomplete_details": null, "usage": {"input_tokens": 10, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 25, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 35}, "max_output_tokens": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true} @@ -814,7 +826,7 @@ examples: speakeasy-default-get-credits: responses: "200": - application/json: {} + application/json: {"data": {"total_credits": 100.5, "total_usage": 25.75}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "403": diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c68359b..80ecc68 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.0.19 + version: 0.1.1 additionalDependencies: dev: {} main: {} @@ -62,12 +62,14 @@ python: operations: operations shared: components webhooks: "" + inferUnionDiscriminators: true inputModelSuffix: input legacyPyright: false license: Apache-2.0 maxMethodParams: 999 methodArguments: infer-optional-args moduleName: "" + multipartArrayFormat: legacy outputModelSuffix: output packageManager: uv packageName: openrouter diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 82b30d2..df8bd30 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -3447,12 +3447,14 @@ components: - AionLabs - Alibaba - Amazon Bedrock + - Amazon Nova - Anthropic - - Arcee + - Arcee AI - AtlasCloud - Avian - Azure - BaseTen + - BytePlus - Black Forest Labs - Cerebras - Chutes @@ -3467,6 +3469,7 @@ components: - Fireworks - Friendli - GMICloud + - GoPomelo - Google - Google AI Studio - Groq @@ -3496,7 +3499,9 @@ components: - Relace - SambaNova - SiliconFlow + - Sourceful - Stealth + - StreamLake - Switchpoint - Targon - Together @@ -3628,17 +3633,13 @@ components: nullable: true store: type: boolean - nullable: true + const: false + default: false service_tier: - allOf: - - $ref: '#/components/schemas/OpenAIResponsesServiceTier' - - enum: - - auto - - default - - flex - - scale - - priority - example: auto + type: string + enum: + - auto + default: auto truncation: allOf: - $ref: '#/components/schemas/OpenAIResponsesTruncation' @@ -3789,6 +3790,14 @@ components: - native required: - id + - type: object + properties: + id: + type: string + enum: + - response-healing + required: + - id description: Plugins you want to enable for this request, including their settings. user: type: string @@ -3797,6 +3806,13 @@ components: 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. + session_id: + type: string + maxLength: 128 + description: >- + A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for + observability. If provided in both the request body and the x-session-id header, the body value takes + precedence. Maximum of 128 characters. description: Request schema for Responses endpoint example: model: anthropic/claude-4.5-sonnet-20250929 @@ -4577,6 +4593,10 @@ components: status: default uptime_last_30m: 99.5 supports_implicit_caching: true + __schema0: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - type: 'null' ModelName: type: string ChatMessageContentItemText: @@ -4587,6 +4607,8 @@ components: const: text text: type: string + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' required: - type - text @@ -4625,14 +4647,6 @@ components: type: string format: type: string - enum: - - wav - - mp3 - - flac - - m4a - - ogg - - pcm16 - - pcm24 required: - data - format @@ -4810,15 +4824,13 @@ components: - prompt_tokens - total_tokens ChatCompletionFinishReason: - anyOf: - - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - - type: 'null' + type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error JSONSchemaConfig: type: object properties: @@ -4860,6 +4872,19 @@ components: required: - type - grammar + ChatMessageContentItemCacheControl: + type: object + properties: + type: + type: string + const: ephemeral + ttl: + type: string + enum: + - 5m + - 1h + required: + - type SystemMessage: type: object properties: @@ -5170,13 +5195,18 @@ components: - type: 'null' user: type: string + debug: + type: object + properties: + echo_upstream_body: + type: boolean required: - messages ChatResponseChoice: type: object properties: finish_reason: - $ref: '#/components/schemas/ChatCompletionFinishReason' + $ref: '#/components/schemas/__schema0' index: type: number message: @@ -5237,7 +5267,7 @@ components: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/ChatCompletionFinishReason' + $ref: '#/components/schemas/__schema0' index: type: number logprobs: @@ -5569,6 +5599,12 @@ components: - type: 'null' finish_reason: $ref: '#/components/schemas/CompletionFinishReason' + native_finish_reason: + type: string + reasoning: + anyOf: + - type: string + - type: 'null' required: - text - index @@ -5586,6 +5622,8 @@ components: type: number model: type: string + provider: + type: string system_fingerprint: type: string choices: @@ -5804,6 +5842,26 @@ paths: application/json: schema: type: object + properties: + data: + type: object + properties: + total_credits: + type: number + description: Total credits purchased + example: 100.5 + total_usage: + type: number + description: Total credits used + example: 25.75 + required: + - total_credits + - total_usage + example: + total_credits: 100.5 + total_usage: 25.75 + required: + - data description: Total credits purchased and used example: data: @@ -6726,12 +6784,14 @@ paths: - AionLabs - Alibaba - Amazon Bedrock + - Amazon Nova - Anthropic - - Arcee + - Arcee AI - AtlasCloud - Avian - Azure - BaseTen + - BytePlus - Black Forest Labs - Cerebras - Chutes @@ -6746,6 +6806,7 @@ paths: - Fireworks - Friendli - GMICloud + - GoPomelo - Google - Google AI Studio - Groq @@ -6775,7 +6836,9 @@ paths: - Relace - SambaNova - SiliconFlow + - Sourceful - Stealth + - StreamLake - Switchpoint - Targon - Together diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2987de9..c609cc4 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -1,8387 +1,8441 @@ 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 + 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: + schemas: + OpenAIResponsesResponseStatus: + type: string + enum: + - completed + - incomplete + - in_progress + - failed + - cancelled + - queued + x-speakeasy-unknown-values: allow + 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 - - failed - - cancelled - - queued - x-speakeasy-unknown-values: allow - 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: + content: + type: array + items: 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 + - $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 - example: completed - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - required: - - location - ResponsesSearchContextSize: + - 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 + x-speakeasy-unknown-values: allow + 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 - enum: - - low - - medium - - high - description: Size of the search context for web search tools - example: medium - x-speakeasy-unknown-values: allow - 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: + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + OpenAIResponsesInput: + anyOf: + - type: string + - type: array + items: anyOf: - - type: string - enum: - - auto - - type: string - enum: - - none - - type: string - enum: - - required - - type: object - properties: - type: - type: string + - type: object + properties: + type: + type: string + enum: + - message + role: + anyOf: + - 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 - x-speakeasy-unknown-values: allow - ReasoningSummaryVerbosity: - type: string - enum: - - auto - - concise - - detailed - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - OpenAIResponsesTruncation: - type: string - nullable: true - enum: - - auto - - disabled - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 + - user + - type: string + enum: + - system + - type: string + enum: + - assistant + - type: string + enum: + - developer + content: + anyOf: + - 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 - x-speakeasy-unknown-values: allow - 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: + oneOf: - $ref: '#/components/schemas/ResponseInputText' - $ref: '#/components/schemas/ResponseInputImage' - $ref: '#/components/schemas/ResponseInputFile' - $ref: '#/components/schemas/ResponseInputAudio' - discriminator: + 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: + 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: - - 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: + - message + role: 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 - x-speakeasy-unknown-values: allow - DataCollection: - type: string + - 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 - 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: - - 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 - x-speakeasy-unknown-values: allow - Quantization: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - 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 + 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 + x-speakeasy-unknown-values: allow + required: + - location + ResponsesSearchContextSize: + type: string + enum: + - low + - medium + - high + description: Size of the search context for web search tools + example: medium + x-speakeasy-unknown-values: allow + 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 - - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - truncation: - allOf: - - $ref: '#/components/schemas/OpenAIResponsesTruncation' - - example: auto - stream: - type: boolean - default: false - provider: + 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 + x-speakeasy-unknown-values: allow + ReasoningSummaryVerbosity: + type: string + enum: + - auto + - concise + - detailed + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + OpenAIResponsesTruncation: + type: string + nullable: true + enum: + - auto + - disabled + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 - nullable: true properties: - allow_fallbacks: - type: boolean - nullable: true - description: > - Whether to allow backup providers to serve requests + location: + type: string + description: The city and state + unit: + type: string + enum: + - celsius + - fahrenheit + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + 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. - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. + - allow: (default) allow providers which store user data non-transiently and may train on it - - 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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: + - deny: use only providers which do not collect user data. + example: allow + x-speakeasy-unknown-values: allow + ProviderName: + type: string + enum: + - AI21 + - AionLabs + - Alibaba + - Amazon Bedrock + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - GoPomelo + - 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 + - StreamLake + - Switchpoint + - Targon + - Together + - Venice + - WandB + - xAI + - Z.AI + - FakeProvider + example: OpenAI + x-speakeasy-unknown-values: allow + Quantization: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - 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 + - 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 - 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 - x-speakeasy-unknown-values: allow - 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: + properties: + location: + type: string + description: The city and state + unit: + type: string + enum: + - celsius + - fahrenheit + x-speakeasy-unknown-values: allow + 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 + const: false + default: false + service_tier: + type: string + enum: + - auto + default: 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' + $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' - request: - $ref: '#/components/schemas/BigNumberUnion' + $ref: '#/components/schemas/BigNumberUnion' image: - $ref: '#/components/schemas/BigNumberUnion' - image_token: - $ref: '#/components/schemas/BigNumberUnion' - image_output: - $ref: '#/components/schemas/BigNumberUnion' + $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 - x-speakeasy-unknown-values: allow - InputModality: - type: string - enum: - - text - - image - - file - - audio - - video - example: text - x-speakeasy-unknown-values: allow - OutputModality: - type: string - enum: - - text - - image - - embeddings - example: text - x-speakeasy-unknown-values: allow - ModelArchitecture: - type: object - properties: - tokenizer: - $ref: '#/components/schemas/ModelGroup' - instruct_type: + $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 - 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 - x-speakeasy-unknown-values: allow - modality: + - moderation + required: + - id + - type: object + properties: + id: type: string - nullable: true - description: Primary modality of the model - example: text->text + enum: + - web + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + required: + - id + - type: object + properties: + id: + type: string + enum: + - response-healing + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + InputModality: + type: string + enum: + - text + - image + - file + - audio + - video + example: text + x-speakeasy-unknown-values: allow + OutputModality: + type: string + enum: + - text + - image + - embeddings + example: text + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + EndpointStatus: + type: integer + enum: + - 0 + - -1 + - -2 + - -3 + - -5 + - -10 + example: 0 + x-speakeasy-unknown-values: allow + 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 + 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: + type: array + items: + $ref: '#/components/schemas/OutputModality' + description: Supported output modalities + required: + - tokenizer + - instruct_type - modality - input_modalities - output_modalities - description: Model architecture information - example: + example: tokenizer: GPT instruct_type: chatml - modality: text->text - input_modalities: - - text - output_modalities: - - text - TopProviderInfo: + 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 + __schema0: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - type: 'null' + ModelName: + type: string + ChatMessageContentItemText: + type: object + properties: + type: + type: string + const: text + text: + type: string + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' + 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 + x-speakeasy-unknown-values: allow + 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 + 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: - 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 + token: + type: string + logprob: + type: number + bytes: + anyOf: + - type: array + items: + type: number + - type: 'null' 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: + - 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: + type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + x-speakeasy-unknown-values: allow + JSONSchemaConfig: + type: object + properties: + name: + type: string + maxLength: 64 + description: + type: string + schema: + type: object + propertyNames: 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 - x-speakeasy-unknown-values: allow - 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: + 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 + ChatMessageContentItemCacheControl: + type: object + properties: + type: + type: string + const: ephemeral + ttl: + type: string + enum: + - 5m + - 1h + x-speakeasy-unknown-values: allow + required: + - type + 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 - 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 - x-speakeasy-unknown-values: allow - EndpointStatus: - type: integer - enum: - - 0 - - -1 - - -2 - - -3 - - -5 - - -10 - example: 0 - x-speakeasy-unknown-values: allow - 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: + additionalProperties: 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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: + presence_penalty: + anyOf: + - type: number + minimum: -2 + maximum: 2 + - type: 'null' + reasoning: + type: object + properties: + effort: + anyOf: - type: string enum: - - tool_calls - - stop - - length - - content_filter - - error + - none + - minimal + - low + - medium + - high x-speakeasy-unknown-values: allow - 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: + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryVerbosity' + - type: 'null' + response_format: + oneOf: + - type: object + properties: type: - type: string - const: json_schema - json_schema: - $ref: '#/components/schemas/JSONSchemaConfig' - required: + type: string + const: text + required: - type - - json_schema - ResponseFormatTextGrammar: - type: object - properties: + - type: object + properties: type: - type: string - const: grammar - grammar: - type: string - required: + type: string + const: json_object + 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: + - $ref: '#/components/schemas/ResponseFormatJSONSchema' + - $ref: '#/components/schemas/ResponseFormatTextGrammar' + - 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: string + const: python + 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: object + seed: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: 'null' + stop: + anyOf: + - 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 - x-speakeasy-unknown-values: allow - - 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: + - maxItems: 4 + type: array + items: type: string - required: - - messages - ChatResponseChoice: - type: object - properties: - finish_reason: - $ref: '#/components/schemas/ChatCompletionFinishReason' - index: - type: number + - 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 + debug: + type: object + properties: + echo_upstream_body: + type: boolean + required: + - messages + ChatResponseChoice: + type: object + properties: + finish_reason: + $ref: '#/components/schemas/__schema0' + 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/__schema0' + 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: - $ref: '#/components/schemas/AssistantMessage' - logprobs: - anyOf: - - $ref: '#/components/schemas/ChatMessageTokenLogprobs' - - type: 'null' - required: - - finish_reason - - index + type: string + code: + type: number + required: - message - ChatStreamingMessageToolCall: - type: object - properties: - index: - type: number - id: + - 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 + x-speakeasy-unknown-values: allow + - 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: - 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: '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' + native_finish_reason: + type: string + reasoning: + anyOf: + - type: string + - type: 'null' + 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 + provider: + 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: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}} + 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/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: + $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 + properties: + data: 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' + total_credits: + type: number + description: Total credits purchased + example: 100.5 + total_usage: + type: number + description: Total credits used + example: 25.75 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: + - total_credits + - total_usage + example: + total_credits: 100.5 + total_usage: 25.75 + required: + - data + description: Total credits purchased and used + example: + data: + total_credits: 100.5 + total_usage: 25.75 + '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 - 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: + id: + type: string + created_at: + type: string + expires_at: + type: string + web3_data: + type: object + properties: + transfer_intent: type: object properties: - message: + call_data: + type: object + properties: + deadline: type: string - code: + 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: - - message - - code - additionalProperties: false - usage: - $ref: '#/components/schemas/ChatGenerationTokenUsage' + - call_data + - metadata + required: + - transfer_intent required: - - id - - choices - - created - - model - - object - additionalProperties: false - required: - - data - additionalProperties: false - CompletionFinishReason: - anyOf: - - type: string - enum: - - stop - - length - - content_filter - x-speakeasy-unknown-values: allow - - type: 'null' - CompletionLogprobs: - type: object - properties: - tokens: - type: array - items: + - 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 - token_logprobs: - type: array - items: + - 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: array + items: + type: number + - type: array + items: + type: object + properties: + content: 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 + 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: + 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: 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: number + - type: string + index: + type: number + required: + - object + - embedding + model: 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: + usage: + type: object + properties: + prompt_tokens: + type: number + total_tokens: + type: number + cost: + type: number + required: + - prompt_tokens + - total_tokens + required: + - object + - data + - model + '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 + x-speakeasy-unknown-values: allow + 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 + responses: + '200': + description: Returns a list of models or RSS feed + 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: 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/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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 - responses: - '200': - description: Returns a list of models or RSS feed - 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: 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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': + $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 + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - GoPomelo + - 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 + - StreamLake + - Switchpoint + - Targon + - Together + - Venice + - WandB + - xAI + - Z.AI + - FakeProvider + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 - 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 - x-speakeasy-unknown-values: allow - 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: + 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 + x-speakeasy-unknown-values: allow + 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 hash identifier of the API key to update + description: The actual API key string (only shown once) 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 - x-speakeasy-unknown-values: allow - 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: + 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 + x-speakeasy-unknown-values: allow + 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 + x-speakeasy-unknown-values: allow + 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 hash identifier of the API key to delete + description: The API key to use for OpenRouter requests 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: + user_id: 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 - x-speakeasy-unknown-values: allow - 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 - x-speakeasy-unknown-values: allow - 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 + 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 + x-speakeasy-unknown-values: allow + 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 + - url: https://openrouter.ai/api/v1 + description: Production server + x-speakeasy-server-id: production security: - - apiKey: [] + - apiKey: [] externalDocs: - description: OpenRouter Documentation - url: https://openrouter.ai/docs + 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 + - 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 + type: exponential + initialDelay: 500 + maxDelay: 60000 + maxAttempts: 3 +x-speakeasy-globals: + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" diff --git a/.speakeasy/overlays/add-headers.overlay.yaml b/.speakeasy/overlays/add-headers.overlay.yaml new file mode 100644 index 0000000..60a2232 --- /dev/null +++ b/.speakeasy/overlays/add-headers.overlay.yaml @@ -0,0 +1,35 @@ +overlay: 1.0.0 +x-speakeasy-jsonpath: rfc9535 +info: + title: Add HTTP-Referer and X-Title as global parameters + version: 0.0.0 +actions: + # Add global parameters for app identification + - target: $ + description: Add x-speakeasy-globals for HTTP-Referer and X-Title headers + update: + x-speakeasy-globals: + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + + # Add component parameters + - target: $.components + description: Add parameters for app identification headers + update: + parameters: + AppIdentifier: + name: HTTP-Referer + in: header + schema: + type: string + description: | + The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + AppDisplayName: + name: X-Title + in: header + schema: + type: string + description: | + The app display name allows you to customize how your app appears in OpenRouter's dashboard. diff --git a/.speakeasy/overlays/open-enums.overlay.yaml b/.speakeasy/overlays/open-enums.overlay.yaml new file mode 100644 index 0000000..50a03a3 --- /dev/null +++ b/.speakeasy/overlays/open-enums.overlay.yaml @@ -0,0 +1,10 @@ +overlay: 1.0.0 +x-speakeasy-jsonpath: rfc9535 +info: + title: Add open enums + version: 0.0.0 +actions: + - target: $..[?length(@.enum) > 1] + description: Automatically open all enums that have length > 1 + update: + x-speakeasy-unknown-values: allow diff --git a/.speakeasy/overlays/remove-rss-responses.overlay.yaml b/.speakeasy/overlays/remove-rss-responses.overlay.yaml new file mode 100644 index 0000000..ac294a9 --- /dev/null +++ b/.speakeasy/overlays/remove-rss-responses.overlay.yaml @@ -0,0 +1,15 @@ +overlay: 1.0.0 +x-speakeasy-jsonpath: rfc9535 +info: + title: Remove RSS+XML response schemas and related parameters + version: 0.0.0 +actions: + - target: $..responses.*.content["application/rss+xml"] + description: Remove application/rss+xml response schemas + remove: true + - target: $..parameters[?@.name == "use_rss"] + description: Remove use_rss parameter + remove: true + - target: $..parameters[?@.name == "use_rss_chat_links"] + description: Remove use_rss_chat_links parameter + remove: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e8a1112..346e0ea 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,24 +1,28 @@ -speakeasyVersion: 1.658.2 +speakeasyVersion: 1.666.0 sources: -OAS: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 - sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 + sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695 + sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 tags: - latest targets: open-router: source: -OAS sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 - sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 + sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695 + sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 workflow: workflowVersion: 1.0.0 - speakeasyVersion: latest + speakeasyVersion: 1.666.0 sources: -OAS: inputs: - location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main + overlays: + - location: .speakeasy/overlays/open-enums.overlay.yaml + - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml + - location: .speakeasy/overlays/add-headers.overlay.yaml output: .speakeasy/out.openapi.yaml registry: location: registry.speakeasyapi.dev/openrouter/sdk/-oas diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 9afbab9..dce887d 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -1,9 +1,13 @@ workflowVersion: 1.0.0 -speakeasyVersion: latest +speakeasyVersion: 1.666.0 sources: -OAS: inputs: - location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main + overlays: + - location: .speakeasy/overlays/open-enums.overlay.yaml + - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml + - location: .speakeasy/overlays/add-headers.overlay.yaml output: .speakeasy/out.openapi.yaml registry: location: registry.speakeasyapi.dev/openrouter/sdk/-oas diff --git a/docs/components/chatgenerationparams.md b/docs/components/chatgenerationparams.md index 238044f..41db71b 100644 --- a/docs/components/chatgenerationparams.md +++ b/docs/components/chatgenerationparams.md @@ -26,4 +26,5 @@ | `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | | `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemaudioformat.md b/docs/components/chatmessagecontentitemaudioformat.md deleted file mode 100644 index 97119c0..0000000 --- a/docs/components/chatmessagecontentitemaudioformat.md +++ /dev/null @@ -1,14 +0,0 @@ -# ChatMessageContentItemAudioFormat - - -## Values - -| Name | Value | -| ------- | ------- | -| `WAV` | wav | -| `MP3` | mp3 | -| `FLAC` | flac | -| `M4A` | m4a | -| `OGG` | ogg | -| `PCM16` | pcm16 | -| `PCM24` | pcm24 | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemaudioinputaudio.md b/docs/components/chatmessagecontentitemaudioinputaudio.md index 3665698..f7a62b5 100644 --- a/docs/components/chatmessagecontentitemaudioinputaudio.md +++ b/docs/components/chatmessagecontentitemaudioinputaudio.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `data` | *str* | :heavy_check_mark: | N/A | -| `format_` | [components.ChatMessageContentItemAudioFormat](../components/chatmessagecontentitemaudioformat.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `data` | *str* | :heavy_check_mark: | N/A | +| `format_` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemcachecontrol.md b/docs/components/chatmessagecontentitemcachecontrol.md new file mode 100644 index 0000000..2ad30d0 --- /dev/null +++ b/docs/components/chatmessagecontentitemcachecontrol.md @@ -0,0 +1,9 @@ +# ChatMessageContentItemCacheControl + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A | +| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemtext.md b/docs/components/chatmessagecontentitemtext.md index 4fa8b7b..4f8a874 100644 --- a/docs/components/chatmessagecontentitemtext.md +++ b/docs/components/chatmessagecontentitemtext.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | -| `text` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | +| `text` | *str* | :heavy_check_mark: | N/A | +| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completionchoice.md b/docs/components/completionchoice.md index 758eea9..cb489be 100644 --- a/docs/components/completionchoice.md +++ b/docs/components/completionchoice.md @@ -8,4 +8,6 @@ | `text` | *str* | :heavy_check_mark: | N/A | | `index` | *float* | :heavy_check_mark: | N/A | | `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A | -| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A | +| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completionresponse.md b/docs/components/completionresponse.md index 404f19d..3e9a9bd 100644 --- a/docs/components/completionresponse.md +++ b/docs/components/completionresponse.md @@ -9,6 +9,7 @@ | `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A | | `created` | *float* | :heavy_check_mark: | N/A | | `model` | *str* | :heavy_check_mark: | N/A | +| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A | | `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A | | `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A | | `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/debug.md b/docs/components/debug.md new file mode 100644 index 0000000..459bb4b --- /dev/null +++ b/docs/components/debug.md @@ -0,0 +1,8 @@ +# Debug + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/idresponsehealing.md b/docs/components/idresponsehealing.md new file mode 100644 index 0000000..4a12790 --- /dev/null +++ b/docs/components/idresponsehealing.md @@ -0,0 +1,8 @@ +# IDResponseHealing + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `RESPONSE_HEALING` | response-healing | \ No newline at end of file diff --git a/docs/components/openresponsesrequest.md b/docs/components/openresponsesrequest.md index fcc6420..56283da 100644 --- a/docs/components/openresponsesrequest.md +++ b/docs/components/openresponsesrequest.md @@ -27,8 +27,8 @@ Request schema for Responses endpoint | `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `service_tier` | [OptionalNullable[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | auto | +| `store` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | | +| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | diff --git a/docs/components/plugin.md b/docs/components/plugin.md index 7f6e744..bc21cd4 100644 --- a/docs/components/plugin.md +++ b/docs/components/plugin.md @@ -21,3 +21,9 @@ value: components.PluginWeb = /* values here */ value: components.PluginFileParser = /* values here */ ``` +### `components.PluginResponseHealing` + +```python +value: components.PluginResponseHealing = /* values here */ +``` + diff --git a/docs/components/pluginresponsehealing.md b/docs/components/pluginresponsehealing.md new file mode 100644 index 0000000..ecee55d --- /dev/null +++ b/docs/components/pluginresponsehealing.md @@ -0,0 +1,8 @@ +# PluginResponseHealing + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/providername.md b/docs/components/providername.md index 9c86cd3..47b7be5 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -9,12 +9,14 @@ | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | | `AMAZON_BEDROCK` | Amazon Bedrock | +| `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | -| `ARCEE` | Arcee | +| `ARCEE_AI` | Arcee AI | | `ATLAS_CLOUD` | AtlasCloud | | `AVIAN` | Avian | | `AZURE` | Azure | | `BASE_TEN` | BaseTen | +| `BYTE_PLUS` | BytePlus | | `BLACK_FOREST_LABS` | Black Forest Labs | | `CEREBRAS` | Cerebras | | `CHUTES` | Chutes | @@ -29,6 +31,7 @@ | `FIREWORKS` | Fireworks | | `FRIENDLI` | Friendli | | `GMI_CLOUD` | GMICloud | +| `GO_POMELO` | GoPomelo | | `GOOGLE` | Google | | `GOOGLE_AI_STUDIO` | Google AI Studio | | `GROQ` | Groq | @@ -59,6 +62,7 @@ | `SAMBA_NOVA` | SambaNova | | `SILICON_FLOW` | SiliconFlow | | `STEALTH` | Stealth | +| `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | | `TARGON` | Targon | | `TOGETHER` | Together | diff --git a/docs/components/servicetier.md b/docs/components/servicetier.md index 3a7a020..bfc6187 100644 --- a/docs/components/servicetier.md +++ b/docs/components/servicetier.md @@ -3,10 +3,6 @@ ## Values -| Name | Value | -| ---------- | ---------- | -| `AUTO` | auto | -| `DEFAULT` | default | -| `FLEX` | flex | -| `PRIORITY` | priority | -| `SCALE` | scale | \ No newline at end of file +| Name | Value | +| ------ | ------ | +| `AUTO` | auto | \ No newline at end of file diff --git a/docs/components/ttl.md b/docs/components/ttl.md new file mode 100644 index 0000000..0cbc7f3 --- /dev/null +++ b/docs/components/ttl.md @@ -0,0 +1,9 @@ +# TTL + + +## Values + +| Name | Value | +| ------- | ------- | +| `FIVEM` | 5m | +| `ONEH` | 1h | \ No newline at end of file diff --git a/docs/models/internal/globals.md b/docs/models/internal/globals.md new file mode 100644 index 0000000..5399b31 --- /dev/null +++ b/docs/models/internal/globals.md @@ -0,0 +1,9 @@ +# Globals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createembeddingsresponse.md b/docs/operations/createembeddingsresponse.md index 4c379be..2dc9adf 100644 --- a/docs/operations/createembeddingsresponse.md +++ b/docs/operations/createembeddingsresponse.md @@ -1,17 +1,14 @@ # CreateEmbeddingsResponse +Embedding response -## Supported Types -### `operations.CreateEmbeddingsResponseBody` - -```python -value: operations.CreateEmbeddingsResponseBody = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A | +| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A | +| `model` | *str* | :heavy_check_mark: | N/A | +| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/createembeddingsresponsebody.md b/docs/operations/createembeddingsresponsebody.md deleted file mode 100644 index 2252cfd..0000000 --- a/docs/operations/createembeddingsresponsebody.md +++ /dev/null @@ -1,14 +0,0 @@ -# CreateEmbeddingsResponseBody - -Embedding response - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A | -| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/getcreditsdata.md b/docs/operations/getcreditsdata.md new file mode 100644 index 0000000..9ba4582 --- /dev/null +++ b/docs/operations/getcreditsdata.md @@ -0,0 +1,9 @@ +# GetCreditsData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `total_credits` | *float* | :heavy_check_mark: | Total credits purchased | 100.5 | +| `total_usage` | *float* | :heavy_check_mark: | Total credits used | 25.75 | \ No newline at end of file diff --git a/docs/operations/getcreditsresponse.md b/docs/operations/getcreditsresponse.md index c52bc01..a58a336 100644 --- a/docs/operations/getcreditsresponse.md +++ b/docs/operations/getcreditsresponse.md @@ -5,5 +5,6 @@ Total credits purchased and used ## Fields -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `data` | [operations.GetCreditsData](../operations/getcreditsdata.md) | :heavy_check_mark: | N/A | {
"total_credits": 100.5,
"total_usage": 25.75
} | \ No newline at end of file diff --git a/docs/operations/getparametersprovider.md b/docs/operations/getparametersprovider.md index 21a0244..f8728f0 100644 --- a/docs/operations/getparametersprovider.md +++ b/docs/operations/getparametersprovider.md @@ -9,12 +9,14 @@ | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | | `AMAZON_BEDROCK` | Amazon Bedrock | +| `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | -| `ARCEE` | Arcee | +| `ARCEE_AI` | Arcee AI | | `ATLAS_CLOUD` | AtlasCloud | | `AVIAN` | Avian | | `AZURE` | Azure | | `BASE_TEN` | BaseTen | +| `BYTE_PLUS` | BytePlus | | `BLACK_FOREST_LABS` | Black Forest Labs | | `CEREBRAS` | Cerebras | | `CHUTES` | Chutes | @@ -29,6 +31,7 @@ | `FIREWORKS` | Fireworks | | `FRIENDLI` | Friendli | | `GMI_CLOUD` | GMICloud | +| `GO_POMELO` | GoPomelo | | `GOOGLE` | Google | | `GOOGLE_AI_STUDIO` | Google AI Studio | | `GROQ` | Groq | @@ -59,6 +62,7 @@ | `SAMBA_NOVA` | SambaNova | | `SILICON_FLOW` | SiliconFlow | | `STEALTH` | Stealth | +| `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | | `TARGON` | Targon | | `TOGETHER` | Together | diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 94ffd97..78c3a29 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -58,6 +58,7 @@ with OpenRouter( | `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../../components/debug.md) | :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 386fd37..001617b 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -112,8 +112,7 @@ with OpenRouter( | `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `service_tier` | [OptionalNullable[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | auto | +| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | diff --git a/pyproject.toml b/pyproject.toml index e10c064..7d65137 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.0.19" +version = "0.1.1" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index a25d226..43d4d8d 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.19" +__version__: str = "0.1.1" __openapi_doc_version__: str = "1.0.0" -__gen_version__: str = "2.755.9" -__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter" +__gen_version__: str = "2.768.0" +__user_agent__: str = "speakeasy-sdk/python 0.1.1 2.768.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/analytics.py b/src/openrouter/analytics.py index 181e1da..a60430c 100644 --- a/src/openrouter/analytics.py +++ b/src/openrouter/analytics.py @@ -58,6 +58,7 @@ class Analytics(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -166,6 +167,7 @@ class Analytics(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/api_keys.py b/src/openrouter/api_keys.py index 0906aa8..f4f0d23 100644 --- a/src/openrouter/api_keys.py +++ b/src/openrouter/api_keys.py @@ -60,6 +60,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -164,6 +165,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -280,6 +282,7 @@ class APIKeys(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateKeysRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -401,6 +404,7 @@ class APIKeys(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateKeysRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -527,6 +531,7 @@ class APIKeys(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request.body, False, False, "json", operations.UpdateKeysRequestBody ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -658,6 +663,7 @@ class APIKeys(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request.body, False, False, "json", operations.UpdateKeysRequestBody ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -769,6 +775,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -875,6 +882,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -981,6 +989,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1087,6 +1096,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1188,6 +1198,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1279,6 +1290,7 @@ class APIKeys(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/basesdk.py b/src/openrouter/basesdk.py index 17059ed..fcffdcc 100644 --- a/src/openrouter/basesdk.py +++ b/src/openrouter/basesdk.py @@ -60,6 +60,7 @@ class BaseSDK: ] = None, url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, + allow_empty_value: Optional[List[str]] = None, ) -> httpx.Request: client = self.sdk_configuration.async_client return self._build_request_with_client( @@ -80,6 +81,7 @@ class BaseSDK: get_serialized_body, url_override, http_headers, + allow_empty_value, ) def _build_request( @@ -102,6 +104,7 @@ class BaseSDK: ] = None, url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, + allow_empty_value: Optional[List[str]] = None, ) -> httpx.Request: client = self.sdk_configuration.client return self._build_request_with_client( @@ -122,6 +125,7 @@ class BaseSDK: get_serialized_body, url_override, http_headers, + allow_empty_value, ) def _build_request_with_client( @@ -145,6 +149,7 @@ class BaseSDK: ] = None, url_override: Optional[str] = None, http_headers: Optional[Mapping[str, str]] = None, + allow_empty_value: Optional[List[str]] = None, ) -> httpx.Request: query_params = {} @@ -160,6 +165,7 @@ class BaseSDK: query_params = utils.get_query_params( request if request_has_query_params else None, _globals if request_has_query_params else None, + allow_empty_value, ) else: # Pick up the query parameter from the override so they can be diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 5a80cf8..bc00143 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -61,6 +61,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -92,6 +93,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -144,6 +146,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -175,6 +178,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -226,6 +230,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -257,6 +262,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -305,6 +311,7 @@ class Chat(BaseSDK): ), top_p=top_p, user=user, + debug=utils.get_pydantic_model(debug, Optional[components.Debug]), ) req = self._build_request( @@ -323,6 +330,7 @@ class Chat(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.ChatGenerationParams ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -438,6 +446,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -469,6 +478,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -521,6 +531,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -552,6 +563,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -603,6 +615,7 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = UNSET, user: Optional[str] = None, + debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -634,6 +647,7 @@ class Chat(BaseSDK): :param tools: :param top_p: :param user: + :param debug: :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 @@ -682,6 +696,7 @@ class Chat(BaseSDK): ), top_p=top_p, user=user, + debug=utils.get_pydantic_model(debug, Optional[components.Debug]), ) req = self._build_request_async( @@ -700,6 +715,7 @@ class Chat(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.ChatGenerationParams ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/completions.py b/src/openrouter/completions.py index 4ffeb7b..26bbf6a 100644 --- a/src/openrouter/completions.py +++ b/src/openrouter/completions.py @@ -136,6 +136,7 @@ class Completions(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.CompletionCreateParams ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -310,6 +311,7 @@ class Completions(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.CompletionCreateParams ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 8a34729..d7818e6 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -21,6 +21,7 @@ if TYPE_CHECKING: BadRequestResponseErrorData, BadRequestResponseErrorDataTypedDict, ) + from .chatcompletionfinishreason import ChatCompletionFinishReason from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, @@ -35,6 +36,8 @@ if TYPE_CHECKING: ChatGenerationParamsStop, ChatGenerationParamsStopTypedDict, ChatGenerationParamsTypedDict, + Debug, + DebugTypedDict, Effort, Reasoning, ReasoningTypedDict, @@ -53,11 +56,15 @@ if TYPE_CHECKING: ) from .chatmessagecontentitemaudio import ( ChatMessageContentItemAudio, - ChatMessageContentItemAudioFormat, ChatMessageContentItemAudioInputAudio, ChatMessageContentItemAudioInputAudioTypedDict, ChatMessageContentItemAudioTypedDict, ) + from .chatmessagecontentitemcachecontrol import ( + ChatMessageContentItemCacheControl, + ChatMessageContentItemCacheControlTypedDict, + TTL, + ) from .chatmessagecontentitemimage import ( ChatMessageContentItemImage, ChatMessageContentItemImageDetail, @@ -98,13 +105,8 @@ if TYPE_CHECKING: ChatMessageToolCallTypedDict, ) from .chatresponse import ChatResponse, ChatResponseTypedDict - from .chatresponsechoice import ( - ChatCompletionFinishReason, - ChatResponseChoice, - ChatResponseChoiceTypedDict, - ChatStreamingChoice, - ChatStreamingChoiceTypedDict, - ) + from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict + from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from .chatstreamingmessagechunk import ( ChatStreamingMessageChunk, ChatStreamingMessageChunkRole, @@ -422,6 +424,7 @@ if TYPE_CHECKING: Engine, IDFileParser, IDModeration, + IDResponseHealing, IDWeb, Ignore, IgnoreTypedDict, @@ -446,6 +449,8 @@ if TYPE_CHECKING: PluginFileParserTypedDict, PluginModeration, PluginModerationTypedDict, + PluginResponseHealing, + PluginResponseHealingTypedDict, PluginTypedDict, PluginWeb, PluginWebTypedDict, @@ -820,10 +825,11 @@ __all__ = [ "ChatGenerationTokenUsageTypedDict", "ChatMessageContentItem", "ChatMessageContentItemAudio", - "ChatMessageContentItemAudioFormat", "ChatMessageContentItemAudioInputAudio", "ChatMessageContentItemAudioInputAudioTypedDict", "ChatMessageContentItemAudioTypedDict", + "ChatMessageContentItemCacheControl", + "ChatMessageContentItemCacheControlTypedDict", "ChatMessageContentItemImage", "ChatMessageContentItemImageDetail", "ChatMessageContentItemImageTypedDict", @@ -896,6 +902,8 @@ __all__ = [ "CreateChargeRequest", "CreateChargeRequestTypedDict", "DataCollection", + "Debug", + "DebugTypedDict", "DefaultParameters", "DefaultParametersTypedDict", "EdgeNetworkTimeoutResponseErrorData", @@ -913,6 +921,7 @@ __all__ = [ "ForbiddenResponseErrorDataTypedDict", "IDFileParser", "IDModeration", + "IDResponseHealing", "IDWeb", "Ignore", "IgnoreTypedDict", @@ -1206,6 +1215,8 @@ __all__ = [ "PluginFileParserTypedDict", "PluginModeration", "PluginModerationTypedDict", + "PluginResponseHealing", + "PluginResponseHealingTypedDict", "PluginTypedDict", "PluginWeb", "PluginWebTypedDict", @@ -1331,6 +1342,7 @@ __all__ = [ "SystemMessageContent", "SystemMessageContentTypedDict", "SystemMessageTypedDict", + "TTL", "Tokenizer", "TooManyRequestsResponseErrorData", "TooManyRequestsResponseErrorDataTypedDict", @@ -1401,6 +1413,7 @@ _dynamic_imports: dict[str, str] = { "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata", "BadRequestResponseErrorData": ".badrequestresponseerrordata", "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata", + "ChatCompletionFinishReason": ".chatcompletionfinishreason", "ChatErrorError": ".chaterror", "ChatErrorErrorTypedDict": ".chaterror", "Code": ".chaterror", @@ -1417,6 +1430,8 @@ _dynamic_imports: dict[str, str] = { "ChatGenerationParamsStop": ".chatgenerationparams", "ChatGenerationParamsStopTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams", + "Debug": ".chatgenerationparams", + "DebugTypedDict": ".chatgenerationparams", "Effort": ".chatgenerationparams", "Reasoning": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams", @@ -1429,10 +1444,12 @@ _dynamic_imports: dict[str, str] = { "ChatMessageContentItem": ".chatmessagecontentitem", "ChatMessageContentItemTypedDict": ".chatmessagecontentitem", "ChatMessageContentItemAudio": ".chatmessagecontentitemaudio", - "ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio", + "ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol", + "ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol", + "TTL": ".chatmessagecontentitemcachecontrol", "ChatMessageContentItemImage": ".chatmessagecontentitemimage", "ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage", "ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage", @@ -1462,11 +1479,10 @@ _dynamic_imports: dict[str, str] = { "ChatMessageToolCallTypedDict": ".chatmessagetoolcall", "ChatResponse": ".chatresponse", "ChatResponseTypedDict": ".chatresponse", - "ChatCompletionFinishReason": ".chatresponsechoice", "ChatResponseChoice": ".chatresponsechoice", "ChatResponseChoiceTypedDict": ".chatresponsechoice", - "ChatStreamingChoice": ".chatresponsechoice", - "ChatStreamingChoiceTypedDict": ".chatresponsechoice", + "ChatStreamingChoice": ".chatstreamingchoice", + "ChatStreamingChoiceTypedDict": ".chatstreamingchoice", "ChatStreamingMessageChunk": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk", @@ -1713,6 +1729,7 @@ _dynamic_imports: dict[str, str] = { "Engine": ".openresponsesrequest", "IDFileParser": ".openresponsesrequest", "IDModeration": ".openresponsesrequest", + "IDResponseHealing": ".openresponsesrequest", "IDWeb": ".openresponsesrequest", "Ignore": ".openresponsesrequest", "IgnoreTypedDict": ".openresponsesrequest", @@ -1737,6 +1754,8 @@ _dynamic_imports: dict[str, str] = { "PluginFileParserTypedDict": ".openresponsesrequest", "PluginModeration": ".openresponsesrequest", "PluginModerationTypedDict": ".openresponsesrequest", + "PluginResponseHealing": ".openresponsesrequest", + "PluginResponseHealingTypedDict": ".openresponsesrequest", "PluginTypedDict": ".openresponsesrequest", "PluginWeb": ".openresponsesrequest", "PluginWebTypedDict": ".openresponsesrequest", diff --git a/src/openrouter/components/chatcompletionfinishreason.py b/src/openrouter/components/chatcompletionfinishreason.py new file mode 100644 index 0000000..686462c --- /dev/null +++ b/src/openrouter/components/chatcompletionfinishreason.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +ChatCompletionFinishReason = Union[ + Literal[ + "tool_calls", + "stop", + "length", + "content_filter", + "error", + ], + UnrecognizedStr, +] diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 32fd9ca..07b4c33 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -21,9 +21,9 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_const, validate_open_enum +from openrouter.utils import get_discriminator, validate_const, validate_open_enum import pydantic -from pydantic import model_serializer +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import AfterValidator, PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -134,16 +134,16 @@ ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType( ) -ChatGenerationParamsResponseFormatUnion = TypeAliasType( - "ChatGenerationParamsResponseFormatUnion", +ChatGenerationParamsResponseFormatUnion = Annotated[ Union[ - ChatGenerationParamsResponseFormatText, - ChatGenerationParamsResponseFormatJSONObject, - ChatGenerationParamsResponseFormatPython, - ResponseFormatJSONSchema, - ResponseFormatTextGrammar, + Annotated[ChatGenerationParamsResponseFormatText, Tag("text")], + Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")], + Annotated[ResponseFormatJSONSchema, Tag("json_schema")], + Annotated[ResponseFormatTextGrammar, Tag("grammar")], + Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] ChatGenerationParamsStopTypedDict = TypeAliasType( @@ -156,6 +156,14 @@ ChatGenerationParamsStop = TypeAliasType( ) +class DebugTypedDict(TypedDict): + echo_upstream_body: NotRequired[bool] + + +class Debug(BaseModel): + echo_upstream_body: Optional[bool] = None + + class ChatGenerationParamsTypedDict(TypedDict): messages: List[MessageTypedDict] model: NotRequired[str] @@ -179,6 +187,7 @@ class ChatGenerationParamsTypedDict(TypedDict): tools: NotRequired[List[ToolDefinitionJSONTypedDict]] top_p: NotRequired[Nullable[float]] user: NotRequired[str] + debug: NotRequired[DebugTypedDict] class ChatGenerationParams(BaseModel): @@ -226,6 +235,8 @@ class ChatGenerationParams(BaseModel): user: Optional[str] = None + debug: Optional[Debug] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -250,6 +261,7 @@ class ChatGenerationParams(BaseModel): "tools", "top_p", "user", + "debug", ] nullable_fields = [ "frequency_penalty", diff --git a/src/openrouter/components/chatmessagecontentitem.py b/src/openrouter/components/chatmessagecontentitem.py index 87547ca..eba0a3b 100644 --- a/src/openrouter/components/chatmessagecontentitem.py +++ b/src/openrouter/components/chatmessagecontentitem.py @@ -26,9 +26,9 @@ from typing_extensions import Annotated, TypeAliasType ChatMessageContentItemTypedDict = TypeAliasType( "ChatMessageContentItemTypedDict", Union[ - ChatMessageContentItemTextTypedDict, ChatMessageContentItemImageTypedDict, ChatMessageContentItemAudioTypedDict, + ChatMessageContentItemTextTypedDict, ChatMessageContentItemVideoTypedDict, ], ) diff --git a/src/openrouter/components/chatmessagecontentitemaudio.py b/src/openrouter/components/chatmessagecontentitemaudio.py index 21a8803..b251803 100644 --- a/src/openrouter/components/chatmessagecontentitemaudio.py +++ b/src/openrouter/components/chatmessagecontentitemaudio.py @@ -1,42 +1,23 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import validate_const, validate_open_enum +from openrouter.types import BaseModel +from openrouter.utils import validate_const import pydantic -from pydantic.functional_validators import AfterValidator, PlainValidator -from typing import Literal, Union +from pydantic.functional_validators import AfterValidator +from typing import Literal from typing_extensions import Annotated, TypedDict -ChatMessageContentItemAudioFormat = Union[ - Literal[ - "wav", - "mp3", - "flac", - "m4a", - "ogg", - "pcm16", - "pcm24", - ], - UnrecognizedStr, -] - - class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict): data: str - format_: ChatMessageContentItemAudioFormat + format_: str class ChatMessageContentItemAudioInputAudio(BaseModel): data: str - format_: Annotated[ - Annotated[ - ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False)) - ], - pydantic.Field(alias="format"), - ] + format_: Annotated[str, pydantic.Field(alias="format")] class ChatMessageContentItemAudioTypedDict(TypedDict): diff --git a/src/openrouter/components/chatmessagecontentitemcachecontrol.py b/src/openrouter/components/chatmessagecontentitemcachecontrol.py new file mode 100644 index 0000000..b96625f --- /dev/null +++ b/src/openrouter/components/chatmessagecontentitemcachecontrol.py @@ -0,0 +1,32 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import validate_const, validate_open_enum +import pydantic +from pydantic.functional_validators import AfterValidator, PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +TTL = Union[ + Literal[ + "5m", + "1h", + ], + UnrecognizedStr, +] + + +class ChatMessageContentItemCacheControlTypedDict(TypedDict): + type: Literal["ephemeral"] + ttl: NotRequired[TTL] + + +class ChatMessageContentItemCacheControl(BaseModel): + TYPE: Annotated[ + Annotated[Literal["ephemeral"], AfterValidator(validate_const("ephemeral"))], + pydantic.Field(alias="type"), + ] = "ephemeral" + + ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None diff --git a/src/openrouter/components/chatmessagecontentitemtext.py b/src/openrouter/components/chatmessagecontentitemtext.py index c791fa9..4dc1662 100644 --- a/src/openrouter/components/chatmessagecontentitemtext.py +++ b/src/openrouter/components/chatmessagecontentitemtext.py @@ -1,17 +1,22 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .chatmessagecontentitemcachecontrol import ( + ChatMessageContentItemCacheControl, + ChatMessageContentItemCacheControlTypedDict, +) from openrouter.types import BaseModel 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, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ChatMessageContentItemTextTypedDict(TypedDict): text: str type: Literal["text"] + cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict] class ChatMessageContentItemText(BaseModel): @@ -21,3 +26,5 @@ class ChatMessageContentItemText(BaseModel): Annotated[Literal["text"], AfterValidator(validate_const("text"))], pydantic.Field(alias="type"), ] = "text" + + cache_control: Optional[ChatMessageContentItemCacheControl] = None diff --git a/src/openrouter/components/chatmessagecontentitemvideo.py b/src/openrouter/components/chatmessagecontentitemvideo.py index fccda91..06be297 100644 --- a/src/openrouter/components/chatmessagecontentitemvideo.py +++ b/src/openrouter/components/chatmessagecontentitemvideo.py @@ -2,8 +2,9 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const +from openrouter.utils import get_discriminator, validate_const import pydantic +from pydantic import Discriminator, Tag from pydantic.functional_validators import AfterValidator from typing import Literal, Union from typing_extensions import Annotated, TypeAliasType, TypedDict @@ -64,7 +65,10 @@ ChatMessageContentItemVideoTypedDict = TypeAliasType( ) -ChatMessageContentItemVideo = TypeAliasType( - "ChatMessageContentItemVideo", - Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL], -) +ChatMessageContentItemVideo = Annotated[ + Union[ + Annotated[ChatMessageContentItemVideoInputVideo, Tag("input_video")], + Annotated[ChatMessageContentItemVideoVideoURL, Tag("video_url")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] diff --git a/src/openrouter/components/chatresponsechoice.py b/src/openrouter/components/chatresponsechoice.py index e59f847..9592bf1 100644 --- a/src/openrouter/components/chatresponsechoice.py +++ b/src/openrouter/components/chatresponsechoice.py @@ -2,41 +2,24 @@ 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 @@ -84,52 +67,3 @@ class ChatResponseChoice(BaseModel): 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 new file mode 100644 index 0000000..b64b8ff --- /dev/null +++ b/src/openrouter/components/chatstreamingchoice.py @@ -0,0 +1,72 @@ +"""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 0ec76bc..7c32481 100644 --- a/src/openrouter/components/chatstreamingresponsechunk.py +++ b/src/openrouter/components/chatstreamingresponsechunk.py @@ -5,7 +5,7 @@ from .chatgenerationtokenusage import ( ChatGenerationTokenUsage, ChatGenerationTokenUsageTypedDict, ) -from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict +from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from openrouter.types import ( BaseModel, Nullable, diff --git a/src/openrouter/components/completionchoice.py b/src/openrouter/components/completionchoice.py index 3e68a00..21ce2b9 100644 --- a/src/openrouter/components/completionchoice.py +++ b/src/openrouter/components/completionchoice.py @@ -2,12 +2,19 @@ from __future__ import annotations from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +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, TypedDict +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict CompletionFinishReason = Union[ @@ -25,6 +32,8 @@ class CompletionChoiceTypedDict(TypedDict): index: float logprobs: Nullable[CompletionLogprobsTypedDict] finish_reason: Nullable[CompletionFinishReason] + native_finish_reason: NotRequired[str] + reasoning: NotRequired[Nullable[str]] class CompletionChoice(BaseModel): @@ -38,10 +47,14 @@ class CompletionChoice(BaseModel): Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False)) ] + native_finish_reason: Optional[str] = None + + reasoning: OptionalNullable[str] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = [] - nullable_fields = ["logprobs", "finish_reason"] + optional_fields = ["native_finish_reason", "reasoning"] + nullable_fields = ["logprobs", "finish_reason", "reasoning"] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/completioncreateparams.py b/src/openrouter/components/completioncreateparams.py index 3a81d2e..712feaa 100644 --- a/src/openrouter/components/completioncreateparams.py +++ b/src/openrouter/components/completioncreateparams.py @@ -16,9 +16,9 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_const +from openrouter.utils import get_discriminator, validate_const import pydantic -from pydantic import model_serializer +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import AfterValidator from typing import Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -127,16 +127,16 @@ CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType( ) -CompletionCreateParamsResponseFormatUnion = TypeAliasType( - "CompletionCreateParamsResponseFormatUnion", +CompletionCreateParamsResponseFormatUnion = Annotated[ Union[ - CompletionCreateParamsResponseFormatText, - CompletionCreateParamsResponseFormatJSONObject, - CompletionCreateParamsResponseFormatPython, - ResponseFormatJSONSchema, - ResponseFormatTextGrammar, + Annotated[CompletionCreateParamsResponseFormatText, Tag("text")], + Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")], + Annotated[ResponseFormatJSONSchema, Tag("json_schema")], + Annotated[ResponseFormatTextGrammar, Tag("grammar")], + Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class CompletionCreateParamsTypedDict(TypedDict): diff --git a/src/openrouter/components/completionresponse.py b/src/openrouter/components/completionresponse.py index 12bde5f..dcdd529 100644 --- a/src/openrouter/components/completionresponse.py +++ b/src/openrouter/components/completionresponse.py @@ -17,6 +17,7 @@ class CompletionResponseTypedDict(TypedDict): model: str choices: List[CompletionChoiceTypedDict] object: Literal["text_completion"] + provider: NotRequired[str] system_fingerprint: NotRequired[str] usage: NotRequired[CompletionUsageTypedDict] @@ -38,6 +39,8 @@ class CompletionResponse(BaseModel): pydantic.Field(alias="object"), ] = "text_completion" + provider: Optional[str] = None + system_fingerprint: Optional[str] = None usage: Optional[CompletionUsage] = None diff --git a/src/openrouter/components/message.py b/src/openrouter/components/message.py index 676b497..8d92cba 100644 --- a/src/openrouter/components/message.py +++ b/src/openrouter/components/message.py @@ -10,8 +10,9 @@ from .systemmessage import SystemMessage, SystemMessageTypedDict from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict from openrouter.types import BaseModel -from openrouter.utils import validate_const +from openrouter.utils import get_discriminator, validate_const import pydantic +from pydantic import Discriminator, Tag from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -56,13 +57,13 @@ MessageTypedDict = TypeAliasType( ) -Message = TypeAliasType( - "Message", +Message = Annotated[ Union[ - SystemMessage, - UserMessage, - MessageDeveloper, - ToolResponseMessage, - AssistantMessage, + Annotated[SystemMessage, Tag("system")], + Annotated[UserMessage, Tag("user")], + Annotated[MessageDeveloper, Tag("developer")], + Annotated[AssistantMessage, Tag("assistant")], + Annotated[ToolResponseMessage, Tag("tool")], ], -) + Discriminator(lambda m: get_discriminator(m, "role", "role")), +] diff --git a/src/openrouter/components/openairesponsesannotation.py b/src/openrouter/components/openairesponsesannotation.py index 315df01..1303f98 100644 --- a/src/openrouter/components/openairesponsesannotation.py +++ b/src/openrouter/components/openairesponsesannotation.py @@ -4,8 +4,10 @@ from __future__ import annotations from .filecitation import FileCitation, FileCitationTypedDict from .filepath import FilePath, FilePathTypedDict from .urlcitation import URLCitation, URLCitationTypedDict +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import Union -from typing_extensions import TypeAliasType +from typing_extensions import Annotated, TypeAliasType OpenAIResponsesAnnotationTypedDict = TypeAliasType( @@ -14,6 +16,11 @@ OpenAIResponsesAnnotationTypedDict = TypeAliasType( ) -OpenAIResponsesAnnotation = TypeAliasType( - "OpenAIResponsesAnnotation", Union[FilePath, FileCitation, URLCitation] -) +OpenAIResponsesAnnotation = Annotated[ + Union[ + Annotated[FileCitation, Tag("file_citation")], + Annotated[URLCitation, Tag("url_citation")], + Annotated[FilePath, Tag("file_path")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] diff --git a/src/openrouter/components/openresponsesnonstreamingresponse.py b/src/openrouter/components/openresponsesnonstreamingresponse.py index 6051f4e..4836d91 100644 --- a/src/openrouter/components/openresponsesnonstreamingresponse.py +++ b/src/openrouter/components/openresponsesnonstreamingresponse.py @@ -48,8 +48,8 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer +from openrouter.utils import get_discriminator, validate_open_enum +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -127,16 +127,19 @@ OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType( ) -OpenResponsesNonStreamingResponseToolUnion = TypeAliasType( - "OpenResponsesNonStreamingResponseToolUnion", +OpenResponsesNonStreamingResponseToolUnion = Annotated[ Union[ - OpenResponsesWebSearchPreviewTool, - OpenResponsesWebSearchPreview20250311Tool, - OpenResponsesWebSearchTool, - OpenResponsesWebSearch20250826Tool, - OpenResponsesNonStreamingResponseToolFunction, + Annotated[OpenResponsesNonStreamingResponseToolFunction, Tag("function")], + Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")], + Annotated[ + OpenResponsesWebSearchPreview20250311Tool, + Tag("web_search_preview_2025_03_11"), + ], + Annotated[OpenResponsesWebSearchTool, Tag("web_search")], + Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class OpenResponsesNonStreamingResponseTypedDict(TypedDict): diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 265f2d5..78f00d3 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -44,9 +44,10 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator +from openrouter.utils import get_discriminator, validate_const, validate_open_enum +import pydantic +from pydantic import Discriminator, Tag, model_serializer +from pydantic.functional_validators import AfterValidator, PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -120,30 +121,24 @@ OpenResponsesRequestToolUnionTypedDict = TypeAliasType( ) -OpenResponsesRequestToolUnion = TypeAliasType( - "OpenResponsesRequestToolUnion", +OpenResponsesRequestToolUnion = Annotated[ Union[ - OpenResponsesWebSearchPreviewTool, - OpenResponsesWebSearchPreview20250311Tool, - OpenResponsesWebSearchTool, - OpenResponsesWebSearch20250826Tool, - OpenResponsesRequestToolFunction, + Annotated[OpenResponsesRequestToolFunction, Tag("function")], + Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")], + Annotated[ + OpenResponsesWebSearchPreview20250311Tool, + Tag("web_search_preview_2025_03_11"), + ], + Annotated[OpenResponsesWebSearchTool, Tag("web_search")], + Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")], ], -) - - -ServiceTier = Union[ - Literal[ - "auto", - "default", - "flex", - "priority", - "scale", - ], - UnrecognizedStr, + Discriminator(lambda m: get_discriminator(m, "type", "type")), ] +ServiceTier = Literal["auto",] + + Truncation = Union[ Literal[ "auto", @@ -353,6 +348,17 @@ class Provider(BaseModel): return m +IDResponseHealing = Literal["response-healing",] + + +class PluginResponseHealingTypedDict(TypedDict): + id: IDResponseHealing + + +class PluginResponseHealing(BaseModel): + id: IDResponseHealing + + IDFileParser = Literal["file-parser",] @@ -434,11 +440,24 @@ class PluginModeration(BaseModel): PluginTypedDict = TypeAliasType( "PluginTypedDict", - Union[PluginModerationTypedDict, PluginFileParserTypedDict, PluginWebTypedDict], + Union[ + PluginModerationTypedDict, + PluginResponseHealingTypedDict, + PluginFileParserTypedDict, + PluginWebTypedDict, + ], ) -Plugin = TypeAliasType("Plugin", Union[PluginModeration, PluginFileParser, PluginWeb]) +Plugin = Annotated[ + Union[ + Annotated[PluginModeration, Tag("moderation")], + Annotated[PluginWeb, Tag("web")], + Annotated[PluginFileParser, Tag("file-parser")], + Annotated[PluginResponseHealing, Tag("response-healing")], + ], + Discriminator(lambda m: get_discriminator(m, "id", "id")), +] class OpenResponsesRequestTypedDict(TypedDict): @@ -468,8 +487,8 @@ class OpenResponsesRequestTypedDict(TypedDict): include: NotRequired[Nullable[List[OpenAIResponsesIncludable]]] background: NotRequired[Nullable[bool]] safety_identifier: NotRequired[Nullable[str]] - store: NotRequired[Nullable[bool]] - service_tier: NotRequired[Nullable[ServiceTier]] + store: Literal[False] + service_tier: NotRequired[ServiceTier] truncation: NotRequired[Nullable[Truncation]] stream: NotRequired[bool] provider: NotRequired[Nullable[ProviderTypedDict]] @@ -533,11 +552,12 @@ class OpenResponsesRequest(BaseModel): safety_identifier: OptionalNullable[str] = UNSET - store: OptionalNullable[bool] = UNSET + STORE: Annotated[ + Annotated[Optional[Literal[False]], AfterValidator(validate_const(False))], + pydantic.Field(alias="store"), + ] = False - service_tier: Annotated[ - OptionalNullable[ServiceTier], PlainValidator(validate_open_enum(False)) - ] = UNSET + service_tier: Optional[ServiceTier] = "auto" truncation: Annotated[ OptionalNullable[Truncation], PlainValidator(validate_open_enum(False)) @@ -599,8 +619,6 @@ class OpenResponsesRequest(BaseModel): "include", "background", "safety_identifier", - "store", - "service_tier", "truncation", "provider", ] diff --git a/src/openrouter/components/openresponsesstreamevent.py b/src/openrouter/components/openresponsesstreamevent.py index 6e423d8..8b21548 100644 --- a/src/openrouter/components/openresponsesstreamevent.py +++ b/src/openrouter/components/openresponsesstreamevent.py @@ -59,8 +59,10 @@ from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentType from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict from openrouter.types import BaseModel +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import List, Literal, Union -from typing_extensions import TypeAliasType, TypedDict +from typing_extensions import Annotated, TypeAliasType, TypedDict TypeResponseReasoningSummaryPartDone = Literal["response.reasoning_summary_part.done",] @@ -328,10 +330,14 @@ Part2TypedDict = TypeAliasType( ) -Part2 = TypeAliasType( - "Part2", - Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText], -) +Part2 = Annotated[ + Union[ + Annotated[ResponseOutputText, Tag("output_text")], + Annotated[ReasoningTextContent, Tag("reasoning_text")], + Annotated[OpenAIResponsesRefusalContent, Tag("refusal")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class OpenResponsesStreamEventResponseContentPartDoneTypedDict(TypedDict): @@ -374,10 +380,14 @@ Part1TypedDict = TypeAliasType( ) -Part1 = TypeAliasType( - "Part1", - Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText], -) +Part1 = Annotated[ + Union[ + Annotated[ResponseOutputText, Tag("output_text")], + Annotated[ReasoningTextContent, Tag("reasoning_text")], + Annotated[OpenAIResponsesRefusalContent, Tag("refusal")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class OpenResponsesStreamEventResponseContentPartAddedTypedDict(TypedDict): @@ -609,36 +619,97 @@ OpenResponsesStreamEventTypedDict = TypeAliasType( r"""Union of all possible event types emitted during response streaming""" -OpenResponsesStreamEvent = TypeAliasType( - "OpenResponsesStreamEvent", +OpenResponsesStreamEvent = Annotated[ Union[ - OpenResponsesStreamEventResponseCreated, - OpenResponsesStreamEventResponseInProgress, - OpenResponsesStreamEventResponseCompleted, - OpenResponsesStreamEventResponseIncomplete, - OpenResponsesStreamEventResponseFailed, - OpenResponsesStreamEventResponseOutputItemAdded, - OpenResponsesStreamEventResponseOutputItemDone, - OpenResponsesImageGenCallCompleted, - OpenResponsesImageGenCallGenerating, - OpenResponsesImageGenCallInProgress, - OpenResponsesErrorEvent, - OpenResponsesStreamEventResponseFunctionCallArgumentsDelta, - OpenResponsesStreamEventResponseRefusalDelta, - OpenResponsesReasoningSummaryPartAddedEvent, - OpenResponsesStreamEventResponseContentPartAdded, - OpenResponsesImageGenCallPartialImage, - OpenResponsesStreamEventResponseFunctionCallArgumentsDone, - OpenResponsesReasoningDeltaEvent, - OpenResponsesReasoningDoneEvent, - OpenResponsesStreamEventResponseRefusalDone, - OpenResponsesStreamEventResponseReasoningSummaryPartDone, - OpenResponsesReasoningSummaryTextDeltaEvent, - OpenResponsesReasoningSummaryTextDoneEvent, - OpenResponsesStreamEventResponseContentPartDone, - OpenResponsesStreamEventResponseOutputTextDelta, - OpenResponsesStreamEventResponseOutputTextDone, - OpenResponsesStreamEventResponseOutputTextAnnotationAdded, + Annotated[OpenResponsesStreamEventResponseCreated, Tag("response.created")], + Annotated[ + OpenResponsesStreamEventResponseInProgress, Tag("response.in_progress") + ], + Annotated[OpenResponsesStreamEventResponseCompleted, Tag("response.completed")], + Annotated[ + OpenResponsesStreamEventResponseIncomplete, Tag("response.incomplete") + ], + Annotated[OpenResponsesStreamEventResponseFailed, Tag("response.failed")], + Annotated[OpenResponsesErrorEvent, Tag("error")], + Annotated[ + OpenResponsesStreamEventResponseOutputItemAdded, + Tag("response.output_item.added"), + ], + Annotated[ + OpenResponsesStreamEventResponseOutputItemDone, + Tag("response.output_item.done"), + ], + Annotated[ + OpenResponsesStreamEventResponseContentPartAdded, + Tag("response.content_part.added"), + ], + Annotated[ + OpenResponsesStreamEventResponseContentPartDone, + Tag("response.content_part.done"), + ], + Annotated[ + OpenResponsesStreamEventResponseOutputTextDelta, + Tag("response.output_text.delta"), + ], + Annotated[ + OpenResponsesStreamEventResponseOutputTextDone, + Tag("response.output_text.done"), + ], + Annotated[ + OpenResponsesStreamEventResponseRefusalDelta, Tag("response.refusal.delta") + ], + Annotated[ + OpenResponsesStreamEventResponseRefusalDone, Tag("response.refusal.done") + ], + Annotated[ + OpenResponsesStreamEventResponseOutputTextAnnotationAdded, + Tag("response.output_text.annotation.added"), + ], + Annotated[ + OpenResponsesStreamEventResponseFunctionCallArgumentsDelta, + Tag("response.function_call_arguments.delta"), + ], + Annotated[ + OpenResponsesStreamEventResponseFunctionCallArgumentsDone, + Tag("response.function_call_arguments.done"), + ], + Annotated[ + OpenResponsesReasoningDeltaEvent, Tag("response.reasoning_text.delta") + ], + Annotated[OpenResponsesReasoningDoneEvent, Tag("response.reasoning_text.done")], + Annotated[ + OpenResponsesReasoningSummaryPartAddedEvent, + Tag("response.reasoning_summary_part.added"), + ], + Annotated[ + OpenResponsesStreamEventResponseReasoningSummaryPartDone, + Tag("response.reasoning_summary_part.done"), + ], + Annotated[ + OpenResponsesReasoningSummaryTextDeltaEvent, + Tag("response.reasoning_summary_text.delta"), + ], + Annotated[ + OpenResponsesReasoningSummaryTextDoneEvent, + Tag("response.reasoning_summary_text.done"), + ], + Annotated[ + OpenResponsesImageGenCallInProgress, + Tag("response.image_generation_call.in_progress"), + ], + Annotated[ + OpenResponsesImageGenCallGenerating, + Tag("response.image_generation_call.generating"), + ], + Annotated[ + OpenResponsesImageGenCallPartialImage, + Tag("response.image_generation_call.partial_image"), + ], + Annotated[ + OpenResponsesImageGenCallCompleted, + Tag("response.image_generation_call.completed"), + ], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] r"""Union of all possible event types emitted during response streaming""" diff --git a/src/openrouter/components/outputmessage.py b/src/openrouter/components/outputmessage.py index a956778..1304077 100644 --- a/src/openrouter/components/outputmessage.py +++ b/src/openrouter/components/outputmessage.py @@ -7,8 +7,10 @@ from .openairesponsesrefusalcontent import ( ) from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict from openrouter.types import BaseModel +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import List, Literal, Optional, Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict OutputMessageRole = Literal["assistant",] @@ -52,9 +54,13 @@ OutputMessageContentTypedDict = TypeAliasType( ) -OutputMessageContent = TypeAliasType( - "OutputMessageContent", Union[OpenAIResponsesRefusalContent, ResponseOutputText] -) +OutputMessageContent = Annotated[ + Union[ + Annotated[ResponseOutputText, Tag("output_text")], + Annotated[OpenAIResponsesRefusalContent, Tag("refusal")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class OutputMessageTypedDict(TypedDict): diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 21f6345..62e892c 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -11,12 +11,14 @@ ProviderName = Union[ "AionLabs", "Alibaba", "Amazon Bedrock", + "Amazon Nova", "Anthropic", - "Arcee", + "Arcee AI", "AtlasCloud", "Avian", "Azure", "BaseTen", + "BytePlus", "Black Forest Labs", "Cerebras", "Chutes", @@ -31,6 +33,7 @@ ProviderName = Union[ "Fireworks", "Friendli", "GMICloud", + "GoPomelo", "Google", "Google AI Studio", "Groq", @@ -61,6 +64,7 @@ ProviderName = Union[ "SambaNova", "SiliconFlow", "Stealth", + "StreamLake", "Switchpoint", "Targon", "Together", diff --git a/src/openrouter/components/responseformattextconfig.py b/src/openrouter/components/responseformattextconfig.py index 7478c80..a82e125 100644 --- a/src/openrouter/components/responseformattextconfig.py +++ b/src/openrouter/components/responseformattextconfig.py @@ -10,8 +10,10 @@ from .responsesformattextjsonschemaconfig import ( ResponsesFormatTextJSONSchemaConfig, ResponsesFormatTextJSONSchemaConfigTypedDict, ) +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import Union -from typing_extensions import TypeAliasType +from typing_extensions import Annotated, TypeAliasType ResponseFormatTextConfigTypedDict = TypeAliasType( @@ -25,12 +27,12 @@ ResponseFormatTextConfigTypedDict = TypeAliasType( r"""Text response format configuration""" -ResponseFormatTextConfig = TypeAliasType( - "ResponseFormatTextConfig", +ResponseFormatTextConfig = Annotated[ Union[ - ResponsesFormatText, - ResponsesFormatJSONObject, - ResponsesFormatTextJSONSchemaConfig, + Annotated[ResponsesFormatText, Tag("text")], + Annotated[ResponsesFormatJSONObject, Tag("json_object")], + Annotated[ResponsesFormatTextJSONSchemaConfig, Tag("json_schema")], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] r"""Text response format configuration""" diff --git a/src/openrouter/components/responsesoutputitem.py b/src/openrouter/components/responsesoutputitem.py index 63c4023..28966bd 100644 --- a/src/openrouter/components/responsesoutputitem.py +++ b/src/openrouter/components/responsesoutputitem.py @@ -25,8 +25,10 @@ from .responseswebsearchcalloutput import ( ResponsesWebSearchCallOutput, ResponsesWebSearchCallOutputTypedDict, ) +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import Union -from typing_extensions import TypeAliasType +from typing_extensions import Annotated, TypeAliasType ResponsesOutputItemTypedDict = TypeAliasType( @@ -43,15 +45,15 @@ ResponsesOutputItemTypedDict = TypeAliasType( r"""An output item from the response""" -ResponsesOutputItem = TypeAliasType( - "ResponsesOutputItem", +ResponsesOutputItem = Annotated[ Union[ - ResponsesWebSearchCallOutput, - ResponsesOutputItemFileSearchCall, - ResponsesImageGenerationCall, - ResponsesOutputMessage, - ResponsesOutputItemReasoning, - ResponsesOutputItemFunctionCall, + Annotated[ResponsesOutputMessage, Tag("message")], + Annotated[ResponsesOutputItemReasoning, Tag("reasoning")], + Annotated[ResponsesOutputItemFunctionCall, Tag("function_call")], + Annotated[ResponsesWebSearchCallOutput, Tag("web_search_call")], + Annotated[ResponsesOutputItemFileSearchCall, Tag("file_search_call")], + Annotated[ResponsesImageGenerationCall, Tag("image_generation_call")], ], -) + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] r"""An output item from the response""" diff --git a/src/openrouter/components/responsesoutputmessage.py b/src/openrouter/components/responsesoutputmessage.py index 74126d4..6717a26 100644 --- a/src/openrouter/components/responsesoutputmessage.py +++ b/src/openrouter/components/responsesoutputmessage.py @@ -7,8 +7,10 @@ from .openairesponsesrefusalcontent import ( ) from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict from openrouter.types import BaseModel +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag from typing import List, Literal, Optional, Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict ResponsesOutputMessageRole = Literal["assistant",] @@ -52,10 +54,13 @@ ResponsesOutputMessageContentTypedDict = TypeAliasType( ) -ResponsesOutputMessageContent = TypeAliasType( - "ResponsesOutputMessageContent", - Union[OpenAIResponsesRefusalContent, ResponseOutputText], -) +ResponsesOutputMessageContent = Annotated[ + Union[ + Annotated[ResponseOutputText, Tag("output_text")], + Annotated[OpenAIResponsesRefusalContent, Tag("refusal")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class ResponsesOutputMessageTypedDict(TypedDict): diff --git a/src/openrouter/credits.py b/src/openrouter/credits.py index ee3cb92..241f22f 100644 --- a/src/openrouter/credits.py +++ b/src/openrouter/credits.py @@ -51,6 +51,7 @@ class Credits(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -147,6 +148,7 @@ class Credits(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -266,6 +268,7 @@ class Credits(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.CreateChargeRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -390,6 +393,7 @@ class Credits(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.CreateChargeRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 0dec307..eaa52b0 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -1,7 +1,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from enum import Enum from openrouter import components, errors, operations, utils from openrouter._hooks import HookContext from openrouter.types import OptionalNullable, UNSET @@ -10,11 +9,6 @@ from openrouter.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Mapping, Optional, Union -class GenerateAcceptEnum(str, Enum): - APPLICATION_JSON = "application/json" - TEXT_EVENT_STREAM = "text/event-stream" - - class Embeddings(BaseSDK): r"""Text embedding endpoints""" @@ -36,7 +30,6 @@ class Embeddings(BaseSDK): retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - accept_header_override: Optional[GenerateAcceptEnum] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> operations.CreateEmbeddingsResponse: r"""Submit an embedding request @@ -53,7 +46,6 @@ class Embeddings(BaseSDK): :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 - :param accept_header_override: Override the default accept header for this method :param http_headers: Additional headers to set or replace on requests. """ base_url = None @@ -88,14 +80,13 @@ class Embeddings(BaseSDK): request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value=accept_header_override.value - if accept_header_override is not None - else "application/json;q=1, text/event-stream;q=0", + accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateEmbeddingsRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -138,10 +129,8 @@ class Embeddings(BaseSDK): response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - operations.CreateEmbeddingsResponseBody, http_res + operations.CreateEmbeddingsResponse, http_res ) - if utils.match_response(http_res, "200", "text/event-stream"): - return http_res.text if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res @@ -223,7 +212,6 @@ class Embeddings(BaseSDK): retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - accept_header_override: Optional[GenerateAcceptEnum] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> operations.CreateEmbeddingsResponse: r"""Submit an embedding request @@ -240,7 +228,6 @@ class Embeddings(BaseSDK): :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 - :param accept_header_override: Override the default accept header for this method :param http_headers: Additional headers to set or replace on requests. """ base_url = None @@ -275,14 +262,13 @@ class Embeddings(BaseSDK): request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value=accept_header_override.value - if accept_header_override is not None - else "application/json;q=1, text/event-stream;q=0", + accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateEmbeddingsRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -325,10 +311,8 @@ class Embeddings(BaseSDK): response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - operations.CreateEmbeddingsResponseBody, http_res + operations.CreateEmbeddingsResponse, http_res ) - if utils.match_response(http_res, "200", "text/event-stream"): - return http_res.text if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res @@ -431,6 +415,7 @@ class Embeddings(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -522,6 +507,7 @@ class Embeddings(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/endpoints.py b/src/openrouter/endpoints.py index c6d8824..23f6842 100644 --- a/src/openrouter/endpoints.py +++ b/src/openrouter/endpoints.py @@ -59,6 +59,7 @@ class Endpoints(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -158,6 +159,7 @@ class Endpoints(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -247,6 +249,7 @@ class Endpoints(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -333,6 +336,7 @@ class Endpoints(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index 2f75494..fd085ef 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -56,6 +56,7 @@ class Generations(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -193,6 +194,7 @@ class Generations(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/models/__init__.py b/src/openrouter/models/__init__.py new file mode 100644 index 0000000..726fc5e --- /dev/null +++ b/src/openrouter/models/__init__.py @@ -0,0 +1,3 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +# package diff --git a/src/openrouter/models/internal/__init__.py b/src/openrouter/models/internal/__init__.py new file mode 100644 index 0000000..e7070a1 --- /dev/null +++ b/src/openrouter/models/internal/__init__.py @@ -0,0 +1,54 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import TYPE_CHECKING +from importlib import import_module +import builtins +import sys + +if TYPE_CHECKING: + from .globals import Globals, GlobalsTypedDict + +__all__ = ["Globals", "GlobalsTypedDict"] + +_dynamic_imports: dict[str, str] = { + "Globals": ".globals", + "GlobalsTypedDict": ".globals", +} + + +def dynamic_import(modname, retries=3): + for attempt in range(retries): + try: + return import_module(modname, __package__) + except KeyError: + # Clear any half-initialized module and retry + sys.modules.pop(modname, None) + if attempt == retries - 1: + break + raise KeyError(f"Failed to import module '{modname}' after {retries} attempts") + + +def __getattr__(attr_name: str) -> object: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError( + f"No {attr_name} found in _dynamic_imports for module name -> {__name__} " + ) + + try: + module = dynamic_import(module_name) + result = getattr(module, attr_name) + return result + except ImportError as e: + raise ImportError( + f"Failed to import {attr_name} from {module_name}: {e}" + ) from e + except AttributeError as e: + raise AttributeError( + f"Failed to get {attr_name} from {module_name}: {e}" + ) from e + + +def __dir__(): + lazy_attrs = builtins.list(_dynamic_imports.keys()) + return builtins.sorted(lazy_attrs) diff --git a/src/openrouter/models/internal/globals.py b/src/openrouter/models/internal/globals.py new file mode 100644 index 0000000..248f13e --- /dev/null +++ b/src/openrouter/models/internal/globals.py @@ -0,0 +1,41 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class Globals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index 6ba885b..6b9e6e7 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -49,6 +49,7 @@ class Models(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -133,6 +134,7 @@ class Models(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -227,6 +229,7 @@ class Models(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -326,6 +329,7 @@ class Models(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -422,6 +426,7 @@ class Models(BaseSDK): security=utils.get_pydantic_model( security, operations.ListModelsUserSecurity ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -516,6 +521,7 @@ class Models(BaseSDK): security=utils.get_pydantic_model( security, operations.ListModelsUserSecurity ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index 50d2395..3fc3316 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -74,6 +74,7 @@ class OAuth(BaseSDK): "json", operations.ExchangeAuthCodeForAPIKeyRequest, ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -194,6 +195,7 @@ class OAuth(BaseSDK): "json", operations.ExchangeAuthCodeForAPIKeyRequest, ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -316,6 +318,7 @@ class OAuth(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateAuthKeysCodeRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -438,6 +441,7 @@ class OAuth(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", operations.CreateAuthKeysCodeRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 3ba8b45..82d7f51 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -45,8 +45,6 @@ if TYPE_CHECKING: CreateEmbeddingsRequest, CreateEmbeddingsRequestTypedDict, CreateEmbeddingsResponse, - CreateEmbeddingsResponseBody, - CreateEmbeddingsResponseBodyTypedDict, CreateEmbeddingsResponseTypedDict, Embedding, EmbeddingTypedDict, @@ -100,7 +98,12 @@ if TYPE_CHECKING: ExchangeAuthCodeForAPIKeyResponse, ExchangeAuthCodeForAPIKeyResponseTypedDict, ) - from .getcredits import GetCreditsResponse, GetCreditsResponseTypedDict + from .getcredits import ( + GetCreditsData, + GetCreditsDataTypedDict, + GetCreditsResponse, + GetCreditsResponseTypedDict, + ) from .getcurrentkey import ( GetCurrentKeyData, GetCurrentKeyDataTypedDict, @@ -216,8 +219,6 @@ __all__ = [ "CreateEmbeddingsRequest", "CreateEmbeddingsRequestTypedDict", "CreateEmbeddingsResponse", - "CreateEmbeddingsResponseBody", - "CreateEmbeddingsResponseBodyTypedDict", "CreateEmbeddingsResponseTypedDict", "CreateKeysData", "CreateKeysDataTypedDict", @@ -242,6 +243,8 @@ __all__ = [ "ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponseTypedDict", + "GetCreditsData", + "GetCreditsDataTypedDict", "GetCreditsResponse", "GetCreditsResponseTypedDict", "GetCurrentKeyData", @@ -370,8 +373,6 @@ _dynamic_imports: dict[str, str] = { "CreateEmbeddingsRequest": ".createembeddings", "CreateEmbeddingsRequestTypedDict": ".createembeddings", "CreateEmbeddingsResponse": ".createembeddings", - "CreateEmbeddingsResponseBody": ".createembeddings", - "CreateEmbeddingsResponseBodyTypedDict": ".createembeddings", "CreateEmbeddingsResponseTypedDict": ".createembeddings", "Embedding": ".createembeddings", "EmbeddingTypedDict": ".createembeddings", @@ -416,6 +417,8 @@ _dynamic_imports: dict[str, str] = { "ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey", + "GetCreditsData": ".getcredits", + "GetCreditsDataTypedDict": ".getcredits", "GetCreditsResponse": ".getcredits", "GetCreditsResponseTypedDict": ".getcredits", "GetCurrentKeyData": ".getcurrentkey", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index ddd90c3..c200370 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -15,8 +15,8 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer +from openrouter.utils import get_discriminator, validate_open_enum +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import PlainValidator from typing import Any, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -63,7 +63,13 @@ ContentTypedDict = TypeAliasType( ) -Content = TypeAliasType("Content", Union[ContentText, ContentImageURL]) +Content = Annotated[ + Union[ + Annotated[ContentText, Tag("text")], + Annotated[ContentImageURL, Tag("image_url")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] class InputTypedDict(TypedDict): @@ -389,7 +395,7 @@ class Usage(BaseModel): cost: Optional[float] = None -class CreateEmbeddingsResponseBodyTypedDict(TypedDict): +class CreateEmbeddingsResponseTypedDict(TypedDict): r"""Embedding response""" object: Object @@ -399,7 +405,7 @@ class CreateEmbeddingsResponseBodyTypedDict(TypedDict): usage: NotRequired[UsageTypedDict] -class CreateEmbeddingsResponseBody(BaseModel): +class CreateEmbeddingsResponse(BaseModel): r"""Embedding response""" object: Object @@ -411,14 +417,3 @@ class CreateEmbeddingsResponseBody(BaseModel): id: Optional[str] = None usage: Optional[Usage] = None - - -CreateEmbeddingsResponseTypedDict = TypeAliasType( - "CreateEmbeddingsResponseTypedDict", - Union[CreateEmbeddingsResponseBodyTypedDict, str], -) - - -CreateEmbeddingsResponse = TypeAliasType( - "CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str] -) diff --git a/src/openrouter/operations/getcredits.py b/src/openrouter/operations/getcredits.py index 9719016..8cab52d 100644 --- a/src/openrouter/operations/getcredits.py +++ b/src/openrouter/operations/getcredits.py @@ -5,9 +5,28 @@ from openrouter.types import BaseModel from typing_extensions import TypedDict +class GetCreditsDataTypedDict(TypedDict): + total_credits: float + r"""Total credits purchased""" + total_usage: float + r"""Total credits used""" + + +class GetCreditsData(BaseModel): + total_credits: float + r"""Total credits purchased""" + + total_usage: float + r"""Total credits used""" + + class GetCreditsResponseTypedDict(TypedDict): r"""Total credits purchased and used""" + data: GetCreditsDataTypedDict + class GetCreditsResponse(BaseModel): r"""Total credits purchased and used""" + + data: GetCreditsData diff --git a/src/openrouter/operations/getparameters.py b/src/openrouter/operations/getparameters.py index 18da669..14349a8 100644 --- a/src/openrouter/operations/getparameters.py +++ b/src/openrouter/operations/getparameters.py @@ -38,12 +38,14 @@ GetParametersProvider = Union[ "AionLabs", "Alibaba", "Amazon Bedrock", + "Amazon Nova", "Anthropic", - "Arcee", + "Arcee AI", "AtlasCloud", "Avian", "Azure", "BaseTen", + "BytePlus", "Black Forest Labs", "Cerebras", "Chutes", @@ -58,6 +60,7 @@ GetParametersProvider = Union[ "Fireworks", "Friendli", "GMICloud", + "GoPomelo", "Google", "Google AI Studio", "Groq", @@ -88,6 +91,7 @@ GetParametersProvider = Union[ "SambaNova", "SiliconFlow", "Stealth", + "StreamLake", "Switchpoint", "Targon", "Together", diff --git a/src/openrouter/parameters.py b/src/openrouter/parameters.py index 5b4008a..5206f57 100644 --- a/src/openrouter/parameters.py +++ b/src/openrouter/parameters.py @@ -68,6 +68,7 @@ class Parameters(BaseSDK): security=utils.get_pydantic_model( security, operations.GetParametersSecurity ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -179,6 +180,7 @@ class Parameters(BaseSDK): security=utils.get_pydantic_model( security, operations.GetParametersSecurity ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/providers.py b/src/openrouter/providers.py index a5f8066..04c0598 100644 --- a/src/openrouter/providers.py +++ b/src/openrouter/providers.py @@ -49,6 +49,7 @@ class Providers(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -133,6 +134,7 @@ class Providers(BaseSDK): accept_header_value="application/json", http_headers=http_headers, security=self.sdk_configuration.security, + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 277e769..fba3823 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -69,8 +69,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ @@ -109,7 +108,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -174,8 +172,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ @@ -214,7 +211,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -278,8 +274,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ @@ -318,7 +313,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -374,7 +368,6 @@ class Responses(BaseSDK): include=include, background=background, safety_identifier=safety_identifier, - store=store, service_tier=service_tier, truncation=truncation, stream=stream, @@ -403,6 +396,7 @@ class Responses(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.OpenResponsesRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -626,8 +620,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ @@ -666,7 +659,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -731,8 +723,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ @@ -771,7 +762,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -835,8 +825,7 @@ class Responses(BaseSDK): include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, background: OptionalNullable[bool] = UNSET, safety_identifier: OptionalNullable[str] = UNSET, - store: OptionalNullable[bool] = UNSET, - service_tier: OptionalNullable[components.ServiceTier] = UNSET, + service_tier: Optional[components.ServiceTier] = "auto", truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ @@ -875,7 +864,6 @@ class Responses(BaseSDK): :param include: :param background: :param safety_identifier: - :param store: :param service_tier: :param truncation: :param stream: @@ -931,7 +919,6 @@ class Responses(BaseSDK): include=include, background=background, safety_identifier=safety_identifier, - store=store, service_tier=service_tier, truncation=truncation, stream=stream, @@ -960,6 +947,7 @@ class Responses(BaseSDK): get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", components.OpenResponsesRequest ), + allow_empty_value=None, timeout_ms=timeout_ms, ) diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 0ad8870..a71e057 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -9,6 +9,7 @@ import httpx import importlib from openrouter import components, utils from openrouter._hooks import SDKHooks +from openrouter.models import internal from openrouter.types import OptionalNullable, UNSET import sys from typing import Any, Callable, Dict, Optional, TYPE_CHECKING, Union, cast @@ -77,6 +78,8 @@ class OpenRouter(BaseSDK): def __init__( self, api_key: Optional[Union[Optional[str], Callable[[], Optional[str]]]] = None, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, server: Optional[str] = None, server_url: Optional[str] = None, url_params: Optional[Dict[str, str]] = None, @@ -89,6 +92,8 @@ class OpenRouter(BaseSDK): r"""Instantiates the SDK configuring it with the provided parameters. :param api_key: The api_key required for authentication + :param http_referer: Configures the http_referer parameter for all supported operations + :param x_title: Configures the x_title parameter for all supported operations :param server: The server by name to use for all methods :param server_url: The server URL to use for all methods :param url_params: Parameters to optionally template the server URL with @@ -129,6 +134,13 @@ class OpenRouter(BaseSDK): if url_params is not None: server_url = utils.template_url(server_url, url_params) + _globals = internal.Globals( + http_referer=utils.get_global_from_env( + http_referer, "OPENROUTER_HTTP_REFERER", str + ), + x_title=utils.get_global_from_env(x_title, "OPENROUTER_X_TITLE", str), + ) + BaseSDK.__init__( self, SDKConfiguration( @@ -136,6 +148,7 @@ class OpenRouter(BaseSDK): client_supplied=client_supplied, async_client=async_client, async_client_supplied=async_client_supplied, + globals=_globals, security=security, server_url=server_url, server=server, diff --git a/src/openrouter/sdkconfiguration.py b/src/openrouter/sdkconfiguration.py index 4f12a18..2643316 100644 --- a/src/openrouter/sdkconfiguration.py +++ b/src/openrouter/sdkconfiguration.py @@ -10,6 +10,7 @@ from .httpclient import AsyncHttpClient, HttpClient from .utils import Logger, RetryConfig, remove_suffix from dataclasses import dataclass from openrouter import components +from openrouter.models import internal from openrouter.types import OptionalNullable, UNSET from pydantic import Field from typing import Callable, Dict, Optional, Tuple, Union @@ -30,6 +31,7 @@ class SDKConfiguration: async_client: Union[AsyncHttpClient, None] async_client_supplied: bool debug_logger: Logger + globals: internal.Globals security: Optional[ Union[components.Security, Callable[[], components.Security]] ] = None diff --git a/src/openrouter/utils/forms.py b/src/openrouter/utils/forms.py index e873495..f961e76 100644 --- a/src/openrouter/utils/forms.py +++ b/src/openrouter/utils/forms.py @@ -142,16 +142,21 @@ def serialize_multipart_form( if field_metadata.file: if isinstance(val, List): # Handle array of files + array_field_name = f_name + "[]" for file_obj in val: if not _is_set(file_obj): continue - - file_name, content, content_type = _extract_file_properties(file_obj) + + file_name, content, content_type = _extract_file_properties( + file_obj + ) if content_type is not None: - files.append((f_name + "[]", (file_name, content, content_type))) + files.append( + (array_field_name, (file_name, content, content_type)) + ) else: - files.append((f_name + "[]", (file_name, content))) + files.append((array_field_name, (file_name, content))) else: # Handle single file file_name, content, content_type = _extract_file_properties(val) @@ -161,11 +166,16 @@ def serialize_multipart_form( else: files.append((f_name, (file_name, content))) elif field_metadata.json: - files.append((f_name, ( - None, - marshal_json(val, request_field_types[name]), - "application/json", - ))) + files.append( + ( + f_name, + ( + None, + marshal_json(val, request_field_types[name]), + "application/json", + ), + ) + ) else: if isinstance(val, List): values = [] @@ -175,7 +185,8 @@ def serialize_multipart_form( continue values.append(_val_to_string(value)) - form[f_name + "[]"] = values + array_field_name = f_name + "[]" + form[array_field_name] = values else: form[f_name] = _val_to_string(val) return media_type, form, files diff --git a/src/openrouter/utils/queryparams.py b/src/openrouter/utils/queryparams.py index 37a6e7f..c04e0db 100644 --- a/src/openrouter/utils/queryparams.py +++ b/src/openrouter/utils/queryparams.py @@ -27,12 +27,13 @@ from .forms import _populate_form def get_query_params( query_params: Any, gbls: Optional[Any] = None, + allow_empty_value: Optional[List[str]] = None, ) -> Dict[str, List[str]]: params: Dict[str, List[str]] = {} - globals_already_populated = _populate_query_params(query_params, gbls, params, []) + globals_already_populated = _populate_query_params(query_params, gbls, params, [], allow_empty_value) if _is_set(gbls): - _populate_query_params(gbls, None, params, globals_already_populated) + _populate_query_params(gbls, None, params, globals_already_populated, allow_empty_value) return params @@ -42,6 +43,7 @@ def _populate_query_params( gbls: Any, query_param_values: Dict[str, List[str]], skip_fields: List[str], + allow_empty_value: Optional[List[str]] = None, ) -> List[str]: globals_already_populated: List[str] = [] @@ -69,6 +71,16 @@ def _populate_query_params( globals_already_populated.append(name) f_name = field.alias if field.alias is not None else name + + allow_empty_set = set(allow_empty_value or []) + should_include_empty = f_name in allow_empty_set and ( + value is None or value == [] or value == "" + ) + + if should_include_empty: + query_param_values[f_name] = [""] + continue + serialization = metadata.serialization if serialization is not None: serialized_parms = _get_serialized_params( diff --git a/src/openrouter/utils/retries.py b/src/openrouter/utils/retries.py index 4d60867..88a91b1 100644 --- a/src/openrouter/utils/retries.py +++ b/src/openrouter/utils/retries.py @@ -3,7 +3,9 @@ import asyncio import random import time -from typing import List +from datetime import datetime +from email.utils import parsedate_to_datetime +from typing import List, Optional import httpx @@ -51,9 +53,11 @@ class Retries: class TemporaryError(Exception): response: httpx.Response + retry_after: Optional[int] def __init__(self, response: httpx.Response): self.response = response + self.retry_after = _parse_retry_after_header(response) class PermanentError(Exception): @@ -63,6 +67,62 @@ class PermanentError(Exception): self.inner = inner +def _parse_retry_after_header(response: httpx.Response) -> Optional[int]: + """Parse Retry-After header from response. + + Returns: + Retry interval in milliseconds, or None if header is missing or invalid. + """ + retry_after_header = response.headers.get("retry-after") + if not retry_after_header: + return None + + try: + seconds = float(retry_after_header) + return round(seconds * 1000) + except ValueError: + pass + + try: + retry_date = parsedate_to_datetime(retry_after_header) + delta = (retry_date - datetime.now(retry_date.tzinfo)).total_seconds() + return round(max(0, delta) * 1000) + except (ValueError, TypeError): + pass + + return None + + +def _get_sleep_interval( + exception: Exception, + initial_interval: int, + max_interval: int, + exponent: float, + retries: int, +) -> float: + """Get sleep interval for retry with exponential backoff. + + Args: + exception: The exception that triggered the retry. + initial_interval: Initial retry interval in milliseconds. + max_interval: Maximum retry interval in milliseconds. + exponent: Base for exponential backoff calculation. + retries: Current retry attempt count. + + Returns: + Sleep interval in seconds. + """ + if ( + isinstance(exception, TemporaryError) + and exception.retry_after is not None + and exception.retry_after > 0 + ): + return exception.retry_after / 1000 + + sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) + return min(sleep, max_interval / 1000) + + def retry(func, retries: Retries): if retries.config.strategy == "backoff": @@ -183,8 +243,10 @@ def retry_with_backoff( return exception.response raise - sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) - sleep = min(sleep, max_interval / 1000) + + sleep = _get_sleep_interval( + exception, initial_interval, max_interval, exponent, retries + ) time.sleep(sleep) retries += 1 @@ -211,7 +273,9 @@ async def retry_with_backoff_async( return exception.response raise - sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) - sleep = min(sleep, max_interval / 1000) + + sleep = _get_sleep_interval( + exception, initial_interval, max_interval, exponent, retries + ) await asyncio.sleep(sleep) retries += 1