mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-08 11:22:59 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cbb39da19 |
+4
-6
@@ -1,12 +1,12 @@
|
|||||||
lockVersion: 2.0.0
|
lockVersion: 2.0.0
|
||||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||||
management:
|
management:
|
||||||
docChecksum: b46bf86766cf18470329da1fb2271f4e
|
docChecksum: 342e7e8ea9cb2b7ff1c1860e18d58822
|
||||||
docVersion: 1.0.0
|
docVersion: 1.0.0
|
||||||
speakeasyVersion: 1.666.0
|
speakeasyVersion: 1.666.0
|
||||||
generationVersion: 2.768.0
|
generationVersion: 2.768.0
|
||||||
releaseVersion: 0.3.2
|
releaseVersion: 0.3.0
|
||||||
configChecksum: 684039465cd4c6f0105466ef2833908d
|
configChecksum: 987e66c3a2350c79a554bfc232ca4961
|
||||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||||
published: true
|
published: true
|
||||||
@@ -593,8 +593,6 @@ generatedFiles:
|
|||||||
- docs/operations/metadata.md
|
- docs/operations/metadata.md
|
||||||
- docs/operations/object.md
|
- docs/operations/object.md
|
||||||
- docs/operations/objectembedding.md
|
- docs/operations/objectembedding.md
|
||||||
- docs/operations/providername.md
|
|
||||||
- docs/operations/providerresponse.md
|
|
||||||
- docs/operations/ratelimit.md
|
- docs/operations/ratelimit.md
|
||||||
- docs/operations/sendchatcompletionrequestresponse.md
|
- docs/operations/sendchatcompletionrequestresponse.md
|
||||||
- docs/operations/transferintent.md
|
- docs/operations/transferintent.md
|
||||||
@@ -1003,7 +1001,7 @@ examples:
|
|||||||
id: "<id>"
|
id: "<id>"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto", "provider_responses": []}}
|
application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto"}}
|
||||||
"401":
|
"401":
|
||||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||||
"402":
|
"402":
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ generation:
|
|||||||
skipResponseBodyAssertions: false
|
skipResponseBodyAssertions: false
|
||||||
preApplyUnionDiscriminators: true
|
preApplyUnionDiscriminators: true
|
||||||
python:
|
python:
|
||||||
version: 0.3.2
|
version: 0.3.0
|
||||||
additionalDependencies:
|
additionalDependencies:
|
||||||
dev: {}
|
dev: {}
|
||||||
main: {}
|
main: {}
|
||||||
|
|||||||
@@ -3542,7 +3542,6 @@ components:
|
|||||||
- AI21
|
- AI21
|
||||||
- AionLabs
|
- AionLabs
|
||||||
- Alibaba
|
- Alibaba
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
- Amazon Bedrock
|
||||||
- Amazon Nova
|
- Amazon Nova
|
||||||
- Anthropic
|
- Anthropic
|
||||||
@@ -8111,7 +8110,6 @@ components:
|
|||||||
- AI21
|
- AI21
|
||||||
- AionLabs
|
- AionLabs
|
||||||
- Alibaba
|
- Alibaba
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
- Amazon Bedrock
|
||||||
- Amazon Nova
|
- Amazon Nova
|
||||||
- Anthropic
|
- Anthropic
|
||||||
@@ -10357,130 +10355,6 @@ paths:
|
|||||||
nullable: true
|
nullable: true
|
||||||
description: Router used for the request (e.g., openrouter/auto)
|
description: Router used for the request (e.g., openrouter/auto)
|
||||||
example: openrouter/auto
|
example: openrouter/auto
|
||||||
provider_responses:
|
|
||||||
type: array
|
|
||||||
nullable: true
|
|
||||||
items:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: string
|
|
||||||
endpoint_id:
|
|
||||||
type: string
|
|
||||||
model_permaslug:
|
|
||||||
type: string
|
|
||||||
provider_name:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- AnyScale
|
|
||||||
- Atoma
|
|
||||||
- Cent-ML
|
|
||||||
- CrofAI
|
|
||||||
- Enfer
|
|
||||||
- GoPomelo
|
|
||||||
- HuggingFace
|
|
||||||
- Hyperbolic 2
|
|
||||||
- InoCloud
|
|
||||||
- Kluster
|
|
||||||
- Lambda
|
|
||||||
- Lepton
|
|
||||||
- Lynn 2
|
|
||||||
- Lynn
|
|
||||||
- Mancer
|
|
||||||
- Meta
|
|
||||||
- Modal
|
|
||||||
- Nineteen
|
|
||||||
- OctoAI
|
|
||||||
- Recursal
|
|
||||||
- Reflection
|
|
||||||
- Replicate
|
|
||||||
- SambaNova 2
|
|
||||||
- SF Compute
|
|
||||||
- Targon
|
|
||||||
- Together 2
|
|
||||||
- Ubicloud
|
|
||||||
- 01.AI
|
|
||||||
- AI21
|
|
||||||
- AionLabs
|
|
||||||
- Alibaba
|
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
|
||||||
- Amazon Nova
|
|
||||||
- Anthropic
|
|
||||||
- Arcee AI
|
|
||||||
- AtlasCloud
|
|
||||||
- Avian
|
|
||||||
- Azure
|
|
||||||
- BaseTen
|
|
||||||
- BytePlus
|
|
||||||
- Black Forest Labs
|
|
||||||
- Cerebras
|
|
||||||
- Chutes
|
|
||||||
- Cirrascale
|
|
||||||
- Clarifai
|
|
||||||
- Cloudflare
|
|
||||||
- Cohere
|
|
||||||
- Crusoe
|
|
||||||
- DeepInfra
|
|
||||||
- DeepSeek
|
|
||||||
- Featherless
|
|
||||||
- Fireworks
|
|
||||||
- Friendli
|
|
||||||
- GMICloud
|
|
||||||
- Google
|
|
||||||
- Google AI Studio
|
|
||||||
- Groq
|
|
||||||
- Hyperbolic
|
|
||||||
- Inception
|
|
||||||
- Inceptron
|
|
||||||
- InferenceNet
|
|
||||||
- Infermatic
|
|
||||||
- Inflection
|
|
||||||
- Liquid
|
|
||||||
- Mara
|
|
||||||
- Mancer 2
|
|
||||||
- Minimax
|
|
||||||
- ModelRun
|
|
||||||
- Mistral
|
|
||||||
- Modular
|
|
||||||
- Moonshot AI
|
|
||||||
- Morph
|
|
||||||
- NCompass
|
|
||||||
- Nebius
|
|
||||||
- NextBit
|
|
||||||
- Novita
|
|
||||||
- Nvidia
|
|
||||||
- OpenAI
|
|
||||||
- OpenInference
|
|
||||||
- Parasail
|
|
||||||
- Perplexity
|
|
||||||
- Phala
|
|
||||||
- Relace
|
|
||||||
- SambaNova
|
|
||||||
- Seed
|
|
||||||
- SiliconFlow
|
|
||||||
- Sourceful
|
|
||||||
- Stealth
|
|
||||||
- StreamLake
|
|
||||||
- Switchpoint
|
|
||||||
- Together
|
|
||||||
- Upstage
|
|
||||||
- Venice
|
|
||||||
- WandB
|
|
||||||
- Xiaomi
|
|
||||||
- xAI
|
|
||||||
- Z.AI
|
|
||||||
- FakeProvider
|
|
||||||
status:
|
|
||||||
type: number
|
|
||||||
nullable: true
|
|
||||||
latency:
|
|
||||||
type: number
|
|
||||||
is_byok:
|
|
||||||
type: boolean
|
|
||||||
required:
|
|
||||||
- status
|
|
||||||
description: List of provider responses for this generation, including fallback attempts
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- upstream_id
|
- upstream_id
|
||||||
@@ -10515,7 +10389,6 @@ paths:
|
|||||||
- external_user
|
- external_user
|
||||||
- api_type
|
- api_type
|
||||||
- router
|
- router
|
||||||
- provider_responses
|
|
||||||
description: Generation data
|
description: Generation data
|
||||||
required:
|
required:
|
||||||
- data
|
- data
|
||||||
|
|||||||
@@ -3561,7 +3561,6 @@ components:
|
|||||||
- AI21
|
- AI21
|
||||||
- AionLabs
|
- AionLabs
|
||||||
- Alibaba
|
- Alibaba
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
- Amazon Bedrock
|
||||||
- Amazon Nova
|
- Amazon Nova
|
||||||
- Anthropic
|
- Anthropic
|
||||||
@@ -8125,7 +8124,6 @@ components:
|
|||||||
- AI21
|
- AI21
|
||||||
- AionLabs
|
- AionLabs
|
||||||
- Alibaba
|
- Alibaba
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
- Amazon Bedrock
|
||||||
- Amazon Nova
|
- Amazon Nova
|
||||||
- Anthropic
|
- Anthropic
|
||||||
@@ -10365,131 +10363,6 @@ paths:
|
|||||||
nullable: true
|
nullable: true
|
||||||
description: Router used for the request (e.g., openrouter/auto)
|
description: Router used for the request (e.g., openrouter/auto)
|
||||||
example: openrouter/auto
|
example: openrouter/auto
|
||||||
provider_responses:
|
|
||||||
type: array
|
|
||||||
nullable: true
|
|
||||||
items:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: string
|
|
||||||
endpoint_id:
|
|
||||||
type: string
|
|
||||||
model_permaslug:
|
|
||||||
type: string
|
|
||||||
provider_name:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- AnyScale
|
|
||||||
- Atoma
|
|
||||||
- Cent-ML
|
|
||||||
- CrofAI
|
|
||||||
- Enfer
|
|
||||||
- GoPomelo
|
|
||||||
- HuggingFace
|
|
||||||
- Hyperbolic 2
|
|
||||||
- InoCloud
|
|
||||||
- Kluster
|
|
||||||
- Lambda
|
|
||||||
- Lepton
|
|
||||||
- Lynn 2
|
|
||||||
- Lynn
|
|
||||||
- Mancer
|
|
||||||
- Meta
|
|
||||||
- Modal
|
|
||||||
- Nineteen
|
|
||||||
- OctoAI
|
|
||||||
- Recursal
|
|
||||||
- Reflection
|
|
||||||
- Replicate
|
|
||||||
- SambaNova 2
|
|
||||||
- SF Compute
|
|
||||||
- Targon
|
|
||||||
- Together 2
|
|
||||||
- Ubicloud
|
|
||||||
- 01.AI
|
|
||||||
- AI21
|
|
||||||
- AionLabs
|
|
||||||
- Alibaba
|
|
||||||
- Ambient
|
|
||||||
- Amazon Bedrock
|
|
||||||
- Amazon Nova
|
|
||||||
- Anthropic
|
|
||||||
- Arcee AI
|
|
||||||
- AtlasCloud
|
|
||||||
- Avian
|
|
||||||
- Azure
|
|
||||||
- BaseTen
|
|
||||||
- BytePlus
|
|
||||||
- Black Forest Labs
|
|
||||||
- Cerebras
|
|
||||||
- Chutes
|
|
||||||
- Cirrascale
|
|
||||||
- Clarifai
|
|
||||||
- Cloudflare
|
|
||||||
- Cohere
|
|
||||||
- Crusoe
|
|
||||||
- DeepInfra
|
|
||||||
- DeepSeek
|
|
||||||
- Featherless
|
|
||||||
- Fireworks
|
|
||||||
- Friendli
|
|
||||||
- GMICloud
|
|
||||||
- Google
|
|
||||||
- Google AI Studio
|
|
||||||
- Groq
|
|
||||||
- Hyperbolic
|
|
||||||
- Inception
|
|
||||||
- Inceptron
|
|
||||||
- InferenceNet
|
|
||||||
- Infermatic
|
|
||||||
- Inflection
|
|
||||||
- Liquid
|
|
||||||
- Mara
|
|
||||||
- Mancer 2
|
|
||||||
- Minimax
|
|
||||||
- ModelRun
|
|
||||||
- Mistral
|
|
||||||
- Modular
|
|
||||||
- Moonshot AI
|
|
||||||
- Morph
|
|
||||||
- NCompass
|
|
||||||
- Nebius
|
|
||||||
- NextBit
|
|
||||||
- Novita
|
|
||||||
- Nvidia
|
|
||||||
- OpenAI
|
|
||||||
- OpenInference
|
|
||||||
- Parasail
|
|
||||||
- Perplexity
|
|
||||||
- Phala
|
|
||||||
- Relace
|
|
||||||
- SambaNova
|
|
||||||
- Seed
|
|
||||||
- SiliconFlow
|
|
||||||
- Sourceful
|
|
||||||
- Stealth
|
|
||||||
- StreamLake
|
|
||||||
- Switchpoint
|
|
||||||
- Together
|
|
||||||
- Upstage
|
|
||||||
- Venice
|
|
||||||
- WandB
|
|
||||||
- Xiaomi
|
|
||||||
- xAI
|
|
||||||
- Z.AI
|
|
||||||
- FakeProvider
|
|
||||||
x-speakeasy-unknown-values: allow
|
|
||||||
status:
|
|
||||||
type: number
|
|
||||||
nullable: true
|
|
||||||
latency:
|
|
||||||
type: number
|
|
||||||
is_byok:
|
|
||||||
type: boolean
|
|
||||||
required:
|
|
||||||
- status
|
|
||||||
description: List of provider responses for this generation, including fallback attempts
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- upstream_id
|
- upstream_id
|
||||||
@@ -10524,7 +10397,6 @@ paths:
|
|||||||
- external_user
|
- external_user
|
||||||
- api_type
|
- api_type
|
||||||
- router
|
- router
|
||||||
- provider_responses
|
|
||||||
description: Generation data
|
description: Generation data
|
||||||
required:
|
required:
|
||||||
- data
|
- data
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ sources:
|
|||||||
- latest
|
- latest
|
||||||
OpenRouter API:
|
OpenRouter API:
|
||||||
sourceNamespace: open-router-chat-completions-api
|
sourceNamespace: open-router-chat-completions-api
|
||||||
sourceRevisionDigest: sha256:6e8165360ec62cc8b776111afb2e6d8c17e5dd46f2be6e124138a8296e2c7046
|
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb
|
||||||
sourceBlobDigest: sha256:373dfa5b56ef18b9cdc55a2ad1a5d8b377deabfcc028ab7f940f525b3a3ca9c9
|
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- main
|
- main
|
||||||
@@ -18,10 +18,10 @@ targets:
|
|||||||
open-router:
|
open-router:
|
||||||
source: OpenRouter API
|
source: OpenRouter API
|
||||||
sourceNamespace: open-router-chat-completions-api
|
sourceNamespace: open-router-chat-completions-api
|
||||||
sourceRevisionDigest: sha256:6e8165360ec62cc8b776111afb2e6d8c17e5dd46f2be6e124138a8296e2c7046
|
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb
|
||||||
sourceBlobDigest: sha256:373dfa5b56ef18b9cdc55a2ad1a5d8b377deabfcc028ab7f940f525b3a3ca9c9
|
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730
|
||||||
codeSamplesNamespace: open-router-python-code-samples
|
codeSamplesNamespace: open-router-python-code-samples
|
||||||
codeSamplesRevisionDigest: sha256:0441c6e25f98818e2b2398041d3a974e3f26897c151a3fabfccbc2206640751a
|
codeSamplesRevisionDigest: sha256:edf48a4b247040d1d03e08ea515577092801ecddf188310752b8fc11ee23a360
|
||||||
workflow:
|
workflow:
|
||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: 1.666.0
|
speakeasyVersion: 1.666.0
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
| `AI21` | AI21 |
|
| `AI21` | AI21 |
|
||||||
| `AION_LABS` | AionLabs |
|
| `AION_LABS` | AionLabs |
|
||||||
| `ALIBABA` | Alibaba |
|
| `ALIBABA` | Alibaba |
|
||||||
| `AMBIENT` | Ambient |
|
|
||||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||||
| `AMAZON_NOVA` | Amazon Nova |
|
| `AMAZON_NOVA` | Amazon Nova |
|
||||||
| `ANTHROPIC` | Anthropic |
|
| `ANTHROPIC` | Anthropic |
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
| `AI21` | AI21 |
|
| `AI21` | AI21 |
|
||||||
| `AION_LABS` | AionLabs |
|
| `AION_LABS` | AionLabs |
|
||||||
| `ALIBABA` | Alibaba |
|
| `ALIBABA` | Alibaba |
|
||||||
| `AMBIENT` | Ambient |
|
|
||||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||||
| `AMAZON_NOVA` | Amazon Nova |
|
| `AMAZON_NOVA` | Amazon Nova |
|
||||||
| `ANTHROPIC` | Anthropic |
|
| `ANTHROPIC` | Anthropic |
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Generation data
|
|||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
||||||
| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 |
|
| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 |
|
||||||
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
||||||
@@ -40,4 +40,3 @@ Generation data
|
|||||||
| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 |
|
| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 |
|
||||||
| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | |
|
| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | |
|
||||||
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
|
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
|
||||||
| `provider_responses` | List[[operations.ProviderResponse](../operations/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | |
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
# ProviderName
|
|
||||||
|
|
||||||
|
|
||||||
## Values
|
|
||||||
|
|
||||||
| Name | Value |
|
|
||||||
| ------------------- | ------------------- |
|
|
||||||
| `ANY_SCALE` | AnyScale |
|
|
||||||
| `ATOMA` | Atoma |
|
|
||||||
| `CENT_ML` | Cent-ML |
|
|
||||||
| `CROF_AI` | CrofAI |
|
|
||||||
| `ENFER` | Enfer |
|
|
||||||
| `GO_POMELO` | GoPomelo |
|
|
||||||
| `HUGGING_FACE` | HuggingFace |
|
|
||||||
| `HYPERBOLIC_2` | Hyperbolic 2 |
|
|
||||||
| `INO_CLOUD` | InoCloud |
|
|
||||||
| `KLUSTER` | Kluster |
|
|
||||||
| `LAMBDA` | Lambda |
|
|
||||||
| `LEPTON` | Lepton |
|
|
||||||
| `LYNN_2` | Lynn 2 |
|
|
||||||
| `LYNN` | Lynn |
|
|
||||||
| `MANCER` | Mancer |
|
|
||||||
| `META` | Meta |
|
|
||||||
| `MODAL` | Modal |
|
|
||||||
| `NINETEEN` | Nineteen |
|
|
||||||
| `OCTO_AI` | OctoAI |
|
|
||||||
| `RECURSAL` | Recursal |
|
|
||||||
| `REFLECTION` | Reflection |
|
|
||||||
| `REPLICATE` | Replicate |
|
|
||||||
| `SAMBA_NOVA_2` | SambaNova 2 |
|
|
||||||
| `SF_COMPUTE` | SF Compute |
|
|
||||||
| `TARGON` | Targon |
|
|
||||||
| `TOGETHER_2` | Together 2 |
|
|
||||||
| `UBICLOUD` | Ubicloud |
|
|
||||||
| `ONE_DOT_AI` | 01.AI |
|
|
||||||
| `AI21` | AI21 |
|
|
||||||
| `AION_LABS` | AionLabs |
|
|
||||||
| `ALIBABA` | Alibaba |
|
|
||||||
| `AMBIENT` | Ambient |
|
|
||||||
| `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 |
|
|
||||||
| `GOOGLE` | Google |
|
|
||||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
|
||||||
| `GROQ` | Groq |
|
|
||||||
| `HYPERBOLIC` | Hyperbolic |
|
|
||||||
| `INCEPTION` | Inception |
|
|
||||||
| `INCEPTRON` | Inceptron |
|
|
||||||
| `INFERENCE_NET` | InferenceNet |
|
|
||||||
| `INFERMATIC` | Infermatic |
|
|
||||||
| `INFLECTION` | Inflection |
|
|
||||||
| `LIQUID` | Liquid |
|
|
||||||
| `MARA` | Mara |
|
|
||||||
| `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 |
|
|
||||||
| `SEED` | Seed |
|
|
||||||
| `SILICON_FLOW` | SiliconFlow |
|
|
||||||
| `SOURCEFUL` | Sourceful |
|
|
||||||
| `STEALTH` | Stealth |
|
|
||||||
| `STREAM_LAKE` | StreamLake |
|
|
||||||
| `SWITCHPOINT` | Switchpoint |
|
|
||||||
| `TOGETHER` | Together |
|
|
||||||
| `UPSTAGE` | Upstage |
|
|
||||||
| `VENICE` | Venice |
|
|
||||||
| `WAND_B` | WandB |
|
|
||||||
| `XIAOMI` | Xiaomi |
|
|
||||||
| `X_AI` | xAI |
|
|
||||||
| `Z_AI` | Z.AI |
|
|
||||||
| `FAKE_PROVIDER` | FakeProvider |
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# ProviderResponse
|
|
||||||
|
|
||||||
|
|
||||||
## Fields
|
|
||||||
|
|
||||||
| Field | Type | Required | Description |
|
|
||||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
|
||||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `provider_name` | [Optional[operations.ProviderName]](../operations/providername.md) | :heavy_minus_sign: | N/A |
|
|
||||||
| `status` | *Nullable[float]* | :heavy_check_mark: | N/A |
|
|
||||||
| `latency` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "openrouter"
|
name = "openrouter"
|
||||||
version = "0.3.2"
|
version = "0.3.0"
|
||||||
description = "Official Python Client SDK for OpenRouter."
|
description = "Official Python Client SDK for OpenRouter."
|
||||||
authors = [{ name = "OpenRouter" },]
|
authors = [{ name = "OpenRouter" },]
|
||||||
readme = "README-PYPI.md"
|
readme = "README-PYPI.md"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import importlib.metadata
|
import importlib.metadata
|
||||||
|
|
||||||
__title__: str = "openrouter"
|
__title__: str = "openrouter"
|
||||||
__version__: str = "0.3.2"
|
__version__: str = "0.3.0"
|
||||||
__openapi_doc_version__: str = "1.0.0"
|
__openapi_doc_version__: str = "1.0.0"
|
||||||
__gen_version__: str = "2.768.0"
|
__gen_version__: str = "2.768.0"
|
||||||
__user_agent__: str = "speakeasy-sdk/python 0.3.2 2.768.0 1.0.0 openrouter"
|
__user_agent__: str = "speakeasy-sdk/python 0.3.0 2.768.0 1.0.0 openrouter"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if __package__ is not None:
|
if __package__ is not None:
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ Schema0Enum = Union[
|
|||||||
"AI21",
|
"AI21",
|
||||||
"AionLabs",
|
"AionLabs",
|
||||||
"Alibaba",
|
"Alibaba",
|
||||||
"Ambient",
|
|
||||||
"Amazon Bedrock",
|
"Amazon Bedrock",
|
||||||
"Amazon Nova",
|
"Amazon Nova",
|
||||||
"Anthropic",
|
"Anthropic",
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ ProviderName = Union[
|
|||||||
"AI21",
|
"AI21",
|
||||||
"AionLabs",
|
"AionLabs",
|
||||||
"Alibaba",
|
"Alibaba",
|
||||||
"Ambient",
|
|
||||||
"Amazon Bedrock",
|
"Amazon Bedrock",
|
||||||
"Amazon Nova",
|
"Amazon Nova",
|
||||||
"Anthropic",
|
"Anthropic",
|
||||||
|
|||||||
@@ -160,9 +160,6 @@ if TYPE_CHECKING:
|
|||||||
GetGenerationRequestTypedDict,
|
GetGenerationRequestTypedDict,
|
||||||
GetGenerationResponse,
|
GetGenerationResponse,
|
||||||
GetGenerationResponseTypedDict,
|
GetGenerationResponseTypedDict,
|
||||||
ProviderName,
|
|
||||||
ProviderResponse,
|
|
||||||
ProviderResponseTypedDict,
|
|
||||||
)
|
)
|
||||||
from .getguardrail import (
|
from .getguardrail import (
|
||||||
GetGuardrailData,
|
GetGuardrailData,
|
||||||
@@ -465,9 +462,6 @@ __all__ = [
|
|||||||
"MetadataTypedDict",
|
"MetadataTypedDict",
|
||||||
"Object",
|
"Object",
|
||||||
"ObjectEmbedding",
|
"ObjectEmbedding",
|
||||||
"ProviderName",
|
|
||||||
"ProviderResponse",
|
|
||||||
"ProviderResponseTypedDict",
|
|
||||||
"RateLimit",
|
"RateLimit",
|
||||||
"RateLimitTypedDict",
|
"RateLimitTypedDict",
|
||||||
"SendChatCompletionRequestResponse",
|
"SendChatCompletionRequestResponse",
|
||||||
@@ -625,9 +619,6 @@ _dynamic_imports: dict[str, str] = {
|
|||||||
"GetGenerationRequestTypedDict": ".getgeneration",
|
"GetGenerationRequestTypedDict": ".getgeneration",
|
||||||
"GetGenerationResponse": ".getgeneration",
|
"GetGenerationResponse": ".getgeneration",
|
||||||
"GetGenerationResponseTypedDict": ".getgeneration",
|
"GetGenerationResponseTypedDict": ".getgeneration",
|
||||||
"ProviderName": ".getgeneration",
|
|
||||||
"ProviderResponse": ".getgeneration",
|
|
||||||
"ProviderResponseTypedDict": ".getgeneration",
|
|
||||||
"GetGuardrailData": ".getguardrail",
|
"GetGuardrailData": ".getguardrail",
|
||||||
"GetGuardrailDataTypedDict": ".getguardrail",
|
"GetGuardrailDataTypedDict": ".getguardrail",
|
||||||
"GetGuardrailRequest": ".getguardrail",
|
"GetGuardrailRequest": ".getguardrail",
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedSt
|
|||||||
from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum
|
from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum
|
||||||
from pydantic import model_serializer
|
from pydantic import model_serializer
|
||||||
from pydantic.functional_validators import PlainValidator
|
from pydantic.functional_validators import PlainValidator
|
||||||
from typing import List, Literal, Optional, Union
|
from typing import Literal, Union
|
||||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
from typing_extensions import Annotated, TypedDict
|
||||||
|
|
||||||
|
|
||||||
class GetGenerationRequestTypedDict(TypedDict):
|
class GetGenerationRequestTypedDict(TypedDict):
|
||||||
@@ -29,177 +29,6 @@ APIType = Union[
|
|||||||
r"""Type of API used for the generation"""
|
r"""Type of API used for the generation"""
|
||||||
|
|
||||||
|
|
||||||
ProviderName = Union[
|
|
||||||
Literal[
|
|
||||||
"AnyScale",
|
|
||||||
"Atoma",
|
|
||||||
"Cent-ML",
|
|
||||||
"CrofAI",
|
|
||||||
"Enfer",
|
|
||||||
"GoPomelo",
|
|
||||||
"HuggingFace",
|
|
||||||
"Hyperbolic 2",
|
|
||||||
"InoCloud",
|
|
||||||
"Kluster",
|
|
||||||
"Lambda",
|
|
||||||
"Lepton",
|
|
||||||
"Lynn 2",
|
|
||||||
"Lynn",
|
|
||||||
"Mancer",
|
|
||||||
"Meta",
|
|
||||||
"Modal",
|
|
||||||
"Nineteen",
|
|
||||||
"OctoAI",
|
|
||||||
"Recursal",
|
|
||||||
"Reflection",
|
|
||||||
"Replicate",
|
|
||||||
"SambaNova 2",
|
|
||||||
"SF Compute",
|
|
||||||
"Targon",
|
|
||||||
"Together 2",
|
|
||||||
"Ubicloud",
|
|
||||||
"01.AI",
|
|
||||||
"AI21",
|
|
||||||
"AionLabs",
|
|
||||||
"Alibaba",
|
|
||||||
"Ambient",
|
|
||||||
"Amazon Bedrock",
|
|
||||||
"Amazon Nova",
|
|
||||||
"Anthropic",
|
|
||||||
"Arcee AI",
|
|
||||||
"AtlasCloud",
|
|
||||||
"Avian",
|
|
||||||
"Azure",
|
|
||||||
"BaseTen",
|
|
||||||
"BytePlus",
|
|
||||||
"Black Forest Labs",
|
|
||||||
"Cerebras",
|
|
||||||
"Chutes",
|
|
||||||
"Cirrascale",
|
|
||||||
"Clarifai",
|
|
||||||
"Cloudflare",
|
|
||||||
"Cohere",
|
|
||||||
"Crusoe",
|
|
||||||
"DeepInfra",
|
|
||||||
"DeepSeek",
|
|
||||||
"Featherless",
|
|
||||||
"Fireworks",
|
|
||||||
"Friendli",
|
|
||||||
"GMICloud",
|
|
||||||
"Google",
|
|
||||||
"Google AI Studio",
|
|
||||||
"Groq",
|
|
||||||
"Hyperbolic",
|
|
||||||
"Inception",
|
|
||||||
"Inceptron",
|
|
||||||
"InferenceNet",
|
|
||||||
"Infermatic",
|
|
||||||
"Inflection",
|
|
||||||
"Liquid",
|
|
||||||
"Mara",
|
|
||||||
"Mancer 2",
|
|
||||||
"Minimax",
|
|
||||||
"ModelRun",
|
|
||||||
"Mistral",
|
|
||||||
"Modular",
|
|
||||||
"Moonshot AI",
|
|
||||||
"Morph",
|
|
||||||
"NCompass",
|
|
||||||
"Nebius",
|
|
||||||
"NextBit",
|
|
||||||
"Novita",
|
|
||||||
"Nvidia",
|
|
||||||
"OpenAI",
|
|
||||||
"OpenInference",
|
|
||||||
"Parasail",
|
|
||||||
"Perplexity",
|
|
||||||
"Phala",
|
|
||||||
"Relace",
|
|
||||||
"SambaNova",
|
|
||||||
"Seed",
|
|
||||||
"SiliconFlow",
|
|
||||||
"Sourceful",
|
|
||||||
"Stealth",
|
|
||||||
"StreamLake",
|
|
||||||
"Switchpoint",
|
|
||||||
"Together",
|
|
||||||
"Upstage",
|
|
||||||
"Venice",
|
|
||||||
"WandB",
|
|
||||||
"Xiaomi",
|
|
||||||
"xAI",
|
|
||||||
"Z.AI",
|
|
||||||
"FakeProvider",
|
|
||||||
],
|
|
||||||
UnrecognizedStr,
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class ProviderResponseTypedDict(TypedDict):
|
|
||||||
status: Nullable[float]
|
|
||||||
id: NotRequired[str]
|
|
||||||
endpoint_id: NotRequired[str]
|
|
||||||
model_permaslug: NotRequired[str]
|
|
||||||
provider_name: NotRequired[ProviderName]
|
|
||||||
latency: NotRequired[float]
|
|
||||||
is_byok: NotRequired[bool]
|
|
||||||
|
|
||||||
|
|
||||||
class ProviderResponse(BaseModel):
|
|
||||||
status: Nullable[float]
|
|
||||||
|
|
||||||
id: Optional[str] = None
|
|
||||||
|
|
||||||
endpoint_id: Optional[str] = None
|
|
||||||
|
|
||||||
model_permaslug: Optional[str] = None
|
|
||||||
|
|
||||||
provider_name: Annotated[
|
|
||||||
Optional[ProviderName], PlainValidator(validate_open_enum(False))
|
|
||||||
] = None
|
|
||||||
|
|
||||||
latency: Optional[float] = None
|
|
||||||
|
|
||||||
is_byok: Optional[bool] = None
|
|
||||||
|
|
||||||
@model_serializer(mode="wrap")
|
|
||||||
def serialize_model(self, handler):
|
|
||||||
optional_fields = [
|
|
||||||
"id",
|
|
||||||
"endpoint_id",
|
|
||||||
"model_permaslug",
|
|
||||||
"provider_name",
|
|
||||||
"latency",
|
|
||||||
"is_byok",
|
|
||||||
]
|
|
||||||
nullable_fields = ["status"]
|
|
||||||
null_default_fields = []
|
|
||||||
|
|
||||||
serialized = handler(self)
|
|
||||||
|
|
||||||
m = {}
|
|
||||||
|
|
||||||
for n, f in type(self).model_fields.items():
|
|
||||||
k = f.alias or n
|
|
||||||
val = serialized.get(k)
|
|
||||||
serialized.pop(k, None)
|
|
||||||
|
|
||||||
optional_nullable = k in optional_fields and k in nullable_fields
|
|
||||||
is_set = (
|
|
||||||
self.__pydantic_fields_set__.intersection({n})
|
|
||||||
or k in null_default_fields
|
|
||||||
) # pylint: disable=no-member
|
|
||||||
|
|
||||||
if val is not None and val != UNSET_SENTINEL:
|
|
||||||
m[k] = val
|
|
||||||
elif val != UNSET_SENTINEL and (
|
|
||||||
not k in optional_fields or (optional_nullable and is_set)
|
|
||||||
):
|
|
||||||
m[k] = val
|
|
||||||
|
|
||||||
return m
|
|
||||||
|
|
||||||
|
|
||||||
class GetGenerationDataTypedDict(TypedDict):
|
class GetGenerationDataTypedDict(TypedDict):
|
||||||
r"""Generation data"""
|
r"""Generation data"""
|
||||||
|
|
||||||
@@ -269,8 +98,6 @@ class GetGenerationDataTypedDict(TypedDict):
|
|||||||
r"""Type of API used for the generation"""
|
r"""Type of API used for the generation"""
|
||||||
router: Nullable[str]
|
router: Nullable[str]
|
||||||
r"""Router used for the request (e.g., openrouter/auto)"""
|
r"""Router used for the request (e.g., openrouter/auto)"""
|
||||||
provider_responses: Nullable[List[ProviderResponseTypedDict]]
|
|
||||||
r"""List of provider responses for this generation, including fallback attempts"""
|
|
||||||
|
|
||||||
|
|
||||||
class GetGenerationData(BaseModel):
|
class GetGenerationData(BaseModel):
|
||||||
@@ -375,9 +202,6 @@ class GetGenerationData(BaseModel):
|
|||||||
router: Nullable[str]
|
router: Nullable[str]
|
||||||
r"""Router used for the request (e.g., openrouter/auto)"""
|
r"""Router used for the request (e.g., openrouter/auto)"""
|
||||||
|
|
||||||
provider_responses: Nullable[List[ProviderResponse]]
|
|
||||||
r"""List of provider responses for this generation, including fallback attempts"""
|
|
||||||
|
|
||||||
@model_serializer(mode="wrap")
|
@model_serializer(mode="wrap")
|
||||||
def serialize_model(self, handler):
|
def serialize_model(self, handler):
|
||||||
optional_fields = []
|
optional_fields = []
|
||||||
@@ -408,7 +232,6 @@ class GetGenerationData(BaseModel):
|
|||||||
"external_user",
|
"external_user",
|
||||||
"api_type",
|
"api_type",
|
||||||
"router",
|
"router",
|
||||||
"provider_responses",
|
|
||||||
]
|
]
|
||||||
null_default_fields = []
|
null_default_fields = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user