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