mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f812f831d | ||
|
|
95cb1260c7 | ||
|
|
a1dae775cb | ||
|
|
10a76ba502 | ||
|
|
f4ffd51f40 | ||
|
|
20c63f6f13 | ||
|
|
0f9cb9787a | ||
|
|
6c5dfcfb2b | ||
|
|
afbf99e8bf | ||
|
|
6895d9d45b | ||
|
|
e824ca8a57 | ||
|
|
e70f43e916 |
@@ -1,4 +1,9 @@
|
||||
|
||||
<div align="center">
|
||||
<a href="https://codespaces.new/OpenRouterTeam/python-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
> **Remember to shutdown a GitHub Codespace when it is not in use!**
|
||||
|
||||
# Dev Containers Quick Start
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Notify Monorepo of Changes
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
notify-monorepo:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send repository dispatch to monorepo
|
||||
run: |
|
||||
# Determine which event type to send based on repository name
|
||||
REPO_NAME="${GITHUB_REPOSITORY#*/}" # Gets 'python-sdk' from 'OpenRouterTeam/python-sdk'
|
||||
|
||||
case "$REPO_NAME" in
|
||||
"typescript-sdk")
|
||||
EVENT_TYPE="sync-typescript-sdk"
|
||||
;;
|
||||
"python-sdk")
|
||||
EVENT_TYPE="sync-python-sdk"
|
||||
;;
|
||||
"ai-sdk-provider")
|
||||
EVENT_TYPE="sync-ai-sdk-provider"
|
||||
;;
|
||||
"cli")
|
||||
EVENT_TYPE="sync-cli"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown repository: $REPO_NAME"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Sending repository_dispatch event: $EVENT_TYPE"
|
||||
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.MONOREPO_SYNC_TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/OpenRouterTeam/openrouter-web/dispatches \
|
||||
-d "{\"event_type\":\"$EVENT_TYPE\",\"client_payload\":{\"repository\":\"$GITHUB_REPOSITORY\",\"ref\":\"$GITHUB_REF\",\"sha\":\"$GITHUB_SHA\"}}"
|
||||
|
||||
echo "✅ Notification sent to monorepo"
|
||||
+41
-19
@@ -1,19 +1,21 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: b1b97e85c6e3464e1fd6e2163c4ebc87
|
||||
docChecksum: d2e69fbbac1477d094fdfc212c13670c
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.656.2
|
||||
generationVersion: 2.753.6
|
||||
releaseVersion: 0.0.14
|
||||
configChecksum: 7fdc1a8de90d75e76f19d0d7a83a0215
|
||||
speakeasyVersion: 1.668.0
|
||||
generationVersion: 2.770.0
|
||||
releaseVersion: 0.1.0
|
||||
configChecksum: fa0d13fb5fd38982a589d64e64b0d87d
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
features:
|
||||
python:
|
||||
acceptHeaders: 3.0.0
|
||||
additionalDependencies: 1.0.0
|
||||
constsAndDefaults: 1.0.5
|
||||
core: 5.23.6
|
||||
core: 5.23.13
|
||||
defaultEnabledRetries: 0.2.0
|
||||
deprecations: 3.0.2
|
||||
devContainers: 3.0.0
|
||||
@@ -25,6 +27,7 @@ features:
|
||||
globalSecurityCallbacks: 1.0.0
|
||||
globalSecurityFlattening: 1.0.0
|
||||
globalServerURLs: 3.2.0
|
||||
globals: 3.0.0
|
||||
groups: 3.0.1
|
||||
methodArguments: 1.0.2
|
||||
methodSecurity: 3.0.1
|
||||
@@ -32,8 +35,8 @@ features:
|
||||
nullables: 1.0.1
|
||||
openEnums: 1.0.1
|
||||
responseFormat: 1.0.1
|
||||
retries: 3.0.2
|
||||
sdkHooks: 1.1.0
|
||||
retries: 3.0.3
|
||||
sdkHooks: 1.2.0
|
||||
serverEvents: 1.0.11
|
||||
serverEventsSentinels: 0.1.0
|
||||
serverIDs: 3.0.0
|
||||
@@ -63,12 +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/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/chatmessagetokenlogprob.md
|
||||
- docs/components/chatmessagetokenlogprobs.md
|
||||
- docs/components/chatmessagetoolcall.md
|
||||
@@ -101,6 +106,7 @@ generatedFiles:
|
||||
- docs/components/costdetails.md
|
||||
- docs/components/createchargerequest.md
|
||||
- docs/components/datacollection.md
|
||||
- docs/components/debug.md
|
||||
- docs/components/defaultparameters.md
|
||||
- docs/components/edgenetworktimeoutresponseerrordata.md
|
||||
- docs/components/effort.md
|
||||
@@ -113,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
|
||||
@@ -296,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
|
||||
@@ -303,6 +311,7 @@ generatedFiles:
|
||||
- docs/components/provider.md
|
||||
- docs/components/providername.md
|
||||
- docs/components/provideroverloadedresponseerrordata.md
|
||||
- docs/components/providersort.md
|
||||
- docs/components/publicendpoint.md
|
||||
- docs/components/publicendpointquantization.md
|
||||
- docs/components/publicpricing.md
|
||||
@@ -373,7 +382,6 @@ generatedFiles:
|
||||
- docs/components/security.md
|
||||
- docs/components/servicetier.md
|
||||
- docs/components/serviceunavailableresponseerrordata.md
|
||||
- docs/components/sort.md
|
||||
- docs/components/streamoptions.md
|
||||
- docs/components/systemmessage.md
|
||||
- docs/components/systemmessagecontent.md
|
||||
@@ -387,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
|
||||
@@ -412,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
|
||||
@@ -431,9 +441,13 @@ generatedFiles:
|
||||
- docs/errors/toomanyrequestsresponseerror.md
|
||||
- docs/errors/unauthorizedresponseerror.md
|
||||
- docs/errors/unprocessableentityresponseerror.md
|
||||
- docs/models/internal/globals.md
|
||||
- docs/models/utils/retryconfig.md
|
||||
- docs/operations/apitype.md
|
||||
- docs/operations/calldata.md
|
||||
- docs/operations/content.md
|
||||
- docs/operations/contentimageurl.md
|
||||
- docs/operations/contenttext.md
|
||||
- docs/operations/createauthkeyscodecodechallengemethod.md
|
||||
- docs/operations/createauthkeyscodedata.md
|
||||
- docs/operations/createauthkeyscoderequest.md
|
||||
@@ -445,23 +459,20 @@ generatedFiles:
|
||||
- docs/operations/createembeddingsprovider.md
|
||||
- docs/operations/createembeddingsrequest.md
|
||||
- docs/operations/createembeddingsresponse.md
|
||||
- docs/operations/createembeddingsresponsebody.md
|
||||
- docs/operations/createkeysdata.md
|
||||
- docs/operations/createkeyslimitreset.md
|
||||
- docs/operations/createkeysrequest.md
|
||||
- docs/operations/createkeysresponse.md
|
||||
- docs/operations/createresponsesresponse.md
|
||||
- docs/operations/createresponsesresponsebody.md
|
||||
- docs/operations/datacollection.md
|
||||
- docs/operations/deletekeysrequest.md
|
||||
- docs/operations/deletekeysresponse.md
|
||||
- docs/operations/embedding.md
|
||||
- docs/operations/encodingformat.md
|
||||
- docs/operations/encodingformatbase64.md
|
||||
- docs/operations/encodingformatfloat.md
|
||||
- docs/operations/exchangeauthcodeforapikeycodechallengemethod.md
|
||||
- docs/operations/exchangeauthcodeforapikeyrequest.md
|
||||
- docs/operations/exchangeauthcodeforapikeyresponse.md
|
||||
- docs/operations/getcreditsdata.md
|
||||
- docs/operations/getcreditsresponse.md
|
||||
- docs/operations/getcurrentkeydata.md
|
||||
- docs/operations/getcurrentkeyresponse.md
|
||||
@@ -480,7 +491,9 @@ generatedFiles:
|
||||
- docs/operations/getuseractivityrequest.md
|
||||
- docs/operations/getuseractivityresponse.md
|
||||
- docs/operations/ignore.md
|
||||
- docs/operations/imageurl.md
|
||||
- docs/operations/input.md
|
||||
- docs/operations/inputunion.md
|
||||
- docs/operations/listdata.md
|
||||
- docs/operations/listendpointsrequest.md
|
||||
- docs/operations/listendpointsresponse.md
|
||||
@@ -498,9 +511,10 @@ generatedFiles:
|
||||
- docs/operations/order.md
|
||||
- docs/operations/ratelimit.md
|
||||
- docs/operations/sendchatcompletionrequestresponse.md
|
||||
- docs/operations/sort.md
|
||||
- docs/operations/supportedparameter.md
|
||||
- docs/operations/transferintent.md
|
||||
- docs/operations/typeimageurl.md
|
||||
- docs/operations/typetext.md
|
||||
- docs/operations/updatekeysdata.md
|
||||
- docs/operations/updatekeyslimitreset.md
|
||||
- docs/operations/updatekeysrequest.md
|
||||
@@ -523,6 +537,7 @@ generatedFiles:
|
||||
- docs/sdks/responses/README.md
|
||||
- py.typed
|
||||
- pyproject.toml
|
||||
- scripts/prepare_readme.py
|
||||
- scripts/publish.sh
|
||||
- src/openrouter/__init__.py
|
||||
- src/openrouter/_hooks/__init__.py
|
||||
@@ -546,6 +561,7 @@ generatedFiles:
|
||||
- src/openrouter/components/chatgenerationtokenusage.py
|
||||
- src/openrouter/components/chatmessagecontentitem.py
|
||||
- src/openrouter/components/chatmessagecontentitemaudio.py
|
||||
- src/openrouter/components/chatmessagecontentitemcachecontrol.py
|
||||
- src/openrouter/components/chatmessagecontentitemimage.py
|
||||
- src/openrouter/components/chatmessagecontentitemtext.py
|
||||
- src/openrouter/components/chatmessagecontentitemvideo.py
|
||||
@@ -565,6 +581,7 @@ generatedFiles:
|
||||
- src/openrouter/components/completionresponse.py
|
||||
- src/openrouter/components/completionusage.py
|
||||
- src/openrouter/components/createchargerequest.py
|
||||
- src/openrouter/components/datacollection.py
|
||||
- src/openrouter/components/defaultparameters.py
|
||||
- src/openrouter/components/edgenetworktimeoutresponseerrordata.py
|
||||
- src/openrouter/components/endpointstatus.py
|
||||
@@ -634,6 +651,7 @@ generatedFiles:
|
||||
- src/openrouter/components/perrequestlimits.py
|
||||
- src/openrouter/components/providername.py
|
||||
- src/openrouter/components/provideroverloadedresponseerrordata.py
|
||||
- src/openrouter/components/providersort.py
|
||||
- src/openrouter/components/publicendpoint.py
|
||||
- src/openrouter/components/publicpricing.py
|
||||
- src/openrouter/components/quantization.py
|
||||
@@ -702,6 +720,9 @@ generatedFiles:
|
||||
- src/openrouter/errors/unprocessableentityresponse_error.py
|
||||
- src/openrouter/generations.py
|
||||
- src/openrouter/httpclient.py
|
||||
- src/openrouter/models/__init__.py
|
||||
- src/openrouter/models/internal/__init__.py
|
||||
- src/openrouter/models/internal/globals.py
|
||||
- src/openrouter/models_.py
|
||||
- src/openrouter/oauth.py
|
||||
- src/openrouter/operations/__init__.py
|
||||
@@ -755,7 +776,7 @@ examples:
|
||||
createResponses:
|
||||
speakeasy-default-create-responses:
|
||||
requestBody:
|
||||
application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "stream": false}
|
||||
application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "store": false, "service_tier": "auto", "stream": false}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "status": "completed", "content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]}], "error": null, "incomplete_details": null, "usage": {"input_tokens": 10, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 25, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 35}, "max_output_tokens": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
|
||||
@@ -805,7 +826,7 @@ examples:
|
||||
speakeasy-default-get-credits:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {}
|
||||
application/json: {"data": {"total_credits": 100.5, "total_usage": 25.75}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"403":
|
||||
@@ -830,7 +851,7 @@ examples:
|
||||
createEmbeddings:
|
||||
speakeasy-default-create-embeddings:
|
||||
requestBody:
|
||||
application/json: {"input": "<value>", "model": "Taurus", "provider": {"data_collection": "deny", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}}
|
||||
application/json: {"input": "<value>", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
|
||||
@@ -1095,3 +1116,4 @@ examples:
|
||||
"500":
|
||||
application/json: {"error": {"code": "<value>", "message": "<value>"}}
|
||||
examplesVersion: 1.0.2
|
||||
releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: `request` **Changed** **Breaking** :warning:\n* `open_router.embeddings.generate()`: `response.status[200].content[text/event-stream` **Removed** **Breaking** :warning:\n* `open_router.chat.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response.choices.[].message.content.[array].[]` **Changed** **Breaking** :warning:\n* `open_router.credits.get_credits()`: `response.data` **Added**\n* `open_router.parameters.get_parameters()`: `request.provider` **Changed**\n* `open_router.completions.generate()`: `response` **Changed**\n"
|
||||
|
||||
+4
-1
@@ -30,7 +30,7 @@ generation:
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
python:
|
||||
version: 0.0.14
|
||||
version: 0.1.0
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
@@ -62,11 +62,14 @@ python:
|
||||
operations: operations
|
||||
shared: components
|
||||
webhooks: ""
|
||||
inferUnionDiscriminators: true
|
||||
inputModelSuffix: input
|
||||
legacyPyright: false
|
||||
license: Apache-2.0
|
||||
maxMethodParams: 999
|
||||
methodArguments: infer-optional-args
|
||||
moduleName: ""
|
||||
multipartArrayFormat: legacy
|
||||
outputModelSuffix: output
|
||||
packageManager: uv
|
||||
packageName: openrouter
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+199
-131
@@ -1067,6 +1067,7 @@ components:
|
||||
- medium
|
||||
- low
|
||||
- minimal
|
||||
- none
|
||||
x-speakeasy-unknown-values: allow
|
||||
ReasoningSummaryVerbosity:
|
||||
type: string
|
||||
@@ -3239,6 +3240,7 @@ components:
|
||||
- openai-responses-v1
|
||||
- xai-responses-v1
|
||||
- anthropic-claude-v1
|
||||
- google-gemini-v1
|
||||
x-speakeasy-unknown-values: allow
|
||||
example:
|
||||
type: reasoning
|
||||
@@ -3440,51 +3442,51 @@ components:
|
||||
- reasoning.encrypted_content
|
||||
- code_interpreter_call.outputs
|
||||
x-speakeasy-unknown-values: allow
|
||||
DataCollection:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- deny
|
||||
- allow
|
||||
description: >-
|
||||
Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
example: allow
|
||||
x-speakeasy-unknown-values: allow
|
||||
ProviderName:
|
||||
type: string
|
||||
enum:
|
||||
- AnyScale
|
||||
- Cent-ML
|
||||
- HuggingFace
|
||||
- Hyperbolic 2
|
||||
- Lepton
|
||||
- Lynn 2
|
||||
- Lynn
|
||||
- Mancer
|
||||
- Modal
|
||||
- OctoAI
|
||||
- Recursal
|
||||
- Reflection
|
||||
- Replicate
|
||||
- SambaNova 2
|
||||
- SF Compute
|
||||
- Together 2
|
||||
- 01.AI
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee AI
|
||||
- AtlasCloud
|
||||
- Atoma
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
- Cirrascale
|
||||
- Clarifai
|
||||
- Cloudflare
|
||||
- Cohere
|
||||
- CrofAI
|
||||
- Crusoe
|
||||
- DeepInfra
|
||||
- DeepSeek
|
||||
- Enfer
|
||||
- Featherless
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -3493,12 +3495,8 @@ components:
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- InoCloud
|
||||
- Kluster
|
||||
- Lambda
|
||||
- Liquid
|
||||
- Mancer 2
|
||||
- Meta
|
||||
- Minimax
|
||||
- ModelRun
|
||||
- Mistral
|
||||
@@ -3508,7 +3506,6 @@ components:
|
||||
- NCompass
|
||||
- Nebius
|
||||
- NextBit
|
||||
- Nineteen
|
||||
- Novita
|
||||
- Nvidia
|
||||
- OpenAI
|
||||
@@ -3520,10 +3517,10 @@ components:
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Ubicloud
|
||||
- Venice
|
||||
- WandB
|
||||
- xAI
|
||||
@@ -3545,6 +3542,17 @@ components:
|
||||
- unknown
|
||||
example: fp16
|
||||
x-speakeasy-unknown-values: allow
|
||||
ProviderSort:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- price
|
||||
- throughput
|
||||
- latency
|
||||
description: >-
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
example: price
|
||||
x-speakeasy-unknown-values: allow
|
||||
BigNumberUnion:
|
||||
anyOf:
|
||||
- type: number
|
||||
@@ -3644,18 +3652,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'
|
||||
@@ -3683,20 +3686,7 @@ components:
|
||||
description: >-
|
||||
Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
|
||||
data_collection:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- deny
|
||||
- allow
|
||||
example: deny
|
||||
description: >
|
||||
Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
x-speakeasy-unknown-values: allow
|
||||
$ref: '#/components/schemas/DataCollection'
|
||||
zdr:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@@ -3743,16 +3733,7 @@ components:
|
||||
$ref: '#/components/schemas/Quantization'
|
||||
description: A list of quantization levels to filter the provider by.
|
||||
sort:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- price
|
||||
- throughput
|
||||
- latency
|
||||
example: price
|
||||
description: >-
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
x-speakeasy-unknown-values: allow
|
||||
$ref: '#/components/schemas/ProviderSort'
|
||||
max_price:
|
||||
type: object
|
||||
properties:
|
||||
@@ -3821,6 +3802,14 @@ 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
|
||||
@@ -3984,6 +3973,8 @@ components:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image_token:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image_output:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
audio:
|
||||
@@ -4428,6 +4419,8 @@ components:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image_token:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
image_output:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
audio:
|
||||
@@ -4625,6 +4618,8 @@ components:
|
||||
const: text
|
||||
text:
|
||||
type: string
|
||||
cache_control:
|
||||
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
|
||||
required:
|
||||
- type
|
||||
- text
|
||||
@@ -4664,15 +4659,6 @@ components:
|
||||
type: string
|
||||
format:
|
||||
type: string
|
||||
enum:
|
||||
- wav
|
||||
- mp3
|
||||
- flac
|
||||
- m4a
|
||||
- ogg
|
||||
- pcm16
|
||||
- pcm24
|
||||
x-speakeasy-unknown-values: allow
|
||||
required:
|
||||
- data
|
||||
- format
|
||||
@@ -4680,21 +4666,38 @@ components:
|
||||
- type
|
||||
- input_audio
|
||||
ChatMessageContentItemVideo:
|
||||
oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: input_video
|
||||
video_url:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
required:
|
||||
- url
|
||||
required:
|
||||
- type
|
||||
- video_url
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: video_url
|
||||
video_url:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
required:
|
||||
- url
|
||||
required:
|
||||
- type
|
||||
- video_url
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: input_video
|
||||
video_url:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
required:
|
||||
- url
|
||||
required:
|
||||
- type
|
||||
- video_url
|
||||
ChatMessageContentItem:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ChatMessageContentItemText'
|
||||
@@ -4709,6 +4712,7 @@ components:
|
||||
image_url: '#/components/schemas/ChatMessageContentItemImage'
|
||||
input_audio: '#/components/schemas/ChatMessageContentItemAudio'
|
||||
input_video: '#/components/schemas/ChatMessageContentItemVideo'
|
||||
video_url: '#/components/schemas/ChatMessageContentItemVideo'
|
||||
ChatMessageToolCall:
|
||||
type: object
|
||||
properties:
|
||||
@@ -4881,6 +4885,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:
|
||||
@@ -5111,6 +5129,7 @@ components:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- none
|
||||
- minimal
|
||||
- low
|
||||
- medium
|
||||
@@ -5191,6 +5210,11 @@ components:
|
||||
- type: 'null'
|
||||
user:
|
||||
type: string
|
||||
debug:
|
||||
type: object
|
||||
properties:
|
||||
echo_upstream_body:
|
||||
type: boolean
|
||||
required:
|
||||
- messages
|
||||
ChatResponseChoice:
|
||||
@@ -5591,6 +5615,12 @@ components:
|
||||
- type: 'null'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/CompletionFinishReason'
|
||||
native_finish_reason:
|
||||
type: string
|
||||
reasoning:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
required:
|
||||
- text
|
||||
- index
|
||||
@@ -5608,6 +5638,8 @@ components:
|
||||
type: number
|
||||
model:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
system_fingerprint:
|
||||
type: string
|
||||
choices:
|
||||
@@ -5623,7 +5655,7 @@ components:
|
||||
- model
|
||||
- choices
|
||||
additionalProperties: false
|
||||
parameters: {}
|
||||
parameters: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}}
|
||||
securitySchemes:
|
||||
apiKey:
|
||||
type: http
|
||||
@@ -5826,6 +5858,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:
|
||||
@@ -5998,8 +6050,57 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
- type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
content:
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- text
|
||||
text:
|
||||
type: string
|
||||
required:
|
||||
- type
|
||||
- text
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- image_url
|
||||
image_url:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
required:
|
||||
- url
|
||||
required:
|
||||
- type
|
||||
- image_url
|
||||
required:
|
||||
- content
|
||||
model:
|
||||
type: string
|
||||
encoding_format:
|
||||
type: string
|
||||
enum:
|
||||
- float
|
||||
- base64
|
||||
x-speakeasy-unknown-values: allow
|
||||
dimensions:
|
||||
type: integer
|
||||
minimum: 0
|
||||
exclusiveMinimum: true
|
||||
user:
|
||||
type: string
|
||||
provider:
|
||||
type: object
|
||||
properties:
|
||||
@@ -6019,20 +6120,7 @@ paths:
|
||||
description: >-
|
||||
Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
|
||||
data_collection:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- deny
|
||||
- allow
|
||||
example: deny
|
||||
description: >
|
||||
Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
x-speakeasy-unknown-values: allow
|
||||
$ref: '#/components/schemas/DataCollection'
|
||||
zdr:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@@ -6079,16 +6167,7 @@ paths:
|
||||
$ref: '#/components/schemas/Quantization'
|
||||
description: A list of quantization levels to filter the provider by.
|
||||
sort:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- price
|
||||
- throughput
|
||||
- latency
|
||||
example: price
|
||||
description: >-
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
x-speakeasy-unknown-values: allow
|
||||
$ref: '#/components/schemas/ProviderSort'
|
||||
max_price:
|
||||
type: object
|
||||
properties:
|
||||
@@ -6105,15 +6184,7 @@ paths:
|
||||
additionalProperties: false
|
||||
description: >-
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
encoding_format:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- float
|
||||
- type: string
|
||||
enum:
|
||||
- base64
|
||||
user:
|
||||
input_type:
|
||||
type: string
|
||||
required:
|
||||
- input
|
||||
@@ -6171,11 +6242,6 @@ paths:
|
||||
- object
|
||||
- data
|
||||
- model
|
||||
text/event-stream:
|
||||
schema:
|
||||
type: string
|
||||
description: Not used for embeddings - embeddings do not support streaming
|
||||
x-speakeasy-sse-sentinel: '[DONE]'
|
||||
'400':
|
||||
description: Bad Request - Invalid request parameters or malformed input
|
||||
content:
|
||||
@@ -6708,27 +6774,29 @@ paths:
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee AI
|
||||
- AtlasCloud
|
||||
- Atoma
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
- Cirrascale
|
||||
- Clarifai
|
||||
- Cloudflare
|
||||
- Cohere
|
||||
- CrofAI
|
||||
- Crusoe
|
||||
- DeepInfra
|
||||
- DeepSeek
|
||||
- Enfer
|
||||
- Featherless
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -6737,11 +6805,8 @@ paths:
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Kluster
|
||||
- Lambda
|
||||
- Liquid
|
||||
- Mancer 2
|
||||
- Meta
|
||||
- Minimax
|
||||
- ModelRun
|
||||
- Mistral
|
||||
@@ -6751,7 +6816,6 @@ paths:
|
||||
- NCompass
|
||||
- Nebius
|
||||
- NextBit
|
||||
- Nineteen
|
||||
- Novita
|
||||
- Nvidia
|
||||
- OpenAI
|
||||
@@ -6763,10 +6827,10 @@ paths:
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Ubicloud
|
||||
- Venice
|
||||
- WandB
|
||||
- xAI
|
||||
@@ -8369,3 +8433,7 @@ x-retry-strategy:
|
||||
initialDelay: 500
|
||||
maxDelay: 60000
|
||||
maxAttempts: 3
|
||||
x-speakeasy-globals:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/AppIdentifier"
|
||||
- $ref: "#/components/parameters/AppDisplayName"
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
speakeasyVersion: 1.656.2
|
||||
speakeasyVersion: 1.668.0
|
||||
sources:
|
||||
-OAS:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||
tags:
|
||||
- latest
|
||||
- speakeasy-sdk-regen-1763684529
|
||||
targets:
|
||||
open-router:
|
||||
source: -OAS
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
# OpenRouter SDK (Beta)
|
||||
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
||||
|
||||
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
||||
|
||||
<!-- No Summary [summary] -->
|
||||
|
||||
<!-- No Table of Contents [toc] -->
|
||||
|
||||
<!-- Start SDK Installation [installation] -->
|
||||
## SDK Installation
|
||||
|
||||
> [!NOTE]
|
||||
> **Python version upgrade policy**
|
||||
>
|
||||
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
||||
|
||||
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
||||
|
||||
### uv
|
||||
|
||||
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
||||
|
||||
```bash
|
||||
uv add openrouter
|
||||
```
|
||||
|
||||
### PIP
|
||||
|
||||
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
||||
|
||||
```bash
|
||||
pip install openrouter
|
||||
```
|
||||
|
||||
### Poetry
|
||||
|
||||
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
||||
|
||||
```bash
|
||||
poetry add openrouter
|
||||
```
|
||||
|
||||
### Shell and script usage with `uv`
|
||||
|
||||
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
||||
|
||||
```shell
|
||||
uvx --from openrouter python
|
||||
```
|
||||
|
||||
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
||||
|
||||
```python
|
||||
#!/usr/bin/env -S uv run --script
|
||||
# /// script
|
||||
# requires-python = ">=3.9"
|
||||
# dependencies = [
|
||||
# "openrouter",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
from openrouter import OpenRouter
|
||||
|
||||
sdk = OpenRouter(
|
||||
# SDK arguments
|
||||
)
|
||||
|
||||
# Rest of script here...
|
||||
```
|
||||
|
||||
Once that is saved to a file, you can run it with `uv run script.py` where
|
||||
`script.py` can be replaced with the actual file name.
|
||||
<!-- End SDK Installation [installation] -->
|
||||
|
||||
<!-- Start Requirements [requirements] -->
|
||||
## Requirements
|
||||
|
||||
This SDK requires Python 3.9 or higher. For Python version support policy, see the SDK Installation section above.
|
||||
<!-- End Requirements [requirements] -->
|
||||
|
||||
<!-- Start IDE Support [idesupport] -->
|
||||
## IDE Support
|
||||
|
||||
### PyCharm
|
||||
|
||||
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
||||
|
||||
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
||||
<!-- End IDE Support [idesupport] -->
|
||||
|
||||
<!-- No SDK Example Usage [usage] -->
|
||||
## SDK Usage
|
||||
|
||||
```python
|
||||
# Synchronous Example
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.chat.send(messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], model="anthropic/claude-4.5-sonnet", provider={
|
||||
"zdr": True,
|
||||
"sort": "price",
|
||||
}, stream=True)
|
||||
|
||||
for event in event_stream:
|
||||
# handle event
|
||||
print(event, flush=True)
|
||||
```
|
||||
|
||||
</br>
|
||||
|
||||
The same SDK client can also be used to make asynchronous requests by importing asyncio.
|
||||
|
||||
```python
|
||||
# Asynchronous Example
|
||||
import asyncio
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
async def main():
|
||||
|
||||
async with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = await open_router.chat.send_async(messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], model="anthropic/claude-4.5-sonnet", provider={
|
||||
"zdr": True,
|
||||
"sort": "price",
|
||||
}, stream=True)
|
||||
|
||||
async for event in event_stream:
|
||||
# handle event
|
||||
print(event, flush=True)
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
<!-- No Authentication [security] -->
|
||||
|
||||
<!-- No Available Resources and Operations [operations] -->
|
||||
|
||||
<!-- No Standalone functions [standalone-funcs] -->
|
||||
|
||||
<!-- No React hooks with TanStack Query [react-query] -->
|
||||
|
||||
<!-- No Server-sent event streaming [eventstream] -->
|
||||
|
||||
<!-- No Retries [retries] -->
|
||||
|
||||
<!-- No Error Handling [errors] -->
|
||||
|
||||
<!-- No Server Selection [server] -->
|
||||
|
||||
<!-- No Custom HTTP Client [http-client] -->
|
||||
|
||||
<!-- Start Resource Management [resource-management] -->
|
||||
## Resource Management
|
||||
|
||||
The `OpenRouter` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
||||
|
||||
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
||||
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
def main():
|
||||
|
||||
with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
|
||||
|
||||
# Or when using async:
|
||||
async def amain():
|
||||
|
||||
async with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
```
|
||||
<!-- End Resource Management [resource-management] -->
|
||||
|
||||
<!-- Start Debugging [debug] -->
|
||||
## Debugging
|
||||
|
||||
You can setup your SDK to emit debug logs for SDK requests and responses.
|
||||
|
||||
You can pass your own logger class directly into your SDK.
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
s = OpenRouter(debug_logger=logging.getLogger("openrouter"))
|
||||
```
|
||||
|
||||
You can also enable a default debug logger by setting an environment variable `OPENROUTER_DEBUG` to true.
|
||||
<!-- End Debugging [debug] -->
|
||||
|
||||
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
||||
|
||||
# Development
|
||||
|
||||
## Running Tests
|
||||
|
||||
To run the test suite, you'll need to set up your environment with an OpenRouter API key.
|
||||
|
||||
### Local Development
|
||||
|
||||
1. Copy the example environment file:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. Edit `.env` and add your OpenRouter API key:
|
||||
|
||||
```bash
|
||||
OPENROUTER_API_KEY=your_api_key_here
|
||||
```
|
||||
|
||||
3. Run the tests:
|
||||
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
|
||||
## Maturity
|
||||
|
||||
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
||||
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
||||
looking for the latest version.
|
||||
@@ -1,5 +1,3 @@
|
||||

|
||||
|
||||
# OpenRouter SDK (Beta)
|
||||
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
## 2025-11-15 18:16:18
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.658.1 (2.755.6) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.0.16] .
|
||||
### Releases
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
|
||||
## 2025-12-04 00:22:56
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.668.0 (2.770.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.1.0] .
|
||||
### Releases
|
||||
- [PyPI v0.1.0] https://pypi.org/project/openrouter/0.1.0 - .
|
||||
@@ -49,7 +49,7 @@ with OpenRouter(
|
||||
},
|
||||
},
|
||||
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||
"data_collection": "deny",
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
@@ -127,7 +127,7 @@ async def main():
|
||||
},
|
||||
},
|
||||
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||
"data_collection": "deny",
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
|
||||
@@ -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 |
|
||||
@@ -27,3 +27,9 @@ value: components.ChatMessageContentItemAudio = /* values here */
|
||||
value: components.ChatMessageContentItemVideo = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemVideo`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideo = /* 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 |
|
||||
@@ -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 |
|
||||
@@ -1,9 +1,17 @@
|
||||
# ChatMessageContentItemVideo
|
||||
|
||||
|
||||
## Fields
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatMessageContentItemVideoInputVideo`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideoInputVideo = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemVideoVideoURL`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideoVideoURL = /* values here */
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL](../components/videourl.md) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatMessageContentItemVideoInputVideo
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatMessageContentItemVideoVideoURL
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A |
|
||||
@@ -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 |
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Debug
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `NONE` | none |
|
||||
| `MINIMAL` | minimal |
|
||||
| `LOW` | low |
|
||||
| `MEDIUM` | medium |
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# IDResponseHealing
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `RESPONSE_HEALING` | response-healing |
|
||||
@@ -8,4 +8,5 @@
|
||||
| `HIGH` | high |
|
||||
| `MEDIUM` | medium |
|
||||
| `LOW` | low |
|
||||
| `MINIMAL` | minimal |
|
||||
| `MINIMAL` | minimal |
|
||||
| `NONE` | none |
|
||||
@@ -8,4 +8,5 @@
|
||||
| `UNKNOWN` | unknown |
|
||||
| `OPENAI_RESPONSES_V1` | openai-responses-v1 |
|
||||
| `XAI_RESPONSES_V1` | xai-responses-v1 |
|
||||
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
|
||||
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
|
||||
| `GOOGLE_GEMINI_V1` | google-gemini-v1 |
|
||||
@@ -27,8 +27,8 @@ Request schema for Responses endpoint
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `store` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
|
||||
@@ -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,6 +9,7 @@
|
||||
| `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
|
||||
@@ -9,12 +9,12 @@ When multiple model providers are available, optionally indicate your routing pr
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
|
||||
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/>- deny: use only providers which do not collect user data.<br/> | deny |
|
||||
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
|
||||
| `order` | List[[components.Order](../components/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
|
||||
| `only` | List[[components.Only](../components/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
|
||||
| `ignore` | List[[components.Ignore](../components/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
|
||||
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
|
||||
| `sort` | [OptionalNullable[components.Sort]](../components/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
|
||||
| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
|
||||
| `max_price` | [Optional[components.MaxPrice]](../components/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
|
||||
@@ -3,91 +3,71 @@
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `ANY_SCALE` | AnyScale |
|
||||
| `CENT_ML` | Cent-ML |
|
||||
| `HUGGING_FACE` | HuggingFace |
|
||||
| `HYPERBOLIC_2` | Hyperbolic 2 |
|
||||
| `LEPTON` | Lepton |
|
||||
| `LYNN_2` | Lynn 2 |
|
||||
| `LYNN` | Lynn |
|
||||
| `MANCER` | Mancer |
|
||||
| `MODAL` | Modal |
|
||||
| `OCTO_AI` | OctoAI |
|
||||
| `RECURSAL` | Recursal |
|
||||
| `REFLECTION` | Reflection |
|
||||
| `REPLICATE` | Replicate |
|
||||
| `SAMBA_NOVA_2` | SambaNova 2 |
|
||||
| `SF_COMPUTE` | SF Compute |
|
||||
| `TOGETHER_2` | Together 2 |
|
||||
| `ONE_DOT_AI` | 01.AI |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `ATOMA` | Atoma |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CROF_AI` | CrofAI |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `ENFER` | Enfer |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `INO_CLOUD` | InoCloud |
|
||||
| `KLUSTER` | Kluster |
|
||||
| `LAMBDA` | Lambda |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `META` | Meta |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NINETEEN` | Nineteen |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
| `UBICLOUD` | Ubicloud |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
| Name | Value |
|
||||
| ------------------- | ------------------- |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `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 |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Sort
|
||||
# ProviderSort
|
||||
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
|
||||
@@ -11,6 +11,7 @@ Pricing information for the model
|
||||
| `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `AUTO` | auto |
|
||||
| `DEFAULT` | default |
|
||||
| `FLEX` | flex |
|
||||
| `PRIORITY` | priority |
|
||||
| `SCALE` | scale |
|
||||
| Name | Value |
|
||||
| ------ | ------ |
|
||||
| `AUTO` | auto |
|
||||
@@ -1,8 +1,9 @@
|
||||
# EncodingFormatFloat
|
||||
# TTL
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `FLOAT` | float |
|
||||
| `FIVEM` | 5m |
|
||||
| `ONEH` | 1h |
|
||||
@@ -0,0 +1,8 @@
|
||||
# VideoURL1
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,8 @@
|
||||
# VideoURL2
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# Globals
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> |
|
||||
| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> |
|
||||
@@ -0,0 +1,17 @@
|
||||
# Content
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `operations.ContentText`
|
||||
|
||||
```python
|
||||
value: operations.ContentText = /* values here */
|
||||
```
|
||||
|
||||
### `operations.ContentImageURL`
|
||||
|
||||
```python
|
||||
value: operations.ContentImageURL = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# ContentImageURL
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `type` | [operations.TypeImageURL](../operations/typeimageurl.md) | :heavy_check_mark: | N/A |
|
||||
| `image_url` | [operations.ImageURL](../operations/imageurl.md) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ContentText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | [operations.TypeText](../operations/typetext.md) | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -7,12 +7,12 @@
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
|
||||
| `data_collection` | [OptionalNullable[operations.DataCollection]](../operations/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/>- deny: use only providers which do not collect user data.<br/> | deny |
|
||||
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
|
||||
| `order` | List[[operations.Order](../operations/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
|
||||
| `only` | List[[operations.Only](../operations/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
|
||||
| `ignore` | List[[operations.Ignore](../operations/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
|
||||
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
|
||||
| `sort` | [OptionalNullable[operations.Sort]](../operations/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
|
||||
| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
|
||||
| `max_price` | [Optional[operations.MaxPrice]](../operations/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
|
||||
@@ -5,8 +5,10 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||
| `input` | [operations.Input](../operations/input.md) | :heavy_check_mark: | N/A |
|
||||
| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
|
||||
| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
|
||||
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +1,14 @@
|
||||
# CreateEmbeddingsResponse
|
||||
|
||||
Embedding response
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `operations.CreateEmbeddingsResponseBody`
|
||||
|
||||
```python
|
||||
value: operations.CreateEmbeddingsResponseBody = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
|
||||
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,14 +0,0 @@
|
||||
# CreateEmbeddingsResponseBody
|
||||
|
||||
Embedding response
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
|
||||
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,14 +0,0 @@
|
||||
# DataCollection
|
||||
|
||||
Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `DENY` | deny |
|
||||
| `ALLOW` | allow |
|
||||
@@ -1,17 +1,9 @@
|
||||
# EncodingFormat
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `operations.EncodingFormatFloat`
|
||||
|
||||
```python
|
||||
value: operations.EncodingFormatFloat = /* values here */
|
||||
```
|
||||
|
||||
### `operations.EncodingFormatBase64`
|
||||
|
||||
```python
|
||||
value: operations.EncodingFormatBase64 = /* values here */
|
||||
```
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| -------- | -------- |
|
||||
| `FLOAT` | float |
|
||||
| `BASE64` | base64 |
|
||||
@@ -1,8 +0,0 @@
|
||||
# EncodingFormatBase64
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| -------- | -------- |
|
||||
| `BASE64` | base64 |
|
||||
@@ -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/>} |
|
||||
@@ -3,73 +3,71 @@
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `ATOMA` | Atoma |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CROF_AI` | CrofAI |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `ENFER` | Enfer |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `KLUSTER` | Kluster |
|
||||
| `LAMBDA` | Lambda |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `META` | Meta |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NINETEEN` | Nineteen |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
| `UBICLOUD` | Ubicloud |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
| Name | Value |
|
||||
| ------------------- | ------------------- |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `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 |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -1,4 +1,4 @@
|
||||
# VideoURL
|
||||
# ImageURL
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,29 +1,8 @@
|
||||
# Input
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[str]`
|
||||
|
||||
```python
|
||||
value: List[str] = /* values here */
|
||||
```
|
||||
|
||||
### `List[float]`
|
||||
|
||||
```python
|
||||
value: List[float] = /* values here */
|
||||
```
|
||||
|
||||
### `List[List[float]]`
|
||||
|
||||
```python
|
||||
value: List[List[float]] = /* values here */
|
||||
```
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
|
||||
| `content` | List[[operations.Content](../operations/content.md)] | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,35 @@
|
||||
# InputUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[str]`
|
||||
|
||||
```python
|
||||
value: List[str] = /* values here */
|
||||
```
|
||||
|
||||
### `List[float]`
|
||||
|
||||
```python
|
||||
value: List[float] = /* values here */
|
||||
```
|
||||
|
||||
### `List[List[float]]`
|
||||
|
||||
```python
|
||||
value: List[List[float]] = /* values here */
|
||||
```
|
||||
|
||||
### `List[operations.Input]`
|
||||
|
||||
```python
|
||||
value: List[operations.Input] = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Sort
|
||||
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
@@ -0,0 +1,8 @@
|
||||
# TypeImageURL
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ----------- | ----------- |
|
||||
| `IMAGE_URL` | image_url |
|
||||
@@ -0,0 +1,8 @@
|
||||
# TypeText
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------ | ------ |
|
||||
| `TEXT` | text |
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@ with OpenRouter(
|
||||
) as open_router:
|
||||
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus", provider={
|
||||
"data_collection": "deny",
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
@@ -54,11 +54,13 @@ with OpenRouter(
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
||||
| `input` | [operations.Input](../../operations/input.md) | :heavy_check_mark: | N/A |
|
||||
| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
|
||||
| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
|
||||
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
|
||||
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
|
||||
### Response
|
||||
|
||||
@@ -65,7 +65,7 @@ with OpenRouter(
|
||||
},
|
||||
},
|
||||
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||
"data_collection": "deny",
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
@@ -112,8 +112,7 @@ with OpenRouter(
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
|
||||
+4
-2
@@ -1,15 +1,17 @@
|
||||
[project]
|
||||
name = "openrouter"
|
||||
version = "0.0.14"
|
||||
version = "0.1.0"
|
||||
description = "Official Python Client SDK for OpenRouter."
|
||||
authors = [{ name = "OpenRouter" },]
|
||||
readme = "README.md"
|
||||
readme = "README-PYPI.md"
|
||||
requires-python = ">=3.9.2"
|
||||
dependencies = [
|
||||
"httpcore >=1.0.9",
|
||||
"httpx >=0.28.1",
|
||||
"pydantic >=2.11.2",
|
||||
]
|
||||
urls.repository = "https://github.com/OpenRouterTeam/python-sdk.git"
|
||||
license = { text = "Apache-2.0" }
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
import re
|
||||
import shutil
|
||||
|
||||
try:
|
||||
with open("README.md", "r", encoding="utf-8") as rh:
|
||||
readme_contents = rh.read()
|
||||
GITHUB_URL = "https://github.com/OpenRouterTeam/python-sdk.git"
|
||||
GITHUB_URL = (
|
||||
GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL
|
||||
)
|
||||
REPO_SUBDIR = ""
|
||||
# links on PyPI should have absolute URLs
|
||||
readme_contents = re.sub(
|
||||
r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))",
|
||||
lambda m: m.group(1)
|
||||
+ GITHUB_URL
|
||||
+ "/blob/master/"
|
||||
+ REPO_SUBDIR
|
||||
+ m.group(2)
|
||||
+ m.group(3),
|
||||
readme_contents,
|
||||
)
|
||||
|
||||
with open("README-PYPI.md", "w", encoding="utf-8") as wh:
|
||||
wh.write(readme_contents)
|
||||
except Exception as e:
|
||||
try:
|
||||
print("Failed to rewrite README.md to README-PYPI.md, copying original instead")
|
||||
print(e)
|
||||
shutil.copyfile("README.md", "README-PYPI.md")
|
||||
except Exception as ie:
|
||||
print("Failed to copy README.md to README-PYPI.md")
|
||||
print(ie)
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
uv run python scripts/prepare_readme.py
|
||||
|
||||
uv build
|
||||
uv publish --token $PYPI_TOKEN
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.0.14"
|
||||
__version__: str = "0.1.0"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.753.6"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.14 2.753.6 1.0.0 openrouter"
|
||||
__gen_version__: str = "2.770.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.1.0 2.770.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -6,7 +6,7 @@ from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
from openrouter.utils import get_security_from_env
|
||||
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, List, Mapping, Optional
|
||||
from typing import Any, Mapping, Optional
|
||||
|
||||
|
||||
class Analytics(BaseSDK):
|
||||
@@ -20,7 +20,7 @@ class Analytics(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> List[components.ActivityItem]:
|
||||
) -> operations.GetUserActivityResponse:
|
||||
r"""Get user activity grouped by endpoint
|
||||
|
||||
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
||||
@@ -58,6 +58,7 @@ class Analytics(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -128,7 +129,7 @@ class Analytics(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> List[components.ActivityItem]:
|
||||
) -> operations.GetUserActivityResponse:
|
||||
r"""Get user activity grouped by endpoint
|
||||
|
||||
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
||||
@@ -166,6 +167,7 @@ class Analytics(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
+23
-11
@@ -7,7 +7,7 @@ from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
from openrouter.utils import get_security_from_env
|
||||
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, List, Mapping, Optional
|
||||
from typing import Any, Mapping, Optional
|
||||
|
||||
|
||||
class APIKeys(BaseSDK):
|
||||
@@ -22,7 +22,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> List[operations.ListData]:
|
||||
) -> operations.ListResponse:
|
||||
r"""List API keys
|
||||
|
||||
:param include_disabled: Whether to include disabled API keys in the response
|
||||
@@ -60,6 +60,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -126,7 +127,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> List[operations.ListData]:
|
||||
) -> operations.ListResponse:
|
||||
r"""List API keys
|
||||
|
||||
:param include_disabled: Whether to include disabled API keys in the response
|
||||
@@ -164,6 +165,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -233,7 +235,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateKeysData:
|
||||
) -> operations.CreateKeysResponse:
|
||||
r"""Create a new API key
|
||||
|
||||
:param name: Name for the new API key
|
||||
@@ -280,6 +282,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", operations.CreateKeysRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -354,7 +357,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateKeysData:
|
||||
) -> operations.CreateKeysResponse:
|
||||
r"""Create a new API key
|
||||
|
||||
:param name: Name for the new API key
|
||||
@@ -401,6 +404,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", operations.CreateKeysRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -476,7 +480,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.UpdateKeysData:
|
||||
) -> operations.UpdateKeysResponse:
|
||||
r"""Update an API key
|
||||
|
||||
:param hash: The hash identifier of the API key to update
|
||||
@@ -527,6 +531,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -607,7 +612,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.UpdateKeysData:
|
||||
) -> operations.UpdateKeysResponse:
|
||||
r"""Update an API key
|
||||
|
||||
:param hash: The hash identifier of the API key to update
|
||||
@@ -658,6 +663,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -769,6 +775,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -875,6 +882,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -945,7 +953,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.GetKeyData:
|
||||
) -> operations.GetKeyResponse:
|
||||
r"""Get a single API key
|
||||
|
||||
:param hash: The hash identifier of the API key to retrieve
|
||||
@@ -981,6 +989,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1051,7 +1060,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.GetKeyData:
|
||||
) -> operations.GetKeyResponse:
|
||||
r"""Get a single API key
|
||||
|
||||
:param hash: The hash identifier of the API key to retrieve
|
||||
@@ -1087,6 +1096,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1156,7 +1166,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.GetCurrentKeyData:
|
||||
) -> operations.GetCurrentKeyResponse:
|
||||
r"""Get current API key
|
||||
|
||||
Get information on the API key associated with the current authentication session
|
||||
@@ -1188,6 +1198,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1247,7 +1258,7 @@ class APIKeys(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.GetCurrentKeyData:
|
||||
) -> operations.GetCurrentKeyResponse:
|
||||
r"""Get current API key
|
||||
|
||||
Get information on the API key associated with the current authentication session
|
||||
@@ -1279,6 +1290,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
client = self.sdk_configuration.async_client
|
||||
return self._build_request_with_client(
|
||||
@@ -80,6 +81,7 @@ class BaseSDK:
|
||||
get_serialized_body,
|
||||
url_override,
|
||||
http_headers,
|
||||
allow_empty_value,
|
||||
)
|
||||
|
||||
def _build_request(
|
||||
@@ -102,6 +104,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
client = self.sdk_configuration.client
|
||||
return self._build_request_with_client(
|
||||
@@ -122,6 +125,7 @@ class BaseSDK:
|
||||
get_serialized_body,
|
||||
url_override,
|
||||
http_headers,
|
||||
allow_empty_value,
|
||||
)
|
||||
|
||||
def _build_request_with_client(
|
||||
@@ -145,6 +149,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
query_params = {}
|
||||
|
||||
@@ -160,6 +165,7 @@ class BaseSDK:
|
||||
query_params = utils.get_query_params(
|
||||
request if request_has_query_params else None,
|
||||
_globals if request_has_query_params else None,
|
||||
allow_empty_value,
|
||||
)
|
||||
else:
|
||||
# Pick up the query parameter from the override so they can be
|
||||
|
||||
@@ -61,6 +61,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -92,6 +93,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -144,6 +146,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -175,6 +178,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -226,6 +230,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -257,6 +262,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -305,6 +311,7 @@ class Chat(BaseSDK):
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -323,6 +330,7 @@ class Chat(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.ChatGenerationParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -438,6 +446,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -469,6 +478,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -521,6 +531,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -552,6 +563,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -603,6 +615,7 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -634,6 +647,7 @@ class Chat(BaseSDK):
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -682,6 +696,7 @@ class Chat(BaseSDK):
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -700,6 +715,7 @@ class Chat(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.ChatGenerationParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ class Completions(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -310,6 +311,7 @@ class Completions(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ if TYPE_CHECKING:
|
||||
ChatGenerationParamsStop,
|
||||
ChatGenerationParamsStopTypedDict,
|
||||
ChatGenerationParamsTypedDict,
|
||||
Debug,
|
||||
DebugTypedDict,
|
||||
Effort,
|
||||
Reasoning,
|
||||
ReasoningTypedDict,
|
||||
@@ -54,11 +56,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .chatmessagecontentitemaudio import (
|
||||
ChatMessageContentItemAudio,
|
||||
ChatMessageContentItemAudioFormat,
|
||||
ChatMessageContentItemAudioInputAudio,
|
||||
ChatMessageContentItemAudioInputAudioTypedDict,
|
||||
ChatMessageContentItemAudioTypedDict,
|
||||
)
|
||||
from .chatmessagecontentitemcachecontrol import (
|
||||
ChatMessageContentItemCacheControl,
|
||||
ChatMessageContentItemCacheControlTypedDict,
|
||||
TTL,
|
||||
)
|
||||
from .chatmessagecontentitemimage import (
|
||||
ChatMessageContentItemImage,
|
||||
ChatMessageContentItemImageDetail,
|
||||
@@ -72,9 +78,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .chatmessagecontentitemvideo import (
|
||||
ChatMessageContentItemVideo,
|
||||
ChatMessageContentItemVideoInputVideo,
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoTypedDict,
|
||||
VideoURL,
|
||||
VideoURLTypedDict,
|
||||
ChatMessageContentItemVideoVideoURL,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
VideoURL1,
|
||||
VideoURL1TypedDict,
|
||||
VideoURL2,
|
||||
VideoURL2TypedDict,
|
||||
)
|
||||
from .chatmessagetokenlogprob import (
|
||||
ChatMessageTokenLogprob,
|
||||
@@ -146,6 +158,7 @@ if TYPE_CHECKING:
|
||||
CreateChargeRequest,
|
||||
CreateChargeRequestTypedDict,
|
||||
)
|
||||
from .datacollection import DataCollection
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .edgenetworktimeoutresponseerrordata import (
|
||||
EdgeNetworkTimeoutResponseErrorData,
|
||||
@@ -408,10 +421,10 @@ if TYPE_CHECKING:
|
||||
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
|
||||
)
|
||||
from .openresponsesrequest import (
|
||||
DataCollection,
|
||||
Engine,
|
||||
IDFileParser,
|
||||
IDModeration,
|
||||
IDResponseHealing,
|
||||
IDWeb,
|
||||
Ignore,
|
||||
IgnoreTypedDict,
|
||||
@@ -436,13 +449,14 @@ if TYPE_CHECKING:
|
||||
PluginFileParserTypedDict,
|
||||
PluginModeration,
|
||||
PluginModerationTypedDict,
|
||||
PluginResponseHealing,
|
||||
PluginResponseHealingTypedDict,
|
||||
PluginTypedDict,
|
||||
PluginWeb,
|
||||
PluginWebTypedDict,
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Sort,
|
||||
Truncation,
|
||||
)
|
||||
from .openresponsesresponsetext import (
|
||||
@@ -581,6 +595,7 @@ if TYPE_CHECKING:
|
||||
ProviderOverloadedResponseErrorData,
|
||||
ProviderOverloadedResponseErrorDataTypedDict,
|
||||
)
|
||||
from .providersort import ProviderSort
|
||||
from .publicendpoint import (
|
||||
Pricing,
|
||||
PricingTypedDict,
|
||||
@@ -810,10 +825,11 @@ __all__ = [
|
||||
"ChatGenerationTokenUsageTypedDict",
|
||||
"ChatMessageContentItem",
|
||||
"ChatMessageContentItemAudio",
|
||||
"ChatMessageContentItemAudioFormat",
|
||||
"ChatMessageContentItemAudioInputAudio",
|
||||
"ChatMessageContentItemAudioInputAudioTypedDict",
|
||||
"ChatMessageContentItemAudioTypedDict",
|
||||
"ChatMessageContentItemCacheControl",
|
||||
"ChatMessageContentItemCacheControlTypedDict",
|
||||
"ChatMessageContentItemImage",
|
||||
"ChatMessageContentItemImageDetail",
|
||||
"ChatMessageContentItemImageTypedDict",
|
||||
@@ -821,7 +837,11 @@ __all__ = [
|
||||
"ChatMessageContentItemTextTypedDict",
|
||||
"ChatMessageContentItemTypedDict",
|
||||
"ChatMessageContentItemVideo",
|
||||
"ChatMessageContentItemVideoInputVideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict",
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
"ChatMessageContentItemVideoVideoURL",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict",
|
||||
"ChatMessageTokenLogprob",
|
||||
"ChatMessageTokenLogprobTypedDict",
|
||||
"ChatMessageTokenLogprobs",
|
||||
@@ -882,6 +902,8 @@ __all__ = [
|
||||
"CreateChargeRequest",
|
||||
"CreateChargeRequestTypedDict",
|
||||
"DataCollection",
|
||||
"Debug",
|
||||
"DebugTypedDict",
|
||||
"DefaultParameters",
|
||||
"DefaultParametersTypedDict",
|
||||
"EdgeNetworkTimeoutResponseErrorData",
|
||||
@@ -899,6 +921,7 @@ __all__ = [
|
||||
"ForbiddenResponseErrorDataTypedDict",
|
||||
"IDFileParser",
|
||||
"IDModeration",
|
||||
"IDResponseHealing",
|
||||
"IDWeb",
|
||||
"Ignore",
|
||||
"IgnoreTypedDict",
|
||||
@@ -1192,6 +1215,8 @@ __all__ = [
|
||||
"PluginFileParserTypedDict",
|
||||
"PluginModeration",
|
||||
"PluginModerationTypedDict",
|
||||
"PluginResponseHealing",
|
||||
"PluginResponseHealingTypedDict",
|
||||
"PluginTypedDict",
|
||||
"PluginWeb",
|
||||
"PluginWebTypedDict",
|
||||
@@ -1205,6 +1230,7 @@ __all__ = [
|
||||
"ProviderName",
|
||||
"ProviderOverloadedResponseErrorData",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict",
|
||||
"ProviderSort",
|
||||
"ProviderTypedDict",
|
||||
"PublicEndpoint",
|
||||
"PublicEndpointQuantization",
|
||||
@@ -1310,13 +1336,13 @@ __all__ = [
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"Sort",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"SystemMessage",
|
||||
"SystemMessageContent",
|
||||
"SystemMessageContentTypedDict",
|
||||
"SystemMessageTypedDict",
|
||||
"TTL",
|
||||
"Tokenizer",
|
||||
"TooManyRequestsResponseErrorData",
|
||||
"TooManyRequestsResponseErrorDataTypedDict",
|
||||
@@ -1366,8 +1392,10 @@ __all__ = [
|
||||
"UserMessageTypedDict",
|
||||
"Variables",
|
||||
"VariablesTypedDict",
|
||||
"VideoURL",
|
||||
"VideoURLTypedDict",
|
||||
"VideoURL1",
|
||||
"VideoURL1TypedDict",
|
||||
"VideoURL2",
|
||||
"VideoURL2TypedDict",
|
||||
"WebSearchPreviewToolUserLocation",
|
||||
"WebSearchPreviewToolUserLocationType",
|
||||
"WebSearchPreviewToolUserLocationTypedDict",
|
||||
@@ -1402,6 +1430,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatGenerationParamsStop": ".chatgenerationparams",
|
||||
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
|
||||
"Debug": ".chatgenerationparams",
|
||||
"DebugTypedDict": ".chatgenerationparams",
|
||||
"Effort": ".chatgenerationparams",
|
||||
"Reasoning": ".chatgenerationparams",
|
||||
"ReasoningTypedDict": ".chatgenerationparams",
|
||||
@@ -1414,10 +1444,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageContentItem": ".chatmessagecontentitem",
|
||||
"ChatMessageContentItemTypedDict": ".chatmessagecontentitem",
|
||||
"ChatMessageContentItemAudio": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol",
|
||||
"ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol",
|
||||
"TTL": ".chatmessagecontentitemcachecontrol",
|
||||
"ChatMessageContentItemImage": ".chatmessagecontentitemimage",
|
||||
"ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
|
||||
"ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
|
||||
@@ -1426,9 +1458,15 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageContentItemText": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL": ".chatmessagecontentitemvideo",
|
||||
"VideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1TypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
|
||||
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
|
||||
"TopLogprob": ".chatmessagetokenlogprob",
|
||||
@@ -1488,6 +1526,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChainID": ".createchargerequest",
|
||||
"CreateChargeRequest": ".createchargerequest",
|
||||
"CreateChargeRequestTypedDict": ".createchargerequest",
|
||||
"DataCollection": ".datacollection",
|
||||
"DefaultParameters": ".defaultparameters",
|
||||
"DefaultParametersTypedDict": ".defaultparameters",
|
||||
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata",
|
||||
@@ -1687,10 +1726,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"DataCollection": ".openresponsesrequest",
|
||||
"Engine": ".openresponsesrequest",
|
||||
"IDFileParser": ".openresponsesrequest",
|
||||
"IDModeration": ".openresponsesrequest",
|
||||
"IDResponseHealing": ".openresponsesrequest",
|
||||
"IDWeb": ".openresponsesrequest",
|
||||
"Ignore": ".openresponsesrequest",
|
||||
"IgnoreTypedDict": ".openresponsesrequest",
|
||||
@@ -1715,13 +1754,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"PluginFileParserTypedDict": ".openresponsesrequest",
|
||||
"PluginModeration": ".openresponsesrequest",
|
||||
"PluginModerationTypedDict": ".openresponsesrequest",
|
||||
"PluginResponseHealing": ".openresponsesrequest",
|
||||
"PluginResponseHealingTypedDict": ".openresponsesrequest",
|
||||
"PluginTypedDict": ".openresponsesrequest",
|
||||
"PluginWeb": ".openresponsesrequest",
|
||||
"PluginWebTypedDict": ".openresponsesrequest",
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Sort": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
"OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext",
|
||||
@@ -1834,6 +1874,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ProviderName": ".providername",
|
||||
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
|
||||
"ProviderSort": ".providersort",
|
||||
"Pricing": ".publicendpoint",
|
||||
"PricingTypedDict": ".publicendpoint",
|
||||
"PublicEndpoint": ".publicendpoint",
|
||||
|
||||
@@ -21,9 +21,9 @@ from openrouter.types import (
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_const, validate_open_enum
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -31,6 +31,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
Effort = Union[
|
||||
Literal[
|
||||
"none",
|
||||
"minimal",
|
||||
"low",
|
||||
"medium",
|
||||
@@ -133,16 +134,16 @@ ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsResponseFormatUnion = TypeAliasType(
|
||||
"ChatGenerationParamsResponseFormatUnion",
|
||||
ChatGenerationParamsResponseFormatUnion = Annotated[
|
||||
Union[
|
||||
ChatGenerationParamsResponseFormatText,
|
||||
ChatGenerationParamsResponseFormatJSONObject,
|
||||
ChatGenerationParamsResponseFormatPython,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatTextGrammar,
|
||||
Annotated[ChatGenerationParamsResponseFormatText, Tag("text")],
|
||||
Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
ChatGenerationParamsStopTypedDict = TypeAliasType(
|
||||
@@ -155,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]
|
||||
@@ -178,6 +187,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
user: NotRequired[str]
|
||||
debug: NotRequired[DebugTypedDict]
|
||||
|
||||
|
||||
class ChatGenerationParams(BaseModel):
|
||||
@@ -225,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 = [
|
||||
@@ -249,6 +261,7 @@ class ChatGenerationParams(BaseModel):
|
||||
"tools",
|
||||
"top_p",
|
||||
"user",
|
||||
"debug",
|
||||
]
|
||||
nullable_fields = [
|
||||
"frequency_penalty",
|
||||
|
||||
@@ -26,9 +26,9 @@ from typing_extensions import Annotated, TypeAliasType
|
||||
ChatMessageContentItemTypedDict = TypeAliasType(
|
||||
"ChatMessageContentItemTypedDict",
|
||||
Union[
|
||||
ChatMessageContentItemTextTypedDict,
|
||||
ChatMessageContentItemImageTypedDict,
|
||||
ChatMessageContentItemAudioTypedDict,
|
||||
ChatMessageContentItemTextTypedDict,
|
||||
ChatMessageContentItemVideoTypedDict,
|
||||
],
|
||||
)
|
||||
@@ -40,6 +40,7 @@ ChatMessageContentItem = Annotated[
|
||||
Annotated[ChatMessageContentItemImage, Tag("image_url")],
|
||||
Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("input_video")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("video_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -2,28 +2,51 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class VideoURLTypedDict(TypedDict):
|
||||
class VideoURL2TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL(BaseModel):
|
||||
class VideoURL2(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoTypedDict(TypedDict):
|
||||
video_url: VideoURLTypedDict
|
||||
class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
|
||||
video_url: VideoURL2TypedDict
|
||||
type: Literal["video_url"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoVideoURL(BaseModel):
|
||||
video_url: VideoURL2
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "video_url"
|
||||
|
||||
|
||||
class VideoURL1TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL1(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
|
||||
video_url: VideoURL1TypedDict
|
||||
type: Literal["input_video"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideo(BaseModel):
|
||||
video_url: VideoURL
|
||||
class ChatMessageContentItemVideoInputVideo(BaseModel):
|
||||
video_url: VideoURL1
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
@@ -31,3 +54,21 @@ class ChatMessageContentItemVideo(BaseModel):
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "input_video"
|
||||
|
||||
|
||||
ChatMessageContentItemVideoTypedDict = TypeAliasType(
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
Union[
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ChatMessageContentItemVideo = Annotated[
|
||||
Union[
|
||||
Annotated[ChatMessageContentItemVideoInputVideo, Tag("input_video")],
|
||||
Annotated[ChatMessageContentItemVideoVideoURL, Tag("video_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -16,9 +16,9 @@ from openrouter.types import (
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -127,16 +127,16 @@ CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
CompletionCreateParamsResponseFormatUnion = TypeAliasType(
|
||||
"CompletionCreateParamsResponseFormatUnion",
|
||||
CompletionCreateParamsResponseFormatUnion = Annotated[
|
||||
Union[
|
||||
CompletionCreateParamsResponseFormatText,
|
||||
CompletionCreateParamsResponseFormatJSONObject,
|
||||
CompletionCreateParamsResponseFormatPython,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatTextGrammar,
|
||||
Annotated[CompletionCreateParamsResponseFormatText, Tag("text")],
|
||||
Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class CompletionCreateParamsTypedDict(TypedDict):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
@@ -10,8 +10,9 @@ from .systemmessage import SystemMessage, SystemMessageTypedDict
|
||||
from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict
|
||||
from .usermessage import UserMessage, UserMessageTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -56,13 +57,13 @@ MessageTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Message = TypeAliasType(
|
||||
"Message",
|
||||
Message = Annotated[
|
||||
Union[
|
||||
SystemMessage,
|
||||
UserMessage,
|
||||
MessageDeveloper,
|
||||
ToolResponseMessage,
|
||||
AssistantMessage,
|
||||
Annotated[SystemMessage, Tag("system")],
|
||||
Annotated[UserMessage, Tag("user")],
|
||||
Annotated[MessageDeveloper, Tag("developer")],
|
||||
Annotated[AssistantMessage, Tag("assistant")],
|
||||
Annotated[ToolResponseMessage, Tag("tool")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
||||
]
|
||||
|
||||
@@ -4,8 +4,10 @@ from __future__ import annotations
|
||||
from .filecitation import FileCitation, FileCitationTypedDict
|
||||
from .filepath import FilePath, FilePathTypedDict
|
||||
from .urlcitation import URLCitation, URLCitationTypedDict
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
OpenAIResponsesAnnotationTypedDict = TypeAliasType(
|
||||
@@ -14,6 +16,11 @@ OpenAIResponsesAnnotationTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenAIResponsesAnnotation = TypeAliasType(
|
||||
"OpenAIResponsesAnnotation", Union[FilePath, FileCitation, URLCitation]
|
||||
)
|
||||
OpenAIResponsesAnnotation = Annotated[
|
||||
Union[
|
||||
Annotated[FileCitation, Tag("file_citation")],
|
||||
Annotated[URLCitation, Tag("url_citation")],
|
||||
Annotated[FilePath, Tag("file_path")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -11,6 +11,7 @@ OpenAIResponsesReasoningEffort = Union[
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -48,8 +48,8 @@ from openrouter.types import (
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from openrouter.utils import get_discriminator, validate_open_enum
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -127,16 +127,19 @@ OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenResponsesNonStreamingResponseToolUnion = TypeAliasType(
|
||||
"OpenResponsesNonStreamingResponseToolUnion",
|
||||
OpenResponsesNonStreamingResponseToolUnion = Annotated[
|
||||
Union[
|
||||
OpenResponsesWebSearchPreviewTool,
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
OpenResponsesWebSearchTool,
|
||||
OpenResponsesWebSearch20250826Tool,
|
||||
OpenResponsesNonStreamingResponseToolFunction,
|
||||
Annotated[OpenResponsesNonStreamingResponseToolFunction, Tag("function")],
|
||||
Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")],
|
||||
Annotated[
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
Tag("web_search_preview_2025_03_11"),
|
||||
],
|
||||
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
|
||||
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesNonStreamingResponseTypedDict(TypedDict):
|
||||
|
||||
@@ -57,6 +57,7 @@ OpenResponsesReasoningFormat = Union[
|
||||
"openai-responses-v1",
|
||||
"xai-responses-v1",
|
||||
"anthropic-claude-v1",
|
||||
"google-gemini-v1",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .datacollection import DataCollection
|
||||
from .openairesponsesincludable import OpenAIResponsesIncludable
|
||||
from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict
|
||||
from .openairesponsestoolchoice_union import (
|
||||
@@ -33,6 +34,7 @@ from .openresponseswebsearchtool import (
|
||||
OpenResponsesWebSearchToolTypedDict,
|
||||
)
|
||||
from .providername import ProviderName
|
||||
from .providersort import ProviderSort
|
||||
from .quantization import Quantization
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -42,9 +44,10 @@ from openrouter.types import (
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
@@ -118,30 +121,24 @@ OpenResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenResponsesRequestToolUnion = TypeAliasType(
|
||||
"OpenResponsesRequestToolUnion",
|
||||
OpenResponsesRequestToolUnion = Annotated[
|
||||
Union[
|
||||
OpenResponsesWebSearchPreviewTool,
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
OpenResponsesWebSearchTool,
|
||||
OpenResponsesWebSearch20250826Tool,
|
||||
OpenResponsesRequestToolFunction,
|
||||
Annotated[OpenResponsesRequestToolFunction, Tag("function")],
|
||||
Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")],
|
||||
Annotated[
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
Tag("web_search_preview_2025_03_11"),
|
||||
],
|
||||
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
|
||||
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ServiceTier = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"default",
|
||||
"flex",
|
||||
"priority",
|
||||
"scale",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
ServiceTier = Literal["auto",]
|
||||
|
||||
|
||||
Truncation = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
@@ -151,20 +148,6 @@ Truncation = Union[
|
||||
]
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
|
||||
|
||||
|
||||
@@ -192,17 +175,6 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Sort = Union[
|
||||
Literal[
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
@@ -251,8 +223,8 @@ class ProviderTypedDict(TypedDict):
|
||||
data_collection: NotRequired[Nullable[DataCollection]]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
zdr: NotRequired[Nullable[bool]]
|
||||
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
|
||||
@@ -266,7 +238,7 @@ class ProviderTypedDict(TypedDict):
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
quantizations: NotRequired[Nullable[List[Quantization]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
sort: NotRequired[Nullable[Sort]]
|
||||
sort: NotRequired[Nullable[ProviderSort]]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
max_price: NotRequired[MaxPriceTypedDict]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
@@ -290,8 +262,8 @@ class Provider(BaseModel):
|
||||
] = UNSET
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
|
||||
zdr: OptionalNullable[bool] = UNSET
|
||||
@@ -315,7 +287,7 @@ class Provider(BaseModel):
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: Annotated[
|
||||
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
|
||||
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
@@ -376,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",]
|
||||
|
||||
|
||||
@@ -457,11 +440,24 @@ class PluginModeration(BaseModel):
|
||||
|
||||
PluginTypedDict = TypeAliasType(
|
||||
"PluginTypedDict",
|
||||
Union[PluginModerationTypedDict, PluginFileParserTypedDict, PluginWebTypedDict],
|
||||
Union[
|
||||
PluginModerationTypedDict,
|
||||
PluginResponseHealingTypedDict,
|
||||
PluginFileParserTypedDict,
|
||||
PluginWebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Plugin = TypeAliasType("Plugin", Union[PluginModeration, PluginFileParser, PluginWeb])
|
||||
Plugin = Annotated[
|
||||
Union[
|
||||
Annotated[PluginModeration, Tag("moderation")],
|
||||
Annotated[PluginWeb, Tag("web")],
|
||||
Annotated[PluginFileParser, Tag("file-parser")],
|
||||
Annotated[PluginResponseHealing, Tag("response-healing")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "id", "id")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesRequestTypedDict(TypedDict):
|
||||
@@ -491,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]]
|
||||
@@ -556,11 +552,12 @@ class OpenResponsesRequest(BaseModel):
|
||||
|
||||
safety_identifier: OptionalNullable[str] = UNSET
|
||||
|
||||
store: OptionalNullable[bool] = UNSET
|
||||
STORE: Annotated[
|
||||
Annotated[Optional[Literal[False]], AfterValidator(validate_const(False))],
|
||||
pydantic.Field(alias="store"),
|
||||
] = False
|
||||
|
||||
service_tier: Annotated[
|
||||
OptionalNullable[ServiceTier], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
service_tier: Optional[ServiceTier] = "auto"
|
||||
|
||||
truncation: Annotated[
|
||||
OptionalNullable[Truncation], PlainValidator(validate_open_enum(False))
|
||||
@@ -622,8 +619,6 @@ class OpenResponsesRequest(BaseModel):
|
||||
"include",
|
||||
"background",
|
||||
"safety_identifier",
|
||||
"store",
|
||||
"service_tier",
|
||||
"truncation",
|
||||
"provider",
|
||||
]
|
||||
|
||||
@@ -59,8 +59,10 @@ from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentType
|
||||
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
|
||||
from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import List, Literal, Union
|
||||
from typing_extensions import TypeAliasType, TypedDict
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
TypeResponseReasoningSummaryPartDone = Literal["response.reasoning_summary_part.done",]
|
||||
@@ -328,10 +330,14 @@ Part2TypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Part2 = TypeAliasType(
|
||||
"Part2",
|
||||
Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
|
||||
)
|
||||
Part2 = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[ReasoningTextContent, Tag("reasoning_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesStreamEventResponseContentPartDoneTypedDict(TypedDict):
|
||||
@@ -374,10 +380,14 @@ Part1TypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Part1 = TypeAliasType(
|
||||
"Part1",
|
||||
Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
|
||||
)
|
||||
Part1 = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[ReasoningTextContent, Tag("reasoning_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesStreamEventResponseContentPartAddedTypedDict(TypedDict):
|
||||
@@ -609,36 +619,97 @@ OpenResponsesStreamEventTypedDict = TypeAliasType(
|
||||
r"""Union of all possible event types emitted during response streaming"""
|
||||
|
||||
|
||||
OpenResponsesStreamEvent = TypeAliasType(
|
||||
"OpenResponsesStreamEvent",
|
||||
OpenResponsesStreamEvent = Annotated[
|
||||
Union[
|
||||
OpenResponsesStreamEventResponseCreated,
|
||||
OpenResponsesStreamEventResponseInProgress,
|
||||
OpenResponsesStreamEventResponseCompleted,
|
||||
OpenResponsesStreamEventResponseIncomplete,
|
||||
OpenResponsesStreamEventResponseFailed,
|
||||
OpenResponsesStreamEventResponseOutputItemAdded,
|
||||
OpenResponsesStreamEventResponseOutputItemDone,
|
||||
OpenResponsesImageGenCallCompleted,
|
||||
OpenResponsesImageGenCallGenerating,
|
||||
OpenResponsesImageGenCallInProgress,
|
||||
OpenResponsesErrorEvent,
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
|
||||
OpenResponsesStreamEventResponseRefusalDelta,
|
||||
OpenResponsesReasoningSummaryPartAddedEvent,
|
||||
OpenResponsesStreamEventResponseContentPartAdded,
|
||||
OpenResponsesImageGenCallPartialImage,
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
|
||||
OpenResponsesReasoningDeltaEvent,
|
||||
OpenResponsesReasoningDoneEvent,
|
||||
OpenResponsesStreamEventResponseRefusalDone,
|
||||
OpenResponsesStreamEventResponseReasoningSummaryPartDone,
|
||||
OpenResponsesReasoningSummaryTextDeltaEvent,
|
||||
OpenResponsesReasoningSummaryTextDoneEvent,
|
||||
OpenResponsesStreamEventResponseContentPartDone,
|
||||
OpenResponsesStreamEventResponseOutputTextDelta,
|
||||
OpenResponsesStreamEventResponseOutputTextDone,
|
||||
OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
|
||||
Annotated[OpenResponsesStreamEventResponseCreated, Tag("response.created")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseInProgress, Tag("response.in_progress")
|
||||
],
|
||||
Annotated[OpenResponsesStreamEventResponseCompleted, Tag("response.completed")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseIncomplete, Tag("response.incomplete")
|
||||
],
|
||||
Annotated[OpenResponsesStreamEventResponseFailed, Tag("response.failed")],
|
||||
Annotated[OpenResponsesErrorEvent, Tag("error")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputItemAdded,
|
||||
Tag("response.output_item.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputItemDone,
|
||||
Tag("response.output_item.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseContentPartAdded,
|
||||
Tag("response.content_part.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseContentPartDone,
|
||||
Tag("response.content_part.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextDelta,
|
||||
Tag("response.output_text.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextDone,
|
||||
Tag("response.output_text.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseRefusalDelta, Tag("response.refusal.delta")
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseRefusalDone, Tag("response.refusal.done")
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
|
||||
Tag("response.output_text.annotation.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
|
||||
Tag("response.function_call_arguments.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
|
||||
Tag("response.function_call_arguments.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningDeltaEvent, Tag("response.reasoning_text.delta")
|
||||
],
|
||||
Annotated[OpenResponsesReasoningDoneEvent, Tag("response.reasoning_text.done")],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryPartAddedEvent,
|
||||
Tag("response.reasoning_summary_part.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseReasoningSummaryPartDone,
|
||||
Tag("response.reasoning_summary_part.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryTextDeltaEvent,
|
||||
Tag("response.reasoning_summary_text.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryTextDoneEvent,
|
||||
Tag("response.reasoning_summary_text.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallInProgress,
|
||||
Tag("response.image_generation_call.in_progress"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallGenerating,
|
||||
Tag("response.image_generation_call.generating"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallPartialImage,
|
||||
Tag("response.image_generation_call.partial_image"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallCompleted,
|
||||
Tag("response.image_generation_call.completed"),
|
||||
],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Union of all possible event types emitted during response streaming"""
|
||||
|
||||
@@ -7,8 +7,10 @@ from .openairesponsesrefusalcontent import (
|
||||
)
|
||||
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
OutputMessageRole = Literal["assistant",]
|
||||
@@ -52,9 +54,13 @@ OutputMessageContentTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OutputMessageContent = TypeAliasType(
|
||||
"OutputMessageContent", Union[OpenAIResponsesRefusalContent, ResponseOutputText]
|
||||
)
|
||||
OutputMessageContent = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OutputMessageTypedDict(TypedDict):
|
||||
|
||||
@@ -7,48 +7,33 @@ from typing import Literal, Union
|
||||
|
||||
ProviderName = Union[
|
||||
Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
"Hyperbolic 2",
|
||||
"Lepton",
|
||||
"Lynn 2",
|
||||
"Lynn",
|
||||
"Mancer",
|
||||
"Modal",
|
||||
"OctoAI",
|
||||
"Recursal",
|
||||
"Reflection",
|
||||
"Replicate",
|
||||
"SambaNova 2",
|
||||
"SF Compute",
|
||||
"Together 2",
|
||||
"01.AI",
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
"Arcee AI",
|
||||
"AtlasCloud",
|
||||
"Atoma",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"BytePlus",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
"Cirrascale",
|
||||
"Clarifai",
|
||||
"Cloudflare",
|
||||
"Cohere",
|
||||
"CrofAI",
|
||||
"Crusoe",
|
||||
"DeepInfra",
|
||||
"DeepSeek",
|
||||
"Enfer",
|
||||
"Featherless",
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
"GMICloud",
|
||||
"GoPomelo",
|
||||
"Google",
|
||||
"Google AI Studio",
|
||||
"Groq",
|
||||
@@ -57,12 +42,8 @@ ProviderName = Union[
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"InoCloud",
|
||||
"Kluster",
|
||||
"Lambda",
|
||||
"Liquid",
|
||||
"Mancer 2",
|
||||
"Meta",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
"Mistral",
|
||||
@@ -72,7 +53,6 @@ ProviderName = Union[
|
||||
"NCompass",
|
||||
"Nebius",
|
||||
"NextBit",
|
||||
"Nineteen",
|
||||
"Novita",
|
||||
"Nvidia",
|
||||
"OpenAI",
|
||||
@@ -84,10 +64,10 @@ ProviderName = Union[
|
||||
"SambaNova",
|
||||
"SiliconFlow",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
"Ubicloud",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"xAI",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ProviderSort = Union[
|
||||
Literal[
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
@@ -21,6 +21,8 @@ class PricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -51,6 +53,9 @@ class Pricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class PublicPricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -49,6 +51,9 @@ class PublicPricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ from .responsesformattextjsonschemaconfig import (
|
||||
ResponsesFormatTextJSONSchemaConfig,
|
||||
ResponsesFormatTextJSONSchemaConfigTypedDict,
|
||||
)
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
ResponseFormatTextConfigTypedDict = TypeAliasType(
|
||||
@@ -25,12 +27,12 @@ ResponseFormatTextConfigTypedDict = TypeAliasType(
|
||||
r"""Text response format configuration"""
|
||||
|
||||
|
||||
ResponseFormatTextConfig = TypeAliasType(
|
||||
"ResponseFormatTextConfig",
|
||||
ResponseFormatTextConfig = Annotated[
|
||||
Union[
|
||||
ResponsesFormatText,
|
||||
ResponsesFormatJSONObject,
|
||||
ResponsesFormatTextJSONSchemaConfig,
|
||||
Annotated[ResponsesFormatText, Tag("text")],
|
||||
Annotated[ResponsesFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponsesFormatTextJSONSchemaConfig, Tag("json_schema")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Text response format configuration"""
|
||||
|
||||
@@ -25,8 +25,10 @@ from .responseswebsearchcalloutput import (
|
||||
ResponsesWebSearchCallOutput,
|
||||
ResponsesWebSearchCallOutputTypedDict,
|
||||
)
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
ResponsesOutputItemTypedDict = TypeAliasType(
|
||||
@@ -43,15 +45,15 @@ ResponsesOutputItemTypedDict = TypeAliasType(
|
||||
r"""An output item from the response"""
|
||||
|
||||
|
||||
ResponsesOutputItem = TypeAliasType(
|
||||
"ResponsesOutputItem",
|
||||
ResponsesOutputItem = Annotated[
|
||||
Union[
|
||||
ResponsesWebSearchCallOutput,
|
||||
ResponsesOutputItemFileSearchCall,
|
||||
ResponsesImageGenerationCall,
|
||||
ResponsesOutputMessage,
|
||||
ResponsesOutputItemReasoning,
|
||||
ResponsesOutputItemFunctionCall,
|
||||
Annotated[ResponsesOutputMessage, Tag("message")],
|
||||
Annotated[ResponsesOutputItemReasoning, Tag("reasoning")],
|
||||
Annotated[ResponsesOutputItemFunctionCall, Tag("function_call")],
|
||||
Annotated[ResponsesWebSearchCallOutput, Tag("web_search_call")],
|
||||
Annotated[ResponsesOutputItemFileSearchCall, Tag("file_search_call")],
|
||||
Annotated[ResponsesImageGenerationCall, Tag("image_generation_call")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""An output item from the response"""
|
||||
|
||||
@@ -7,8 +7,10 @@ from .openairesponsesrefusalcontent import (
|
||||
)
|
||||
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
ResponsesOutputMessageRole = Literal["assistant",]
|
||||
@@ -52,10 +54,13 @@ ResponsesOutputMessageContentTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
ResponsesOutputMessageContent = TypeAliasType(
|
||||
"ResponsesOutputMessageContent",
|
||||
Union[OpenAIResponsesRefusalContent, ResponseOutputText],
|
||||
)
|
||||
ResponsesOutputMessageContent = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class ResponsesOutputMessageTypedDict(TypedDict):
|
||||
|
||||
@@ -51,6 +51,7 @@ class Credits(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -147,6 +148,7 @@ class Credits(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -218,7 +220,7 @@ class Credits(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateCoinbaseChargeData:
|
||||
) -> operations.CreateCoinbaseChargeResponse:
|
||||
r"""Create a Coinbase charge for crypto payment
|
||||
|
||||
Create a Coinbase charge for crypto payment
|
||||
@@ -266,6 +268,7 @@ class Credits(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CreateChargeRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -342,7 +345,7 @@ class Credits(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateCoinbaseChargeData:
|
||||
) -> operations.CreateCoinbaseChargeResponse:
|
||||
r"""Create a Coinbase charge for crypto payment
|
||||
|
||||
Create a Coinbase charge for crypto payment
|
||||
@@ -390,6 +393,7 @@ class Credits(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CreateChargeRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user