mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-07 11:25:29 +08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88bc51d136 |
+4
-6
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: b46bf86766cf18470329da1fb2271f4e
|
||||
docChecksum: 342e7e8ea9cb2b7ff1c1860e18d58822
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
generationVersion: 2.768.0
|
||||
releaseVersion: 0.3.2
|
||||
configChecksum: 684039465cd4c6f0105466ef2833908d
|
||||
releaseVersion: 0.2.0
|
||||
configChecksum: 65a367d36e219e834a1176c8ec421a0a
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
@@ -593,8 +593,6 @@ generatedFiles:
|
||||
- docs/operations/metadata.md
|
||||
- docs/operations/object.md
|
||||
- docs/operations/objectembedding.md
|
||||
- docs/operations/providername.md
|
||||
- docs/operations/providerresponse.md
|
||||
- docs/operations/ratelimit.md
|
||||
- docs/operations/sendchatcompletionrequestresponse.md
|
||||
- docs/operations/transferintent.md
|
||||
@@ -1003,7 +1001,7 @@ examples:
|
||||
id: "<id>"
|
||||
responses:
|
||||
"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":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"402":
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ generation:
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.3.2
|
||||
version: 0.2.0
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
|
||||
Regular → Executable
-127
@@ -3542,7 +3542,6 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -8111,7 +8110,6 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -10357,130 +10355,6 @@ paths:
|
||||
nullable: true
|
||||
description: Router used for the request (e.g., 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:
|
||||
- id
|
||||
- upstream_id
|
||||
@@ -10515,7 +10389,6 @@ paths:
|
||||
- external_user
|
||||
- api_type
|
||||
- router
|
||||
- provider_responses
|
||||
description: Generation data
|
||||
required:
|
||||
- data
|
||||
|
||||
@@ -3561,7 +3561,6 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -8125,7 +8124,6 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -10365,131 +10363,6 @@ paths:
|
||||
nullable: true
|
||||
description: Router used for the request (e.g., 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:
|
||||
- id
|
||||
- upstream_id
|
||||
@@ -10524,7 +10397,6 @@ paths:
|
||||
- external_user
|
||||
- api_type
|
||||
- router
|
||||
- provider_responses
|
||||
description: Generation data
|
||||
required:
|
||||
- data
|
||||
|
||||
@@ -8,20 +8,19 @@ sources:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:6e8165360ec62cc8b776111afb2e6d8c17e5dd46f2be6e124138a8296e2c7046
|
||||
sourceBlobDigest: sha256:373dfa5b56ef18b9cdc55a2ad1a5d8b377deabfcc028ab7f940f525b3a3ca9c9
|
||||
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb
|
||||
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
- 1.0.0
|
||||
targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:6e8165360ec62cc8b776111afb2e6d8c17e5dd46f2be6e124138a8296e2c7046
|
||||
sourceBlobDigest: sha256:373dfa5b56ef18b9cdc55a2ad1a5d8b377deabfcc028ab7f940f525b3a3ca9c9
|
||||
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb
|
||||
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:0441c6e25f98818e2b2398041d3a974e3f26897c151a3fabfccbc2206640751a
|
||||
codeSamplesRevisionDigest: sha256:bfe86dbe763c7e6164cdcddd56ddda61a8981ca5b5dc0aa7cd97bbbb4a44142a
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
|
||||
@@ -5,39 +5,38 @@ Generation data
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
||||
| `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 |
|
||||
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
||||
| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 |
|
||||
| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 |
|
||||
| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b |
|
||||
| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 |
|
||||
| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true |
|
||||
| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false |
|
||||
| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic |
|
||||
| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 |
|
||||
| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 |
|
||||
| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 |
|
||||
| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop |
|
||||
| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 |
|
||||
| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 |
|
||||
| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 |
|
||||
| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 |
|
||||
| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 |
|
||||
| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 |
|
||||
| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 |
|
||||
| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 |
|
||||
| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 |
|
||||
| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 |
|
||||
| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 |
|
||||
| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ |
|
||||
| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 |
|
||||
| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false |
|
||||
| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop |
|
||||
| `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 | |
|
||||
| `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 | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `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 |
|
||||
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
||||
| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 |
|
||||
| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 |
|
||||
| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b |
|
||||
| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 |
|
||||
| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true |
|
||||
| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false |
|
||||
| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic |
|
||||
| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 |
|
||||
| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 |
|
||||
| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 |
|
||||
| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop |
|
||||
| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 |
|
||||
| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 |
|
||||
| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 |
|
||||
| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 |
|
||||
| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 |
|
||||
| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 |
|
||||
| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 |
|
||||
| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 |
|
||||
| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 |
|
||||
| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 |
|
||||
| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 |
|
||||
| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ |
|
||||
| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 |
|
||||
| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false |
|
||||
| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop |
|
||||
| `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 | |
|
||||
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
|
||||
@@ -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]
|
||||
name = "openrouter"
|
||||
version = "0.3.2"
|
||||
version = "0.2.0"
|
||||
description = "Official Python Client SDK for OpenRouter."
|
||||
authors = [{ name = "OpenRouter" },]
|
||||
readme = "README-PYPI.md"
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.3.2"
|
||||
__version__: str = "0.2.0"
|
||||
__openapi_doc_version__: str = "1.0.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.2.0 2.768.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -13,7 +13,6 @@ Schema0Enum = Union[
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Ambient",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
|
||||
@@ -10,7 +10,6 @@ ProviderName = Union[
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Ambient",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
|
||||
@@ -160,9 +160,6 @@ if TYPE_CHECKING:
|
||||
GetGenerationRequestTypedDict,
|
||||
GetGenerationResponse,
|
||||
GetGenerationResponseTypedDict,
|
||||
ProviderName,
|
||||
ProviderResponse,
|
||||
ProviderResponseTypedDict,
|
||||
)
|
||||
from .getguardrail import (
|
||||
GetGuardrailData,
|
||||
@@ -465,9 +462,6 @@ __all__ = [
|
||||
"MetadataTypedDict",
|
||||
"Object",
|
||||
"ObjectEmbedding",
|
||||
"ProviderName",
|
||||
"ProviderResponse",
|
||||
"ProviderResponseTypedDict",
|
||||
"RateLimit",
|
||||
"RateLimitTypedDict",
|
||||
"SendChatCompletionRequestResponse",
|
||||
@@ -625,9 +619,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"GetGenerationRequestTypedDict": ".getgeneration",
|
||||
"GetGenerationResponse": ".getgeneration",
|
||||
"GetGenerationResponseTypedDict": ".getgeneration",
|
||||
"ProviderName": ".getgeneration",
|
||||
"ProviderResponse": ".getgeneration",
|
||||
"ProviderResponseTypedDict": ".getgeneration",
|
||||
"GetGuardrailData": ".getguardrail",
|
||||
"GetGuardrailDataTypedDict": ".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 pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
class GetGenerationRequestTypedDict(TypedDict):
|
||||
@@ -29,177 +29,6 @@ APIType = Union[
|
||||
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):
|
||||
r"""Generation data"""
|
||||
|
||||
@@ -269,8 +98,6 @@ class GetGenerationDataTypedDict(TypedDict):
|
||||
r"""Type of API used for the generation"""
|
||||
router: Nullable[str]
|
||||
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):
|
||||
@@ -375,9 +202,6 @@ class GetGenerationData(BaseModel):
|
||||
router: Nullable[str]
|
||||
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")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
@@ -408,7 +232,6 @@ class GetGenerationData(BaseModel):
|
||||
"external_user",
|
||||
"api_type",
|
||||
"router",
|
||||
"provider_responses",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user