more updates

This commit is contained in:
Matt Apperson
2025-12-04 13:07:08 -05:00
parent aed8199b2b
commit d4474da1b8
57 changed files with 588 additions and 415 deletions
+16 -12
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management: management:
docChecksum: bcccd1abd05f6654a822386f2eefbd8a docChecksum: 01481f11e87a18cf1daa583fee2c88fb
docVersion: 1.0.0 docVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
generationVersion: 2.768.0 generationVersion: 2.768.0
releaseVersion: 0.0.16 releaseVersion: 0.0.21
configChecksum: cd00e781b0ef78cfcb3fe812f51e93ff configChecksum: 52c13d7fdf159611bf5d900363e322ac
repoURL: https://github.com/OpenRouterTeam/python-sdk.git repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true published: true
@@ -66,16 +66,14 @@ generatedFiles:
- docs/components/chatgenerationtokenusage.md - docs/components/chatgenerationtokenusage.md
- docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitem.md
- docs/components/chatmessagecontentitemaudio.md - docs/components/chatmessagecontentitemaudio.md
- docs/components/chatmessagecontentitemaudioformat.md
- docs/components/chatmessagecontentitemaudioinputaudio.md - docs/components/chatmessagecontentitemaudioinputaudio.md
- docs/components/chatmessagecontentitemfile.md - docs/components/chatmessagecontentitemcachecontrol.md
- docs/components/chatmessagecontentitemimage.md - docs/components/chatmessagecontentitemimage.md
- docs/components/chatmessagecontentitemimagedetail.md - docs/components/chatmessagecontentitemimagedetail.md
- docs/components/chatmessagecontentitemtext.md - docs/components/chatmessagecontentitemtext.md
- docs/components/chatmessagecontentitemvideo.md - docs/components/chatmessagecontentitemvideo.md
- docs/components/chatmessagecontentitemvideoinputvideo.md - docs/components/chatmessagecontentitemvideoinputvideo.md
- docs/components/chatmessagecontentitemvideovideourl.md - docs/components/chatmessagecontentitemvideovideourl.md
- docs/components/chatmessagecontentitemvideovideourlvideourl.md
- docs/components/chatmessagetokenlogprob.md - docs/components/chatmessagetokenlogprob.md
- docs/components/chatmessagetokenlogprobs.md - docs/components/chatmessagetokenlogprobs.md
- docs/components/chatmessagetoolcall.md - docs/components/chatmessagetoolcall.md
@@ -108,12 +106,12 @@ generatedFiles:
- docs/components/costdetails.md - docs/components/costdetails.md
- docs/components/createchargerequest.md - docs/components/createchargerequest.md
- docs/components/datacollection.md - docs/components/datacollection.md
- docs/components/debug.md
- docs/components/defaultparameters.md - docs/components/defaultparameters.md
- docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/edgenetworktimeoutresponseerrordata.md
- docs/components/effort.md - docs/components/effort.md
- docs/components/endpointstatus.md - docs/components/endpointstatus.md
- docs/components/engine.md - docs/components/engine.md
- docs/components/file.md
- docs/components/filecitation.md - docs/components/filecitation.md
- docs/components/filecitationtype.md - docs/components/filecitationtype.md
- docs/components/filepath.md - docs/components/filepath.md
@@ -121,6 +119,7 @@ generatedFiles:
- docs/components/forbiddenresponseerrordata.md - docs/components/forbiddenresponseerrordata.md
- docs/components/idfileparser.md - docs/components/idfileparser.md
- docs/components/idmoderation.md - docs/components/idmoderation.md
- docs/components/idresponsehealing.md
- docs/components/idweb.md - docs/components/idweb.md
- docs/components/ignore.md - docs/components/ignore.md
- docs/components/imagegenerationstatus.md - docs/components/imagegenerationstatus.md
@@ -304,6 +303,7 @@ generatedFiles:
- docs/components/plugin.md - docs/components/plugin.md
- docs/components/pluginfileparser.md - docs/components/pluginfileparser.md
- docs/components/pluginmoderation.md - docs/components/pluginmoderation.md
- docs/components/pluginresponsehealing.md
- docs/components/pluginweb.md - docs/components/pluginweb.md
- docs/components/pricing.md - docs/components/pricing.md
- docs/components/prompt.md - docs/components/prompt.md
@@ -395,6 +395,7 @@ generatedFiles:
- docs/components/toplogprob.md - docs/components/toplogprob.md
- docs/components/topproviderinfo.md - docs/components/topproviderinfo.md
- docs/components/truncation.md - docs/components/truncation.md
- docs/components/ttl.md
- docs/components/type.md - docs/components/type.md
- docs/components/typeresponsecompleted.md - docs/components/typeresponsecompleted.md
- docs/components/typeresponsecontentpartadded.md - docs/components/typeresponsecontentpartadded.md
@@ -420,7 +421,8 @@ generatedFiles:
- docs/components/usermessage.md - docs/components/usermessage.md
- docs/components/usermessagecontent.md - docs/components/usermessagecontent.md
- docs/components/variables.md - docs/components/variables.md
- docs/components/videourl.md - docs/components/videourl1.md
- docs/components/videourl2.md
- docs/components/websearchpreviewtooluserlocation.md - docs/components/websearchpreviewtooluserlocation.md
- docs/components/websearchpreviewtooluserlocationtype.md - docs/components/websearchpreviewtooluserlocationtype.md
- docs/components/websearchstatus.md - docs/components/websearchstatus.md
@@ -471,6 +473,7 @@ generatedFiles:
- docs/operations/exchangeauthcodeforapikeycodechallengemethod.md - docs/operations/exchangeauthcodeforapikeycodechallengemethod.md
- docs/operations/exchangeauthcodeforapikeyrequest.md - docs/operations/exchangeauthcodeforapikeyrequest.md
- docs/operations/exchangeauthcodeforapikeyresponse.md - docs/operations/exchangeauthcodeforapikeyresponse.md
- docs/operations/getcreditsdata.md
- docs/operations/getcreditsresponse.md - docs/operations/getcreditsresponse.md
- docs/operations/getcurrentkeydata.md - docs/operations/getcurrentkeydata.md
- docs/operations/getcurrentkeyresponse.md - docs/operations/getcurrentkeyresponse.md
@@ -553,12 +556,13 @@ generatedFiles:
- src/openrouter/components/assistantmessage.py - src/openrouter/components/assistantmessage.py
- src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badgatewayresponseerrordata.py
- src/openrouter/components/badrequestresponseerrordata.py - src/openrouter/components/badrequestresponseerrordata.py
- src/openrouter/components/chatcompletionfinishreason.py
- src/openrouter/components/chaterror.py - src/openrouter/components/chaterror.py
- src/openrouter/components/chatgenerationparams.py - src/openrouter/components/chatgenerationparams.py
- src/openrouter/components/chatgenerationtokenusage.py - src/openrouter/components/chatgenerationtokenusage.py
- src/openrouter/components/chatmessagecontentitem.py - src/openrouter/components/chatmessagecontentitem.py
- src/openrouter/components/chatmessagecontentitemaudio.py - src/openrouter/components/chatmessagecontentitemaudio.py
- src/openrouter/components/chatmessagecontentitemfile.py - src/openrouter/components/chatmessagecontentitemcachecontrol.py
- src/openrouter/components/chatmessagecontentitemimage.py - src/openrouter/components/chatmessagecontentitemimage.py
- src/openrouter/components/chatmessagecontentitemtext.py - src/openrouter/components/chatmessagecontentitemtext.py
- src/openrouter/components/chatmessagecontentitemvideo.py - src/openrouter/components/chatmessagecontentitemvideo.py
@@ -567,6 +571,7 @@ generatedFiles:
- src/openrouter/components/chatmessagetoolcall.py - src/openrouter/components/chatmessagetoolcall.py
- src/openrouter/components/chatresponse.py - src/openrouter/components/chatresponse.py
- src/openrouter/components/chatresponsechoice.py - src/openrouter/components/chatresponsechoice.py
- src/openrouter/components/chatstreamingchoice.py
- src/openrouter/components/chatstreamingmessagechunk.py - src/openrouter/components/chatstreamingmessagechunk.py
- src/openrouter/components/chatstreamingmessagetoolcall.py - src/openrouter/components/chatstreamingmessagetoolcall.py
- src/openrouter/components/chatstreamingresponsechunk.py - src/openrouter/components/chatstreamingresponsechunk.py
@@ -689,7 +694,6 @@ generatedFiles:
- src/openrouter/components/unprocessableentityresponseerrordata.py - src/openrouter/components/unprocessableentityresponseerrordata.py
- src/openrouter/components/urlcitation.py - src/openrouter/components/urlcitation.py
- src/openrouter/components/usermessage.py - src/openrouter/components/usermessage.py
- src/openrouter/components/videourl.py
- src/openrouter/components/websearchpreviewtooluserlocation.py - src/openrouter/components/websearchpreviewtooluserlocation.py
- src/openrouter/components/websearchstatus.py - src/openrouter/components/websearchstatus.py
- src/openrouter/credits.py - src/openrouter/credits.py
@@ -773,7 +777,7 @@ examples:
createResponses: createResponses:
speakeasy-default-create-responses: speakeasy-default-create-responses:
requestBody: requestBody:
application/json: {"stream": false} application/json: {"store": false, "service_tier": "auto", "stream": false}
responses: responses:
"200": "200":
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true} application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
@@ -823,7 +827,7 @@ examples:
speakeasy-default-get-credits: speakeasy-default-get-credits:
responses: responses:
"200": "200":
application/json: {} application/json: {"data": {"total_credits": 100.5, "total_usage": 25.75}}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"403": "403":
+1 -1
View File
@@ -31,7 +31,7 @@ generation:
skipResponseBodyAssertions: false skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true preApplyUnionDiscriminators: true
python: python:
version: 0.0.16 version: 0.0.21
additionalDependencies: additionalDependencies:
dev: {} dev: {}
main: {} main: {}
+100 -64
View File
@@ -3464,12 +3464,14 @@ components:
- AionLabs - AionLabs
- Alibaba - Alibaba
- Amazon Bedrock - Amazon Bedrock
- Amazon Nova
- Anthropic - Anthropic
- Arcee - Arcee AI
- AtlasCloud - AtlasCloud
- Avian - Avian
- Azure - Azure
- BaseTen - BaseTen
- BytePlus
- Black Forest Labs - Black Forest Labs
- Cerebras - Cerebras
- Chutes - Chutes
@@ -3484,6 +3486,7 @@ components:
- Fireworks - Fireworks
- Friendli - Friendli
- GMICloud - GMICloud
- GoPomelo
- Google - Google
- Google AI Studio - Google AI Studio
- Groq - Groq
@@ -3513,7 +3516,9 @@ components:
- Relace - Relace
- SambaNova - SambaNova
- SiliconFlow - SiliconFlow
- Sourceful
- Stealth - Stealth
- StreamLake
- Switchpoint - Switchpoint
- Targon - Targon
- Together - Together
@@ -3648,18 +3653,13 @@ components:
nullable: true nullable: true
store: store:
type: boolean type: boolean
nullable: true const: false
default: false
service_tier: service_tier:
allOf: type: string
- $ref: '#/components/schemas/OpenAIResponsesServiceTier' enum:
- enum: - auto
- auto default: auto
- default
- flex
- scale
- priority
example: auto
x-speakeasy-unknown-values: allow
truncation: truncation:
allOf: allOf:
- $ref: '#/components/schemas/OpenAIResponsesTruncation' - $ref: '#/components/schemas/OpenAIResponsesTruncation'
@@ -3803,12 +3803,25 @@ components:
x-speakeasy-unknown-values: allow x-speakeasy-unknown-values: allow
required: required:
- id - id
- type: object
properties:
id:
type: string
enum:
- response-healing
required:
- id
description: Plugins you want to enable for this request, including their settings. description: Plugins you want to enable for this request, including their settings.
user: user:
type: string type: string
maxLength: 128 maxLength: 128
description: >- 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. 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 description: Request schema for Responses endpoint
example: example:
model: anthropic/claude-4.5-sonnet-20250929 model: anthropic/claude-4.5-sonnet-20250929
@@ -4597,6 +4610,10 @@ components:
status: default status: default
uptime_last_30m: 99.5 uptime_last_30m: 99.5
supports_implicit_caching: true supports_implicit_caching: true
__schema0:
anyOf:
- $ref: '#/components/schemas/ChatCompletionFinishReason'
- type: 'null'
ModelName: ModelName:
type: string type: string
ChatMessageContentItemText: ChatMessageContentItemText:
@@ -4607,6 +4624,8 @@ components:
const: text const: text
text: text:
type: string type: string
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
required: required:
- type - type
- text - text
@@ -4646,15 +4665,6 @@ components:
type: string type: string
format: format:
type: string type: string
enum:
- wav
- mp3
- flac
- m4a
- ogg
- pcm16
- pcm24
x-speakeasy-unknown-values: allow
required: required:
- data - data
- format - format
@@ -4669,7 +4679,12 @@ components:
type: string type: string
const: input_video const: input_video
video_url: video_url:
$ref: '#/components/schemas/VideoURL' type: object
properties:
url:
type: string
required:
- url
required: required:
- type - type
- video_url - video_url
@@ -4689,40 +4704,12 @@ components:
- type - type
- video_url - video_url
type: object type: object
VideoURL:
type: object
properties:
url:
type: string
required:
- url
ChatMessageContentItemFile:
type: object
properties:
type:
type: string
const: file
file:
type: object
properties:
file_data:
type: string
file_id:
type: string
filename:
type: string
required:
- file_data
required:
- type
- file
ChatMessageContentItem: ChatMessageContentItem:
oneOf: oneOf:
- $ref: '#/components/schemas/ChatMessageContentItemText' - $ref: '#/components/schemas/ChatMessageContentItemText'
- $ref: '#/components/schemas/ChatMessageContentItemImage' - $ref: '#/components/schemas/ChatMessageContentItemImage'
- $ref: '#/components/schemas/ChatMessageContentItemAudio' - $ref: '#/components/schemas/ChatMessageContentItemAudio'
- $ref: '#/components/schemas/ChatMessageContentItemVideo' - $ref: '#/components/schemas/ChatMessageContentItemVideo'
- $ref: '#/components/schemas/ChatMessageContentItemFile'
type: object type: object
discriminator: discriminator:
propertyName: type propertyName: type
@@ -4732,7 +4719,6 @@ components:
input_audio: '#/components/schemas/ChatMessageContentItemAudio' input_audio: '#/components/schemas/ChatMessageContentItemAudio'
input_video: '#/components/schemas/ChatMessageContentItemVideo' input_video: '#/components/schemas/ChatMessageContentItemVideo'
video_url: '#/components/schemas/ChatMessageContentItemVideo' video_url: '#/components/schemas/ChatMessageContentItemVideo'
file: '#/components/schemas/ChatMessageContentItemFile'
ChatMessageToolCall: ChatMessageToolCall:
type: object type: object
properties: properties:
@@ -4856,16 +4842,14 @@ components:
- prompt_tokens - prompt_tokens
- total_tokens - total_tokens
ChatCompletionFinishReason: ChatCompletionFinishReason:
anyOf: type: string
- type: string enum:
enum: - tool_calls
- tool_calls - stop
- stop - length
- length - content_filter
- content_filter - error
- error x-speakeasy-unknown-values: allow
x-speakeasy-unknown-values: allow
- type: 'null'
JSONSchemaConfig: JSONSchemaConfig:
type: object type: object
properties: properties:
@@ -4907,6 +4891,20 @@ components:
required: required:
- type - type
- grammar - grammar
ChatMessageContentItemCacheControl:
type: object
properties:
type:
type: string
const: ephemeral
ttl:
type: string
enum:
- 5m
- 1h
x-speakeasy-unknown-values: allow
required:
- type
SystemMessage: SystemMessage:
type: object type: object
properties: properties:
@@ -5218,13 +5216,18 @@ components:
- type: 'null' - type: 'null'
user: user:
type: string type: string
debug:
type: object
properties:
echo_upstream_body:
type: boolean
required: required:
- messages - messages
ChatResponseChoice: ChatResponseChoice:
type: object type: object
properties: properties:
finish_reason: finish_reason:
$ref: '#/components/schemas/ChatCompletionFinishReason' $ref: '#/components/schemas/__schema0'
index: index:
type: number type: number
message: message:
@@ -5285,7 +5288,7 @@ components:
delta: delta:
$ref: '#/components/schemas/ChatStreamingMessageChunk' $ref: '#/components/schemas/ChatStreamingMessageChunk'
finish_reason: finish_reason:
$ref: '#/components/schemas/ChatCompletionFinishReason' $ref: '#/components/schemas/__schema0'
index: index:
type: number type: number
logprobs: logprobs:
@@ -5618,6 +5621,12 @@ components:
- type: 'null' - type: 'null'
finish_reason: finish_reason:
$ref: '#/components/schemas/CompletionFinishReason' $ref: '#/components/schemas/CompletionFinishReason'
native_finish_reason:
type: string
reasoning:
anyOf:
- type: string
- type: 'null'
required: required:
- text - text
- index - index
@@ -5635,6 +5644,8 @@ components:
type: number type: number
model: model:
type: string type: string
provider:
type: string
system_fingerprint: system_fingerprint:
type: string type: string
choices: choices:
@@ -5853,6 +5864,26 @@ paths:
application/json: application/json:
schema: schema:
type: object 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 description: Total credits purchased and used
example: example:
data: data:
@@ -6754,12 +6785,14 @@ paths:
- AionLabs - AionLabs
- Alibaba - Alibaba
- Amazon Bedrock - Amazon Bedrock
- Amazon Nova
- Anthropic - Anthropic
- Arcee - Arcee AI
- AtlasCloud - AtlasCloud
- Avian - Avian
- Azure - Azure
- BaseTen - BaseTen
- BytePlus
- Black Forest Labs - Black Forest Labs
- Cerebras - Cerebras
- Chutes - Chutes
@@ -6774,6 +6807,7 @@ paths:
- Fireworks - Fireworks
- Friendli - Friendli
- GMICloud - GMICloud
- GoPomelo
- Google - Google
- Google AI Studio - Google AI Studio
- Groq - Groq
@@ -6803,7 +6837,9 @@ paths:
- Relace - Relace
- SambaNova - SambaNova
- SiliconFlow - SiliconFlow
- Sourceful
- Stealth - Stealth
- StreamLake
- Switchpoint - Switchpoint
- Targon - Targon
- Together - Together
+14 -7
View File
@@ -6,30 +6,37 @@ sources:
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
tags: tags:
- latest - latest
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
tags:
- latest
- 1.0.0
targets: targets:
open-router: open-router:
source: -OAS source: OpenRouter API
sourceNamespace: open-router-chat-completions-api sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695 sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
sources: sources:
-OAS: OpenRouter API:
inputs: inputs:
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main - location: .speakeasy/in.openapi.yaml
overlays: overlays:
- location: .speakeasy/overlays/open-enums.overlay.yaml - location: .speakeasy/overlays/open-enums.overlay.yaml
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
- location: .speakeasy/overlays/add-headers.overlay.yaml - location: .speakeasy/overlays/add-headers.overlay.yaml
output: .speakeasy/out.openapi.yaml output: .speakeasy/out.openapi.yaml
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets: targets:
open-router: open-router:
target: python target: python
source: -OAS source: OpenRouter API
publish: publish:
pypi: pypi:
token: $pypi_token token: $pypi_token
+5 -5
View File
@@ -1,26 +1,26 @@
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
sources: sources:
-OAS: OpenRouter API:
inputs: inputs:
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main - location: .speakeasy/in.openapi.yaml
overlays: overlays:
- location: .speakeasy/overlays/open-enums.overlay.yaml - location: .speakeasy/overlays/open-enums.overlay.yaml
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
- location: .speakeasy/overlays/add-headers.overlay.yaml - location: .speakeasy/overlays/add-headers.overlay.yaml
output: .speakeasy/out.openapi.yaml output: .speakeasy/out.openapi.yaml
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets: targets:
open-router: open-router:
target: python target: python
source: -OAS source: OpenRouter API
publish: publish:
pypi: pypi:
token: $pypi_token token: $pypi_token
codeSamples: codeSamples:
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
labelOverride: labelOverride:
fixedValue: Python (SDK) fixedValue: Python (SDK)
blocking: false blocking: false
+2 -2
View File
@@ -9,7 +9,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.beta.responses.send(stream=False) res = open_router.beta.responses.send(service_tier="auto", stream=False)
with res as event_stream: with res as event_stream:
for event in event_stream: for event in event_stream:
@@ -33,7 +33,7 @@ async def main():
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = await open_router.beta.responses.send_async(stream=False) res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
async with res as event_stream: async with res as event_stream:
async for event in event_stream: async for event in event_stream:
+2 -1
View File
@@ -26,4 +26,5 @@
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | | `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :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 | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :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 |
@@ -33,9 +33,3 @@ value: components.ChatMessageContentItemVideo = /* values here */
value: components.ChatMessageContentItemVideo = /* values here */ value: components.ChatMessageContentItemVideo = /* values here */
``` ```
### `components.ChatMessageContentItemFile`
```python
value: components.ChatMessageContentItemFile = /* values here */
```
@@ -1,14 +0,0 @@
# ChatMessageContentItemAudioFormat
## Values
| Name | Value |
| ------- | ------- |
| `WAV` | wav |
| `MP3` | mp3 |
| `FLAC` | flac |
| `M4A` | m4a |
| `OGG` | ogg |
| `PCM16` | pcm16 |
| `PCM24` | pcm24 |
@@ -3,7 +3,7 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | ------------------ | ------------------ | ------------------ | ------------------ |
| `data` | *str* | :heavy_check_mark: | N/A | | `data` | *str* | :heavy_check_mark: | N/A |
| `format_` | [components.ChatMessageContentItemAudioFormat](../components/chatmessagecontentitemaudioformat.md) | :heavy_check_mark: | N/A | | `format_` | *str* | :heavy_check_mark: | N/A |
@@ -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 |
@@ -1,9 +0,0 @@
# ChatMessageContentItemFile
## Fields
| Field | Type | Required | Description |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| `type` | *Literal["file"]* | :heavy_check_mark: | N/A |
| `file` | [components.File](../components/file.md) | :heavy_check_mark: | N/A |
@@ -3,7 +3,8 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ | | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | | `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
| `text` | *str* | :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 |
@@ -3,7 +3,7 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | | `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
| `video_url` | [components.VideoURL](../components/videourl.md) | :heavy_check_mark: | N/A | | `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A |
@@ -3,7 +3,7 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A | | `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
| `video_url` | [components.ChatMessageContentItemVideoVideoURLVideoURL](../components/chatmessagecontentitemvideovideourlvideourl.md) | :heavy_check_mark: | N/A | | `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A |
+3 -1
View File
@@ -8,4 +8,6 @@
| `text` | *str* | :heavy_check_mark: | N/A | | `text` | *str* | :heavy_check_mark: | N/A |
| `index` | *float* | :heavy_check_mark: | N/A | | `index` | *float* | :heavy_check_mark: | N/A |
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :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 | | `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 |
+1
View File
@@ -9,6 +9,7 @@
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A | | `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
| `created` | *float* | :heavy_check_mark: | N/A | | `created` | *float* | :heavy_check_mark: | N/A |
| `model` | *str* | :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 | | `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | 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 | | `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
+8
View File
@@ -0,0 +1,8 @@
# Debug
## Fields
| Field | Type | Required | Description |
| -------------------- | -------------------- | -------------------- | -------------------- |
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
-10
View File
@@ -1,10 +0,0 @@
# File
## Fields
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `file_data` | *str* | :heavy_check_mark: | N/A |
| `file_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `filename` | *Optional[str]* | :heavy_minus_sign: | N/A |
+8
View File
@@ -0,0 +1,8 @@
# IDResponseHealing
## Values
| Name | Value |
| ------------------ | ------------------ |
| `RESPONSE_HEALING` | response-healing |
+4 -3
View File
@@ -27,10 +27,11 @@ Request schema for Responses endpoint
| `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | | | `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `store` | *Optional[Literal[False]]* | :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 | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `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. | | | `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | 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. | | | `user` | *Optional[str]* | :heavy_minus_sign: | 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` | *Optional[str]* | :heavy_minus_sign: | 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. | |
+6
View File
@@ -21,3 +21,9 @@ value: components.PluginWeb = /* values here */
value: components.PluginFileParser = /* values here */ value: components.PluginFileParser = /* values here */
``` ```
### `components.PluginResponseHealing`
```python
value: components.PluginResponseHealing = /* values here */
```
+8
View File
@@ -0,0 +1,8 @@
# PluginResponseHealing
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
+6 -1
View File
@@ -9,12 +9,14 @@
| `AION_LABS` | AionLabs | | `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba | | `ALIBABA` | Alibaba |
| `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_BEDROCK` | Amazon Bedrock |
| `AMAZON_NOVA` | Amazon Nova |
| `ANTHROPIC` | Anthropic | | `ANTHROPIC` | Anthropic |
| `ARCEE` | Arcee | | `ARCEE_AI` | Arcee AI |
| `ATLAS_CLOUD` | AtlasCloud | | `ATLAS_CLOUD` | AtlasCloud |
| `AVIAN` | Avian | | `AVIAN` | Avian |
| `AZURE` | Azure | | `AZURE` | Azure |
| `BASE_TEN` | BaseTen | | `BASE_TEN` | BaseTen |
| `BYTE_PLUS` | BytePlus |
| `BLACK_FOREST_LABS` | Black Forest Labs | | `BLACK_FOREST_LABS` | Black Forest Labs |
| `CEREBRAS` | Cerebras | | `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes | | `CHUTES` | Chutes |
@@ -29,6 +31,7 @@
| `FIREWORKS` | Fireworks | | `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli | | `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud | | `GMI_CLOUD` | GMICloud |
| `GO_POMELO` | GoPomelo |
| `GOOGLE` | Google | | `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio | | `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq | | `GROQ` | Groq |
@@ -58,7 +61,9 @@
| `RELACE` | Relace | | `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova | | `SAMBA_NOVA` | SambaNova |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon | | `TARGON` | Targon |
| `TOGETHER` | Together | | `TOGETHER` | Together |
+3 -7
View File
@@ -3,10 +3,6 @@
## Values ## Values
| Name | Value | | Name | Value |
| ---------- | ---------- | | ------ | ------ |
| `AUTO` | auto | | `AUTO` | auto |
| `DEFAULT` | default |
| `FLEX` | flex |
| `PRIORITY` | priority |
| `SCALE` | scale |
+9
View File
@@ -0,0 +1,9 @@
# TTL
## Values
| Name | Value |
| ------- | ------- |
| `FIVEM` | 5m |
| `ONEH` | 1h |
@@ -1,4 +1,4 @@
# VideoURL # VideoURL1
## Fields ## Fields
@@ -1,4 +1,4 @@
# ChatMessageContentItemVideoVideoURLVideoURL # VideoURL2
## Fields ## Fields
+9
View File
@@ -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 |
+3 -2
View File
@@ -5,5 +5,6 @@ Total credits purchased and used
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description | Example |
| ----------- | ----------- | ----------- | ----------- | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `data` | [operations.GetCreditsData](../operations/getcreditsdata.md) | :heavy_check_mark: | N/A | {<br/>"total_credits": 100.5,<br/>"total_usage": 25.75<br/>} |
+6 -1
View File
@@ -9,12 +9,14 @@
| `AION_LABS` | AionLabs | | `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba | | `ALIBABA` | Alibaba |
| `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_BEDROCK` | Amazon Bedrock |
| `AMAZON_NOVA` | Amazon Nova |
| `ANTHROPIC` | Anthropic | | `ANTHROPIC` | Anthropic |
| `ARCEE` | Arcee | | `ARCEE_AI` | Arcee AI |
| `ATLAS_CLOUD` | AtlasCloud | | `ATLAS_CLOUD` | AtlasCloud |
| `AVIAN` | Avian | | `AVIAN` | Avian |
| `AZURE` | Azure | | `AZURE` | Azure |
| `BASE_TEN` | BaseTen | | `BASE_TEN` | BaseTen |
| `BYTE_PLUS` | BytePlus |
| `BLACK_FOREST_LABS` | Black Forest Labs | | `BLACK_FOREST_LABS` | Black Forest Labs |
| `CEREBRAS` | Cerebras | | `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes | | `CHUTES` | Chutes |
@@ -29,6 +31,7 @@
| `FIREWORKS` | Fireworks | | `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli | | `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud | | `GMI_CLOUD` | GMICloud |
| `GO_POMELO` | GoPomelo |
| `GOOGLE` | Google | | `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio | | `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq | | `GROQ` | Groq |
@@ -58,7 +61,9 @@
| `RELACE` | Relace | | `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova | | `SAMBA_NOVA` | SambaNova |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon | | `TARGON` | Targon |
| `TOGETHER` | Together | | `TOGETHER` | Together |
+1
View File
@@ -58,6 +58,7 @@ with OpenRouter(
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :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 | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :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. | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
### Response ### Response
+3 -3
View File
@@ -25,7 +25,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.beta.responses.send(stream=False) res = open_router.beta.responses.send(service_tier="auto", stream=False)
with res as event_stream: with res as event_stream:
for event in event_stream: for event in event_stream:
@@ -58,13 +58,13 @@ with OpenRouter(
| `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | | | `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | | `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
| `service_tier` | [OptionalNullable[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `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. | | | `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | 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. | | | `user` | *Optional[str]* | :heavy_minus_sign: | 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` | *Optional[str]* | :heavy_minus_sign: | 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. | |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response ### Response
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "openrouter" name = "openrouter"
version = "0.0.16" version = "0.0.21"
description = "Official Python Client SDK for OpenRouter." description = "Official Python Client SDK for OpenRouter."
authors = [{ name = "OpenRouter" },] authors = [{ name = "OpenRouter" },]
readme = "README-PYPI.md" readme = "README-PYPI.md"
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata import importlib.metadata
__title__: str = "openrouter" __title__: str = "openrouter"
__version__: str = "0.0.16" __version__: str = "0.0.21"
__openapi_doc_version__: str = "1.0.0" __openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0" __gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.768.0 1.0.0 openrouter" __user_agent__: str = "speakeasy-sdk/python 0.0.21 2.768.0 1.0.0 openrouter"
try: try:
if __package__ is not None: if __package__ is not None:
+14
View File
@@ -61,6 +61,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -92,6 +93,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -144,6 +146,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -175,6 +178,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -226,6 +230,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -257,6 +262,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -305,6 +311,7 @@ class Chat(BaseSDK):
), ),
top_p=top_p, top_p=top_p,
user=user, user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
) )
req = self._build_request( req = self._build_request(
@@ -439,6 +446,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -470,6 +478,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -522,6 +531,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -553,6 +563,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -604,6 +615,7 @@ class Chat(BaseSDK):
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -635,6 +647,7 @@ class Chat(BaseSDK):
:param tools: :param tools:
:param top_p: :param top_p:
:param user: :param user:
:param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -683,6 +696,7 @@ class Chat(BaseSDK):
), ),
top_p=top_p, top_p=top_p,
user=user, user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
) )
req = self._build_request_async( req = self._build_request_async(
+43 -37
View File
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
BadRequestResponseErrorData, BadRequestResponseErrorData,
BadRequestResponseErrorDataTypedDict, BadRequestResponseErrorDataTypedDict,
) )
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
from .chatgenerationparams import ( from .chatgenerationparams import (
ChatGenerationParams, ChatGenerationParams,
@@ -35,6 +36,8 @@ if TYPE_CHECKING:
ChatGenerationParamsStop, ChatGenerationParamsStop,
ChatGenerationParamsStopTypedDict, ChatGenerationParamsStopTypedDict,
ChatGenerationParamsTypedDict, ChatGenerationParamsTypedDict,
Debug,
DebugTypedDict,
Effort, Effort,
Reasoning, Reasoning,
ReasoningTypedDict, ReasoningTypedDict,
@@ -53,16 +56,14 @@ if TYPE_CHECKING:
) )
from .chatmessagecontentitemaudio import ( from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio, ChatMessageContentItemAudio,
ChatMessageContentItemAudioFormat,
ChatMessageContentItemAudioInputAudio, ChatMessageContentItemAudioInputAudio,
ChatMessageContentItemAudioInputAudioTypedDict, ChatMessageContentItemAudioInputAudioTypedDict,
ChatMessageContentItemAudioTypedDict, ChatMessageContentItemAudioTypedDict,
) )
from .chatmessagecontentitemfile import ( from .chatmessagecontentitemcachecontrol import (
ChatMessageContentItemFile, ChatMessageContentItemCacheControl,
ChatMessageContentItemFileTypedDict, ChatMessageContentItemCacheControlTypedDict,
File, TTL,
FileTypedDict,
) )
from .chatmessagecontentitemimage import ( from .chatmessagecontentitemimage import (
ChatMessageContentItemImage, ChatMessageContentItemImage,
@@ -82,8 +83,10 @@ if TYPE_CHECKING:
ChatMessageContentItemVideoTypedDict, ChatMessageContentItemVideoTypedDict,
ChatMessageContentItemVideoVideoURL, ChatMessageContentItemVideoVideoURL,
ChatMessageContentItemVideoVideoURLTypedDict, ChatMessageContentItemVideoVideoURLTypedDict,
ChatMessageContentItemVideoVideoURLVideoURL, VideoURL1,
ChatMessageContentItemVideoVideoURLVideoURLTypedDict, VideoURL1TypedDict,
VideoURL2,
VideoURL2TypedDict,
) )
from .chatmessagetokenlogprob import ( from .chatmessagetokenlogprob import (
ChatMessageTokenLogprob, ChatMessageTokenLogprob,
@@ -102,13 +105,8 @@ if TYPE_CHECKING:
ChatMessageToolCallTypedDict, ChatMessageToolCallTypedDict,
) )
from .chatresponse import ChatResponse, ChatResponseTypedDict from .chatresponse import ChatResponse, ChatResponseTypedDict
from .chatresponsechoice import ( from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
ChatCompletionFinishReason, from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
ChatResponseChoice,
ChatResponseChoiceTypedDict,
ChatStreamingChoice,
ChatStreamingChoiceTypedDict,
)
from .chatstreamingmessagechunk import ( from .chatstreamingmessagechunk import (
ChatStreamingMessageChunk, ChatStreamingMessageChunk,
ChatStreamingMessageChunkRole, ChatStreamingMessageChunkRole,
@@ -426,6 +424,7 @@ if TYPE_CHECKING:
Engine, Engine,
IDFileParser, IDFileParser,
IDModeration, IDModeration,
IDResponseHealing,
IDWeb, IDWeb,
Ignore, Ignore,
IgnoreTypedDict, IgnoreTypedDict,
@@ -450,6 +449,8 @@ if TYPE_CHECKING:
PluginFileParserTypedDict, PluginFileParserTypedDict,
PluginModeration, PluginModeration,
PluginModerationTypedDict, PluginModerationTypedDict,
PluginResponseHealing,
PluginResponseHealingTypedDict,
PluginTypedDict, PluginTypedDict,
PluginWeb, PluginWeb,
PluginWebTypedDict, PluginWebTypedDict,
@@ -784,7 +785,6 @@ if TYPE_CHECKING:
UserMessageContentTypedDict, UserMessageContentTypedDict,
UserMessageTypedDict, UserMessageTypedDict,
) )
from .videourl import VideoURL, VideoURLTypedDict
from .websearchpreviewtooluserlocation import ( from .websearchpreviewtooluserlocation import (
WebSearchPreviewToolUserLocation, WebSearchPreviewToolUserLocation,
WebSearchPreviewToolUserLocationType, WebSearchPreviewToolUserLocationType,
@@ -825,12 +825,11 @@ __all__ = [
"ChatGenerationTokenUsageTypedDict", "ChatGenerationTokenUsageTypedDict",
"ChatMessageContentItem", "ChatMessageContentItem",
"ChatMessageContentItemAudio", "ChatMessageContentItemAudio",
"ChatMessageContentItemAudioFormat",
"ChatMessageContentItemAudioInputAudio", "ChatMessageContentItemAudioInputAudio",
"ChatMessageContentItemAudioInputAudioTypedDict", "ChatMessageContentItemAudioInputAudioTypedDict",
"ChatMessageContentItemAudioTypedDict", "ChatMessageContentItemAudioTypedDict",
"ChatMessageContentItemFile", "ChatMessageContentItemCacheControl",
"ChatMessageContentItemFileTypedDict", "ChatMessageContentItemCacheControlTypedDict",
"ChatMessageContentItemImage", "ChatMessageContentItemImage",
"ChatMessageContentItemImageDetail", "ChatMessageContentItemImageDetail",
"ChatMessageContentItemImageTypedDict", "ChatMessageContentItemImageTypedDict",
@@ -843,8 +842,6 @@ __all__ = [
"ChatMessageContentItemVideoTypedDict", "ChatMessageContentItemVideoTypedDict",
"ChatMessageContentItemVideoVideoURL", "ChatMessageContentItemVideoVideoURL",
"ChatMessageContentItemVideoVideoURLTypedDict", "ChatMessageContentItemVideoVideoURLTypedDict",
"ChatMessageContentItemVideoVideoURLVideoURL",
"ChatMessageContentItemVideoVideoURLVideoURLTypedDict",
"ChatMessageTokenLogprob", "ChatMessageTokenLogprob",
"ChatMessageTokenLogprobTypedDict", "ChatMessageTokenLogprobTypedDict",
"ChatMessageTokenLogprobs", "ChatMessageTokenLogprobs",
@@ -905,6 +902,8 @@ __all__ = [
"CreateChargeRequest", "CreateChargeRequest",
"CreateChargeRequestTypedDict", "CreateChargeRequestTypedDict",
"DataCollection", "DataCollection",
"Debug",
"DebugTypedDict",
"DefaultParameters", "DefaultParameters",
"DefaultParametersTypedDict", "DefaultParametersTypedDict",
"EdgeNetworkTimeoutResponseErrorData", "EdgeNetworkTimeoutResponseErrorData",
@@ -912,18 +911,17 @@ __all__ = [
"Effort", "Effort",
"EndpointStatus", "EndpointStatus",
"Engine", "Engine",
"File",
"FileCitation", "FileCitation",
"FileCitationType", "FileCitationType",
"FileCitationTypedDict", "FileCitationTypedDict",
"FilePath", "FilePath",
"FilePathType", "FilePathType",
"FilePathTypedDict", "FilePathTypedDict",
"FileTypedDict",
"ForbiddenResponseErrorData", "ForbiddenResponseErrorData",
"ForbiddenResponseErrorDataTypedDict", "ForbiddenResponseErrorDataTypedDict",
"IDFileParser", "IDFileParser",
"IDModeration", "IDModeration",
"IDResponseHealing",
"IDWeb", "IDWeb",
"Ignore", "Ignore",
"IgnoreTypedDict", "IgnoreTypedDict",
@@ -1217,6 +1215,8 @@ __all__ = [
"PluginFileParserTypedDict", "PluginFileParserTypedDict",
"PluginModeration", "PluginModeration",
"PluginModerationTypedDict", "PluginModerationTypedDict",
"PluginResponseHealing",
"PluginResponseHealingTypedDict",
"PluginTypedDict", "PluginTypedDict",
"PluginWeb", "PluginWeb",
"PluginWebTypedDict", "PluginWebTypedDict",
@@ -1342,6 +1342,7 @@ __all__ = [
"SystemMessageContent", "SystemMessageContent",
"SystemMessageContentTypedDict", "SystemMessageContentTypedDict",
"SystemMessageTypedDict", "SystemMessageTypedDict",
"TTL",
"Tokenizer", "Tokenizer",
"TooManyRequestsResponseErrorData", "TooManyRequestsResponseErrorData",
"TooManyRequestsResponseErrorDataTypedDict", "TooManyRequestsResponseErrorDataTypedDict",
@@ -1391,8 +1392,10 @@ __all__ = [
"UserMessageTypedDict", "UserMessageTypedDict",
"Variables", "Variables",
"VariablesTypedDict", "VariablesTypedDict",
"VideoURL", "VideoURL1",
"VideoURLTypedDict", "VideoURL1TypedDict",
"VideoURL2",
"VideoURL2TypedDict",
"WebSearchPreviewToolUserLocation", "WebSearchPreviewToolUserLocation",
"WebSearchPreviewToolUserLocationType", "WebSearchPreviewToolUserLocationType",
"WebSearchPreviewToolUserLocationTypedDict", "WebSearchPreviewToolUserLocationTypedDict",
@@ -1410,6 +1413,7 @@ _dynamic_imports: dict[str, str] = {
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata", "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
"BadRequestResponseErrorData": ".badrequestresponseerrordata", "BadRequestResponseErrorData": ".badrequestresponseerrordata",
"BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata", "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
"ChatCompletionFinishReason": ".chatcompletionfinishreason",
"ChatErrorError": ".chaterror", "ChatErrorError": ".chaterror",
"ChatErrorErrorTypedDict": ".chaterror", "ChatErrorErrorTypedDict": ".chaterror",
"Code": ".chaterror", "Code": ".chaterror",
@@ -1426,6 +1430,8 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsStop": ".chatgenerationparams", "ChatGenerationParamsStop": ".chatgenerationparams",
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams", "ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams", "Effort": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams", "Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams",
@@ -1438,14 +1444,12 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageContentItem": ".chatmessagecontentitem", "ChatMessageContentItem": ".chatmessagecontentitem",
"ChatMessageContentItemTypedDict": ".chatmessagecontentitem", "ChatMessageContentItemTypedDict": ".chatmessagecontentitem",
"ChatMessageContentItemAudio": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudio": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio",
"ChatMessageContentItemFile": ".chatmessagecontentitemfile", "ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol",
"ChatMessageContentItemFileTypedDict": ".chatmessagecontentitemfile", "ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol",
"File": ".chatmessagecontentitemfile", "TTL": ".chatmessagecontentitemcachecontrol",
"FileTypedDict": ".chatmessagecontentitemfile",
"ChatMessageContentItemImage": ".chatmessagecontentitemimage", "ChatMessageContentItemImage": ".chatmessagecontentitemimage",
"ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage", "ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
"ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage", "ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
@@ -1459,8 +1463,10 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLVideoURL": ".chatmessagecontentitemvideo", "VideoURL1": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLVideoURLTypedDict": ".chatmessagecontentitemvideo", "VideoURL1TypedDict": ".chatmessagecontentitemvideo",
"VideoURL2": ".chatmessagecontentitemvideo",
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob", "ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob", "ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
"TopLogprob": ".chatmessagetokenlogprob", "TopLogprob": ".chatmessagetokenlogprob",
@@ -1473,11 +1479,10 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageToolCallTypedDict": ".chatmessagetoolcall", "ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
"ChatResponse": ".chatresponse", "ChatResponse": ".chatresponse",
"ChatResponseTypedDict": ".chatresponse", "ChatResponseTypedDict": ".chatresponse",
"ChatCompletionFinishReason": ".chatresponsechoice",
"ChatResponseChoice": ".chatresponsechoice", "ChatResponseChoice": ".chatresponsechoice",
"ChatResponseChoiceTypedDict": ".chatresponsechoice", "ChatResponseChoiceTypedDict": ".chatresponsechoice",
"ChatStreamingChoice": ".chatresponsechoice", "ChatStreamingChoice": ".chatstreamingchoice",
"ChatStreamingChoiceTypedDict": ".chatresponsechoice", "ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
"ChatStreamingMessageChunk": ".chatstreamingmessagechunk", "ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
"ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
"ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
@@ -1724,6 +1729,7 @@ _dynamic_imports: dict[str, str] = {
"Engine": ".openresponsesrequest", "Engine": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest", "IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest", "IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest",
"IDWeb": ".openresponsesrequest", "IDWeb": ".openresponsesrequest",
"Ignore": ".openresponsesrequest", "Ignore": ".openresponsesrequest",
"IgnoreTypedDict": ".openresponsesrequest", "IgnoreTypedDict": ".openresponsesrequest",
@@ -1748,6 +1754,8 @@ _dynamic_imports: dict[str, str] = {
"PluginFileParserTypedDict": ".openresponsesrequest", "PluginFileParserTypedDict": ".openresponsesrequest",
"PluginModeration": ".openresponsesrequest", "PluginModeration": ".openresponsesrequest",
"PluginModerationTypedDict": ".openresponsesrequest", "PluginModerationTypedDict": ".openresponsesrequest",
"PluginResponseHealing": ".openresponsesrequest",
"PluginResponseHealingTypedDict": ".openresponsesrequest",
"PluginTypedDict": ".openresponsesrequest", "PluginTypedDict": ".openresponsesrequest",
"PluginWeb": ".openresponsesrequest", "PluginWeb": ".openresponsesrequest",
"PluginWebTypedDict": ".openresponsesrequest", "PluginWebTypedDict": ".openresponsesrequest",
@@ -1998,8 +2006,6 @@ _dynamic_imports: dict[str, str] = {
"UserMessageContent": ".usermessage", "UserMessageContent": ".usermessage",
"UserMessageContentTypedDict": ".usermessage", "UserMessageContentTypedDict": ".usermessage",
"UserMessageTypedDict": ".usermessage", "UserMessageTypedDict": ".usermessage",
"VideoURL": ".videourl",
"VideoURLTypedDict": ".videourl",
"WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation",
@@ -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,
]
@@ -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): class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict] messages: List[MessageTypedDict]
model: NotRequired[str] model: NotRequired[str]
@@ -179,6 +187,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
tools: NotRequired[List[ToolDefinitionJSONTypedDict]] tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]] top_p: NotRequired[Nullable[float]]
user: NotRequired[str] user: NotRequired[str]
debug: NotRequired[DebugTypedDict]
class ChatGenerationParams(BaseModel): class ChatGenerationParams(BaseModel):
@@ -226,6 +235,8 @@ class ChatGenerationParams(BaseModel):
user: Optional[str] = None user: Optional[str] = None
debug: Optional[Debug] = None
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -250,6 +261,7 @@ class ChatGenerationParams(BaseModel):
"tools", "tools",
"top_p", "top_p",
"user", "user",
"debug",
] ]
nullable_fields = [ nullable_fields = [
"frequency_penalty", "frequency_penalty",
@@ -5,10 +5,6 @@ from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio, ChatMessageContentItemAudio,
ChatMessageContentItemAudioTypedDict, ChatMessageContentItemAudioTypedDict,
) )
from .chatmessagecontentitemfile import (
ChatMessageContentItemFile,
ChatMessageContentItemFileTypedDict,
)
from .chatmessagecontentitemimage import ( from .chatmessagecontentitemimage import (
ChatMessageContentItemImage, ChatMessageContentItemImage,
ChatMessageContentItemImageTypedDict, ChatMessageContentItemImageTypedDict,
@@ -30,10 +26,9 @@ from typing_extensions import Annotated, TypeAliasType
ChatMessageContentItemTypedDict = TypeAliasType( ChatMessageContentItemTypedDict = TypeAliasType(
"ChatMessageContentItemTypedDict", "ChatMessageContentItemTypedDict",
Union[ Union[
ChatMessageContentItemTextTypedDict,
ChatMessageContentItemImageTypedDict, ChatMessageContentItemImageTypedDict,
ChatMessageContentItemAudioTypedDict, ChatMessageContentItemAudioTypedDict,
ChatMessageContentItemFileTypedDict, ChatMessageContentItemTextTypedDict,
ChatMessageContentItemVideoTypedDict, ChatMessageContentItemVideoTypedDict,
], ],
) )
@@ -46,7 +41,6 @@ ChatMessageContentItem = Annotated[
Annotated[ChatMessageContentItemAudio, Tag("input_audio")], Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
Annotated[ChatMessageContentItemVideo, Tag("input_video")], Annotated[ChatMessageContentItemVideo, Tag("input_video")],
Annotated[ChatMessageContentItemVideo, Tag("video_url")], Annotated[ChatMessageContentItemVideo, Tag("video_url")],
Annotated[ChatMessageContentItemFile, Tag("file")],
], ],
Discriminator(lambda m: get_discriminator(m, "type", "type")), Discriminator(lambda m: get_discriminator(m, "type", "type")),
] ]
@@ -1,42 +1,23 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr from openrouter.types import BaseModel
from openrouter.utils import validate_const, validate_open_enum from openrouter.utils import validate_const
import pydantic import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator from pydantic.functional_validators import AfterValidator
from typing import Literal, Union from typing import Literal
from typing_extensions import Annotated, TypedDict from typing_extensions import Annotated, TypedDict
ChatMessageContentItemAudioFormat = Union[
Literal[
"wav",
"mp3",
"flac",
"m4a",
"ogg",
"pcm16",
"pcm24",
],
UnrecognizedStr,
]
class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict): class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
data: str data: str
format_: ChatMessageContentItemAudioFormat format_: str
class ChatMessageContentItemAudioInputAudio(BaseModel): class ChatMessageContentItemAudioInputAudio(BaseModel):
data: str data: str
format_: Annotated[ format_: Annotated[str, pydantic.Field(alias="format")]
Annotated[
ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"),
]
class ChatMessageContentItemAudioTypedDict(TypedDict): class ChatMessageContentItemAudioTypedDict(TypedDict):
@@ -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
@@ -1,37 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class FileTypedDict(TypedDict):
file_data: str
file_id: NotRequired[str]
filename: NotRequired[str]
class File(BaseModel):
file_data: str
file_id: Optional[str] = None
filename: Optional[str] = None
class ChatMessageContentItemFileTypedDict(TypedDict):
file: FileTypedDict
type: Literal["file"]
class ChatMessageContentItemFile(BaseModel):
file: File
TYPE: Annotated[
Annotated[Literal["file"], AfterValidator(validate_const("file"))],
pydantic.Field(alias="type"),
] = "file"
@@ -1,17 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from .chatmessagecontentitemcachecontrol import (
ChatMessageContentItemCacheControl,
ChatMessageContentItemCacheControlTypedDict,
)
from openrouter.types import BaseModel from openrouter.types import BaseModel
from openrouter.utils import validate_const from openrouter.utils import validate_const
import pydantic import pydantic
from pydantic.functional_validators import AfterValidator from pydantic.functional_validators import AfterValidator
from typing import Literal from typing import Literal, Optional
from typing_extensions import Annotated, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
class ChatMessageContentItemTextTypedDict(TypedDict): class ChatMessageContentItemTextTypedDict(TypedDict):
text: str text: str
type: Literal["text"] type: Literal["text"]
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
class ChatMessageContentItemText(BaseModel): class ChatMessageContentItemText(BaseModel):
@@ -21,3 +26,5 @@ class ChatMessageContentItemText(BaseModel):
Annotated[Literal["text"], AfterValidator(validate_const("text"))], Annotated[Literal["text"], AfterValidator(validate_const("text"))],
pydantic.Field(alias="type"), pydantic.Field(alias="type"),
] = "text" ] = "text"
cache_control: Optional[ChatMessageContentItemCacheControl] = None
@@ -1,7 +1,6 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from .videourl import VideoURL, VideoURLTypedDict
from openrouter.types import BaseModel from openrouter.types import BaseModel
from openrouter.utils import get_discriminator, validate_const from openrouter.utils import get_discriminator, validate_const
import pydantic import pydantic
@@ -11,21 +10,21 @@ from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict from typing_extensions import Annotated, TypeAliasType, TypedDict
class ChatMessageContentItemVideoVideoURLVideoURLTypedDict(TypedDict): class VideoURL2TypedDict(TypedDict):
url: str url: str
class ChatMessageContentItemVideoVideoURLVideoURL(BaseModel): class VideoURL2(BaseModel):
url: str url: str
class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict): class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
video_url: ChatMessageContentItemVideoVideoURLVideoURLTypedDict video_url: VideoURL2TypedDict
type: Literal["video_url"] type: Literal["video_url"]
class ChatMessageContentItemVideoVideoURL(BaseModel): class ChatMessageContentItemVideoVideoURL(BaseModel):
video_url: ChatMessageContentItemVideoVideoURLVideoURL video_url: VideoURL2
TYPE: Annotated[ TYPE: Annotated[
Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))], Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
@@ -33,13 +32,21 @@ class ChatMessageContentItemVideoVideoURL(BaseModel):
] = "video_url" ] = "video_url"
class VideoURL1TypedDict(TypedDict):
url: str
class VideoURL1(BaseModel):
url: str
class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict): class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
video_url: VideoURLTypedDict video_url: VideoURL1TypedDict
type: Literal["input_video"] type: Literal["input_video"]
class ChatMessageContentItemVideoInputVideo(BaseModel): class ChatMessageContentItemVideoInputVideo(BaseModel):
video_url: VideoURL video_url: VideoURL1
TYPE: Annotated[ TYPE: Annotated[
Annotated[ Annotated[
@@ -2,41 +2,24 @@
from __future__ import annotations from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import ( from .chatmessagetokenlogprobs import (
ChatMessageTokenLogprobs, ChatMessageTokenLogprobs,
ChatMessageTokenLogprobsTypedDict, ChatMessageTokenLogprobsTypedDict,
) )
from .chatstreamingmessagechunk import (
ChatStreamingMessageChunk,
ChatStreamingMessageChunkTypedDict,
)
from openrouter.types import ( from openrouter.types import (
BaseModel, BaseModel,
Nullable, Nullable,
OptionalNullable, OptionalNullable,
UNSET, UNSET,
UNSET_SENTINEL, UNSET_SENTINEL,
UnrecognizedStr,
) )
from openrouter.utils import validate_open_enum from openrouter.utils import validate_open_enum
from pydantic import model_serializer from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, NotRequired, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
ChatCompletionFinishReason = Union[
Literal[
"tool_calls",
"stop",
"length",
"content_filter",
"error",
],
UnrecognizedStr,
]
class ChatResponseChoiceTypedDict(TypedDict): class ChatResponseChoiceTypedDict(TypedDict):
finish_reason: Nullable[ChatCompletionFinishReason] finish_reason: Nullable[ChatCompletionFinishReason]
index: float index: float
@@ -84,52 +67,3 @@ class ChatResponseChoice(BaseModel):
m[k] = val m[k] = val
return m 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
@@ -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
@@ -5,7 +5,7 @@ from .chatgenerationtokenusage import (
ChatGenerationTokenUsage, ChatGenerationTokenUsage,
ChatGenerationTokenUsageTypedDict, ChatGenerationTokenUsageTypedDict,
) )
from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from openrouter.types import ( from openrouter.types import (
BaseModel, BaseModel,
Nullable, Nullable,
+18 -5
View File
@@ -2,12 +2,19 @@
from __future__ import annotations from __future__ import annotations
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict 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 openrouter.utils import validate_open_enum
from pydantic import model_serializer from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Literal, Union from typing import Literal, Optional, Union
from typing_extensions import Annotated, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
CompletionFinishReason = Union[ CompletionFinishReason = Union[
@@ -25,6 +32,8 @@ class CompletionChoiceTypedDict(TypedDict):
index: float index: float
logprobs: Nullable[CompletionLogprobsTypedDict] logprobs: Nullable[CompletionLogprobsTypedDict]
finish_reason: Nullable[CompletionFinishReason] finish_reason: Nullable[CompletionFinishReason]
native_finish_reason: NotRequired[str]
reasoning: NotRequired[Nullable[str]]
class CompletionChoice(BaseModel): class CompletionChoice(BaseModel):
@@ -38,10 +47,14 @@ class CompletionChoice(BaseModel):
Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False)) Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False))
] ]
native_finish_reason: Optional[str] = None
reasoning: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [] optional_fields = ["native_finish_reason", "reasoning"]
nullable_fields = ["logprobs", "finish_reason"] nullable_fields = ["logprobs", "finish_reason", "reasoning"]
null_default_fields = [] null_default_fields = []
serialized = handler(self) serialized = handler(self)
@@ -17,6 +17,7 @@ class CompletionResponseTypedDict(TypedDict):
model: str model: str
choices: List[CompletionChoiceTypedDict] choices: List[CompletionChoiceTypedDict]
object: Literal["text_completion"] object: Literal["text_completion"]
provider: NotRequired[str]
system_fingerprint: NotRequired[str] system_fingerprint: NotRequired[str]
usage: NotRequired[CompletionUsageTypedDict] usage: NotRequired[CompletionUsageTypedDict]
@@ -38,6 +39,8 @@ class CompletionResponse(BaseModel):
pydantic.Field(alias="object"), pydantic.Field(alias="object"),
] = "text_completion" ] = "text_completion"
provider: Optional[str] = None
system_fingerprint: Optional[str] = None system_fingerprint: Optional[str] = None
usage: Optional[CompletionUsage] = None usage: Optional[CompletionUsage] = None
@@ -44,9 +44,10 @@ from openrouter.types import (
UNSET_SENTINEL, UNSET_SENTINEL,
UnrecognizedStr, UnrecognizedStr,
) )
from openrouter.utils import get_discriminator, validate_open_enum from openrouter.utils import get_discriminator, validate_const, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag, model_serializer from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -135,16 +136,7 @@ OpenResponsesRequestToolUnion = Annotated[
] ]
ServiceTier = Union[ ServiceTier = Literal["auto",]
Literal[
"auto",
"default",
"flex",
"priority",
"scale",
],
UnrecognizedStr,
]
Truncation = Union[ Truncation = Union[
@@ -356,6 +348,17 @@ class Provider(BaseModel):
return m return m
IDResponseHealing = Literal["response-healing",]
class PluginResponseHealingTypedDict(TypedDict):
id: IDResponseHealing
class PluginResponseHealing(BaseModel):
id: IDResponseHealing
IDFileParser = Literal["file-parser",] IDFileParser = Literal["file-parser",]
@@ -437,7 +440,12 @@ class PluginModeration(BaseModel):
PluginTypedDict = TypeAliasType( PluginTypedDict = TypeAliasType(
"PluginTypedDict", "PluginTypedDict",
Union[PluginModerationTypedDict, PluginFileParserTypedDict, PluginWebTypedDict], Union[
PluginModerationTypedDict,
PluginResponseHealingTypedDict,
PluginFileParserTypedDict,
PluginWebTypedDict,
],
) )
@@ -446,6 +454,7 @@ Plugin = Annotated[
Annotated[PluginModeration, Tag("moderation")], Annotated[PluginModeration, Tag("moderation")],
Annotated[PluginWeb, Tag("web")], Annotated[PluginWeb, Tag("web")],
Annotated[PluginFileParser, Tag("file-parser")], Annotated[PluginFileParser, Tag("file-parser")],
Annotated[PluginResponseHealing, Tag("response-healing")],
], ],
Discriminator(lambda m: get_discriminator(m, "id", "id")), Discriminator(lambda m: get_discriminator(m, "id", "id")),
] ]
@@ -478,8 +487,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
include: NotRequired[Nullable[List[OpenAIResponsesIncludable]]] include: NotRequired[Nullable[List[OpenAIResponsesIncludable]]]
background: NotRequired[Nullable[bool]] background: NotRequired[Nullable[bool]]
safety_identifier: NotRequired[Nullable[str]] safety_identifier: NotRequired[Nullable[str]]
store: NotRequired[Nullable[bool]] store: Literal[False]
service_tier: NotRequired[Nullable[ServiceTier]] service_tier: NotRequired[ServiceTier]
truncation: NotRequired[Nullable[Truncation]] truncation: NotRequired[Nullable[Truncation]]
stream: NotRequired[bool] stream: NotRequired[bool]
provider: NotRequired[Nullable[ProviderTypedDict]] provider: NotRequired[Nullable[ProviderTypedDict]]
@@ -488,6 +497,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
r"""Plugins you want to enable for this request, including their settings.""" r"""Plugins you want to enable for this request, including their settings."""
user: NotRequired[str] user: NotRequired[str]
r"""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.""" r"""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: NotRequired[str]
r"""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."""
class OpenResponsesRequest(BaseModel): class OpenResponsesRequest(BaseModel):
@@ -543,11 +554,12 @@ class OpenResponsesRequest(BaseModel):
safety_identifier: OptionalNullable[str] = UNSET 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[ service_tier: Optional[ServiceTier] = "auto"
OptionalNullable[ServiceTier], PlainValidator(validate_open_enum(False))
] = UNSET
truncation: Annotated[ truncation: Annotated[
OptionalNullable[Truncation], PlainValidator(validate_open_enum(False)) OptionalNullable[Truncation], PlainValidator(validate_open_enum(False))
@@ -564,6 +576,9 @@ class OpenResponsesRequest(BaseModel):
user: Optional[str] = None user: Optional[str] = None
r"""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.""" r"""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: Optional[str] = None
r"""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."""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -594,6 +609,7 @@ class OpenResponsesRequest(BaseModel):
"provider", "provider",
"plugins", "plugins",
"user", "user",
"session_id",
] ]
nullable_fields = [ nullable_fields = [
"instructions", "instructions",
@@ -609,8 +625,6 @@ class OpenResponsesRequest(BaseModel):
"include", "include",
"background", "background",
"safety_identifier", "safety_identifier",
"store",
"service_tier",
"truncation", "truncation",
"provider", "provider",
] ]
+6 -1
View File
@@ -11,12 +11,14 @@ ProviderName = Union[
"AionLabs", "AionLabs",
"Alibaba", "Alibaba",
"Amazon Bedrock", "Amazon Bedrock",
"Amazon Nova",
"Anthropic", "Anthropic",
"Arcee", "Arcee AI",
"AtlasCloud", "AtlasCloud",
"Avian", "Avian",
"Azure", "Azure",
"BaseTen", "BaseTen",
"BytePlus",
"Black Forest Labs", "Black Forest Labs",
"Cerebras", "Cerebras",
"Chutes", "Chutes",
@@ -31,6 +33,7 @@ ProviderName = Union[
"Fireworks", "Fireworks",
"Friendli", "Friendli",
"GMICloud", "GMICloud",
"GoPomelo",
"Google", "Google",
"Google AI Studio", "Google AI Studio",
"Groq", "Groq",
@@ -60,7 +63,9 @@ ProviderName = Union[
"Relace", "Relace",
"SambaNova", "SambaNova",
"SiliconFlow", "SiliconFlow",
"Sourceful",
"Stealth", "Stealth",
"StreamLake",
"Switchpoint", "Switchpoint",
"Targon", "Targon",
"Together", "Together",
-13
View File
@@ -1,13 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class VideoURLTypedDict(TypedDict):
url: str
class VideoURL(BaseModel):
url: str
+10 -1
View File
@@ -100,7 +100,12 @@ if TYPE_CHECKING:
ExchangeAuthCodeForAPIKeyResponse, ExchangeAuthCodeForAPIKeyResponse,
ExchangeAuthCodeForAPIKeyResponseTypedDict, ExchangeAuthCodeForAPIKeyResponseTypedDict,
) )
from .getcredits import GetCreditsResponse, GetCreditsResponseTypedDict from .getcredits import (
GetCreditsData,
GetCreditsDataTypedDict,
GetCreditsResponse,
GetCreditsResponseTypedDict,
)
from .getcurrentkey import ( from .getcurrentkey import (
GetCurrentKeyData, GetCurrentKeyData,
GetCurrentKeyDataTypedDict, GetCurrentKeyDataTypedDict,
@@ -242,6 +247,8 @@ __all__ = [
"ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyRequestTypedDict",
"ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponse",
"ExchangeAuthCodeForAPIKeyResponseTypedDict", "ExchangeAuthCodeForAPIKeyResponseTypedDict",
"GetCreditsData",
"GetCreditsDataTypedDict",
"GetCreditsResponse", "GetCreditsResponse",
"GetCreditsResponseTypedDict", "GetCreditsResponseTypedDict",
"GetCurrentKeyData", "GetCurrentKeyData",
@@ -416,6 +423,8 @@ _dynamic_imports: dict[str, str] = {
"ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey",
"GetCreditsData": ".getcredits",
"GetCreditsDataTypedDict": ".getcredits",
"GetCreditsResponse": ".getcredits", "GetCreditsResponse": ".getcredits",
"GetCreditsResponseTypedDict": ".getcredits", "GetCreditsResponseTypedDict": ".getcredits",
"GetCurrentKeyData": ".getcurrentkey", "GetCurrentKeyData": ".getcurrentkey",
+19
View File
@@ -5,9 +5,28 @@ from openrouter.types import BaseModel
from typing_extensions import TypedDict 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): class GetCreditsResponseTypedDict(TypedDict):
r"""Total credits purchased and used""" r"""Total credits purchased and used"""
data: GetCreditsDataTypedDict
class GetCreditsResponse(BaseModel): class GetCreditsResponse(BaseModel):
r"""Total credits purchased and used""" r"""Total credits purchased and used"""
data: GetCreditsData
+6 -1
View File
@@ -38,12 +38,14 @@ GetParametersProvider = Union[
"AionLabs", "AionLabs",
"Alibaba", "Alibaba",
"Amazon Bedrock", "Amazon Bedrock",
"Amazon Nova",
"Anthropic", "Anthropic",
"Arcee", "Arcee AI",
"AtlasCloud", "AtlasCloud",
"Avian", "Avian",
"Azure", "Azure",
"BaseTen", "BaseTen",
"BytePlus",
"Black Forest Labs", "Black Forest Labs",
"Cerebras", "Cerebras",
"Chutes", "Chutes",
@@ -58,6 +60,7 @@ GetParametersProvider = Union[
"Fireworks", "Fireworks",
"Friendli", "Friendli",
"GMICloud", "GMICloud",
"GoPomelo",
"Google", "Google",
"Google AI Studio", "Google AI Studio",
"Groq", "Groq",
@@ -87,7 +90,9 @@ GetParametersProvider = Union[
"Relace", "Relace",
"SambaNova", "SambaNova",
"SiliconFlow", "SiliconFlow",
"Sourceful",
"Stealth", "Stealth",
"StreamLake",
"Switchpoint", "Switchpoint",
"Targon", "Targon",
"Together", "Together",
+20 -20
View File
@@ -69,8 +69,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
@@ -80,6 +79,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -109,13 +109,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -174,8 +174,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
@@ -185,6 +184,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -214,13 +214,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -278,8 +278,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
@@ -289,6 +288,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -318,13 +318,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -374,7 +374,6 @@ class Responses(BaseSDK):
include=include, include=include,
background=background, background=background,
safety_identifier=safety_identifier, safety_identifier=safety_identifier,
store=store,
service_tier=service_tier, service_tier=service_tier,
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
@@ -385,6 +384,7 @@ class Responses(BaseSDK):
plugins, Optional[List[components.Plugin]] plugins, Optional[List[components.Plugin]]
), ),
user=user, user=user,
session_id=session_id,
) )
req = self._build_request( req = self._build_request(
@@ -627,8 +627,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
@@ -638,6 +637,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -667,13 +667,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -732,8 +732,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
@@ -743,6 +742,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -772,13 +772,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -836,8 +836,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET, include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET, background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET, safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET, service_tier: Optional[components.ServiceTier] = "auto",
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
@@ -847,6 +846,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -876,13 +876,13 @@ class Responses(BaseSDK):
:param include: :param include:
:param background: :param background:
:param safety_identifier: :param safety_identifier:
:param store:
:param service_tier: :param service_tier:
:param truncation: :param truncation:
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins: Plugins you want to enable for this request, including their settings.
:param user: 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. :param user: 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.
:param session_id: 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.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -932,7 +932,6 @@ class Responses(BaseSDK):
include=include, include=include,
background=background, background=background,
safety_identifier=safety_identifier, safety_identifier=safety_identifier,
store=store,
service_tier=service_tier, service_tier=service_tier,
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
@@ -943,6 +942,7 @@ class Responses(BaseSDK):
plugins, Optional[List[components.Plugin]] plugins, Optional[List[components.Plugin]]
), ),
user=user, user=user,
session_id=session_id,
) )
req = self._build_request_async( req = self._build_request_async(