chore: 🐝 Update SDK - Generate 0.10.0 (#317)

This commit is contained in:
Matt Apperson
2026-06-17 09:48:04 -04:00
committed by GitHub
97 changed files with 9804 additions and 391 deletions
+807 -175
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -32,7 +32,7 @@ generation:
skipResponseBodyAssertions: false skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true preApplyUnionDiscriminators: true
python: python:
version: 0.9.2 version: 0.10.0
additionalDependencies: additionalDependencies:
dev: {} dev: {}
main: {} main: {}
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -2,20 +2,20 @@ speakeasyVersion: 1.680.0
sources: sources:
OpenRouter API: OpenRouter API:
sourceNamespace: open-router-chat-completions-api sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 sourceRevisionDigest: sha256:716ece4a1211eac2ee0e7e5836c7b484cff9bb002bd4e676d9ecad8317ee7941
sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 sourceBlobDigest: sha256:12d3dc8e7150ab2c4c5e3d613b01cb5e4dcce52b329eea89ca1fdc656d6fe045
tags: tags:
- latest - latest
- speakeasy-sdk-regen-1776991284 - speakeasy-sdk-regen-1781312282
- 1.0.0 - 1.0.0
targets: 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:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 sourceRevisionDigest: sha256:716ece4a1211eac2ee0e7e5836c7b484cff9bb002bd4e676d9ecad8317ee7941
sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 sourceBlobDigest: sha256:12d3dc8e7150ab2c4c5e3d613b01cb5e4dcce52b329eea89ca1fdc656d6fe045
codeSamplesNamespace: open-router-python-code-samples codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:3c7b0aef799130660fd4017ab9113e6fd3e06a80cff6a540043b9b34dc22facf codeSamplesRevisionDigest: sha256:e7d6f4de48a7c63cf15f3a8378f952277cd4c59373c28c61909497853fa769e2
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.680.0 speakeasyVersion: 1.680.0
+33
View File
@@ -199,6 +199,39 @@ with OpenRouter(
``` ```
<!-- End Pagination [pagination] --> <!-- End Pagination [pagination] -->
<!-- Start File uploads [file-upload] -->
## File uploads
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
> [!TIP]
>
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
>
```python
from openrouter import OpenRouter
import os
with OpenRouter(
http_referer="<value>",
x_open_router_title="<value>",
x_open_router_categories="<value>",
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
res = open_router.files.upload(file={
"file_name": "example.file",
"content": open("example.file", "rb"),
})
# Handle response
print(res)
```
<!-- End File uploads [file-upload] -->
<!-- Start Resource Management [resource-management] --> <!-- Start Resource Management [resource-management] -->
## Resource Management ## Resource Management
+33
View File
@@ -199,6 +199,39 @@ with OpenRouter(
``` ```
<!-- End Pagination [pagination] --> <!-- End Pagination [pagination] -->
<!-- Start File uploads [file-upload] -->
## File uploads
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
> [!TIP]
>
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
>
```python
from openrouter import OpenRouter
import os
with OpenRouter(
http_referer="<value>",
x_open_router_title="<value>",
x_open_router_categories="<value>",
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
res = open_router.files.upload(file={
"file_name": "example.file",
"content": open("example.file", "rb"),
})
# Handle response
print(res)
```
<!-- End File uploads [file-upload] -->
<!-- Start Resource Management [resource-management] --> <!-- Start Resource Management [resource-management] -->
## Resource Management ## Resource Management
+10
View File
@@ -19,3 +19,13 @@ Based on:
- [python v0.9.2] . - [python v0.9.2] .
### Releases ### Releases
- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . - [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - .
## 2026-06-17 00:59:07
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.10.0] .
### Releases
- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - .
+20 -19
View File
@@ -5,22 +5,23 @@ Information about an AI model available on OpenRouter
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>} | | `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>} |
| `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 | | `benchmarks` | [Optional[components.ModelBenchmarks]](../components/modelbenchmarks.md) | :heavy_minus_sign: | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. | {<br/>"artificial_analysis": {<br/>"agentic_index": 55.8,<br/>"coding_index": 63.2,<br/>"intelligence_index": 71.4<br/>},<br/>"design_arena": [<br/>{<br/>"arena": "models",<br/>"category": "website",<br/>"elo": 1385.2,<br/>"rank": 5,<br/>"win_rate": 62.5<br/>}<br/>]<br/>} |
| `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 | | `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 |
| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 | | `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 |
| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {<br/>"frequency_penalty": 0,<br/>"presence_penalty": 0,<br/>"repetition_penalty": 1,<br/>"temperature": 0.7,<br/>"top_k": 0,<br/>"top_p": 0.9<br/>} | | `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 |
| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | | `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {<br/>"frequency_penalty": 0,<br/>"presence_penalty": 0,<br/>"repetition_penalty": 1,<br/>"temperature": 0.7,<br/>"top_k": 0,<br/>"top_p": 0.9<br/>} |
| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | | `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. |
| `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | | `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 |
| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 | | `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium |
| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | | `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 |
| `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {<br/>"details": "/api/v1/models/openai/gpt-5.4/endpoints"<br/>} | | `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 |
| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 | | `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {<br/>"details": "/api/v1/models/openai/gpt-5.4/endpoints"<br/>} |
| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {<br/>"completion_tokens": 1000,<br/>"prompt_tokens": 1000<br/>} | | `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 |
| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {<br/>"completion": "0.00006",<br/>"image": "0",<br/>"prompt": "0.00003",<br/>"request": "0"<br/>} | | `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {<br/>"completion_tokens": 1000,<br/>"prompt_tokens": 1000<br/>} |
| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | | | `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {<br/>"completion": "0.00006",<br/>"image": "0",<br/>"prompt": "0.00003",<br/>"request": "0"<br/>} |
| `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | <nil> | | `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | |
| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {<br/>"context_length": 8192,<br/>"is_moderated": true,<br/>"max_completion_tokens": 4096<br/>} | | `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | <nil> |
| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {<br/>"context_length": 8192,<br/>"is_moderated": true,<br/>"max_completion_tokens": 4096<br/>} |
+1
View File
@@ -5,6 +5,7 @@
| Field | Type | Required | Description | | Field | Type | Required | Description |
| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
| `content` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `end_index` | *int* | :heavy_check_mark: | N/A | | `end_index` | *int* | :heavy_check_mark: | N/A |
| `start_index` | *int* | :heavy_check_mark: | N/A | | `start_index` | *int* | :heavy_check_mark: | N/A |
| `title` | *str* | :heavy_check_mark: | N/A | | `title` | *str* | :heavy_check_mark: | N/A |
+7 -6
View File
@@ -5,9 +5,10 @@ The search engine to use for web search.
## Values ## Values
| Name | Value | | Name | Value |
| ----------- | ----------- | | ------------ | ------------ |
| `NATIVE` | native | | `NATIVE` | native |
| `EXA` | exa | | `EXA` | exa |
| `FIRECRAWL` | firecrawl | | `FIRECRAWL` | firecrawl |
| `PARALLEL` | parallel | | `PARALLEL` | parallel |
| `PERPLEXITY` | perplexity |
@@ -3,12 +3,13 @@
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | | `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback |
| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | | `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM |
| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | | `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 |
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z | | `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z |
| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | | `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key |
| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | | `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 |
| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | | `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly |
| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to associate the API key with | |
+11
View File
@@ -12,3 +12,14 @@
| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest | | `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest |
| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 |
| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image |
| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 |
| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 |
| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 |
| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT |
| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic |
| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic |
| `distillable` | [Optional[operations.Distillable]](../operations/distillable.md) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true |
| `zdr` | [Optional[operations.Zdr]](../operations/zdr.md) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true |
| `region` | [Optional[operations.Region]](../operations/region.md) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu |
+5
View File
@@ -61,6 +61,7 @@ with OpenRouter(
| `max_completion_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens in completion | 100 | | `max_completion_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens in completion | 100 |
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. | 100 | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. | 100 |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {<br/>"session_id": "session-456",<br/>"user_id": "user-123"<br/>} | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {<br/>"session_id": "session-456",<br/>"user_id": "user-123"<br/>} |
| `min_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. | 0.1 |
| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text", "image", and "audio". | [<br/>"text",<br/>"image"<br/>] | | `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text", "image", and "audio". | [<br/>"text",<br/>"image"<br/>] |
| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 | | `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 |
| `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [<br/>"openai/gpt-4",<br/>"openai/gpt-4o"<br/>] | | `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [<br/>"openai/gpt-4",<br/>"openai/gpt-4o"<br/>] |
@@ -69,6 +70,8 @@ with OpenRouter(
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 |
| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | {<br/>"allow_fallbacks": true<br/>} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | {<br/>"allow_fallbacks": true<br/>} |
| `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {<br/>"effort": "medium",<br/>"summary": "concise"<br/>} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {<br/>"effort": "medium",<br/>"summary": "concise"<br/>} |
| `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.md) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium |
| `repetition_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. | 1 |
| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {<br/>"type": "json_object"<br/>} | | `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {<br/>"type": "json_object"<br/>} |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 |
| `service_tier` | [OptionalNullable[components.ChatRequestServiceTier]](../../components/chatrequestservicetier.md) | :heavy_minus_sign: | The service tier to use for processing this request. | auto | | `service_tier` | [OptionalNullable[components.ChatRequestServiceTier]](../../components/chatrequestservicetier.md) | :heavy_minus_sign: | The service tier to use for processing this request. | auto |
@@ -80,6 +83,8 @@ with OpenRouter(
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 |
| `tool_choice` | [Optional[components.ChatToolChoice]](../../components/chattoolchoice.md) | :heavy_minus_sign: | Tool choice configuration | auto | | `tool_choice` | [Optional[components.ChatToolChoice]](../../components/chattoolchoice.md) | :heavy_minus_sign: | Tool choice configuration | auto |
| `tools` | List[[components.ChatFunctionTool](../../components/chatfunctiontool.md)] | :heavy_minus_sign: | Available tools for function calling | [<br/>{<br/>"function": {<br/>"description": "Get weather",<br/>"name": "get_weather"<br/>},<br/>"type": "function"<br/>}<br/>] | | `tools` | List[[components.ChatFunctionTool](../../components/chatfunctiontool.md)] | :heavy_minus_sign: | Available tools for function calling | [<br/>{<br/>"function": {<br/>"description": "Get weather",<br/>"name": "get_weather"<br/>},<br/>"type": "function"<br/>}<br/>] |
| `top_a` | *OptionalNullable[float]* | :heavy_minus_sign: | Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter. | 0 |
| `top_k` | *OptionalNullable[int]* | :heavy_minus_sign: | Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. | 40 |
| `top_logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 | | `top_logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 |
| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | {<br/>"trace_id": "trace-abc123",<br/>"trace_name": "my-app-trace"<br/>} | | `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | {<br/>"trace_id": "trace-abc123",<br/>"trace_name": "my-app-trace"<br/>} |
+61
View File
@@ -6,10 +6,60 @@ Model information endpoints
### Available Operations ### Available Operations
* [get](#get) - Get a model by its slug
* [list](#list) - List all models and their properties * [list](#list) - List all models and their properties
* [count](#count) - Get total count of available models * [count](#count) - Get total count of available models
* [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails * [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails
## get
Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
### Example Usage
<!-- UsageSnippet language="python" operationID="getModel" method="get" path="/model/{author}/{slug}" -->
```python
from openrouter import OpenRouter
import os
with OpenRouter(
http_referer="<value>",
x_open_router_title="<value>",
x_open_router_categories="<value>",
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
res = open_router.models.get(author="openai", slug="gpt-4")
# Handle response
print(res)
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `author` | *str* | :heavy_check_mark: | The author/organization of the model | openai |
| `slug` | *str* | :heavy_check_mark: | The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) | gpt-4 |
| `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_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response
**[components.ModelResponse](../../components/modelresponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
## list ## list
List all models and their properties List all models and their properties
@@ -47,6 +97,17 @@ with OpenRouter(
| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest | | `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest |
| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 |
| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image |
| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 |
| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 |
| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 |
| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT |
| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic |
| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic |
| `distillable` | [Optional[operations.Distillable]](../../operations/distillable.md) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true |
| `zdr` | [Optional[operations.Zdr]](../../operations/zdr.md) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true |
| `region` | [Optional[operations.Region]](../../operations/region.md) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response ### Response
+3 -1
View File
@@ -90,7 +90,7 @@ with OpenRouter(
| Parameter | Type | Required | Description | Example | | Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | | `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback |
| `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/> | | | `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_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | | | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
@@ -100,6 +100,7 @@ with OpenRouter(
| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | | `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key |
| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | | `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 |
| `usage_limit_type` | [Optional[operations.UsageLimitType]](../../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | | `usage_limit_type` | [Optional[operations.UsageLimitType]](../../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly |
| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to associate the API key with | |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response ### Response
@@ -112,6 +113,7 @@ with OpenRouter(
| ---------------------------------- | ---------------------------------- | ---------------------------------- | | ---------------------------------- | ---------------------------------- | ---------------------------------- |
| errors.BadRequestResponseError | 400 | application/json | | errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json | | errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.ConflictResponseError | 409 | application/json | | errors.ConflictResponseError | 409 | application/json |
| errors.InternalServerResponseError | 500 | application/json | | errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "openrouter" name = "openrouter"
version = "0.9.2" version = "0.10.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"
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata import importlib.metadata
__title__: str = "openrouter" __title__: str = "openrouter"
__version__: str = "0.9.2" __version__: str = "0.10.0"
__openapi_doc_version__: str = "1.0.0" __openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.788.4" __gen_version__: str = "2.788.4"
__user_agent__: str = "speakeasy-sdk/python 0.9.2 2.788.4 1.0.0 openrouter" __user_agent__: str = "speakeasy-sdk/python 0.10.0 2.788.4 1.0.0 openrouter"
try: try:
if __package__ is not None: if __package__ is not None:
+2 -2
View File
@@ -302,7 +302,7 @@ class BetaAnalytics(BaseSDK):
:param dimensions: :param dimensions:
:param filters: :param filters:
:param granularity: Time granularity :param granularity: Time granularity
:param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
:param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.
:param order_by: :param order_by:
:param time_range: :param time_range:
@@ -480,7 +480,7 @@ class BetaAnalytics(BaseSDK):
:param dimensions: :param dimensions:
:param filters: :param filters:
:param granularity: Time granularity :param granularity: Time granularity
:param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
:param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.
:param order_by: :param order_by:
:param time_range: :param time_range:
+82
View File
@@ -48,6 +48,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -70,6 +71,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -99,6 +104,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -132,6 +139,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -140,6 +148,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -151,6 +161,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -194,6 +206,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -216,6 +229,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -245,6 +262,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -278,6 +297,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -286,6 +306,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -297,6 +319,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -339,6 +363,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -361,6 +386,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -390,6 +419,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -423,6 +454,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -431,6 +463,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -442,6 +476,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -484,6 +520,7 @@ class Chat(BaseSDK):
messages, List[components.ChatMessages] messages, List[components.ChatMessages]
), ),
metadata=metadata, metadata=metadata,
min_p=min_p,
modalities=modalities, modalities=modalities,
model=model, model=model,
models=models, models=models,
@@ -498,6 +535,8 @@ class Chat(BaseSDK):
reasoning=utils.get_pydantic_model( reasoning=utils.get_pydantic_model(
reasoning, Optional[components.ChatRequestReasoning] reasoning, Optional[components.ChatRequestReasoning]
), ),
reasoning_effort=reasoning_effort,
repetition_penalty=repetition_penalty,
response_format=utils.get_pydantic_model( response_format=utils.get_pydantic_model(
response_format, Optional[components.ResponseFormat] response_format, Optional[components.ResponseFormat]
), ),
@@ -520,6 +559,8 @@ class Chat(BaseSDK):
tools=utils.get_pydantic_model( tools=utils.get_pydantic_model(
tools, Optional[List[components.ChatFunctionTool]] tools, Optional[List[components.ChatFunctionTool]]
), ),
top_a=top_a,
top_k=top_k,
top_logprobs=top_logprobs, top_logprobs=top_logprobs,
top_p=top_p, top_p=top_p,
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
@@ -764,6 +805,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -786,6 +828,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -815,6 +861,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -848,6 +896,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -856,6 +905,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -867,6 +918,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -910,6 +963,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -932,6 +986,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -961,6 +1019,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -994,6 +1054,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -1002,6 +1063,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -1013,6 +1076,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -1055,6 +1120,7 @@ class Chat(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -1077,6 +1143,10 @@ class Chat(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -1106,6 +1176,8 @@ class Chat(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -1139,6 +1211,7 @@ class Chat(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -1147,6 +1220,8 @@ class Chat(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -1158,6 +1233,8 @@ class Chat(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -1200,6 +1277,7 @@ class Chat(BaseSDK):
messages, List[components.ChatMessages] messages, List[components.ChatMessages]
), ),
metadata=metadata, metadata=metadata,
min_p=min_p,
modalities=modalities, modalities=modalities,
model=model, model=model,
models=models, models=models,
@@ -1214,6 +1292,8 @@ class Chat(BaseSDK):
reasoning=utils.get_pydantic_model( reasoning=utils.get_pydantic_model(
reasoning, Optional[components.ChatRequestReasoning] reasoning, Optional[components.ChatRequestReasoning]
), ),
reasoning_effort=reasoning_effort,
repetition_penalty=repetition_penalty,
response_format=utils.get_pydantic_model( response_format=utils.get_pydantic_model(
response_format, Optional[components.ResponseFormat] response_format, Optional[components.ResponseFormat]
), ),
@@ -1236,6 +1316,8 @@ class Chat(BaseSDK):
tools=utils.get_pydantic_model( tools=utils.get_pydantic_model(
tools, Optional[List[components.ChatFunctionTool]] tools, Optional[List[components.ChatFunctionTool]]
), ),
top_a=top_a,
top_k=top_k,
top_logprobs=top_logprobs, top_logprobs=top_logprobs,
top_p=top_p, top_p=top_p,
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
+243 -3
View File
@@ -6,6 +6,7 @@ import builtins
import sys import sys
if TYPE_CHECKING: if TYPE_CHECKING:
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
from .activityitem import ActivityItem, ActivityItemTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict
from .activityresponse import ActivityResponse, ActivityResponseTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict
from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict
@@ -87,6 +88,11 @@ if TYPE_CHECKING:
SourceType, SourceType,
TypeDocument, TypeDocument,
) )
from .anthropicfiledocumentsource import (
AnthropicFileDocumentSource,
AnthropicFileDocumentSourceType,
AnthropicFileDocumentSourceTypedDict,
)
from .anthropicimageblockparam import ( from .anthropicimageblockparam import (
AnthropicImageBlockParam, AnthropicImageBlockParam,
AnthropicImageBlockParamSource, AnthropicImageBlockParamSource,
@@ -270,6 +276,38 @@ if TYPE_CHECKING:
BashServerToolEnvironment, BashServerToolEnvironment,
BashServerToolEnvironmentTypedDict, BashServerToolEnvironmentTypedDict,
) )
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import (
BenchmarksAAMeta,
BenchmarksAAMetaSource,
BenchmarksAAMetaSourceURL,
BenchmarksAAMetaTypedDict,
BenchmarksAAMetaVersion,
)
from .benchmarksaaresponse import (
BenchmarksAAResponse,
BenchmarksAAResponseTypedDict,
)
from .benchmarksdaitem import (
BenchmarksDAItem,
BenchmarksDAItemTypedDict,
TournamentStats,
TournamentStatsTypedDict,
)
from .benchmarksdameta import (
BenchmarksDAMeta,
BenchmarksDAMetaSource,
BenchmarksDAMetaSourceURL,
BenchmarksDAMetaTypedDict,
BenchmarksDAMetaVersion,
EloBounds,
EloBoundsTypedDict,
)
from .benchmarksdaresponse import (
BenchmarksDAResponse,
BenchmarksDAResponseTypedDict,
)
from .bulkaddworkspacemembersrequest import ( from .bulkaddworkspacemembersrequest import (
BulkAddWorkspaceMembersRequest, BulkAddWorkspaceMembersRequest,
BulkAddWorkspaceMembersRequestTypedDict, BulkAddWorkspaceMembersRequestTypedDict,
@@ -434,6 +472,7 @@ if TYPE_CHECKING:
ChatRequestPlugin, ChatRequestPlugin,
ChatRequestPluginTypedDict, ChatRequestPluginTypedDict,
ChatRequestReasoning, ChatRequestReasoning,
ChatRequestReasoningEffort,
ChatRequestReasoningTypedDict, ChatRequestReasoningTypedDict,
ChatRequestServiceTier, ChatRequestServiceTier,
ChatRequestTypedDict, ChatRequestTypedDict,
@@ -727,6 +766,7 @@ if TYPE_CHECKING:
CustomToolCallOutputItemTypeInputImage, CustomToolCallOutputItemTypeInputImage,
CustomToolCallOutputItemTypedDict, CustomToolCallOutputItemTypedDict,
) )
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
from .datetimeservertool import ( from .datetimeservertool import (
DatetimeServerTool, DatetimeServerTool,
DatetimeServerToolType, DatetimeServerToolType,
@@ -749,6 +789,10 @@ if TYPE_CHECKING:
DeleteObservabilityDestinationResponse, DeleteObservabilityDestinationResponse,
DeleteObservabilityDestinationResponseTypedDict, DeleteObservabilityDestinationResponseTypedDict,
) )
from .deleteworkspacebudgetresponse import (
DeleteWorkspaceBudgetResponse,
DeleteWorkspaceBudgetResponseTypedDict,
)
from .deleteworkspaceresponse import ( from .deleteworkspaceresponse import (
DeleteWorkspaceResponse, DeleteWorkspaceResponse,
DeleteWorkspaceResponseTypedDict, DeleteWorkspaceResponseTypedDict,
@@ -785,6 +829,13 @@ if TYPE_CHECKING:
from .endpointstatus import EndpointStatus from .endpointstatus import EndpointStatus
from .errorevent import ErrorEvent, ErrorEventType, ErrorEventTypedDict from .errorevent import ErrorEvent, ErrorEventType, ErrorEventTypedDict
from .filecitation import FileCitation, FileCitationType, FileCitationTypedDict from .filecitation import FileCitation, FileCitationType, FileCitationTypedDict
from .filedeleteresponse import (
FileDeleteResponse,
FileDeleteResponseType,
FileDeleteResponseTypedDict,
)
from .filelistresponse import FileListResponse, FileListResponseTypedDict
from .filemetadata import FileMetadata, FileMetadataType, FileMetadataTypedDict
from .fileparserplugin import ( from .fileparserplugin import (
FileParserPlugin, FileParserPlugin,
FileParserPluginID, FileParserPluginID,
@@ -928,6 +979,7 @@ if TYPE_CHECKING:
FusionPluginTool, FusionPluginTool,
FusionPluginToolTypedDict, FusionPluginToolTypedDict,
FusionPluginTypedDict, FusionPluginTypedDict,
PresetEnum,
) )
from .fusionservertool_openrouter import ( from .fusionservertool_openrouter import (
FusionServerToolOpenRouter, FusionServerToolOpenRouter,
@@ -1156,6 +1208,10 @@ if TYPE_CHECKING:
ListPresetVersionsResponse, ListPresetVersionsResponse,
ListPresetVersionsResponseTypedDict, ListPresetVersionsResponseTypedDict,
) )
from .listworkspacebudgetsresponse import (
ListWorkspaceBudgetsResponse,
ListWorkspaceBudgetsResponseTypedDict,
)
from .listworkspacesresponse import ( from .listworkspacesresponse import (
ListWorkspacesResponse, ListWorkspacesResponse,
ListWorkspacesResponseTypedDict, ListWorkspacesResponseTypedDict,
@@ -1218,6 +1274,10 @@ if TYPE_CHECKING:
MessagesAdvisorToolResultBlockType, MessagesAdvisorToolResultBlockType,
MessagesAdvisorToolResultBlockTypedDict, MessagesAdvisorToolResultBlockTypedDict,
) )
from .messagesfallbackparam import (
MessagesFallbackParam,
MessagesFallbackParamTypedDict,
)
from .messagesmessageparam import ( from .messagesmessageparam import (
ContentCompaction, ContentCompaction,
ContentCompactionTypedDict, ContentCompactionTypedDict,
@@ -1373,8 +1433,10 @@ if TYPE_CHECKING:
ModelArchitectureInstructType, ModelArchitectureInstructType,
ModelArchitectureTypedDict, ModelArchitectureTypedDict,
) )
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
from .modelgroup import ModelGroup from .modelgroup import ModelGroup
from .modellinks import ModelLinks, ModelLinksTypedDict from .modellinks import ModelLinks, ModelLinksTypedDict
from .modelresponse import ModelResponse, ModelResponseTypedDict
from .modelscountresponse import ( from .modelscountresponse import (
ModelsCountResponse, ModelsCountResponse,
ModelsCountResponseData, ModelsCountResponseData,
@@ -1820,6 +1882,11 @@ if TYPE_CHECKING:
TypeExit, TypeExit,
TypeTimeout, TypeTimeout,
) )
from .outputsubagentservertoolitem import (
OutputSubagentServerToolItem,
OutputSubagentServerToolItemType,
OutputSubagentServerToolItemTypedDict,
)
from .outputtexteditorservertoolitem import ( from .outputtexteditorservertoolitem import (
Command, Command,
OutputTextEditorServerToolItem, OutputTextEditorServerToolItem,
@@ -1973,7 +2040,7 @@ if TYPE_CHECKING:
from .rankingsdailymeta import ( from .rankingsdailymeta import (
RankingsDailyMeta, RankingsDailyMeta,
RankingsDailyMetaTypedDict, RankingsDailyMetaTypedDict,
Version, RankingsDailyMetaVersion,
) )
from .rankingsdailyresponse import ( from .rankingsdailyresponse import (
RankingsDailyResponse, RankingsDailyResponse,
@@ -2234,6 +2301,21 @@ if TYPE_CHECKING:
) )
from .sttresponse import STTResponse, STTResponseTypedDict from .sttresponse import STTResponse, STTResponseTypedDict
from .sttusage import STTUsage, STTUsageTypedDict from .sttusage import STTUsage, STTUsageTypedDict
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
from .subagentreasoning import (
SubagentReasoning,
SubagentReasoningEffort,
SubagentReasoningTypedDict,
)
from .subagentservertool_openrouter import (
SubagentServerToolOpenRouter,
SubagentServerToolOpenRouterType,
SubagentServerToolOpenRouterTypedDict,
)
from .subagentservertoolconfig import (
SubagentServerToolConfig,
SubagentServerToolConfigTypedDict,
)
from .textdeltaevent import ( from .textdeltaevent import (
TextDeltaEvent, TextDeltaEvent,
TextDeltaEventType, TextDeltaEventType,
@@ -2302,6 +2384,14 @@ if TYPE_CHECKING:
UpdateWorkspaceResponse, UpdateWorkspaceResponse,
UpdateWorkspaceResponseTypedDict, UpdateWorkspaceResponseTypedDict,
) )
from .upsertworkspacebudgetrequest import (
UpsertWorkspaceBudgetRequest,
UpsertWorkspaceBudgetRequestTypedDict,
)
from .upsertworkspacebudgetresponse import (
UpsertWorkspaceBudgetResponse,
UpsertWorkspaceBudgetResponseTypedDict,
)
from .urlcitation import URLCitation, URLCitationType, URLCitationTypedDict from .urlcitation import URLCitation, URLCitationType, URLCitationTypedDict
from .usage import ( from .usage import (
InputTokensDetails, InputTokensDetails,
@@ -2420,6 +2510,12 @@ if TYPE_CHECKING:
WebSearchUserLocationServerToolTypedDict, WebSearchUserLocationServerToolTypedDict,
) )
from .workspace import Workspace, WorkspaceTypedDict from .workspace import Workspace, WorkspaceTypedDict
from .workspacebudget import (
ResetInterval,
WorkspaceBudget,
WorkspaceBudgetTypedDict,
)
from .workspacebudgetinterval import WorkspaceBudgetInterval
from .workspacemember import ( from .workspacemember import (
WorkspaceMember, WorkspaceMember,
WorkspaceMemberRole, WorkspaceMemberRole,
@@ -2427,6 +2523,8 @@ if TYPE_CHECKING:
) )
__all__ = [ __all__ = [
"AABenchmarkEntry",
"AABenchmarkEntryTypedDict",
"APIType", "APIType",
"Action", "Action",
"ActionEnum", "ActionEnum",
@@ -2496,6 +2594,9 @@ __all__ = [
"AnthropicDocumentBlockParamSourceUnion", "AnthropicDocumentBlockParamSourceUnion",
"AnthropicDocumentBlockParamSourceUnionTypedDict", "AnthropicDocumentBlockParamSourceUnionTypedDict",
"AnthropicDocumentBlockParamTypedDict", "AnthropicDocumentBlockParamTypedDict",
"AnthropicFileDocumentSource",
"AnthropicFileDocumentSourceType",
"AnthropicFileDocumentSourceTypedDict",
"AnthropicImageBlockParam", "AnthropicImageBlockParam",
"AnthropicImageBlockParamSource", "AnthropicImageBlockParamSource",
"AnthropicImageBlockParamSourceTypedDict", "AnthropicImageBlockParamSourceTypedDict",
@@ -2627,6 +2728,26 @@ __all__ = [
"BashServerToolEnvironmentTypedDict", "BashServerToolEnvironmentTypedDict",
"BashServerToolType", "BashServerToolType",
"BashServerToolTypedDict", "BashServerToolTypedDict",
"BenchmarkPricing",
"BenchmarkPricingTypedDict",
"BenchmarksAAItem",
"BenchmarksAAItemTypedDict",
"BenchmarksAAMeta",
"BenchmarksAAMetaSource",
"BenchmarksAAMetaSourceURL",
"BenchmarksAAMetaTypedDict",
"BenchmarksAAMetaVersion",
"BenchmarksAAResponse",
"BenchmarksAAResponseTypedDict",
"BenchmarksDAItem",
"BenchmarksDAItemTypedDict",
"BenchmarksDAMeta",
"BenchmarksDAMetaSource",
"BenchmarksDAMetaSourceURL",
"BenchmarksDAMetaTypedDict",
"BenchmarksDAMetaVersion",
"BenchmarksDAResponse",
"BenchmarksDAResponseTypedDict",
"BulkAddWorkspaceMembersRequest", "BulkAddWorkspaceMembersRequest",
"BulkAddWorkspaceMembersRequestTypedDict", "BulkAddWorkspaceMembersRequestTypedDict",
"BulkAddWorkspaceMembersResponse", "BulkAddWorkspaceMembersResponse",
@@ -2736,6 +2857,7 @@ __all__ = [
"ChatRequestPlugin", "ChatRequestPlugin",
"ChatRequestPluginTypedDict", "ChatRequestPluginTypedDict",
"ChatRequestReasoning", "ChatRequestReasoning",
"ChatRequestReasoningEffort",
"ChatRequestReasoningTypedDict", "ChatRequestReasoningTypedDict",
"ChatRequestServiceTier", "ChatRequestServiceTier",
"ChatRequestTypedDict", "ChatRequestTypedDict",
@@ -2945,6 +3067,8 @@ __all__ = [
"CustomToolCallOutputItemTypedDict", "CustomToolCallOutputItemTypedDict",
"CustomToolTypeCustom", "CustomToolTypeCustom",
"CustomToolTypedDict", "CustomToolTypedDict",
"DABenchmarkEntry",
"DABenchmarkEntryTypedDict",
"DataCollection", "DataCollection",
"DataRegion", "DataRegion",
"DatetimeServerTool", "DatetimeServerTool",
@@ -2960,6 +3084,8 @@ __all__ = [
"DeleteGuardrailResponseTypedDict", "DeleteGuardrailResponseTypedDict",
"DeleteObservabilityDestinationResponse", "DeleteObservabilityDestinationResponse",
"DeleteObservabilityDestinationResponseTypedDict", "DeleteObservabilityDestinationResponseTypedDict",
"DeleteWorkspaceBudgetResponse",
"DeleteWorkspaceBudgetResponseTypedDict",
"DeleteWorkspaceResponse", "DeleteWorkspaceResponse",
"DeleteWorkspaceResponseTypedDict", "DeleteWorkspaceResponseTypedDict",
"EasyInputMessage", "EasyInputMessage",
@@ -2994,6 +3120,8 @@ __all__ = [
"EditCompact20260112TypedDict", "EditCompact20260112TypedDict",
"EditTypeInputTokens", "EditTypeInputTokens",
"EditTypedDict", "EditTypedDict",
"EloBounds",
"EloBoundsTypedDict",
"EndpointInfo", "EndpointInfo",
"EndpointInfoTypedDict", "EndpointInfoTypedDict",
"EndpointStatus", "EndpointStatus",
@@ -3013,6 +3141,14 @@ __all__ = [
"FileCitation", "FileCitation",
"FileCitationType", "FileCitationType",
"FileCitationTypedDict", "FileCitationTypedDict",
"FileDeleteResponse",
"FileDeleteResponseType",
"FileDeleteResponseTypedDict",
"FileListResponse",
"FileListResponseTypedDict",
"FileMetadata",
"FileMetadataType",
"FileMetadataTypedDict",
"FileParserPlugin", "FileParserPlugin",
"FileParserPluginID", "FileParserPluginID",
"FileParserPluginTypedDict", "FileParserPluginTypedDict",
@@ -3293,6 +3429,8 @@ __all__ = [
"ListPresetVersionsResponseTypedDict", "ListPresetVersionsResponseTypedDict",
"ListPresetsResponse", "ListPresetsResponse",
"ListPresetsResponseTypedDict", "ListPresetsResponseTypedDict",
"ListWorkspaceBudgetsResponse",
"ListWorkspaceBudgetsResponseTypedDict",
"ListWorkspacesResponse", "ListWorkspacesResponse",
"ListWorkspacesResponseTypedDict", "ListWorkspacesResponseTypedDict",
"LocalShellCallItem", "LocalShellCallItem",
@@ -3331,6 +3469,8 @@ __all__ = [
"MessagesAdvisorToolResultBlock", "MessagesAdvisorToolResultBlock",
"MessagesAdvisorToolResultBlockType", "MessagesAdvisorToolResultBlockType",
"MessagesAdvisorToolResultBlockTypedDict", "MessagesAdvisorToolResultBlockTypedDict",
"MessagesFallbackParam",
"MessagesFallbackParamTypedDict",
"MessagesMessageParam", "MessagesMessageParam",
"MessagesMessageParamContentUnion1", "MessagesMessageParamContentUnion1",
"MessagesMessageParamContentUnion1TypedDict", "MessagesMessageParamContentUnion1TypedDict",
@@ -3372,10 +3512,14 @@ __all__ = [
"ModelArchitecture", "ModelArchitecture",
"ModelArchitectureInstructType", "ModelArchitectureInstructType",
"ModelArchitectureTypedDict", "ModelArchitectureTypedDict",
"ModelBenchmarks",
"ModelBenchmarksTypedDict",
"ModelEnum", "ModelEnum",
"ModelGroup", "ModelGroup",
"ModelLinks", "ModelLinks",
"ModelLinksTypedDict", "ModelLinksTypedDict",
"ModelResponse",
"ModelResponseTypedDict",
"ModelTypedDict", "ModelTypedDict",
"ModelsCountResponse", "ModelsCountResponse",
"ModelsCountResponseData", "ModelsCountResponseData",
@@ -3702,6 +3846,9 @@ __all__ = [
"OutputShellCallOutputItemOutputTypedDict", "OutputShellCallOutputItemOutputTypedDict",
"OutputShellCallOutputItemTypeShellCallOutput", "OutputShellCallOutputItemTypeShellCallOutput",
"OutputShellCallOutputItemTypedDict", "OutputShellCallOutputItemTypedDict",
"OutputSubagentServerToolItem",
"OutputSubagentServerToolItemType",
"OutputSubagentServerToolItemTypedDict",
"OutputTextEditorServerToolItem", "OutputTextEditorServerToolItem",
"OutputTextEditorServerToolItemType", "OutputTextEditorServerToolItemType",
"OutputTextEditorServerToolItemTypedDict", "OutputTextEditorServerToolItemTypedDict",
@@ -3763,6 +3910,7 @@ __all__ = [
"Preset", "Preset",
"PresetDesignatedVersion", "PresetDesignatedVersion",
"PresetDesignatedVersionTypedDict", "PresetDesignatedVersionTypedDict",
"PresetEnum",
"PresetStatus", "PresetStatus",
"PresetTypedDict", "PresetTypedDict",
"PresetWithDesignatedVersion", "PresetWithDesignatedVersion",
@@ -3808,6 +3956,7 @@ __all__ = [
"RankingsDailyItemTypedDict", "RankingsDailyItemTypedDict",
"RankingsDailyMeta", "RankingsDailyMeta",
"RankingsDailyMetaTypedDict", "RankingsDailyMetaTypedDict",
"RankingsDailyMetaVersion",
"RankingsDailyResponse", "RankingsDailyResponse",
"RankingsDailyResponseTypedDict", "RankingsDailyResponseTypedDict",
"Reason", "Reason",
@@ -3874,6 +4023,7 @@ __all__ = [
"RequireApprovalTypedDict", "RequireApprovalTypedDict",
"RequireApprovalUnion", "RequireApprovalUnion",
"RequireApprovalUnionTypedDict", "RequireApprovalUnionTypedDict",
"ResetInterval",
"Resolution", "Resolution",
"Response", "Response",
"ResponseFormat", "ResponseFormat",
@@ -4007,6 +4157,16 @@ __all__ = [
"StreamLogprobTopLogprob", "StreamLogprobTopLogprob",
"StreamLogprobTopLogprobTypedDict", "StreamLogprobTopLogprobTypedDict",
"StreamLogprobTypedDict", "StreamLogprobTypedDict",
"SubagentNestedTool",
"SubagentNestedToolTypedDict",
"SubagentReasoning",
"SubagentReasoningEffort",
"SubagentReasoningTypedDict",
"SubagentServerToolConfig",
"SubagentServerToolConfigTypedDict",
"SubagentServerToolOpenRouter",
"SubagentServerToolOpenRouterType",
"SubagentServerToolOpenRouterTypedDict",
"SupportedAspectRatio", "SupportedAspectRatio",
"SupportedFrameImage", "SupportedFrameImage",
"SupportedResolution", "SupportedResolution",
@@ -4066,6 +4226,8 @@ __all__ = [
"ToolWebSearch20260209TypedDict", "ToolWebSearch20260209TypedDict",
"TopProviderInfo", "TopProviderInfo",
"TopProviderInfoTypedDict", "TopProviderInfoTypedDict",
"TournamentStats",
"TournamentStatsTypedDict",
"TraceConfig", "TraceConfig",
"TraceConfigTypedDict", "TraceConfigTypedDict",
"Trigger", "Trigger",
@@ -4135,6 +4297,10 @@ __all__ = [
"UpdateWorkspaceRequestTypedDict", "UpdateWorkspaceRequestTypedDict",
"UpdateWorkspaceResponse", "UpdateWorkspaceResponse",
"UpdateWorkspaceResponseTypedDict", "UpdateWorkspaceResponseTypedDict",
"UpsertWorkspaceBudgetRequest",
"UpsertWorkspaceBudgetRequestTypedDict",
"UpsertWorkspaceBudgetResponse",
"UpsertWorkspaceBudgetResponseTypedDict",
"Usage", "Usage",
"UsageCostDetails", "UsageCostDetails",
"UsageCostDetailsTypedDict", "UsageCostDetailsTypedDict",
@@ -4144,7 +4310,6 @@ __all__ = [
"Variables", "Variables",
"VariablesTypedDict", "VariablesTypedDict",
"Verbosity", "Verbosity",
"Version",
"VideoGenerationRequest", "VideoGenerationRequest",
"VideoGenerationRequestProvider", "VideoGenerationRequestProvider",
"VideoGenerationRequestProviderTypedDict", "VideoGenerationRequestProviderTypedDict",
@@ -4207,6 +4372,9 @@ __all__ = [
"WebSearchUserLocationType", "WebSearchUserLocationType",
"WebSearchUserLocationTypedDict", "WebSearchUserLocationTypedDict",
"Workspace", "Workspace",
"WorkspaceBudget",
"WorkspaceBudgetInterval",
"WorkspaceBudgetTypedDict",
"WorkspaceMember", "WorkspaceMember",
"WorkspaceMemberRole", "WorkspaceMemberRole",
"WorkspaceMemberTypedDict", "WorkspaceMemberTypedDict",
@@ -4214,6 +4382,8 @@ __all__ = [
] ]
_dynamic_imports: dict[str, str] = { _dynamic_imports: dict[str, str] = {
"AABenchmarkEntry": ".aabenchmarkentry",
"AABenchmarkEntryTypedDict": ".aabenchmarkentry",
"ActivityItem": ".activityitem", "ActivityItem": ".activityitem",
"ActivityItemTypedDict": ".activityitem", "ActivityItemTypedDict": ".activityitem",
"ActivityResponse": ".activityresponse", "ActivityResponse": ".activityresponse",
@@ -4272,6 +4442,9 @@ _dynamic_imports: dict[str, str] = {
"SourceContentTypedDict": ".anthropicdocumentblockparam", "SourceContentTypedDict": ".anthropicdocumentblockparam",
"SourceType": ".anthropicdocumentblockparam", "SourceType": ".anthropicdocumentblockparam",
"TypeDocument": ".anthropicdocumentblockparam", "TypeDocument": ".anthropicdocumentblockparam",
"AnthropicFileDocumentSource": ".anthropicfiledocumentsource",
"AnthropicFileDocumentSourceType": ".anthropicfiledocumentsource",
"AnthropicFileDocumentSourceTypedDict": ".anthropicfiledocumentsource",
"AnthropicImageBlockParam": ".anthropicimageblockparam", "AnthropicImageBlockParam": ".anthropicimageblockparam",
"AnthropicImageBlockParamSource": ".anthropicimageblockparam", "AnthropicImageBlockParamSource": ".anthropicimageblockparam",
"AnthropicImageBlockParamSourceTypedDict": ".anthropicimageblockparam", "AnthropicImageBlockParamSourceTypedDict": ".anthropicimageblockparam",
@@ -4396,6 +4569,30 @@ _dynamic_imports: dict[str, str] = {
"BashServerToolEngine": ".bashservertoolengine", "BashServerToolEngine": ".bashservertoolengine",
"BashServerToolEnvironment": ".bashservertoolenvironment", "BashServerToolEnvironment": ".bashservertoolenvironment",
"BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment", "BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment",
"BenchmarkPricing": ".benchmarkpricing",
"BenchmarkPricingTypedDict": ".benchmarkpricing",
"BenchmarksAAItem": ".benchmarksaaitem",
"BenchmarksAAItemTypedDict": ".benchmarksaaitem",
"BenchmarksAAMeta": ".benchmarksaameta",
"BenchmarksAAMetaSource": ".benchmarksaameta",
"BenchmarksAAMetaSourceURL": ".benchmarksaameta",
"BenchmarksAAMetaTypedDict": ".benchmarksaameta",
"BenchmarksAAMetaVersion": ".benchmarksaameta",
"BenchmarksAAResponse": ".benchmarksaaresponse",
"BenchmarksAAResponseTypedDict": ".benchmarksaaresponse",
"BenchmarksDAItem": ".benchmarksdaitem",
"BenchmarksDAItemTypedDict": ".benchmarksdaitem",
"TournamentStats": ".benchmarksdaitem",
"TournamentStatsTypedDict": ".benchmarksdaitem",
"BenchmarksDAMeta": ".benchmarksdameta",
"BenchmarksDAMetaSource": ".benchmarksdameta",
"BenchmarksDAMetaSourceURL": ".benchmarksdameta",
"BenchmarksDAMetaTypedDict": ".benchmarksdameta",
"BenchmarksDAMetaVersion": ".benchmarksdameta",
"EloBounds": ".benchmarksdameta",
"EloBoundsTypedDict": ".benchmarksdameta",
"BenchmarksDAResponse": ".benchmarksdaresponse",
"BenchmarksDAResponseTypedDict": ".benchmarksdaresponse",
"BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse", "BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse",
@@ -4507,6 +4704,7 @@ _dynamic_imports: dict[str, str] = {
"ChatRequestPlugin": ".chatrequest", "ChatRequestPlugin": ".chatrequest",
"ChatRequestPluginTypedDict": ".chatrequest", "ChatRequestPluginTypedDict": ".chatrequest",
"ChatRequestReasoning": ".chatrequest", "ChatRequestReasoning": ".chatrequest",
"ChatRequestReasoningEffort": ".chatrequest",
"ChatRequestReasoningTypedDict": ".chatrequest", "ChatRequestReasoningTypedDict": ".chatrequest",
"ChatRequestServiceTier": ".chatrequest", "ChatRequestServiceTier": ".chatrequest",
"ChatRequestTypedDict": ".chatrequest", "ChatRequestTypedDict": ".chatrequest",
@@ -4712,6 +4910,8 @@ _dynamic_imports: dict[str, str] = {
"CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem",
"CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem",
"CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem",
"DABenchmarkEntry": ".dabenchmarkentry",
"DABenchmarkEntryTypedDict": ".dabenchmarkentry",
"DatetimeServerTool": ".datetimeservertool", "DatetimeServerTool": ".datetimeservertool",
"DatetimeServerToolType": ".datetimeservertool", "DatetimeServerToolType": ".datetimeservertool",
"DatetimeServerToolTypedDict": ".datetimeservertool", "DatetimeServerToolTypedDict": ".datetimeservertool",
@@ -4725,6 +4925,8 @@ _dynamic_imports: dict[str, str] = {
"DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse", "DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse",
"DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse", "DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse",
"DeleteObservabilityDestinationResponseTypedDict": ".deleteobservabilitydestinationresponse", "DeleteObservabilityDestinationResponseTypedDict": ".deleteobservabilitydestinationresponse",
"DeleteWorkspaceBudgetResponse": ".deleteworkspacebudgetresponse",
"DeleteWorkspaceBudgetResponseTypedDict": ".deleteworkspacebudgetresponse",
"DeleteWorkspaceResponse": ".deleteworkspaceresponse", "DeleteWorkspaceResponse": ".deleteworkspaceresponse",
"DeleteWorkspaceResponseTypedDict": ".deleteworkspaceresponse", "DeleteWorkspaceResponseTypedDict": ".deleteworkspaceresponse",
"EasyInputMessage": ".easyinputmessage", "EasyInputMessage": ".easyinputmessage",
@@ -4761,6 +4963,14 @@ _dynamic_imports: dict[str, str] = {
"FileCitation": ".filecitation", "FileCitation": ".filecitation",
"FileCitationType": ".filecitation", "FileCitationType": ".filecitation",
"FileCitationTypedDict": ".filecitation", "FileCitationTypedDict": ".filecitation",
"FileDeleteResponse": ".filedeleteresponse",
"FileDeleteResponseType": ".filedeleteresponse",
"FileDeleteResponseTypedDict": ".filedeleteresponse",
"FileListResponse": ".filelistresponse",
"FileListResponseTypedDict": ".filelistresponse",
"FileMetadata": ".filemetadata",
"FileMetadataType": ".filemetadata",
"FileMetadataTypedDict": ".filemetadata",
"FileParserPlugin": ".fileparserplugin", "FileParserPlugin": ".fileparserplugin",
"FileParserPluginID": ".fileparserplugin", "FileParserPluginID": ".fileparserplugin",
"FileParserPluginTypedDict": ".fileparserplugin", "FileParserPluginTypedDict": ".fileparserplugin",
@@ -4864,6 +5074,7 @@ _dynamic_imports: dict[str, str] = {
"FusionPluginTool": ".fusionplugin", "FusionPluginTool": ".fusionplugin",
"FusionPluginToolTypedDict": ".fusionplugin", "FusionPluginToolTypedDict": ".fusionplugin",
"FusionPluginTypedDict": ".fusionplugin", "FusionPluginTypedDict": ".fusionplugin",
"PresetEnum": ".fusionplugin",
"FusionServerToolOpenRouter": ".fusionservertool_openrouter", "FusionServerToolOpenRouter": ".fusionservertool_openrouter",
"FusionServerToolOpenRouterType": ".fusionservertool_openrouter", "FusionServerToolOpenRouterType": ".fusionservertool_openrouter",
"FusionServerToolOpenRouterTypedDict": ".fusionservertool_openrouter", "FusionServerToolOpenRouterTypedDict": ".fusionservertool_openrouter",
@@ -5042,6 +5253,8 @@ _dynamic_imports: dict[str, str] = {
"ListPresetsResponseTypedDict": ".listpresetsresponse", "ListPresetsResponseTypedDict": ".listpresetsresponse",
"ListPresetVersionsResponse": ".listpresetversionsresponse", "ListPresetVersionsResponse": ".listpresetversionsresponse",
"ListPresetVersionsResponseTypedDict": ".listpresetversionsresponse", "ListPresetVersionsResponseTypedDict": ".listpresetversionsresponse",
"ListWorkspaceBudgetsResponse": ".listworkspacebudgetsresponse",
"ListWorkspaceBudgetsResponseTypedDict": ".listworkspacebudgetsresponse",
"ListWorkspacesResponse": ".listworkspacesresponse", "ListWorkspacesResponse": ".listworkspacesresponse",
"ListWorkspacesResponseTypedDict": ".listworkspacesresponse", "ListWorkspacesResponseTypedDict": ".listworkspacesresponse",
"LocalShellCallItem": ".localshellcallitem", "LocalShellCallItem": ".localshellcallitem",
@@ -5091,6 +5304,8 @@ _dynamic_imports: dict[str, str] = {
"MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock",
"MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock",
"MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock",
"MessagesFallbackParam": ".messagesfallbackparam",
"MessagesFallbackParamTypedDict": ".messagesfallbackparam",
"ContentCompaction": ".messagesmessageparam", "ContentCompaction": ".messagesmessageparam",
"ContentCompactionTypedDict": ".messagesmessageparam", "ContentCompactionTypedDict": ".messagesmessageparam",
"ContentRedactedThinking": ".messagesmessageparam", "ContentRedactedThinking": ".messagesmessageparam",
@@ -5239,9 +5454,13 @@ _dynamic_imports: dict[str, str] = {
"ModelArchitecture": ".modelarchitecture", "ModelArchitecture": ".modelarchitecture",
"ModelArchitectureInstructType": ".modelarchitecture", "ModelArchitectureInstructType": ".modelarchitecture",
"ModelArchitectureTypedDict": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture",
"ModelBenchmarks": ".modelbenchmarks",
"ModelBenchmarksTypedDict": ".modelbenchmarks",
"ModelGroup": ".modelgroup", "ModelGroup": ".modelgroup",
"ModelLinks": ".modellinks", "ModelLinks": ".modellinks",
"ModelLinksTypedDict": ".modellinks", "ModelLinksTypedDict": ".modellinks",
"ModelResponse": ".modelresponse",
"ModelResponseTypedDict": ".modelresponse",
"ModelsCountResponse": ".modelscountresponse", "ModelsCountResponse": ".modelscountresponse",
"ModelsCountResponseData": ".modelscountresponse", "ModelsCountResponseData": ".modelscountresponse",
"ModelsCountResponseDataTypedDict": ".modelscountresponse", "ModelsCountResponseDataTypedDict": ".modelscountresponse",
@@ -5573,6 +5792,9 @@ _dynamic_imports: dict[str, str] = {
"OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem", "OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem",
"TypeExit": ".outputshellcalloutputitem", "TypeExit": ".outputshellcalloutputitem",
"TypeTimeout": ".outputshellcalloutputitem", "TypeTimeout": ".outputshellcalloutputitem",
"OutputSubagentServerToolItem": ".outputsubagentservertoolitem",
"OutputSubagentServerToolItemType": ".outputsubagentservertoolitem",
"OutputSubagentServerToolItemTypedDict": ".outputsubagentservertoolitem",
"Command": ".outputtexteditorservertoolitem", "Command": ".outputtexteditorservertoolitem",
"OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem",
"OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem",
@@ -5690,7 +5912,7 @@ _dynamic_imports: dict[str, str] = {
"RankingsDailyItemTypedDict": ".rankingsdailyitem", "RankingsDailyItemTypedDict": ".rankingsdailyitem",
"RankingsDailyMeta": ".rankingsdailymeta", "RankingsDailyMeta": ".rankingsdailymeta",
"RankingsDailyMetaTypedDict": ".rankingsdailymeta", "RankingsDailyMetaTypedDict": ".rankingsdailymeta",
"Version": ".rankingsdailymeta", "RankingsDailyMetaVersion": ".rankingsdailymeta",
"RankingsDailyResponse": ".rankingsdailyresponse", "RankingsDailyResponse": ".rankingsdailyresponse",
"RankingsDailyResponseTypedDict": ".rankingsdailyresponse", "RankingsDailyResponseTypedDict": ".rankingsdailyresponse",
"ReasoningConfig": ".reasoningconfig", "ReasoningConfig": ".reasoningconfig",
@@ -5869,6 +6091,16 @@ _dynamic_imports: dict[str, str] = {
"STTResponseTypedDict": ".sttresponse", "STTResponseTypedDict": ".sttresponse",
"STTUsage": ".sttusage", "STTUsage": ".sttusage",
"STTUsageTypedDict": ".sttusage", "STTUsageTypedDict": ".sttusage",
"SubagentNestedTool": ".subagentnestedtool",
"SubagentNestedToolTypedDict": ".subagentnestedtool",
"SubagentReasoning": ".subagentreasoning",
"SubagentReasoningEffort": ".subagentreasoning",
"SubagentReasoningTypedDict": ".subagentreasoning",
"SubagentServerToolOpenRouter": ".subagentservertool_openrouter",
"SubagentServerToolOpenRouterType": ".subagentservertool_openrouter",
"SubagentServerToolOpenRouterTypedDict": ".subagentservertool_openrouter",
"SubagentServerToolConfig": ".subagentservertoolconfig",
"SubagentServerToolConfigTypedDict": ".subagentservertoolconfig",
"TextDeltaEvent": ".textdeltaevent", "TextDeltaEvent": ".textdeltaevent",
"TextDeltaEventType": ".textdeltaevent", "TextDeltaEventType": ".textdeltaevent",
"TextDeltaEventTypedDict": ".textdeltaevent", "TextDeltaEventTypedDict": ".textdeltaevent",
@@ -5913,6 +6145,10 @@ _dynamic_imports: dict[str, str] = {
"UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest", "UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest",
"UpdateWorkspaceResponse": ".updateworkspaceresponse", "UpdateWorkspaceResponse": ".updateworkspaceresponse",
"UpdateWorkspaceResponseTypedDict": ".updateworkspaceresponse", "UpdateWorkspaceResponseTypedDict": ".updateworkspaceresponse",
"UpsertWorkspaceBudgetRequest": ".upsertworkspacebudgetrequest",
"UpsertWorkspaceBudgetRequestTypedDict": ".upsertworkspacebudgetrequest",
"UpsertWorkspaceBudgetResponse": ".upsertworkspacebudgetresponse",
"UpsertWorkspaceBudgetResponseTypedDict": ".upsertworkspacebudgetresponse",
"URLCitation": ".urlcitation", "URLCitation": ".urlcitation",
"URLCitationType": ".urlcitation", "URLCitationType": ".urlcitation",
"URLCitationTypedDict": ".urlcitation", "URLCitationTypedDict": ".urlcitation",
@@ -5995,6 +6231,10 @@ _dynamic_imports: dict[str, str] = {
"WebSearchUserLocationServerToolTypedDict": ".websearchuserlocationservertool", "WebSearchUserLocationServerToolTypedDict": ".websearchuserlocationservertool",
"Workspace": ".workspace", "Workspace": ".workspace",
"WorkspaceTypedDict": ".workspace", "WorkspaceTypedDict": ".workspace",
"ResetInterval": ".workspacebudget",
"WorkspaceBudget": ".workspacebudget",
"WorkspaceBudgetTypedDict": ".workspacebudget",
"WorkspaceBudgetInterval": ".workspacebudgetinterval",
"WorkspaceMember": ".workspacemember", "WorkspaceMember": ".workspacemember",
"WorkspaceMemberRole": ".workspacemember", "WorkspaceMemberRole": ".workspacemember",
"WorkspaceMemberTypedDict": ".workspacemember", "WorkspaceMemberTypedDict": ".workspacemember",
@@ -0,0 +1,60 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing_extensions import TypedDict
class AABenchmarkEntryTypedDict(TypedDict):
r"""Artificial Analysis benchmark index scores."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index score"""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index score"""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index score"""
class AABenchmarkEntry(BaseModel):
r"""Artificial Analysis benchmark index scores."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index score"""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index score"""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index score"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["agentic_index", "coding_index", "intelligence_index"]
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
@@ -9,15 +9,14 @@ from typing_extensions import NotRequired, TypedDict
class AdvisorNestedToolTypedDict(TypedDict): class AdvisorNestedToolTypedDict(TypedDict):
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself.""" r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself."""
type: str type: str
function: NotRequired[Dict[str, Nullable[Any]]]
parameters: NotRequired[Dict[str, Nullable[Any]]] parameters: NotRequired[Dict[str, Nullable[Any]]]
class AdvisorNestedTool(BaseModel): class AdvisorNestedTool(BaseModel):
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself.""" r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself."""
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, arbitrary_types_allowed=True, extra="allow" populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
@@ -26,8 +25,6 @@ class AdvisorNestedTool(BaseModel):
type: str type: str
function: Optional[Dict[str, Nullable[Any]]] = None
parameters: Optional[Dict[str, Nullable[Any]]] = None parameters: Optional[Dict[str, Nullable[Any]]] = None
@property @property
@@ -30,7 +30,7 @@ class AdvisorServerToolConfigTypedDict(TypedDict):
temperature: NotRequired[float] temperature: NotRequired[float]
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.""" r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
tools: NotRequired[List[AdvisorNestedToolTypedDict]] tools: NotRequired[List[AdvisorNestedToolTypedDict]]
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself.""" r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
class AdvisorServerToolConfig(BaseModel): class AdvisorServerToolConfig(BaseModel):
@@ -64,4 +64,4 @@ class AdvisorServerToolConfig(BaseModel):
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.""" r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
tools: Optional[List[AdvisorNestedTool]] = None tools: Optional[List[AdvisorNestedTool]] = None
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself.""" r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
@@ -9,6 +9,10 @@ from .anthropiccachecontroldirective import (
AnthropicCacheControlDirective, AnthropicCacheControlDirective,
AnthropicCacheControlDirectiveTypedDict, AnthropicCacheControlDirectiveTypedDict,
) )
from .anthropicfiledocumentsource import (
AnthropicFileDocumentSource,
AnthropicFileDocumentSourceTypedDict,
)
from .anthropicimageblockparam import ( from .anthropicimageblockparam import (
AnthropicImageBlockParam, AnthropicImageBlockParam,
AnthropicImageBlockParamTypedDict, AnthropicImageBlockParamTypedDict,
@@ -89,6 +93,7 @@ AnthropicDocumentBlockParamSourceUnionTypedDict = TypeAliasType(
Union[ Union[
SourceContentTypedDict, SourceContentTypedDict,
AnthropicURLPdfSourceTypedDict, AnthropicURLPdfSourceTypedDict,
AnthropicFileDocumentSourceTypedDict,
AnthropicBase64PdfSourceTypedDict, AnthropicBase64PdfSourceTypedDict,
AnthropicPlainTextSourceTypedDict, AnthropicPlainTextSourceTypedDict,
], ],
@@ -101,6 +106,7 @@ AnthropicDocumentBlockParamSourceUnion = Annotated[
Annotated[AnthropicPlainTextSource, Tag("text")], Annotated[AnthropicPlainTextSource, Tag("text")],
Annotated[SourceContent, Tag("content")], Annotated[SourceContent, Tag("content")],
Annotated[AnthropicURLPdfSource, Tag("url")], Annotated[AnthropicURLPdfSource, Tag("url")],
Annotated[AnthropicFileDocumentSource, Tag("file")],
], ],
Discriminator(lambda m: get_discriminator(m, "type", "type")), Discriminator(lambda m: get_discriminator(m, "type", "type")),
] ]
@@ -0,0 +1,20 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
AnthropicFileDocumentSourceType = Literal["file",]
class AnthropicFileDocumentSourceTypedDict(TypedDict):
file_id: str
type: AnthropicFileDocumentSourceType
class AnthropicFileDocumentSource(BaseModel):
file_id: str
type: AnthropicFileDocumentSourceType
@@ -0,0 +1,24 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class BenchmarkPricingTypedDict(TypedDict):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
r"""Cost per output token (USD, decimal string)."""
prompt: str
r"""Cost per input token (USD, decimal string)."""
class BenchmarkPricing(BaseModel):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
r"""Cost per output token (USD, decimal string)."""
prompt: str
r"""Cost per input token (USD, decimal string)."""
@@ -0,0 +1,77 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing_extensions import TypedDict
class BenchmarksAAItemTypedDict(TypedDict):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[BenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
class BenchmarksAAItem(BaseModel):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[BenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = [
"agentic_index",
"coding_index",
"intelligence_index",
"pricing",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,53 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
BenchmarksAAMetaSource = Literal["artificial-analysis",]
r"""Data source identifier."""
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
r"""URL of the upstream data source."""
BenchmarksAAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksAAMetaTypedDict(TypedDict):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
class BenchmarksAAMeta(BaseModel):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
@@ -0,0 +1,19 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksAAResponseTypedDict(TypedDict):
data: List[BenchmarksAAItemTypedDict]
meta: BenchmarksAAMetaTypedDict
class BenchmarksAAResponse(BaseModel):
data: List[BenchmarksAAItem]
meta: BenchmarksAAMeta
@@ -0,0 +1,147 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing_extensions import TypedDict
class TournamentStatsTypedDict(TypedDict):
r"""Placement distribution from tournament matches."""
first_place: Nullable[int]
fourth_place: Nullable[int]
second_place: Nullable[int]
third_place: Nullable[int]
total: Nullable[int]
class TournamentStats(BaseModel):
r"""Placement distribution from tournament matches."""
first_place: Nullable[int]
fourth_place: Nullable[int]
second_place: Nullable[int]
third_place: Nullable[int]
total: Nullable[int]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = [
"first_place",
"fourth_place",
"second_place",
"third_place",
"total",
]
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 BenchmarksDAItemTypedDict(TypedDict):
arena: str
r"""Arena this ranking belongs to."""
avg_generation_time_ms: Nullable[float]
r"""Average generation time in milliseconds."""
category: str
r"""Category within the arena."""
display_name: str
r"""Human-readable model name from Design Arena."""
elo: float
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
pricing: Nullable[BenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
tournament_stats: TournamentStatsTypedDict
r"""Placement distribution from tournament matches."""
win_rate: float
r"""Win rate as a percentage (0100)."""
class BenchmarksDAItem(BaseModel):
arena: str
r"""Arena this ranking belongs to."""
avg_generation_time_ms: Nullable[float]
r"""Average generation time in milliseconds."""
category: str
r"""Category within the arena."""
display_name: str
r"""Human-readable model name from Design Arena."""
elo: float
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
pricing: Nullable[BenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
tournament_stats: TournamentStats
r"""Placement distribution from tournament matches."""
win_rate: float
r"""Win rate as a percentage (0100)."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["avg_generation_time_ms", "pricing"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
class EloBoundsTypedDict(TypedDict):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
class EloBounds(BaseModel):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
BenchmarksDAMetaSource = Literal["design-arena",]
r"""Data source identifier."""
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
r"""URL of the upstream data source."""
BenchmarksDAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksDAMetaTypedDict(TypedDict):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBoundsTypedDict
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
class BenchmarksDAMeta(BaseModel):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBounds
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["category"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,19 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksDAResponseTypedDict(TypedDict):
data: List[BenchmarksDAItemTypedDict]
meta: BenchmarksDAMetaTypedDict
class BenchmarksDAResponse(BaseModel):
data: List[BenchmarksDAItem]
meta: BenchmarksDAMeta
@@ -27,6 +27,10 @@ from .openrouterwebsearchservertool import (
OpenRouterWebSearchServerTool, OpenRouterWebSearchServerTool,
OpenRouterWebSearchServerToolTypedDict, OpenRouterWebSearchServerToolTypedDict,
) )
from .subagentservertool_openrouter import (
SubagentServerToolOpenRouter,
SubagentServerToolOpenRouterTypedDict,
)
from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict
from openrouter.types import ( from openrouter.types import (
BaseModel, BaseModel,
@@ -129,6 +133,7 @@ ChatFunctionToolTypedDict = TypeAliasType(
DatetimeServerToolTypedDict, DatetimeServerToolTypedDict,
ImageGenerationServerToolOpenRouterTypedDict, ImageGenerationServerToolOpenRouterTypedDict,
ChatSearchModelsServerToolTypedDict, ChatSearchModelsServerToolTypedDict,
SubagentServerToolOpenRouterTypedDict,
WebFetchServerToolTypedDict, WebFetchServerToolTypedDict,
OpenRouterWebSearchServerToolTypedDict, OpenRouterWebSearchServerToolTypedDict,
ChatFunctionToolFunctionTypedDict, ChatFunctionToolFunctionTypedDict,
@@ -150,6 +155,7 @@ ChatFunctionTool = Annotated[
Annotated[ Annotated[
ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models") ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models")
], ],
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")], Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")],
Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")], Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")],
Annotated[ChatWebSearchShorthand, Tag("web_search")], Annotated[ChatWebSearchShorthand, Tag("web_search")],
+52
View File
@@ -170,6 +170,20 @@ class ChatRequestReasoning(BaseModel):
return m return m
ChatRequestReasoningEffort = Union[
Literal[
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
ResponseFormatTypedDict = TypeAliasType( ResponseFormatTypedDict = TypeAliasType(
"ResponseFormatTypedDict", "ResponseFormatTypedDict",
Union[ Union[
@@ -240,6 +254,8 @@ class ChatRequestTypedDict(TypedDict):
r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.""" r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16."""
metadata: NotRequired[Dict[str, str]] metadata: NotRequired[Dict[str, str]]
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
min_p: NotRequired[Nullable[float]]
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
modalities: NotRequired[List[Modality]] modalities: NotRequired[List[Modality]]
r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".""" r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"."""
model: NotRequired[str] model: NotRequired[str]
@@ -256,6 +272,10 @@ class ChatRequestTypedDict(TypedDict):
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
reasoning: NotRequired[ChatRequestReasoningTypedDict] reasoning: NotRequired[ChatRequestReasoningTypedDict]
r"""Configuration options for reasoning models""" r"""Configuration options for reasoning models"""
reasoning_effort: NotRequired[Nullable[ChatRequestReasoningEffort]]
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
repetition_penalty: NotRequired[Nullable[float]]
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
response_format: NotRequired[ResponseFormatTypedDict] response_format: NotRequired[ResponseFormatTypedDict]
r"""Response format configuration""" r"""Response format configuration"""
seed: NotRequired[Nullable[int]] seed: NotRequired[Nullable[int]]
@@ -278,6 +298,10 @@ class ChatRequestTypedDict(TypedDict):
r"""Tool choice configuration""" r"""Tool choice configuration"""
tools: NotRequired[List[ChatFunctionToolTypedDict]] tools: NotRequired[List[ChatFunctionToolTypedDict]]
r"""Available tools for function calling""" r"""Available tools for function calling"""
top_a: NotRequired[Nullable[float]]
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
top_k: NotRequired[Nullable[int]]
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
top_logprobs: NotRequired[Nullable[int]] top_logprobs: NotRequired[Nullable[int]]
r"""Number of top log probabilities to return (0-20)""" r"""Number of top log probabilities to return (0-20)"""
top_p: NotRequired[Nullable[float]] top_p: NotRequired[Nullable[float]]
@@ -321,6 +345,9 @@ class ChatRequest(BaseModel):
metadata: Optional[Dict[str, str]] = None metadata: Optional[Dict[str, str]] = None
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
min_p: OptionalNullable[float] = UNSET
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
modalities: Optional[ modalities: Optional[
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]] List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
] = None ] = None
@@ -347,6 +374,15 @@ class ChatRequest(BaseModel):
reasoning: Optional[ChatRequestReasoning] = None reasoning: Optional[ChatRequestReasoning] = None
r"""Configuration options for reasoning models""" r"""Configuration options for reasoning models"""
reasoning_effort: Annotated[
OptionalNullable[ChatRequestReasoningEffort],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
repetition_penalty: OptionalNullable[float] = UNSET
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
response_format: Optional[ResponseFormat] = None response_format: Optional[ResponseFormat] = None
r"""Response format configuration""" r"""Response format configuration"""
@@ -383,6 +419,12 @@ class ChatRequest(BaseModel):
tools: Optional[List[ChatFunctionTool]] = None tools: Optional[List[ChatFunctionTool]] = None
r"""Available tools for function calling""" r"""Available tools for function calling"""
top_a: OptionalNullable[float] = UNSET
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
top_k: OptionalNullable[int] = UNSET
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
top_logprobs: OptionalNullable[int] = UNSET top_logprobs: OptionalNullable[int] = UNSET
r"""Number of top log probabilities to return (0-20)""" r"""Number of top log probabilities to return (0-20)"""
@@ -407,6 +449,7 @@ class ChatRequest(BaseModel):
"max_completion_tokens", "max_completion_tokens",
"max_tokens", "max_tokens",
"metadata", "metadata",
"min_p",
"modalities", "modalities",
"model", "model",
"models", "models",
@@ -415,6 +458,8 @@ class ChatRequest(BaseModel):
"presence_penalty", "presence_penalty",
"provider", "provider",
"reasoning", "reasoning",
"reasoning_effort",
"repetition_penalty",
"response_format", "response_format",
"seed", "seed",
"service_tier", "service_tier",
@@ -426,6 +471,8 @@ class ChatRequest(BaseModel):
"temperature", "temperature",
"tool_choice", "tool_choice",
"tools", "tools",
"top_a",
"top_k",
"top_logprobs", "top_logprobs",
"top_p", "top_p",
"trace", "trace",
@@ -437,14 +484,19 @@ class ChatRequest(BaseModel):
"logprobs", "logprobs",
"max_completion_tokens", "max_completion_tokens",
"max_tokens", "max_tokens",
"min_p",
"parallel_tool_calls", "parallel_tool_calls",
"presence_penalty", "presence_penalty",
"provider", "provider",
"reasoning_effort",
"repetition_penalty",
"seed", "seed",
"service_tier", "service_tier",
"stop", "stop",
"stream_options", "stream_options",
"temperature", "temperature",
"top_a",
"top_k",
"top_logprobs", "top_logprobs",
"top_p", "top_p",
] ]
@@ -31,20 +31,20 @@ class ChatWebSearchShorthandTypedDict(TypedDict):
type: ChatWebSearchShorthandType type: ChatWebSearchShorthandType
allowed_domains: NotRequired[List[str]] allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: NotRequired[List[str]] excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: NotRequired[int] max_characters: NotRequired[int]
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: NotRequired[int] max_total_results: NotRequired[int]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
parameters: NotRequired[WebSearchConfigTypedDict] parameters: NotRequired[WebSearchConfigTypedDict]
search_context_size: NotRequired[SearchQualityLevel] search_context_size: NotRequired[SearchQualityLevel]
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
@@ -57,21 +57,21 @@ class ChatWebSearchShorthand(BaseModel):
] ]
allowed_domains: Optional[List[str]] = None allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: Optional[List[str]] = None excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: Optional[int] = None max_characters: Optional[int] = None
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: Optional[int] = None max_total_results: Optional[int] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
@@ -81,7 +81,7 @@ class ChatWebSearchShorthand(BaseModel):
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: Optional[WebSearchUserLocationServerTool] = None user_location: Optional[WebSearchUserLocationServerTool] = None
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class DABenchmarkEntryTypedDict(TypedDict):
r"""A single Design Arena benchmark entry for a specific arena+category"""
arena: str
r"""Arena type (e.g. models, builders, agents)"""
category: str
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
elo: float
r"""ELO rating from head-to-head arena battles"""
rank: int
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
win_rate: float
r"""Win rate percentage in arena battles"""
class DABenchmarkEntry(BaseModel):
r"""A single Design Arena benchmark entry for a specific arena+category"""
arena: str
r"""Arena type (e.g. models, builders, agents)"""
category: str
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
elo: float
r"""ELO rating from head-to-head arena battles"""
rank: int
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
win_rate: float
r"""Win rate percentage in arena battles"""
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class DeleteWorkspaceBudgetResponseTypedDict(TypedDict):
deleted: Literal[True]
r"""Confirmation that the budget was deleted (or did not exist)"""
class DeleteWorkspaceBudgetResponse(BaseModel):
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Confirmation that the budget was deleted (or did not exist)"""
@@ -0,0 +1,24 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
FileDeleteResponseType = Literal["file_deleted",]
class FileDeleteResponseTypedDict(TypedDict):
r"""Confirmation that a file was deleted."""
id: str
type: FileDeleteResponseType
class FileDeleteResponse(BaseModel):
r"""Confirmation that a file was deleted."""
id: str
type: FileDeleteResponseType
@@ -0,0 +1,64 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .filemetadata import FileMetadata, FileMetadataTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List
from typing_extensions import TypedDict
class FileListResponseTypedDict(TypedDict):
r"""A page of files belonging to the requesting workspace."""
cursor: Nullable[str]
r"""Opaque cursor for the next page; null when there are no more results."""
data: List[FileMetadataTypedDict]
first_id: Nullable[str]
has_more: bool
last_id: Nullable[str]
class FileListResponse(BaseModel):
r"""A page of files belonging to the requesting workspace."""
cursor: Nullable[str]
r"""Opaque cursor for the next page; null when there are no more results."""
data: List[FileMetadata]
first_id: Nullable[str]
has_more: bool
last_id: Nullable[str]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["cursor", "first_id", "last_id"]
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
+39
View File
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
FileMetadataType = Literal["file",]
class FileMetadataTypedDict(TypedDict):
r"""Metadata describing a stored file."""
created_at: str
downloadable: bool
filename: str
id: str
mime_type: str
size_bytes: int
type: FileMetadataType
class FileMetadata(BaseModel):
r"""Metadata describing a stored file."""
created_at: str
downloadable: bool
filename: str
id: str
mime_type: str
size_bytes: int
type: FileMetadataType
+22 -3
View File
@@ -1,14 +1,26 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from openrouter.types import BaseModel, Nullable from openrouter.types import BaseModel, Nullable, UnrecognizedStr
from typing import Any, Dict, List, Literal, Optional from openrouter.utils import validate_open_enum
from typing_extensions import NotRequired, TypedDict from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
FusionPluginID = Literal["fusion",] FusionPluginID = Literal["fusion",]
PresetEnum = Union[
Literal[
"general-high",
"general-budget",
],
UnrecognizedStr,
]
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
class FusionPluginToolTypedDict(TypedDict): class FusionPluginToolTypedDict(TypedDict):
type: str type: str
r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\").""" r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\")."""
@@ -34,6 +46,8 @@ class FusionPluginTypedDict(TypedDict):
r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16.""" r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16."""
model: NotRequired[str] model: NotRequired[str]
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset.""" r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
preset: NotRequired[PresetEnum]
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
tools: NotRequired[List[FusionPluginToolTypedDict]] tools: NotRequired[List[FusionPluginToolTypedDict]]
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).""" r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
@@ -53,5 +67,10 @@ class FusionPlugin(BaseModel):
model: Optional[str] = None model: Optional[str] = None
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset.""" r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
preset: Annotated[
Optional[PresetEnum], PlainValidator(validate_open_enum(False))
] = None
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
tools: Optional[List[FusionPluginTool]] = None tools: Optional[List[FusionPluginTool]] = None
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).""" r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
+44 -32
View File
@@ -84,6 +84,10 @@ from .outputfunctioncallitem import (
OutputFunctionCallItem, OutputFunctionCallItem,
OutputFunctionCallItemTypedDict, OutputFunctionCallItemTypedDict,
) )
from .outputfusionservertoolitem import (
OutputFusionServerToolItem,
OutputFusionServerToolItemTypedDict,
)
from .outputimagegenerationcallitem import ( from .outputimagegenerationcallitem import (
OutputImageGenerationCallItem, OutputImageGenerationCallItem,
OutputImageGenerationCallItemTypedDict, OutputImageGenerationCallItemTypedDict,
@@ -104,6 +108,10 @@ from .outputsearchmodelsservertoolitem import (
OutputSearchModelsServerToolItem, OutputSearchModelsServerToolItem,
OutputSearchModelsServerToolItemTypedDict, OutputSearchModelsServerToolItemTypedDict,
) )
from .outputsubagentservertoolitem import (
OutputSubagentServerToolItem,
OutputSubagentServerToolItemTypedDict,
)
from .outputtexteditorservertoolitem import ( from .outputtexteditorservertoolitem import (
OutputTextEditorServerToolItem, OutputTextEditorServerToolItem,
OutputTextEditorServerToolItemTypedDict, OutputTextEditorServerToolItemTypedDict,
@@ -388,44 +396,46 @@ InputsUnion1TypedDict = TypeAliasType(
OutputFileSearchCallItemTypedDict, OutputFileSearchCallItemTypedDict,
EasyInputMessageTypedDict, EasyInputMessageTypedDict,
InputMessageItemTypedDict, InputMessageItemTypedDict,
CustomToolCallOutputItemTypedDict,
LocalShellCallOutputItemTypedDict, LocalShellCallOutputItemTypedDict,
OutputToolSearchServerToolItemTypedDict, OutputToolSearchServerToolItemTypedDict,
OutputFileSearchServerToolItemTypedDict, OutputFileSearchServerToolItemTypedDict,
OutputWebSearchServerToolItemTypedDict, OutputWebSearchServerToolItemTypedDict,
CustomToolCallOutputItemTypedDict,
OutputImageGenerationCallItemTypedDict, OutputImageGenerationCallItemTypedDict,
OutputWebSearchCallItemTypedDict, OutputWebSearchCallItemTypedDict,
OutputDatetimeItemTypedDict,
OutputMcpServerToolItemTypedDict,
FunctionCallOutputItemTypedDict,
LocalShellCallItemTypedDict, LocalShellCallItemTypedDict,
OutputSearchModelsServerToolItemTypedDict, OutputSearchModelsServerToolItemTypedDict,
FunctionCallOutputItemTypedDict,
ApplyPatchCallItemTypedDict, ApplyPatchCallItemTypedDict,
OutputDatetimeItemTypedDict,
McpApprovalResponseItemTypedDict,
McpApprovalRequestItemTypedDict,
McpListToolsItemTypedDict, McpListToolsItemTypedDict,
ApplyPatchCallOutputItemTypedDict, ApplyPatchCallOutputItemTypedDict,
McpApprovalResponseItemTypedDict,
OutputBrowserUseServerToolItemTypedDict, OutputBrowserUseServerToolItemTypedDict,
McpApprovalRequestItemTypedDict, OutputMcpServerToolItemTypedDict,
OutputTextEditorServerToolItemTypedDict, OutputTextEditorServerToolItemTypedDict,
OutputApplyPatchServerToolItemTypedDict, OutputApplyPatchServerToolItemTypedDict,
CustomToolCallItemTypedDict, ShellCallItemTypedDict,
InputsMessageTypedDict, InputsMessageTypedDict,
OutputMemoryServerToolItemTypedDict, OutputMemoryServerToolItemTypedDict,
OutputCustomToolCallItemTypedDict,
ShellCallItemTypedDict,
ShellCallOutputItemTypedDict,
OutputComputerCallItemTypedDict,
OutputCodeInterpreterCallItemTypedDict, OutputCodeInterpreterCallItemTypedDict,
OutputImageGenerationServerToolItemTypedDict, OutputCustomToolCallItemTypedDict,
OutputBashServerToolItemTypedDict, OutputComputerCallItemTypedDict,
CustomToolCallItemTypedDict,
ShellCallOutputItemTypedDict,
McpCallItemTypedDict, McpCallItemTypedDict,
OutputImageGenerationServerToolItemTypedDict,
OutputFunctionCallItemTypedDict, OutputFunctionCallItemTypedDict,
OutputBashServerToolItemTypedDict,
FunctionCallItemTypedDict, FunctionCallItemTypedDict,
OutputAdvisorServerToolItemTypedDict,
OutputWebFetchServerToolItemTypedDict,
ReasoningItemTypedDict, ReasoningItemTypedDict,
OutputCodeInterpreterServerToolItemTypedDict, OutputSubagentServerToolItemTypedDict,
InputsReasoningTypedDict, InputsReasoningTypedDict,
OutputCodeInterpreterServerToolItemTypedDict,
OutputWebFetchServerToolItemTypedDict,
OutputAdvisorServerToolItemTypedDict,
OutputFusionServerToolItemTypedDict,
], ],
) )
@@ -438,44 +448,46 @@ InputsUnion1 = TypeAliasType(
OutputFileSearchCallItem, OutputFileSearchCallItem,
EasyInputMessage, EasyInputMessage,
InputMessageItem, InputMessageItem,
CustomToolCallOutputItem,
LocalShellCallOutputItem, LocalShellCallOutputItem,
OutputToolSearchServerToolItem, OutputToolSearchServerToolItem,
OutputFileSearchServerToolItem, OutputFileSearchServerToolItem,
OutputWebSearchServerToolItem, OutputWebSearchServerToolItem,
CustomToolCallOutputItem,
OutputImageGenerationCallItem, OutputImageGenerationCallItem,
OutputWebSearchCallItem, OutputWebSearchCallItem,
OutputDatetimeItem,
OutputMcpServerToolItem,
FunctionCallOutputItem,
LocalShellCallItem, LocalShellCallItem,
OutputSearchModelsServerToolItem, OutputSearchModelsServerToolItem,
FunctionCallOutputItem,
ApplyPatchCallItem, ApplyPatchCallItem,
OutputDatetimeItem,
McpApprovalResponseItem,
McpApprovalRequestItem,
McpListToolsItem, McpListToolsItem,
ApplyPatchCallOutputItem, ApplyPatchCallOutputItem,
McpApprovalResponseItem,
OutputBrowserUseServerToolItem, OutputBrowserUseServerToolItem,
McpApprovalRequestItem, OutputMcpServerToolItem,
OutputTextEditorServerToolItem, OutputTextEditorServerToolItem,
OutputApplyPatchServerToolItem, OutputApplyPatchServerToolItem,
CustomToolCallItem, ShellCallItem,
InputsMessage, InputsMessage,
OutputMemoryServerToolItem, OutputMemoryServerToolItem,
OutputCustomToolCallItem,
ShellCallItem,
ShellCallOutputItem,
OutputComputerCallItem,
OutputCodeInterpreterCallItem, OutputCodeInterpreterCallItem,
OutputImageGenerationServerToolItem, OutputCustomToolCallItem,
OutputBashServerToolItem, OutputComputerCallItem,
CustomToolCallItem,
ShellCallOutputItem,
McpCallItem, McpCallItem,
OutputImageGenerationServerToolItem,
OutputFunctionCallItem, OutputFunctionCallItem,
OutputBashServerToolItem,
FunctionCallItem, FunctionCallItem,
OutputAdvisorServerToolItem,
OutputWebFetchServerToolItem,
ReasoningItem, ReasoningItem,
OutputCodeInterpreterServerToolItem, OutputSubagentServerToolItem,
InputsReasoning, InputsReasoning,
OutputCodeInterpreterServerToolItem,
OutputWebFetchServerToolItem,
OutputAdvisorServerToolItem,
OutputFusionServerToolItem,
], ],
) )
@@ -27,10 +27,10 @@ class LegacyWebSearchServerToolTypedDict(TypedDict):
type: LegacyWebSearchServerToolType type: LegacyWebSearchServerToolType
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: NotRequired[SearchContextSizeEnum] search_context_size: NotRequired[SearchContextSizeEnum]
r"""Size of the search context for web search tools""" r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
@@ -45,12 +45,12 @@ class LegacyWebSearchServerTool(BaseModel):
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: OptionalNullable[WebSearchDomainFilter] = UNSET filters: OptionalNullable[WebSearchDomainFilter] = UNSET
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
@@ -0,0 +1,17 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class ListWorkspaceBudgetsResponseTypedDict(TypedDict):
data: List[WorkspaceBudgetTypedDict]
r"""List of budgets configured for the workspace"""
class ListWorkspaceBudgetsResponse(BaseModel):
data: List[WorkspaceBudget]
r"""List of budgets configured for the workspace"""
@@ -0,0 +1,33 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable
import pydantic
from pydantic import ConfigDict
from typing import Any, Dict
from typing_extensions import TypedDict
class MessagesFallbackParamTypedDict(TypedDict):
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
model: str
class MessagesFallbackParam(BaseModel):
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
model_config = ConfigDict(
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
)
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
model: str
@property
def additional_properties(self):
return self.__pydantic_extra__
@additional_properties.setter
def additional_properties(self, value):
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
+14 -1
View File
@@ -50,6 +50,7 @@ from .imagegenerationservertool_openrouter import (
ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter,
ImageGenerationServerToolOpenRouterTypedDict, ImageGenerationServerToolOpenRouterTypedDict,
) )
from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict
from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict
from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
@@ -1046,6 +1047,8 @@ class MessagesRequestTypedDict(TypedDict):
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
context_management: NotRequired[Nullable[ContextManagementTypedDict]] context_management: NotRequired[Nullable[ContextManagementTypedDict]]
fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]]
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
max_tokens: NotRequired[int] max_tokens: NotRequired[int]
metadata: NotRequired[MetadataTypedDict] metadata: NotRequired[MetadataTypedDict]
models: NotRequired[List[str]] models: NotRequired[List[str]]
@@ -1088,6 +1091,9 @@ class MessagesRequest(BaseModel):
context_management: OptionalNullable[ContextManagement] = UNSET context_management: OptionalNullable[ContextManagement] = UNSET
fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
max_tokens: Optional[int] = None max_tokens: Optional[int] = None
metadata: Optional[Metadata] = None metadata: Optional[Metadata] = None
@@ -1144,6 +1150,7 @@ class MessagesRequest(BaseModel):
optional_fields = [ optional_fields = [
"cache_control", "cache_control",
"context_management", "context_management",
"fallbacks",
"max_tokens", "max_tokens",
"metadata", "metadata",
"models", "models",
@@ -1166,7 +1173,13 @@ class MessagesRequest(BaseModel):
"trace", "trace",
"user", "user",
] ]
nullable_fields = ["context_management", "messages", "provider", "speed"] nullable_fields = [
"context_management",
"fallbacks",
"messages",
"provider",
"speed",
]
null_default_fields = [] null_default_fields = []
serialized = handler(self) serialized = handler(self)
+7
View File
@@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
from .modellinks import ModelLinks, ModelLinksTypedDict from .modellinks import ModelLinks, ModelLinksTypedDict
from .parameter import Parameter from .parameter import Parameter
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
@@ -51,6 +52,8 @@ class ModelTypedDict(TypedDict):
r"""List of supported voice identifiers for TTS models. Null for non-TTS models.""" r"""List of supported voice identifiers for TTS models. Null for non-TTS models."""
top_provider: TopProviderInfoTypedDict top_provider: TopProviderInfoTypedDict
r"""Information about the top provider for this model""" r"""Information about the top provider for this model"""
benchmarks: NotRequired[ModelBenchmarksTypedDict]
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
description: NotRequired[str] description: NotRequired[str]
r"""Description of the model""" r"""Description of the model"""
expiration_date: NotRequired[Nullable[str]] expiration_date: NotRequired[Nullable[str]]
@@ -105,6 +108,9 @@ class Model(BaseModel):
top_provider: TopProviderInfo top_provider: TopProviderInfo
r"""Information about the top provider for this model""" r"""Information about the top provider for this model"""
benchmarks: Optional[ModelBenchmarks] = None
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
description: Optional[str] = None description: Optional[str] = None
r"""Description of the model""" r"""Description of the model"""
@@ -120,6 +126,7 @@ class Model(BaseModel):
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
"benchmarks",
"description", "description",
"expiration_date", "expiration_date",
"hugging_face_id", "hugging_face_id",
@@ -0,0 +1,27 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
from openrouter.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class ModelBenchmarksTypedDict(TypedDict):
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
design_arena: List[DABenchmarkEntryTypedDict]
r"""Design Arena ELO rankings across arena+category pairs."""
artificial_analysis: NotRequired[AABenchmarkEntryTypedDict]
r"""Artificial Analysis benchmark index scores."""
class ModelBenchmarks(BaseModel):
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
design_arena: List[DABenchmarkEntry]
r"""Design Arena ELO rankings across arena+category pairs."""
artificial_analysis: Optional[AABenchmarkEntry] = None
r"""Artificial Analysis benchmark index scores."""
@@ -0,0 +1,20 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .model import Model, ModelTypedDict
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class ModelResponseTypedDict(TypedDict):
r"""Single model response"""
data: ModelTypedDict
r"""Information about an AI model available on OpenRouter"""
class ModelResponse(BaseModel):
r"""Single model response"""
data: Model
r"""Information about an AI model available on OpenRouter"""
+6
View File
@@ -81,6 +81,10 @@ from .outputshellcalloutputitem import (
OutputShellCallOutputItem, OutputShellCallOutputItem,
OutputShellCallOutputItemTypedDict, OutputShellCallOutputItemTypedDict,
) )
from .outputsubagentservertoolitem import (
OutputSubagentServerToolItem,
OutputSubagentServerToolItemTypedDict,
)
from .outputtexteditorservertoolitem import ( from .outputtexteditorservertoolitem import (
OutputTextEditorServerToolItem, OutputTextEditorServerToolItem,
OutputTextEditorServerToolItemTypedDict, OutputTextEditorServerToolItemTypedDict,
@@ -138,6 +142,7 @@ OutputItemsTypedDict = TypeAliasType(
OutputReasoningItemTypedDict, OutputReasoningItemTypedDict,
OutputFusionServerToolItemTypedDict, OutputFusionServerToolItemTypedDict,
OutputAdvisorServerToolItemTypedDict, OutputAdvisorServerToolItemTypedDict,
OutputSubagentServerToolItemTypedDict,
], ],
) )
r"""An output item from the response""" r"""An output item from the response"""
@@ -172,6 +177,7 @@ OutputItems = Annotated[
], ],
Annotated[OutputMcpServerToolItem, Tag("openrouter:mcp")], Annotated[OutputMcpServerToolItem, Tag("openrouter:mcp")],
Annotated[OutputMemoryServerToolItem, Tag("openrouter:memory")], Annotated[OutputMemoryServerToolItem, Tag("openrouter:memory")],
Annotated[OutputSubagentServerToolItem, Tag("openrouter:subagent")],
Annotated[OutputTextEditorServerToolItem, Tag("openrouter:text_editor")], Annotated[OutputTextEditorServerToolItem, Tag("openrouter:text_editor")],
Annotated[OutputToolSearchServerToolItem, Tag("openrouter:tool_search")], Annotated[OutputToolSearchServerToolItem, Tag("openrouter:tool_search")],
Annotated[OutputWebFetchServerToolItem, Tag("openrouter:web_fetch")], Annotated[OutputWebFetchServerToolItem, Tag("openrouter:web_fetch")],
@@ -0,0 +1,55 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .toolcallstatus import ToolCallStatus
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
OutputSubagentServerToolItemType = Literal["openrouter:subagent",]
class OutputSubagentServerToolItemTypedDict(TypedDict):
r"""An openrouter:subagent server tool output item"""
status: ToolCallStatus
type: OutputSubagentServerToolItemType
error: NotRequired[str]
r"""Error message when the subagent task did not produce an outcome."""
id: NotRequired[str]
model: NotRequired[str]
r"""Slug of the worker model that executed the task."""
outcome: NotRequired[str]
r"""The worker model's result (the outcome text returned to the delegating model)."""
task_description: NotRequired[str]
r"""The task description the delegating model sent to the worker."""
task_name: NotRequired[str]
r"""The short task identifier the delegating model supplied."""
class OutputSubagentServerToolItem(BaseModel):
r"""An openrouter:subagent server tool output item"""
status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))]
type: OutputSubagentServerToolItemType
error: Optional[str] = None
r"""Error message when the subagent task did not produce an outcome."""
id: Optional[str] = None
model: Optional[str] = None
r"""Slug of the worker model that executed the task."""
outcome: Optional[str] = None
r"""The worker model's result (the outcome text returned to the delegating model)."""
task_description: Optional[str] = None
r"""The task description the delegating model sent to the worker."""
task_name: Optional[str] = None
r"""The short task identifier the delegating model supplied."""
@@ -30,10 +30,10 @@ class Preview20250311WebSearchServerToolTypedDict(TypedDict):
type: Preview20250311WebSearchServerToolType type: Preview20250311WebSearchServerToolType
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: NotRequired[SearchContextSizeEnum] search_context_size: NotRequired[SearchContextSizeEnum]
r"""Size of the search context for web search tools""" r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
@@ -47,12 +47,12 @@ class Preview20250311WebSearchServerTool(BaseModel):
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: OptionalNullable[WebSearchDomainFilter] = UNSET filters: OptionalNullable[WebSearchDomainFilter] = UNSET
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
@@ -30,10 +30,10 @@ class PreviewWebSearchServerToolTypedDict(TypedDict):
type: PreviewWebSearchServerToolType type: PreviewWebSearchServerToolType
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: NotRequired[SearchContextSizeEnum] search_context_size: NotRequired[SearchContextSizeEnum]
r"""Size of the search context for web search tools""" r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
@@ -47,12 +47,12 @@ class PreviewWebSearchServerTool(BaseModel):
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: OptionalNullable[WebSearchDomainFilter] = UNSET filters: OptionalNullable[WebSearchDomainFilter] = UNSET
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
+2 -2
View File
@@ -8,7 +8,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
class ProviderOptionsTypedDict(TypedDict): class ProviderOptionsTypedDict(TypedDict):
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
oneai: NotRequired[Dict[str, Nullable[Any]]] oneai: NotRequired[Dict[str, Nullable[Any]]]
ai21: NotRequired[Dict[str, Nullable[Any]]] ai21: NotRequired[Dict[str, Nullable[Any]]]
@@ -128,7 +128,7 @@ class ProviderOptionsTypedDict(TypedDict):
class ProviderOptions(BaseModel): class ProviderOptions(BaseModel):
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
oneai: Annotated[ oneai: Annotated[
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai") Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
@@ -6,7 +6,7 @@ from typing import Literal
from typing_extensions import TypedDict from typing_extensions import TypedDict
Version = Literal["v1",] RankingsDailyMetaVersion = Literal["v1",]
r"""Dataset version. Field names and grain are stable for the life of `v1`.""" r"""Dataset version. Field names and grain are stable for the life of `v1`."""
@@ -17,7 +17,7 @@ class RankingsDailyMetaTypedDict(TypedDict):
r"""Resolved end of the date window (UTC, inclusive).""" r"""Resolved end of the date window (UTC, inclusive)."""
start_date: str start_date: str
r"""Resolved start of the date window (UTC, inclusive).""" r"""Resolved start of the date window (UTC, inclusive)."""
version: Version version: RankingsDailyMetaVersion
r"""Dataset version. Field names and grain are stable for the life of `v1`.""" r"""Dataset version. Field names and grain are stable for the life of `v1`."""
@@ -31,5 +31,5 @@ class RankingsDailyMeta(BaseModel):
start_date: str start_date: str
r"""Resolved start of the date window (UTC, inclusive).""" r"""Resolved start of the date window (UTC, inclusive)."""
version: Version version: RankingsDailyMetaVersion
r"""Dataset version. Field names and grain are stable for the life of `v1`.""" r"""Dataset version. Field names and grain are stable for the life of `v1`."""
@@ -84,6 +84,10 @@ from .stopservertoolswhencondition import (
StopServerToolsWhenConditionTypedDict, StopServerToolsWhenConditionTypedDict,
) )
from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict
from .subagentservertool_openrouter import (
SubagentServerToolOpenRouter,
SubagentServerToolOpenRouterTypedDict,
)
from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict
from .traceconfig import TraceConfig, TraceConfigTypedDict from .traceconfig import TraceConfig, TraceConfigTypedDict
from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict
@@ -217,16 +221,17 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
CodexLocalShellToolTypedDict, CodexLocalShellToolTypedDict,
ApplyPatchServerToolTypedDict, ApplyPatchServerToolTypedDict,
ShellServerToolTypedDict, ShellServerToolTypedDict,
ImageGenerationServerToolOpenRouterTypedDict,
ChatSearchModelsServerToolTypedDict, ChatSearchModelsServerToolTypedDict,
WebFetchServerToolTypedDict,
ShellServerToolOpenRouterTypedDict, ShellServerToolOpenRouterTypedDict,
BashServerToolTypedDict, BashServerToolTypedDict,
CodeInterpreterServerToolTypedDict, CodeInterpreterServerToolTypedDict,
ApplyPatchServerToolOpenRouterTypedDict, ApplyPatchServerToolOpenRouterTypedDict,
WebSearchServerToolOpenRouterTypedDict, WebSearchServerToolOpenRouterTypedDict,
ImageGenerationServerToolOpenRouterTypedDict, WebFetchServerToolTypedDict,
FusionServerToolOpenRouterTypedDict, FusionServerToolOpenRouterTypedDict,
DatetimeServerToolTypedDict, DatetimeServerToolTypedDict,
SubagentServerToolOpenRouterTypedDict,
AdvisorServerToolOpenRouterTypedDict, AdvisorServerToolOpenRouterTypedDict,
CustomToolTypedDict, CustomToolTypedDict,
ComputerUseServerToolTypedDict, ComputerUseServerToolTypedDict,
@@ -234,8 +239,8 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
FileSearchServerToolTypedDict, FileSearchServerToolTypedDict,
PreviewWebSearchServerToolTypedDict, PreviewWebSearchServerToolTypedDict,
Preview20250311WebSearchServerToolTypedDict, Preview20250311WebSearchServerToolTypedDict,
LegacyWebSearchServerToolTypedDict,
WebSearchServerToolTypedDict, WebSearchServerToolTypedDict,
LegacyWebSearchServerToolTypedDict,
McpServerToolTypedDict, McpServerToolTypedDict,
ImageGenerationServerToolTypedDict, ImageGenerationServerToolTypedDict,
], ],
@@ -261,6 +266,7 @@ ResponsesRequestToolUnion = Annotated[
Annotated[ApplyPatchServerTool, Tag("apply_patch")], Annotated[ApplyPatchServerTool, Tag("apply_patch")],
Annotated[CustomTool, Tag("custom")], Annotated[CustomTool, Tag("custom")],
Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")], Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")],
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
Annotated[DatetimeServerTool, Tag("openrouter:datetime")], Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")], Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")],
Annotated[ Annotated[
@@ -13,4 +13,4 @@ SearchQualityLevel = Union[
], ],
UnrecognizedStr, UnrecognizedStr,
] ]
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
+2 -2
View File
@@ -13,14 +13,14 @@ class SpeechRequestProviderTypedDict(TypedDict):
r"""Provider-specific passthrough configuration""" r"""Provider-specific passthrough configuration"""
options: NotRequired[ProviderOptionsTypedDict] options: NotRequired[ProviderOptionsTypedDict]
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
class SpeechRequestProvider(BaseModel): class SpeechRequestProvider(BaseModel):
r"""Provider-specific passthrough configuration""" r"""Provider-specific passthrough configuration"""
options: Optional[ProviderOptions] = None options: Optional[ProviderOptions] = None
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
ResponseFormatEnum = Union[ ResponseFormatEnum = Union[
+2 -2
View File
@@ -12,14 +12,14 @@ class STTRequestProviderTypedDict(TypedDict):
r"""Provider-specific passthrough configuration""" r"""Provider-specific passthrough configuration"""
options: NotRequired[ProviderOptionsTypedDict] options: NotRequired[ProviderOptionsTypedDict]
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
class STTRequestProvider(BaseModel): class STTRequestProvider(BaseModel):
r"""Provider-specific passthrough configuration""" r"""Provider-specific passthrough configuration"""
options: Optional[ProviderOptions] = None options: Optional[ProviderOptions] = None
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
class STTRequestTypedDict(TypedDict): class STTRequestTypedDict(TypedDict):
@@ -0,0 +1,36 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable
import pydantic
from pydantic import ConfigDict
from typing import Any, Dict, Optional
from typing_extensions import NotRequired, TypedDict
class SubagentNestedToolTypedDict(TypedDict):
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself."""
type: str
parameters: NotRequired[Dict[str, Nullable[Any]]]
class SubagentNestedTool(BaseModel):
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself."""
model_config = ConfigDict(
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
)
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
type: str
parameters: Optional[Dict[str, Nullable[Any]]] = None
@property
def additional_properties(self):
return self.__pydantic_extra__
@additional_properties.setter
def additional_properties(self, value):
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
@@ -0,0 +1,43 @@
"""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_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
SubagentReasoningEffort = Union[
Literal[
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
r"""Reasoning effort level for the subagent call."""
class SubagentReasoningTypedDict(TypedDict):
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
effort: NotRequired[SubagentReasoningEffort]
r"""Reasoning effort level for the subagent call."""
max_tokens: NotRequired[int]
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
class SubagentReasoning(BaseModel):
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
effort: Annotated[
Optional[SubagentReasoningEffort], PlainValidator(validate_open_enum(False))
] = None
r"""Reasoning effort level for the subagent call."""
max_tokens: Optional[int] = None
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
@@ -0,0 +1,30 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .subagentservertoolconfig import (
SubagentServerToolConfig,
SubagentServerToolConfigTypedDict,
)
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
SubagentServerToolOpenRouterType = Literal["openrouter:subagent",]
class SubagentServerToolOpenRouterTypedDict(TypedDict):
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
type: SubagentServerToolOpenRouterType
parameters: NotRequired[SubagentServerToolConfigTypedDict]
r"""Configuration for the openrouter:subagent server tool."""
class SubagentServerToolOpenRouter(BaseModel):
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
type: SubagentServerToolOpenRouterType
parameters: Optional[SubagentServerToolConfig] = None
r"""Configuration for the openrouter:subagent server tool."""
@@ -0,0 +1,52 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
from .subagentreasoning import SubagentReasoning, SubagentReasoningTypedDict
from openrouter.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class SubagentServerToolConfigTypedDict(TypedDict):
r"""Configuration for the openrouter:subagent server tool."""
instructions: NotRequired[str]
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
max_completion_tokens: NotRequired[int]
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
max_tool_calls: NotRequired[int]
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
model: NotRequired[str]
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
reasoning: NotRequired[SubagentReasoningTypedDict]
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
temperature: NotRequired[float]
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
tools: NotRequired[List[SubagentNestedToolTypedDict]]
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
class SubagentServerToolConfig(BaseModel):
r"""Configuration for the openrouter:subagent server tool."""
instructions: Optional[str] = None
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
max_completion_tokens: Optional[int] = None
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
max_tool_calls: Optional[int] = None
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
model: Optional[str] = None
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
reasoning: Optional[SubagentReasoning] = None
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
temperature: Optional[float] = None
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
tools: Optional[List[SubagentNestedTool]] = None
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
@@ -0,0 +1,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class UpsertWorkspaceBudgetRequestTypedDict(TypedDict):
limit_usd: float
r"""Spending limit in USD. Must be greater than 0."""
class UpsertWorkspaceBudgetRequest(BaseModel):
limit_usd: float
r"""Spending limit in USD. Must be greater than 0."""
@@ -0,0 +1,14 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class UpsertWorkspaceBudgetResponseTypedDict(TypedDict):
data: WorkspaceBudgetTypedDict
class UpsertWorkspaceBudgetResponse(BaseModel):
data: WorkspaceBudget
+5 -2
View File
@@ -2,8 +2,8 @@
from __future__ import annotations from __future__ import annotations
from openrouter.types import BaseModel from openrouter.types import BaseModel
from typing import Literal from typing import Literal, Optional
from typing_extensions import TypedDict from typing_extensions import NotRequired, TypedDict
URLCitationType = Literal["url_citation",] URLCitationType = Literal["url_citation",]
@@ -15,6 +15,7 @@ class URLCitationTypedDict(TypedDict):
title: str title: str
type: URLCitationType type: URLCitationType
url: str url: str
content: NotRequired[str]
class URLCitation(BaseModel): class URLCitation(BaseModel):
@@ -27,3 +28,5 @@ class URLCitation(BaseModel):
type: URLCitationType type: URLCitationType
url: str url: str
content: Optional[str] = None
@@ -29,7 +29,7 @@ r"""Aspect ratio of the generated video"""
class OptionsTypedDict(TypedDict): class OptionsTypedDict(TypedDict):
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
oneai: NotRequired[Dict[str, Nullable[Any]]] oneai: NotRequired[Dict[str, Nullable[Any]]]
ai21: NotRequired[Dict[str, Nullable[Any]]] ai21: NotRequired[Dict[str, Nullable[Any]]]
@@ -149,7 +149,7 @@ class OptionsTypedDict(TypedDict):
class Options(BaseModel): class Options(BaseModel):
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
oneai: Annotated[ oneai: Annotated[
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai") Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
+12 -12
View File
@@ -16,40 +16,40 @@ from typing_extensions import Annotated, NotRequired, TypedDict
class WebSearchConfigTypedDict(TypedDict): class WebSearchConfigTypedDict(TypedDict):
allowed_domains: NotRequired[List[str]] allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: NotRequired[List[str]] excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: NotRequired[int] max_characters: NotRequired[int]
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: NotRequired[int] max_total_results: NotRequired[int]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
search_context_size: NotRequired[SearchQualityLevel] search_context_size: NotRequired[SearchQualityLevel]
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
class WebSearchConfig(BaseModel): class WebSearchConfig(BaseModel):
allowed_domains: Optional[List[str]] = None allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: Optional[List[str]] = None excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: Optional[int] = None max_characters: Optional[int] = None
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: Optional[int] = None max_total_results: Optional[int] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
@@ -57,7 +57,7 @@ class WebSearchConfig(BaseModel):
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: Optional[WebSearchUserLocationServerTool] = None user_location: Optional[WebSearchUserLocationServerTool] = None
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
@@ -11,6 +11,7 @@ WebSearchEngine = Union[
"exa", "exa",
"firecrawl", "firecrawl",
"parallel", "parallel",
"perplexity",
], ],
UnrecognizedStr, UnrecognizedStr,
] ]
@@ -7,12 +7,13 @@ from typing import Literal, Union
WebSearchEngineEnum = Union[ WebSearchEngineEnum = Union[
Literal[ Literal[
"auto",
"native", "native",
"exa", "exa",
"parallel", "parallel",
"firecrawl", "firecrawl",
"perplexity",
"auto",
], ],
UnrecognizedStr, UnrecognizedStr,
] ]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
@@ -27,10 +27,10 @@ class WebSearchServerToolTypedDict(TypedDict):
type: WebSearchServerToolType type: WebSearchServerToolType
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: NotRequired[SearchContextSizeEnum] search_context_size: NotRequired[SearchContextSizeEnum]
r"""Size of the search context for web search tools""" r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
@@ -45,12 +45,12 @@ class WebSearchServerTool(BaseModel):
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
filters: OptionalNullable[WebSearchDomainFilter] = UNSET filters: OptionalNullable[WebSearchDomainFilter] = UNSET
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
@@ -18,19 +18,19 @@ class WebSearchServerToolConfigTypedDict(TypedDict):
r"""Configuration for the openrouter:web_search server tool""" r"""Configuration for the openrouter:web_search server tool"""
allowed_domains: NotRequired[List[str]] allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: NotRequired[WebSearchEngineEnum] engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: NotRequired[List[str]] excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: NotRequired[int] max_characters: NotRequired[int]
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: NotRequired[int] max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: NotRequired[int] max_total_results: NotRequired[int]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
search_context_size: NotRequired[SearchQualityLevel] search_context_size: NotRequired[SearchQualityLevel]
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
@@ -39,21 +39,21 @@ class WebSearchServerToolConfig(BaseModel):
r"""Configuration for the openrouter:web_search server tool""" r"""Configuration for the openrouter:web_search server tool"""
allowed_domains: Optional[List[str]] = None allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
engine: Annotated[ engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
excluded_domains: Optional[List[str]] = None excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
max_characters: Optional[int] = None max_characters: Optional[int] = None
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
max_results: Optional[int] = None max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
max_total_results: Optional[int] = None max_total_results: Optional[int] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
@@ -61,7 +61,7 @@ class WebSearchServerToolConfig(BaseModel):
search_context_size: Annotated[ search_context_size: Annotated[
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
] = None ] = None
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
user_location: Optional[WebSearchUserLocationServerTool] = None user_location: Optional[WebSearchUserLocationServerTool] = None
r"""Approximate user location for location-biased results.""" r"""Approximate user location for location-biased results."""
@@ -0,0 +1,87 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, 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
ResetInterval = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
class WorkspaceBudgetTypedDict(TypedDict):
created_at: str
r"""ISO 8601 timestamp of when the budget was created"""
id: str
r"""Unique identifier for the budget"""
limit_usd: float
r"""Spending limit in USD for this interval"""
reset_interval: Nullable[ResetInterval]
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
updated_at: str
r"""ISO 8601 timestamp of when the budget was last updated"""
workspace_id: str
r"""ID of the workspace the budget belongs to"""
class WorkspaceBudget(BaseModel):
created_at: str
r"""ISO 8601 timestamp of when the budget was created"""
id: str
r"""Unique identifier for the budget"""
limit_usd: float
r"""Spending limit in USD for this interval"""
reset_interval: Annotated[
Nullable[ResetInterval], PlainValidator(validate_open_enum(False))
]
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
updated_at: str
r"""ISO 8601 timestamp of when the budget was last updated"""
workspace_id: str
r"""ID of the workspace the budget belongs to"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["reset_interval"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,17 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
WorkspaceBudgetInterval = Union[
Literal[
"daily",
"weekly",
"monthly",
"lifetime",
],
UnrecognizedStr,
]
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
+536
View File
@@ -426,6 +426,542 @@ class Datasets(BaseSDK):
raise errors.OpenRouterDefaultError("Unexpected response received", http_res) raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_benchmarks_artificial_analysis(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksAAResponse:
r"""Artificial Analysis Benchmark Indices
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param max_results: Max results to return (1100, default 50).
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksArtificialAnalysisRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
max_results=max_results,
)
req = self._build_request(
method="GET",
path="/datasets/benchmarks/artificial-analysis",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksArtificialAnalysis",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_benchmarks_artificial_analysis_async(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksAAResponse:
r"""Artificial Analysis Benchmark Indices
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param max_results: Max results to return (1100, default 50).
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksArtificialAnalysisRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
max_results=max_results,
)
req = self._build_request_async(
method="GET",
path="/datasets/benchmarks/artificial-analysis",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksArtificialAnalysis",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_benchmarks_design_arena(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
arena: Optional[operations.Arena] = "models",
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksDAResponse:
r"""Design Arena Benchmark Rankings
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param arena: Arena to query. Defaults to `models`.
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return: per category when no category filter is applied (1100, default 50).
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksDesignArenaRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request(
method="GET",
path="/datasets/benchmarks/design-arena",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksDesignArenaGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksDesignArena",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_benchmarks_design_arena_async(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
arena: Optional[operations.Arena] = "models",
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksDAResponse:
r"""Design Arena Benchmark Rankings
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param arena: Arena to query. Defaults to `models`.
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return: per category when no category filter is applied (1100, default 50).
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksDesignArenaRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request_async(
method="GET",
path="/datasets/benchmarks/design-arena",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksDesignArenaGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksDesignArena",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_rankings_daily( def get_rankings_daily(
self, self,
*, *,
File diff suppressed because it is too large Load Diff
+314
View File
@@ -12,6 +12,254 @@ from typing import Any, Mapping, Optional, Union
class Models(BaseSDK): class Models(BaseSDK):
r"""Model information endpoints""" r"""Model information endpoints"""
def get(
self,
*,
author: str,
slug: str,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.ModelResponse:
r"""Get a model by its slug
Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
:param author: The author/organization of the model
:param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetModelRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
author=author,
slug=slug,
)
req = self._build_request(
method="GET",
path="/model/{author}/{slug}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetModelGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getModel",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.ModelResponse, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_async(
self,
*,
author: str,
slug: str,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.ModelResponse:
r"""Get a model by its slug
Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
:param author: The author/organization of the model
:param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetModelRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
author=author,
slug=slug,
)
req = self._build_request_async(
method="GET",
path="/model/{author}/{slug}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetModelGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getModel",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.ModelResponse, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def list( def list(
self, self,
*, *,
@@ -22,6 +270,17 @@ class Models(BaseSDK):
supported_parameters: Optional[str] = None, supported_parameters: Optional[str] = None,
output_modalities: Optional[str] = None, output_modalities: Optional[str] = None,
sort: Optional[operations.GetModelsSort] = None, sort: Optional[operations.GetModelsSort] = None,
q: Optional[str] = None,
input_modalities: Optional[str] = None,
context: Optional[int] = None,
min_price: OptionalNullable[float] = UNSET,
max_price: OptionalNullable[float] = UNSET,
arch: Optional[str] = None,
model_authors: Optional[str] = None,
providers: Optional[str] = None,
distillable: Optional[operations.Distillable] = None,
zdr: Optional[operations.Zdr] = None,
region: Optional[operations.Region] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -40,6 +299,17 @@ class Models(BaseSDK):
:param supported_parameters: Filter models by supported parameter (comma-separated) :param supported_parameters: Filter models by supported parameter (comma-separated)
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.
:param q: Free-text search by model name or slug.
:param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file.
:param context: Minimum context length (tokens). Models with smaller context are excluded.
:param min_price: Minimum prompt price in $/M tokens.
:param max_price: Maximum prompt price in $/M tokens.
:param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).
:param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs.
:param providers: Filter models by hosting provider. Comma-separated list of provider names.
:param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.
:param zdr: When set to \"true\", return only models with zero data retention endpoints.
:param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -63,6 +333,17 @@ class Models(BaseSDK):
supported_parameters=supported_parameters, supported_parameters=supported_parameters,
output_modalities=output_modalities, output_modalities=output_modalities,
sort=sort, sort=sort,
q=q,
input_modalities=input_modalities,
context=context,
min_price=min_price,
max_price=max_price,
arch=arch,
model_authors=model_authors,
providers=providers,
distillable=distillable,
zdr=zdr,
region=region,
) )
req = self._build_request( req = self._build_request(
@@ -150,6 +431,17 @@ class Models(BaseSDK):
supported_parameters: Optional[str] = None, supported_parameters: Optional[str] = None,
output_modalities: Optional[str] = None, output_modalities: Optional[str] = None,
sort: Optional[operations.GetModelsSort] = None, sort: Optional[operations.GetModelsSort] = None,
q: Optional[str] = None,
input_modalities: Optional[str] = None,
context: Optional[int] = None,
min_price: OptionalNullable[float] = UNSET,
max_price: OptionalNullable[float] = UNSET,
arch: Optional[str] = None,
model_authors: Optional[str] = None,
providers: Optional[str] = None,
distillable: Optional[operations.Distillable] = None,
zdr: Optional[operations.Zdr] = None,
region: Optional[operations.Region] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -168,6 +460,17 @@ class Models(BaseSDK):
:param supported_parameters: Filter models by supported parameter (comma-separated) :param supported_parameters: Filter models by supported parameter (comma-separated)
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.
:param q: Free-text search by model name or slug.
:param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file.
:param context: Minimum context length (tokens). Models with smaller context are excluded.
:param min_price: Minimum prompt price in $/M tokens.
:param max_price: Maximum prompt price in $/M tokens.
:param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).
:param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs.
:param providers: Filter models by hosting provider. Comma-separated list of provider names.
:param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.
:param zdr: When set to \"true\", return only models with zero data retention endpoints.
:param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -191,6 +494,17 @@ class Models(BaseSDK):
supported_parameters=supported_parameters, supported_parameters=supported_parameters,
output_modalities=output_modalities, output_modalities=output_modalities,
sort=sort, sort=sort,
q=q,
input_modalities=input_modalities,
context=context,
min_price=min_price,
max_price=max_price,
arch=arch,
model_authors=model_authors,
providers=providers,
distillable=distillable,
zdr=zdr,
region=region,
) )
req = self._build_request_async( req = self._build_request_async(
+20 -4
View File
@@ -318,6 +318,7 @@ class OAuth(BaseSDK):
key_label: Optional[str] = None, key_label: Optional[str] = None,
limit: Optional[float] = None, limit: Optional[float] = None,
usage_limit_type: Optional[operations.UsageLimitType] = None, usage_limit_type: Optional[operations.UsageLimitType] = None,
workspace_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -327,7 +328,7 @@ class OAuth(BaseSDK):
Create an authorization code for the PKCE flow to generate a user-controlled API key Create an authorization code for the PKCE flow to generate a user-controlled API key
:param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application. This is used to track API usage per application.
@@ -341,6 +342,7 @@ class OAuth(BaseSDK):
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided. :param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
:param limit: Credit limit for the API key to be created :param limit: Credit limit for the API key to be created
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
:param workspace_id: Optional workspace ID to associate the API key with
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -368,6 +370,7 @@ class OAuth(BaseSDK):
key_label=key_label, key_label=key_label,
limit=limit, limit=limit,
usage_limit_type=usage_limit_type, usage_limit_type=usage_limit_type,
workspace_id=workspace_id,
), ),
) )
@@ -423,7 +426,7 @@ class OAuth(BaseSDK):
), ),
), ),
request=req, request=req,
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"], error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"],
retry_config=retry_config, retry_config=retry_config,
) )
@@ -442,6 +445,11 @@ class OAuth(BaseSDK):
errors.UnauthorizedResponseErrorData, http_res errors.UnauthorizedResponseErrorData, http_res
) )
raise errors.UnauthorizedResponseError(response_data, http_res) raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "403", "application/json"):
response_data = unmarshal_json_response(
errors.ForbiddenResponseErrorData, http_res
)
raise errors.ForbiddenResponseError(response_data, http_res)
if utils.match_response(http_res, "409", "application/json"): if utils.match_response(http_res, "409", "application/json"):
response_data = unmarshal_json_response( response_data = unmarshal_json_response(
errors.ConflictResponseErrorData, http_res errors.ConflictResponseErrorData, http_res
@@ -480,6 +488,7 @@ class OAuth(BaseSDK):
key_label: Optional[str] = None, key_label: Optional[str] = None,
limit: Optional[float] = None, limit: Optional[float] = None,
usage_limit_type: Optional[operations.UsageLimitType] = None, usage_limit_type: Optional[operations.UsageLimitType] = None,
workspace_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -489,7 +498,7 @@ class OAuth(BaseSDK):
Create an authorization code for the PKCE flow to generate a user-controlled API key Create an authorization code for the PKCE flow to generate a user-controlled API key
:param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application. This is used to track API usage per application.
@@ -503,6 +512,7 @@ class OAuth(BaseSDK):
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided. :param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
:param limit: Credit limit for the API key to be created :param limit: Credit limit for the API key to be created
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
:param workspace_id: Optional workspace ID to associate the API key with
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -530,6 +540,7 @@ class OAuth(BaseSDK):
key_label=key_label, key_label=key_label,
limit=limit, limit=limit,
usage_limit_type=usage_limit_type, usage_limit_type=usage_limit_type,
workspace_id=workspace_id,
), ),
) )
@@ -585,7 +596,7 @@ class OAuth(BaseSDK):
), ),
), ),
request=req, request=req,
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"], error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"],
retry_config=retry_config, retry_config=retry_config,
) )
@@ -604,6 +615,11 @@ class OAuth(BaseSDK):
errors.UnauthorizedResponseErrorData, http_res errors.UnauthorizedResponseErrorData, http_res
) )
raise errors.UnauthorizedResponseError(response_data, http_res) raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "403", "application/json"):
response_data = unmarshal_json_response(
errors.ForbiddenResponseErrorData, http_res
)
raise errors.ForbiddenResponseError(response_data, http_res)
if utils.match_response(http_res, "409", "application/json"): if utils.match_response(http_res, "409", "application/json"):
response_data = unmarshal_json_response( response_data = unmarshal_json_response(
errors.ConflictResponseErrorData, http_res errors.ConflictResponseErrorData, http_res
+184
View File
@@ -202,6 +202,12 @@ if TYPE_CHECKING:
DeleteBYOKKeyRequest, DeleteBYOKKeyRequest,
DeleteBYOKKeyRequestTypedDict, DeleteBYOKKeyRequestTypedDict,
) )
from .deletefile import (
DeleteFileGlobals,
DeleteFileGlobalsTypedDict,
DeleteFileRequest,
DeleteFileRequestTypedDict,
)
from .deleteguardrail import ( from .deleteguardrail import (
DeleteGuardrailGlobals, DeleteGuardrailGlobals,
DeleteGuardrailGlobalsTypedDict, DeleteGuardrailGlobalsTypedDict,
@@ -228,6 +234,18 @@ if TYPE_CHECKING:
DeleteWorkspaceRequest, DeleteWorkspaceRequest,
DeleteWorkspaceRequestTypedDict, DeleteWorkspaceRequestTypedDict,
) )
from .deleteworkspacebudget import (
DeleteWorkspaceBudgetGlobals,
DeleteWorkspaceBudgetGlobalsTypedDict,
DeleteWorkspaceBudgetRequest,
DeleteWorkspaceBudgetRequestTypedDict,
)
from .downloadfilecontent import (
DownloadFileContentGlobals,
DownloadFileContentGlobalsTypedDict,
DownloadFileContentRequest,
DownloadFileContentRequestTypedDict,
)
from .exchangeauthcodeforapikey import ( from .exchangeauthcodeforapikey import (
ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyCodeChallengeMethod,
ExchangeAuthCodeForAPIKeyGlobals, ExchangeAuthCodeForAPIKeyGlobals,
@@ -272,6 +290,19 @@ if TYPE_CHECKING:
GetAppRankingsSort, GetAppRankingsSort,
Subcategory, Subcategory,
) )
from .getbenchmarksartificialanalysis import (
GetBenchmarksArtificialAnalysisGlobals,
GetBenchmarksArtificialAnalysisGlobalsTypedDict,
GetBenchmarksArtificialAnalysisRequest,
GetBenchmarksArtificialAnalysisRequestTypedDict,
)
from .getbenchmarksdesignarena import (
Arena,
GetBenchmarksDesignArenaGlobals,
GetBenchmarksDesignArenaGlobalsTypedDict,
GetBenchmarksDesignArenaRequest,
GetBenchmarksDesignArenaRequestTypedDict,
)
from .getbyokkey import ( from .getbyokkey import (
GetBYOKKeyGlobals, GetBYOKKeyGlobals,
GetBYOKKeyGlobalsTypedDict, GetBYOKKeyGlobalsTypedDict,
@@ -300,6 +331,12 @@ if TYPE_CHECKING:
RateLimit, RateLimit,
RateLimitTypedDict, RateLimitTypedDict,
) )
from .getfilemetadata import (
GetFileMetadataGlobals,
GetFileMetadataGlobalsTypedDict,
GetFileMetadataRequest,
GetFileMetadataRequestTypedDict,
)
from .getgeneration import ( from .getgeneration import (
GetGenerationGlobals, GetGenerationGlobals,
GetGenerationGlobalsTypedDict, GetGenerationGlobalsTypedDict,
@@ -322,13 +359,22 @@ if TYPE_CHECKING:
GetKeyResponse, GetKeyResponse,
GetKeyResponseTypedDict, GetKeyResponseTypedDict,
) )
from .getmodel import (
GetModelGlobals,
GetModelGlobalsTypedDict,
GetModelRequest,
GetModelRequestTypedDict,
)
from .getmodels import ( from .getmodels import (
Distillable,
GetModelsCategory, GetModelsCategory,
GetModelsGlobals, GetModelsGlobals,
GetModelsGlobalsTypedDict, GetModelsGlobalsTypedDict,
GetModelsRequest, GetModelsRequest,
GetModelsRequestTypedDict, GetModelsRequestTypedDict,
GetModelsSort, GetModelsSort,
Region,
Zdr,
) )
from .getobservabilitydestination import ( from .getobservabilitydestination import (
GetObservabilityDestinationGlobals, GetObservabilityDestinationGlobals,
@@ -413,6 +459,14 @@ if TYPE_CHECKING:
ListEndpointsZdrResponse, ListEndpointsZdrResponse,
ListEndpointsZdrResponseTypedDict, ListEndpointsZdrResponseTypedDict,
) )
from .listfiles import (
ListFilesGlobals,
ListFilesGlobalsTypedDict,
ListFilesRequest,
ListFilesRequestTypedDict,
ListFilesResponse,
ListFilesResponseTypedDict,
)
from .listgenerationcontent import ( from .listgenerationcontent import (
ListGenerationContentGlobals, ListGenerationContentGlobals,
ListGenerationContentGlobalsTypedDict, ListGenerationContentGlobalsTypedDict,
@@ -534,6 +588,12 @@ if TYPE_CHECKING:
ListVideosModelsRequest, ListVideosModelsRequest,
ListVideosModelsRequestTypedDict, ListVideosModelsRequestTypedDict,
) )
from .listworkspacebudgets import (
ListWorkspaceBudgetsGlobals,
ListWorkspaceBudgetsGlobalsTypedDict,
ListWorkspaceBudgetsRequest,
ListWorkspaceBudgetsRequestTypedDict,
)
from .listworkspaces import ( from .listworkspaces import (
ListWorkspacesGlobals, ListWorkspacesGlobals,
ListWorkspacesGlobalsTypedDict, ListWorkspacesGlobalsTypedDict,
@@ -614,8 +674,25 @@ if TYPE_CHECKING:
UpdateWorkspaceRequest, UpdateWorkspaceRequest,
UpdateWorkspaceRequestTypedDict, UpdateWorkspaceRequestTypedDict,
) )
from .uploadfile import (
File,
FileTypedDict,
UploadFileGlobals,
UploadFileGlobalsTypedDict,
UploadFileRequest,
UploadFileRequestBody,
UploadFileRequestBodyTypedDict,
UploadFileRequestTypedDict,
)
from .upsertworkspacebudget import (
UpsertWorkspaceBudgetGlobals,
UpsertWorkspaceBudgetGlobalsTypedDict,
UpsertWorkspaceBudgetRequest,
UpsertWorkspaceBudgetRequestTypedDict,
)
__all__ = [ __all__ = [
"Arena",
"BulkAddWorkspaceMembersGlobals", "BulkAddWorkspaceMembersGlobals",
"BulkAddWorkspaceMembersGlobalsTypedDict", "BulkAddWorkspaceMembersGlobalsTypedDict",
"BulkAddWorkspaceMembersRequest", "BulkAddWorkspaceMembersRequest",
@@ -745,6 +822,10 @@ __all__ = [
"DeleteBYOKKeyGlobalsTypedDict", "DeleteBYOKKeyGlobalsTypedDict",
"DeleteBYOKKeyRequest", "DeleteBYOKKeyRequest",
"DeleteBYOKKeyRequestTypedDict", "DeleteBYOKKeyRequestTypedDict",
"DeleteFileGlobals",
"DeleteFileGlobalsTypedDict",
"DeleteFileRequest",
"DeleteFileRequestTypedDict",
"DeleteGuardrailGlobals", "DeleteGuardrailGlobals",
"DeleteGuardrailGlobalsTypedDict", "DeleteGuardrailGlobalsTypedDict",
"DeleteGuardrailRequest", "DeleteGuardrailRequest",
@@ -759,6 +840,10 @@ __all__ = [
"DeleteObservabilityDestinationGlobalsTypedDict", "DeleteObservabilityDestinationGlobalsTypedDict",
"DeleteObservabilityDestinationRequest", "DeleteObservabilityDestinationRequest",
"DeleteObservabilityDestinationRequestTypedDict", "DeleteObservabilityDestinationRequestTypedDict",
"DeleteWorkspaceBudgetGlobals",
"DeleteWorkspaceBudgetGlobalsTypedDict",
"DeleteWorkspaceBudgetRequest",
"DeleteWorkspaceBudgetRequestTypedDict",
"DeleteWorkspaceGlobals", "DeleteWorkspaceGlobals",
"DeleteWorkspaceGlobalsTypedDict", "DeleteWorkspaceGlobalsTypedDict",
"DeleteWorkspaceRequest", "DeleteWorkspaceRequest",
@@ -767,12 +852,17 @@ __all__ = [
"DimensionTypedDict", "DimensionTypedDict",
"Direction", "Direction",
"DisplayFormat", "DisplayFormat",
"Distillable",
"Document", "Document",
"DocumentRequest", "DocumentRequest",
"DocumentRequestTypedDict", "DocumentRequestTypedDict",
"DocumentResponse", "DocumentResponse",
"DocumentResponseTypedDict", "DocumentResponseTypedDict",
"DocumentTypedDict", "DocumentTypedDict",
"DownloadFileContentGlobals",
"DownloadFileContentGlobalsTypedDict",
"DownloadFileContentRequest",
"DownloadFileContentRequestTypedDict",
"Embedding", "Embedding",
"EmbeddingTypedDict", "EmbeddingTypedDict",
"EncodingFormat", "EncodingFormat",
@@ -785,6 +875,8 @@ __all__ = [
"ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyRequestTypedDict",
"ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponse",
"ExchangeAuthCodeForAPIKeyResponseTypedDict", "ExchangeAuthCodeForAPIKeyResponseTypedDict",
"File",
"FileTypedDict",
"Filter", "Filter",
"FilterTypedDict", "FilterTypedDict",
"GetAnalyticsMetaData", "GetAnalyticsMetaData",
@@ -807,6 +899,14 @@ __all__ = [
"GetBYOKKeyGlobalsTypedDict", "GetBYOKKeyGlobalsTypedDict",
"GetBYOKKeyRequest", "GetBYOKKeyRequest",
"GetBYOKKeyRequestTypedDict", "GetBYOKKeyRequestTypedDict",
"GetBenchmarksArtificialAnalysisGlobals",
"GetBenchmarksArtificialAnalysisGlobalsTypedDict",
"GetBenchmarksArtificialAnalysisRequest",
"GetBenchmarksArtificialAnalysisRequestTypedDict",
"GetBenchmarksDesignArenaGlobals",
"GetBenchmarksDesignArenaGlobalsTypedDict",
"GetBenchmarksDesignArenaRequest",
"GetBenchmarksDesignArenaRequestTypedDict",
"GetCreditsData", "GetCreditsData",
"GetCreditsDataTypedDict", "GetCreditsDataTypedDict",
"GetCreditsGlobals", "GetCreditsGlobals",
@@ -823,6 +923,10 @@ __all__ = [
"GetCurrentKeyRequestTypedDict", "GetCurrentKeyRequestTypedDict",
"GetCurrentKeyResponse", "GetCurrentKeyResponse",
"GetCurrentKeyResponseTypedDict", "GetCurrentKeyResponseTypedDict",
"GetFileMetadataGlobals",
"GetFileMetadataGlobalsTypedDict",
"GetFileMetadataRequest",
"GetFileMetadataRequestTypedDict",
"GetGenerationGlobals", "GetGenerationGlobals",
"GetGenerationGlobalsTypedDict", "GetGenerationGlobalsTypedDict",
"GetGenerationRequest", "GetGenerationRequest",
@@ -839,6 +943,10 @@ __all__ = [
"GetKeyRequestTypedDict", "GetKeyRequestTypedDict",
"GetKeyResponse", "GetKeyResponse",
"GetKeyResponseTypedDict", "GetKeyResponseTypedDict",
"GetModelGlobals",
"GetModelGlobalsTypedDict",
"GetModelRequest",
"GetModelRequestTypedDict",
"GetModelsCategory", "GetModelsCategory",
"GetModelsGlobals", "GetModelsGlobals",
"GetModelsGlobalsTypedDict", "GetModelsGlobalsTypedDict",
@@ -907,6 +1015,12 @@ __all__ = [
"ListEndpointsZdrRequestTypedDict", "ListEndpointsZdrRequestTypedDict",
"ListEndpointsZdrResponse", "ListEndpointsZdrResponse",
"ListEndpointsZdrResponseTypedDict", "ListEndpointsZdrResponseTypedDict",
"ListFilesGlobals",
"ListFilesGlobalsTypedDict",
"ListFilesRequest",
"ListFilesRequestTypedDict",
"ListFilesResponse",
"ListFilesResponseTypedDict",
"ListGenerationContentGlobals", "ListGenerationContentGlobals",
"ListGenerationContentGlobalsTypedDict", "ListGenerationContentGlobalsTypedDict",
"ListGenerationContentRequest", "ListGenerationContentRequest",
@@ -1001,6 +1115,10 @@ __all__ = [
"ListVideosModelsGlobalsTypedDict", "ListVideosModelsGlobalsTypedDict",
"ListVideosModelsRequest", "ListVideosModelsRequest",
"ListVideosModelsRequestTypedDict", "ListVideosModelsRequestTypedDict",
"ListWorkspaceBudgetsGlobals",
"ListWorkspaceBudgetsGlobalsTypedDict",
"ListWorkspaceBudgetsRequest",
"ListWorkspaceBudgetsRequestTypedDict",
"ListWorkspacesGlobals", "ListWorkspacesGlobals",
"ListWorkspacesGlobalsTypedDict", "ListWorkspacesGlobalsTypedDict",
"ListWorkspacesRequest", "ListWorkspacesRequest",
@@ -1035,6 +1153,7 @@ __all__ = [
"QueryAnalyticsResponseTypedDict", "QueryAnalyticsResponseTypedDict",
"RateLimit", "RateLimit",
"RateLimitTypedDict", "RateLimitTypedDict",
"Region",
"Result", "Result",
"ResultTypedDict", "ResultTypedDict",
"Role", "Role",
@@ -1076,12 +1195,23 @@ __all__ = [
"UpdateWorkspaceGlobalsTypedDict", "UpdateWorkspaceGlobalsTypedDict",
"UpdateWorkspaceRequest", "UpdateWorkspaceRequest",
"UpdateWorkspaceRequestTypedDict", "UpdateWorkspaceRequestTypedDict",
"UploadFileGlobals",
"UploadFileGlobalsTypedDict",
"UploadFileRequest",
"UploadFileRequestBody",
"UploadFileRequestBodyTypedDict",
"UploadFileRequestTypedDict",
"UpsertWorkspaceBudgetGlobals",
"UpsertWorkspaceBudgetGlobalsTypedDict",
"UpsertWorkspaceBudgetRequest",
"UpsertWorkspaceBudgetRequestTypedDict",
"UsageLimitType", "UsageLimitType",
"Value1", "Value1",
"Value1TypedDict", "Value1TypedDict",
"Value2", "Value2",
"Value2TypedDict", "Value2TypedDict",
"ValueType", "ValueType",
"Zdr",
] ]
_dynamic_imports: dict[str, str] = { _dynamic_imports: dict[str, str] = {
@@ -1237,6 +1367,10 @@ _dynamic_imports: dict[str, str] = {
"DeleteBYOKKeyGlobalsTypedDict": ".deletebyokkey", "DeleteBYOKKeyGlobalsTypedDict": ".deletebyokkey",
"DeleteBYOKKeyRequest": ".deletebyokkey", "DeleteBYOKKeyRequest": ".deletebyokkey",
"DeleteBYOKKeyRequestTypedDict": ".deletebyokkey", "DeleteBYOKKeyRequestTypedDict": ".deletebyokkey",
"DeleteFileGlobals": ".deletefile",
"DeleteFileGlobalsTypedDict": ".deletefile",
"DeleteFileRequest": ".deletefile",
"DeleteFileRequestTypedDict": ".deletefile",
"DeleteGuardrailGlobals": ".deleteguardrail", "DeleteGuardrailGlobals": ".deleteguardrail",
"DeleteGuardrailGlobalsTypedDict": ".deleteguardrail", "DeleteGuardrailGlobalsTypedDict": ".deleteguardrail",
"DeleteGuardrailRequest": ".deleteguardrail", "DeleteGuardrailRequest": ".deleteguardrail",
@@ -1255,6 +1389,14 @@ _dynamic_imports: dict[str, str] = {
"DeleteWorkspaceGlobalsTypedDict": ".deleteworkspace", "DeleteWorkspaceGlobalsTypedDict": ".deleteworkspace",
"DeleteWorkspaceRequest": ".deleteworkspace", "DeleteWorkspaceRequest": ".deleteworkspace",
"DeleteWorkspaceRequestTypedDict": ".deleteworkspace", "DeleteWorkspaceRequestTypedDict": ".deleteworkspace",
"DeleteWorkspaceBudgetGlobals": ".deleteworkspacebudget",
"DeleteWorkspaceBudgetGlobalsTypedDict": ".deleteworkspacebudget",
"DeleteWorkspaceBudgetRequest": ".deleteworkspacebudget",
"DeleteWorkspaceBudgetRequestTypedDict": ".deleteworkspacebudget",
"DownloadFileContentGlobals": ".downloadfilecontent",
"DownloadFileContentGlobalsTypedDict": ".downloadfilecontent",
"DownloadFileContentRequest": ".downloadfilecontent",
"DownloadFileContentRequestTypedDict": ".downloadfilecontent",
"ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey",
@@ -1293,6 +1435,15 @@ _dynamic_imports: dict[str, str] = {
"GetAppRankingsResponseTypedDict": ".getapprankings", "GetAppRankingsResponseTypedDict": ".getapprankings",
"GetAppRankingsSort": ".getapprankings", "GetAppRankingsSort": ".getapprankings",
"Subcategory": ".getapprankings", "Subcategory": ".getapprankings",
"GetBenchmarksArtificialAnalysisGlobals": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisGlobalsTypedDict": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisRequest": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisRequestTypedDict": ".getbenchmarksartificialanalysis",
"Arena": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena",
"GetBYOKKeyGlobals": ".getbyokkey", "GetBYOKKeyGlobals": ".getbyokkey",
"GetBYOKKeyGlobalsTypedDict": ".getbyokkey", "GetBYOKKeyGlobalsTypedDict": ".getbyokkey",
"GetBYOKKeyRequest": ".getbyokkey", "GetBYOKKeyRequest": ".getbyokkey",
@@ -1315,6 +1466,10 @@ _dynamic_imports: dict[str, str] = {
"GetCurrentKeyResponseTypedDict": ".getcurrentkey", "GetCurrentKeyResponseTypedDict": ".getcurrentkey",
"RateLimit": ".getcurrentkey", "RateLimit": ".getcurrentkey",
"RateLimitTypedDict": ".getcurrentkey", "RateLimitTypedDict": ".getcurrentkey",
"GetFileMetadataGlobals": ".getfilemetadata",
"GetFileMetadataGlobalsTypedDict": ".getfilemetadata",
"GetFileMetadataRequest": ".getfilemetadata",
"GetFileMetadataRequestTypedDict": ".getfilemetadata",
"GetGenerationGlobals": ".getgeneration", "GetGenerationGlobals": ".getgeneration",
"GetGenerationGlobalsTypedDict": ".getgeneration", "GetGenerationGlobalsTypedDict": ".getgeneration",
"GetGenerationRequest": ".getgeneration", "GetGenerationRequest": ".getgeneration",
@@ -1331,12 +1486,19 @@ _dynamic_imports: dict[str, str] = {
"GetKeyRequestTypedDict": ".getkey", "GetKeyRequestTypedDict": ".getkey",
"GetKeyResponse": ".getkey", "GetKeyResponse": ".getkey",
"GetKeyResponseTypedDict": ".getkey", "GetKeyResponseTypedDict": ".getkey",
"GetModelGlobals": ".getmodel",
"GetModelGlobalsTypedDict": ".getmodel",
"GetModelRequest": ".getmodel",
"GetModelRequestTypedDict": ".getmodel",
"Distillable": ".getmodels",
"GetModelsCategory": ".getmodels", "GetModelsCategory": ".getmodels",
"GetModelsGlobals": ".getmodels", "GetModelsGlobals": ".getmodels",
"GetModelsGlobalsTypedDict": ".getmodels", "GetModelsGlobalsTypedDict": ".getmodels",
"GetModelsRequest": ".getmodels", "GetModelsRequest": ".getmodels",
"GetModelsRequestTypedDict": ".getmodels", "GetModelsRequestTypedDict": ".getmodels",
"GetModelsSort": ".getmodels", "GetModelsSort": ".getmodels",
"Region": ".getmodels",
"Zdr": ".getmodels",
"GetObservabilityDestinationGlobals": ".getobservabilitydestination", "GetObservabilityDestinationGlobals": ".getobservabilitydestination",
"GetObservabilityDestinationGlobalsTypedDict": ".getobservabilitydestination", "GetObservabilityDestinationGlobalsTypedDict": ".getobservabilitydestination",
"GetObservabilityDestinationRequest": ".getobservabilitydestination", "GetObservabilityDestinationRequest": ".getobservabilitydestination",
@@ -1396,6 +1558,12 @@ _dynamic_imports: dict[str, str] = {
"ListEndpointsZdrRequestTypedDict": ".listendpointszdr", "ListEndpointsZdrRequestTypedDict": ".listendpointszdr",
"ListEndpointsZdrResponse": ".listendpointszdr", "ListEndpointsZdrResponse": ".listendpointszdr",
"ListEndpointsZdrResponseTypedDict": ".listendpointszdr", "ListEndpointsZdrResponseTypedDict": ".listendpointszdr",
"ListFilesGlobals": ".listfiles",
"ListFilesGlobalsTypedDict": ".listfiles",
"ListFilesRequest": ".listfiles",
"ListFilesRequestTypedDict": ".listfiles",
"ListFilesResponse": ".listfiles",
"ListFilesResponseTypedDict": ".listfiles",
"ListGenerationContentGlobals": ".listgenerationcontent", "ListGenerationContentGlobals": ".listgenerationcontent",
"ListGenerationContentGlobalsTypedDict": ".listgenerationcontent", "ListGenerationContentGlobalsTypedDict": ".listgenerationcontent",
"ListGenerationContentRequest": ".listgenerationcontent", "ListGenerationContentRequest": ".listgenerationcontent",
@@ -1487,6 +1655,10 @@ _dynamic_imports: dict[str, str] = {
"ListVideosModelsGlobalsTypedDict": ".listvideosmodels", "ListVideosModelsGlobalsTypedDict": ".listvideosmodels",
"ListVideosModelsRequest": ".listvideosmodels", "ListVideosModelsRequest": ".listvideosmodels",
"ListVideosModelsRequestTypedDict": ".listvideosmodels", "ListVideosModelsRequestTypedDict": ".listvideosmodels",
"ListWorkspaceBudgetsGlobals": ".listworkspacebudgets",
"ListWorkspaceBudgetsGlobalsTypedDict": ".listworkspacebudgets",
"ListWorkspaceBudgetsRequest": ".listworkspacebudgets",
"ListWorkspaceBudgetsRequestTypedDict": ".listworkspacebudgets",
"ListWorkspacesGlobals": ".listworkspaces", "ListWorkspacesGlobals": ".listworkspaces",
"ListWorkspacesGlobalsTypedDict": ".listworkspaces", "ListWorkspacesGlobalsTypedDict": ".listworkspaces",
"ListWorkspacesRequest": ".listworkspaces", "ListWorkspacesRequest": ".listworkspaces",
@@ -1551,6 +1723,18 @@ _dynamic_imports: dict[str, str] = {
"UpdateWorkspaceGlobalsTypedDict": ".updateworkspace", "UpdateWorkspaceGlobalsTypedDict": ".updateworkspace",
"UpdateWorkspaceRequest": ".updateworkspace", "UpdateWorkspaceRequest": ".updateworkspace",
"UpdateWorkspaceRequestTypedDict": ".updateworkspace", "UpdateWorkspaceRequestTypedDict": ".updateworkspace",
"File": ".uploadfile",
"FileTypedDict": ".uploadfile",
"UploadFileGlobals": ".uploadfile",
"UploadFileGlobalsTypedDict": ".uploadfile",
"UploadFileRequest": ".uploadfile",
"UploadFileRequestBody": ".uploadfile",
"UploadFileRequestBodyTypedDict": ".uploadfile",
"UploadFileRequestTypedDict": ".uploadfile",
"UpsertWorkspaceBudgetGlobals": ".upsertworkspacebudget",
"UpsertWorkspaceBudgetGlobalsTypedDict": ".upsertworkspacebudget",
"UpsertWorkspaceBudgetRequest": ".upsertworkspacebudget",
"UpsertWorkspaceBudgetRequestTypedDict": ".upsertworkspacebudget",
} }
@@ -92,7 +92,7 @@ r"""Optional credit limit reset interval. When set, the credit limit resets on t
class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
callback_url: str callback_url: str
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools."""
code_challenge: NotRequired[str] code_challenge: NotRequired[str]
r"""PKCE code challenge for enhanced security""" r"""PKCE code challenge for enhanced security"""
code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod] code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod]
@@ -105,11 +105,13 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
r"""Credit limit for the API key to be created""" r"""Credit limit for the API key to be created"""
usage_limit_type: NotRequired[UsageLimitType] usage_limit_type: NotRequired[UsageLimitType]
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
workspace_id: NotRequired[str]
r"""Optional workspace ID to associate the API key with"""
class CreateAuthKeysCodeRequestBody(BaseModel): class CreateAuthKeysCodeRequestBody(BaseModel):
callback_url: str callback_url: str
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools."""
code_challenge: Optional[str] = None code_challenge: Optional[str] = None
r"""PKCE code challenge for enhanced security""" r"""PKCE code challenge for enhanced security"""
@@ -134,6 +136,9 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
] = None ] = None
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
workspace_id: Optional[str] = None
r"""Optional workspace ID to associate the API key with"""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -143,6 +148,7 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
"key_label", "key_label",
"limit", "limit",
"usage_limit_type", "usage_limit_type",
"workspace_id",
] ]
nullable_fields = ["expires_at"] nullable_fields = ["expires_at"]
null_default_fields = [] null_default_fields = []
+118
View File
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
QueryParamMetadata,
)
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class DeleteFileGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteFileGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteFileRequestTypedDict(TypedDict):
file_id: str
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: NotRequired[str]
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class DeleteFileRequest(BaseModel):
file_id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
@@ -0,0 +1,127 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
workspacebudgetinterval as components_workspacebudgetinterval,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
validate_open_enum,
)
import pydantic
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class DeleteWorkspaceBudgetGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteWorkspaceBudgetGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteWorkspaceBudgetRequestTypedDict(TypedDict):
id: str
r"""The workspace ID (UUID) or slug"""
interval: components_workspacebudgetinterval.WorkspaceBudgetInterval
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteWorkspaceBudgetRequest(BaseModel):
id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The workspace ID (UUID) or slug"""
interval: Annotated[
Annotated[
components_workspacebudgetinterval.WorkspaceBudgetInterval,
PlainValidator(validate_open_enum(False)),
],
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
]
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
QueryParamMetadata,
)
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class DownloadFileContentGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DownloadFileContentGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DownloadFileContentRequestTypedDict(TypedDict):
file_id: str
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: NotRequired[str]
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class DownloadFileContentRequest(BaseModel):
file_id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
@@ -0,0 +1,108 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetBenchmarksArtificialAnalysisGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetBenchmarksArtificialAnalysisGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetBenchmarksArtificialAnalysisRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
max_results: NotRequired[int]
r"""Max results to return (1100, default 50)."""
class GetBenchmarksArtificialAnalysisRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
max_results: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = 50
r"""Max results to return (1100, default 50)."""
@@ -0,0 +1,141 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
QueryParamMetadata,
validate_open_enum,
)
import pydantic
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetBenchmarksDesignArenaGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
Arena = Union[
Literal[
"models",
"builders",
"agents",
],
UnrecognizedStr,
]
r"""Arena to query. Defaults to `models`."""
class GetBenchmarksDesignArenaRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
arena: NotRequired[Arena]
r"""Arena to query. Defaults to `models`."""
category: NotRequired[str]
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
max_results: NotRequired[int]
r"""Max results to return: per category when no category filter is applied (1100, default 50)."""
class GetBenchmarksDesignArenaRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
arena: Annotated[
Annotated[Optional[Arena], PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = "models"
r"""Arena to query. Defaults to `models`."""
category: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
max_results: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = 50
r"""Max results to return: per category when no category filter is applied (1100, default 50)."""
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
QueryParamMetadata,
)
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetFileMetadataGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetFileMetadataGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetFileMetadataRequestTypedDict(TypedDict):
file_id: str
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: NotRequired[str]
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class GetFileMetadataRequest(BaseModel):
file_id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
+114
View File
@@ -0,0 +1,114 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetModelGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetModelGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetModelRequestTypedDict(TypedDict):
author: str
r"""The author/organization of the model"""
slug: str
r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)"""
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetModelRequest(BaseModel):
author: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The author/organization of the model"""
slug: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)"""
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
+164 -1
View File
@@ -1,7 +1,14 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import ( from openrouter.utils import (
FieldMetadata, FieldMetadata,
HeaderMetadata, HeaderMetadata,
@@ -9,6 +16,7 @@ from openrouter.utils import (
validate_open_enum, validate_open_enum,
) )
import pydantic import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
@@ -96,6 +104,24 @@ GetModelsSort = Union[
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
Distillable = Union[
Literal[
"true",
"false",
],
UnrecognizedStr,
]
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
Zdr = Literal["true",]
r"""When set to \"true\", return only models with zero data retention endpoints."""
Region = Literal["eu",]
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
class GetModelsRequestTypedDict(TypedDict): class GetModelsRequestTypedDict(TypedDict):
http_referer: NotRequired[str] http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
@@ -118,6 +144,28 @@ class GetModelsRequestTypedDict(TypedDict):
r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".""" r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"."""
sort: NotRequired[GetModelsSort] sort: NotRequired[GetModelsSort]
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
q: NotRequired[str]
r"""Free-text search by model name or slug."""
input_modalities: NotRequired[str]
r"""Filter models by input modality. Comma-separated list of: text, image, audio, file."""
context: NotRequired[int]
r"""Minimum context length (tokens). Models with smaller context are excluded."""
min_price: NotRequired[Nullable[float]]
r"""Minimum prompt price in $/M tokens."""
max_price: NotRequired[Nullable[float]]
r"""Maximum prompt price in $/M tokens."""
arch: NotRequired[str]
r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama)."""
model_authors: NotRequired[str]
r"""Filter models by the organization that created the model. Comma-separated list of author slugs."""
providers: NotRequired[str]
r"""Filter models by hosting provider. Comma-separated list of provider names."""
distillable: NotRequired[Distillable]
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
zdr: NotRequired[Zdr]
r"""When set to \"true\", return only models with zero data retention endpoints."""
region: NotRequired[Region]
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
class GetModelsRequest(BaseModel): class GetModelsRequest(BaseModel):
@@ -174,3 +222,118 @@ class GetModelsRequest(BaseModel):
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None ] = None
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
q: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Free-text search by model name or slug."""
input_modalities: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter models by input modality. Comma-separated list of: text, image, audio, file."""
context: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Minimum context length (tokens). Models with smaller context are excluded."""
min_price: Annotated[
OptionalNullable[float],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = UNSET
r"""Minimum prompt price in $/M tokens."""
max_price: Annotated[
OptionalNullable[float],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = UNSET
r"""Maximum prompt price in $/M tokens."""
arch: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama)."""
model_authors: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter models by the organization that created the model. Comma-separated list of author slugs."""
providers: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter models by hosting provider. Comma-separated list of provider names."""
distillable: Annotated[
Annotated[Optional[Distillable], PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
zdr: Annotated[
Optional[Zdr],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""When set to \"true\", return only models with zero data retention endpoints."""
region: Annotated[
Optional[Region],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"HTTP-Referer",
"X-OpenRouter-Title",
"X-OpenRouter-Categories",
"category",
"supported_parameters",
"output_modalities",
"sort",
"q",
"input_modalities",
"context",
"min_price",
"max_price",
"arch",
"model_authors",
"providers",
"distillable",
"zdr",
"region",
]
nullable_fields = ["min_price", "max_price"]
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
+138
View File
@@ -0,0 +1,138 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import filelistresponse as components_filelistresponse
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class ListFilesGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class ListFilesGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class ListFilesRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
limit: NotRequired[int]
r"""Maximum number of files to return (11000)."""
cursor: NotRequired[str]
r"""Opaque pagination cursor from a previous response."""
workspace_id: NotRequired[str]
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class ListFilesRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
limit: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of files to return (11000)."""
cursor: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Opaque pagination cursor from a previous response."""
workspace_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class ListFilesResponseTypedDict(TypedDict):
result: components_filelistresponse.FileListResponseTypedDict
class ListFilesResponse(BaseModel):
next: Union[
Callable[[], Optional[ListFilesResponse]],
Callable[[], Awaitable[Optional[ListFilesResponse]]],
]
result: components_filelistresponse.FileListResponse
@@ -0,0 +1,107 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ListWorkspaceBudgetsGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class ListWorkspaceBudgetsGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class ListWorkspaceBudgetsRequestTypedDict(TypedDict):
id: str
r"""The workspace ID (UUID) or slug"""
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class ListWorkspaceBudgetsRequest(BaseModel):
id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The workspace ID (UUID) or slug"""
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
+13 -8
View File
@@ -70,31 +70,31 @@ Value2 = TypeAliasType("Value2", Union[str, float])
Value1TypedDict = TypeAliasType( Value1TypedDict = TypeAliasType(
"Value1TypedDict", Union[str, float, List[Value2TypedDict]] "Value1TypedDict", Union[str, float, List[Value2TypedDict]]
) )
r"""Filter value (scalar or array depending on operator)""" r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
Value1 = TypeAliasType("Value1", Union[str, float, List[Value2]]) Value1 = TypeAliasType("Value1", Union[str, float, List[Value2]])
r"""Filter value (scalar or array depending on operator)""" r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
class FilterTypedDict(TypedDict): class FilterTypedDict(TypedDict):
field: str field: str
r"""Dimension to filter on""" r"""Dimension to filter on. Use the /meta endpoint for available dimensions."""
operator: str operator: str
r"""Filter operator""" r"""Filter operator"""
value: Value1TypedDict value: Value1TypedDict
r"""Filter value (scalar or array depending on operator)""" r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
class Filter(BaseModel): class Filter(BaseModel):
field: str field: str
r"""Dimension to filter on""" r"""Dimension to filter on. Use the /meta endpoint for available dimensions."""
operator: str operator: str
r"""Filter operator""" r"""Filter operator"""
value: Value1 value: Value1
r"""Filter value (scalar or array depending on operator)""" r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
Direction = Union[ Direction = Union[
@@ -137,7 +137,7 @@ class QueryAnalyticsRequestBodyTypedDict(TypedDict):
granularity: NotRequired[str] granularity: NotRequired[str]
r"""Time granularity""" r"""Time granularity"""
group_limit: NotRequired[int] group_limit: NotRequired[int]
r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
limit: NotRequired[int] limit: NotRequired[int]
r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations."""
order_by: NotRequired[OrderByTypedDict] order_by: NotRequired[OrderByTypedDict]
@@ -155,7 +155,7 @@ class QueryAnalyticsRequestBody(BaseModel):
r"""Time granularity""" r"""Time granularity"""
group_limit: Optional[int] = None group_limit: Optional[int] = None
r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
limit: Optional[int] = None limit: Optional[int] = None
r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations."""
@@ -243,6 +243,8 @@ class QueryAnalyticsData2TypedDict(TypedDict):
data: List[QueryAnalyticsData1TypedDict] data: List[QueryAnalyticsData1TypedDict]
metadata: MetadataTypedDict metadata: MetadataTypedDict
cached_at: NotRequired[float] cached_at: NotRequired[float]
warnings: NotRequired[List[str]]
r"""Warnings about filter resolution issues (e.g. unresolvable api_key_id hashes). The query still runs normally; these inform the caller that some filter values could not be resolved."""
class QueryAnalyticsData2(BaseModel): class QueryAnalyticsData2(BaseModel):
@@ -252,6 +254,9 @@ class QueryAnalyticsData2(BaseModel):
cached_at: Annotated[Optional[float], pydantic.Field(alias="cachedAt")] = None cached_at: Annotated[Optional[float], pydantic.Field(alias="cachedAt")] = None
warnings: Optional[List[str]] = None
r"""Warnings about filter resolution issues (e.g. unresolvable api_key_id hashes). The query still runs normally; these inform the caller that some filter values could not be resolved."""
class QueryAnalyticsResponseTypedDict(TypedDict): class QueryAnalyticsResponseTypedDict(TypedDict):
r"""Analytics query results""" r"""Analytics query results"""
+153
View File
@@ -0,0 +1,153 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
import io
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
MultipartFormMetadata,
QueryParamMetadata,
RequestMetadata,
)
import pydantic
from typing import IO, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class UploadFileGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class UploadFileGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class FileTypedDict(TypedDict):
file_name: str
content: Union[bytes, IO[bytes], io.BufferedReader]
content_type: NotRequired[str]
class File(BaseModel):
file_name: Annotated[
str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True)
]
content: Annotated[
Union[bytes, IO[bytes], io.BufferedReader],
pydantic.Field(alias=""),
FieldMetadata(multipart=MultipartFormMetadata(content=True)),
]
content_type: Annotated[
Optional[str],
pydantic.Field(alias="Content-Type"),
FieldMetadata(multipart=True),
] = None
class UploadFileRequestBodyTypedDict(TypedDict):
file: FileTypedDict
class UploadFileRequestBody(BaseModel):
file: Annotated[File, FieldMetadata(multipart=MultipartFormMetadata(file=True))]
class UploadFileRequestTypedDict(TypedDict):
request_body: UploadFileRequestBodyTypedDict
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: NotRequired[str]
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
class UploadFileRequest(BaseModel):
request_body: Annotated[
UploadFileRequestBody,
FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")),
]
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
workspace_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Workspace to scope the request to. Defaults to the callers default workspace."""
@@ -0,0 +1,137 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
upsertworkspacebudgetrequest as components_upsertworkspacebudgetrequest,
workspacebudgetinterval as components_workspacebudgetinterval,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
RequestMetadata,
validate_open_enum,
)
import pydantic
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class UpsertWorkspaceBudgetGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class UpsertWorkspaceBudgetGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class UpsertWorkspaceBudgetRequestTypedDict(TypedDict):
id: str
r"""The workspace ID (UUID) or slug"""
interval: components_workspacebudgetinterval.WorkspaceBudgetInterval
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
upsert_workspace_budget_request: (
components_upsertworkspacebudgetrequest.UpsertWorkspaceBudgetRequestTypedDict
)
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class UpsertWorkspaceBudgetRequest(BaseModel):
id: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The workspace ID (UUID) or slug"""
interval: Annotated[
Annotated[
components_workspacebudgetinterval.WorkspaceBudgetInterval,
PlainValidator(validate_open_enum(False)),
],
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
]
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
upsert_workspace_budget_request: Annotated[
components_upsertworkspacebudgetrequest.UpsertWorkspaceBudgetRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
+54
View File
@@ -625,6 +625,7 @@ class Presets(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -647,6 +648,10 @@ class Presets(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -676,6 +681,8 @@ class Presets(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -709,6 +716,7 @@ class Presets(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -717,6 +725,8 @@ class Presets(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -728,6 +738,8 @@ class Presets(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -769,6 +781,7 @@ class Presets(BaseSDK):
messages, List[components.ChatMessages] messages, List[components.ChatMessages]
), ),
metadata=metadata, metadata=metadata,
min_p=min_p,
modalities=modalities, modalities=modalities,
model=model, model=model,
models=models, models=models,
@@ -783,6 +796,8 @@ class Presets(BaseSDK):
reasoning=utils.get_pydantic_model( reasoning=utils.get_pydantic_model(
reasoning, Optional[components.ChatRequestReasoning] reasoning, Optional[components.ChatRequestReasoning]
), ),
reasoning_effort=reasoning_effort,
repetition_penalty=repetition_penalty,
response_format=utils.get_pydantic_model( response_format=utils.get_pydantic_model(
response_format, Optional[components.ResponseFormat] response_format, Optional[components.ResponseFormat]
), ),
@@ -805,6 +820,8 @@ class Presets(BaseSDK):
tools=utils.get_pydantic_model( tools=utils.get_pydantic_model(
tools, Optional[List[components.ChatFunctionTool]] tools, Optional[List[components.ChatFunctionTool]]
), ),
top_a=top_a,
top_k=top_k,
top_logprobs=top_logprobs, top_logprobs=top_logprobs,
top_p=top_p, top_p=top_p,
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
@@ -943,6 +960,7 @@ class Presets(BaseSDK):
max_completion_tokens: OptionalNullable[int] = UNSET, max_completion_tokens: OptionalNullable[int] = UNSET,
max_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET,
metadata: Optional[Dict[str, str]] = None, metadata: Optional[Dict[str, str]] = None,
min_p: OptionalNullable[float] = UNSET,
modalities: Optional[List[components.Modality]] = None, modalities: Optional[List[components.Modality]] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
@@ -965,6 +983,10 @@ class Presets(BaseSDK):
components.ChatRequestReasoningTypedDict, components.ChatRequestReasoningTypedDict,
] ]
] = None, ] = None,
reasoning_effort: OptionalNullable[
components.ChatRequestReasoningEffort
] = UNSET,
repetition_penalty: OptionalNullable[float] = UNSET,
response_format: Optional[ response_format: Optional[
Union[components.ResponseFormat, components.ResponseFormatTypedDict] Union[components.ResponseFormat, components.ResponseFormatTypedDict]
] = None, ] = None,
@@ -994,6 +1016,8 @@ class Presets(BaseSDK):
List[components.ChatFunctionToolTypedDict], List[components.ChatFunctionToolTypedDict],
] ]
] = None, ] = None,
top_a: OptionalNullable[float] = UNSET,
top_k: OptionalNullable[int] = UNSET,
top_logprobs: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
trace: Optional[ trace: Optional[
@@ -1027,6 +1051,7 @@ class Presets(BaseSDK):
:param max_completion_tokens: Maximum tokens in completion :param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param model: Model to use for completion :param model: Model to use for completion
:param models: Models to use for completion :param models: Models to use for completion
@@ -1035,6 +1060,8 @@ class Presets(BaseSDK):
:param presence_penalty: Presence penalty (-2.0 to 2.0) :param presence_penalty: Presence penalty (-2.0 to 2.0)
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider: When multiple model providers are available, optionally indicate your routing preference.
:param reasoning: Configuration options for reasoning models :param reasoning: Configuration options for reasoning models
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
:param response_format: Response format configuration :param response_format: Response format configuration
:param seed: Random seed for deterministic outputs :param seed: Random seed for deterministic outputs
:param service_tier: The service tier to use for processing this request. :param service_tier: The service tier to use for processing this request.
@@ -1046,6 +1073,8 @@ class Presets(BaseSDK):
:param temperature: Sampling temperature (0-2) :param temperature: Sampling temperature (0-2)
:param tool_choice: Tool choice configuration :param tool_choice: Tool choice configuration
:param tools: Available tools for function calling :param tools: Available tools for function calling
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
:param top_logprobs: Number of top log probabilities to return (0-20) :param top_logprobs: Number of top log probabilities to return (0-20)
:param top_p: Nucleus sampling parameter (0-1) :param top_p: Nucleus sampling parameter (0-1)
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
@@ -1087,6 +1116,7 @@ class Presets(BaseSDK):
messages, List[components.ChatMessages] messages, List[components.ChatMessages]
), ),
metadata=metadata, metadata=metadata,
min_p=min_p,
modalities=modalities, modalities=modalities,
model=model, model=model,
models=models, models=models,
@@ -1101,6 +1131,8 @@ class Presets(BaseSDK):
reasoning=utils.get_pydantic_model( reasoning=utils.get_pydantic_model(
reasoning, Optional[components.ChatRequestReasoning] reasoning, Optional[components.ChatRequestReasoning]
), ),
reasoning_effort=reasoning_effort,
repetition_penalty=repetition_penalty,
response_format=utils.get_pydantic_model( response_format=utils.get_pydantic_model(
response_format, Optional[components.ResponseFormat] response_format, Optional[components.ResponseFormat]
), ),
@@ -1123,6 +1155,8 @@ class Presets(BaseSDK):
tools=utils.get_pydantic_model( tools=utils.get_pydantic_model(
tools, Optional[List[components.ChatFunctionTool]] tools, Optional[List[components.ChatFunctionTool]]
), ),
top_a=top_a,
top_k=top_k,
top_logprobs=top_logprobs, top_logprobs=top_logprobs,
top_p=top_p, top_p=top_p,
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
@@ -1253,6 +1287,12 @@ class Presets(BaseSDK):
context_management: OptionalNullable[ context_management: OptionalNullable[
Union[components.ContextManagement, components.ContextManagementTypedDict] Union[components.ContextManagement, components.ContextManagementTypedDict]
] = UNSET, ] = UNSET,
fallbacks: OptionalNullable[
Union[
List[components.MessagesFallbackParam],
List[components.MessagesFallbackParamTypedDict],
]
] = UNSET,
max_tokens: Optional[int] = None, max_tokens: Optional[int] = None,
metadata: Optional[ metadata: Optional[
Union[components.Metadata, components.MetadataTypedDict] Union[components.Metadata, components.MetadataTypedDict]
@@ -1327,6 +1367,7 @@ class Presets(BaseSDK):
:param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
:param context_management: :param context_management:
:param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.
:param max_tokens: :param max_tokens:
:param metadata: :param metadata:
:param models: :param models:
@@ -1375,6 +1416,9 @@ class Presets(BaseSDK):
context_management=utils.get_pydantic_model( context_management=utils.get_pydantic_model(
context_management, OptionalNullable[components.ContextManagement] context_management, OptionalNullable[components.ContextManagement]
), ),
fallbacks=utils.get_pydantic_model(
fallbacks, OptionalNullable[List[components.MessagesFallbackParam]]
),
max_tokens=max_tokens, max_tokens=max_tokens,
messages=utils.get_pydantic_model( messages=utils.get_pydantic_model(
messages, Nullable[List[components.MessagesMessageParam]] messages, Nullable[List[components.MessagesMessageParam]]
@@ -1547,6 +1591,12 @@ class Presets(BaseSDK):
context_management: OptionalNullable[ context_management: OptionalNullable[
Union[components.ContextManagement, components.ContextManagementTypedDict] Union[components.ContextManagement, components.ContextManagementTypedDict]
] = UNSET, ] = UNSET,
fallbacks: OptionalNullable[
Union[
List[components.MessagesFallbackParam],
List[components.MessagesFallbackParamTypedDict],
]
] = UNSET,
max_tokens: Optional[int] = None, max_tokens: Optional[int] = None,
metadata: Optional[ metadata: Optional[
Union[components.Metadata, components.MetadataTypedDict] Union[components.Metadata, components.MetadataTypedDict]
@@ -1621,6 +1671,7 @@ class Presets(BaseSDK):
:param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
:param context_management: :param context_management:
:param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.
:param max_tokens: :param max_tokens:
:param metadata: :param metadata:
:param models: :param models:
@@ -1669,6 +1720,9 @@ class Presets(BaseSDK):
context_management=utils.get_pydantic_model( context_management=utils.get_pydantic_model(
context_management, OptionalNullable[components.ContextManagement] context_management, OptionalNullable[components.ContextManagement]
), ),
fallbacks=utils.get_pydantic_model(
fallbacks, OptionalNullable[List[components.MessagesFallbackParam]]
),
max_tokens=max_tokens, max_tokens=max_tokens,
messages=utils.get_pydantic_model( messages=utils.get_pydantic_model(
messages, Nullable[List[components.MessagesMessageParam]] messages, Nullable[List[components.MessagesMessageParam]]
+4
View File
@@ -25,6 +25,7 @@ if TYPE_CHECKING:
from openrouter.datasets import Datasets from openrouter.datasets import Datasets
from openrouter.embeddings import Embeddings from openrouter.embeddings import Embeddings
from openrouter.endpoints import Endpoints from openrouter.endpoints import Endpoints
from openrouter.files import Files
from openrouter.generations import Generations from openrouter.generations import Generations
from openrouter.guardrails import Guardrails from openrouter.guardrails import Guardrails
from openrouter.models_ import Models from openrouter.models_ import Models
@@ -65,6 +66,8 @@ class OpenRouter(BaseSDK):
r"""Text embedding endpoints""" r"""Text embedding endpoints"""
endpoints: "Endpoints" endpoints: "Endpoints"
r"""Endpoint information""" r"""Endpoint information"""
files: "Files"
r"""Files endpoints"""
generations: "Generations" generations: "Generations"
r"""Generation history endpoints""" r"""Generation history endpoints"""
guardrails: "Guardrails" guardrails: "Guardrails"
@@ -99,6 +102,7 @@ class OpenRouter(BaseSDK):
"datasets": ("openrouter.datasets", "Datasets"), "datasets": ("openrouter.datasets", "Datasets"),
"embeddings": ("openrouter.embeddings", "Embeddings"), "embeddings": ("openrouter.embeddings", "Embeddings"),
"endpoints": ("openrouter.endpoints", "Endpoints"), "endpoints": ("openrouter.endpoints", "Endpoints"),
"files": ("openrouter.files", "Files"),
"generations": ("openrouter.generations", "Generations"), "generations": ("openrouter.generations", "Generations"),
"guardrails": ("openrouter.guardrails", "Guardrails"), "guardrails": ("openrouter.guardrails", "Guardrails"),
"api_keys": ("openrouter.api_keys", "APIKeys"), "api_keys": ("openrouter.api_keys", "APIKeys"),
+814
View File
@@ -1542,6 +1542,820 @@ class Workspaces(BaseSDK):
raise errors.OpenRouterDefaultError("Unexpected response received", http_res) raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def list_budgets(
self,
*,
id: str,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.ListWorkspaceBudgetsResponse:
r"""List workspace budgets
List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.ListWorkspaceBudgetsRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
)
req = self._build_request(
method="GET",
path="/workspaces/{id}/budgets",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.ListWorkspaceBudgetsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="listWorkspaceBudgets",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.ListWorkspaceBudgetsResponse, http_res
)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def list_budgets_async(
self,
*,
id: str,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.ListWorkspaceBudgetsResponse:
r"""List workspace budgets
List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.ListWorkspaceBudgetsRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
)
req = self._build_request_async(
method="GET",
path="/workspaces/{id}/budgets",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.ListWorkspaceBudgetsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="listWorkspaceBudgets",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.ListWorkspaceBudgetsResponse, http_res
)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def delete_budget(
self,
*,
id: str,
interval: components.WorkspaceBudgetInterval,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.DeleteWorkspaceBudgetResponse:
r"""Delete a workspace budget
Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.DeleteWorkspaceBudgetRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
interval=interval,
)
req = self._build_request(
method="DELETE",
path="/workspaces/{id}/budgets/{interval}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.DeleteWorkspaceBudgetGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="deleteWorkspaceBudget",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.DeleteWorkspaceBudgetResponse, http_res
)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def delete_budget_async(
self,
*,
id: str,
interval: components.WorkspaceBudgetInterval,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.DeleteWorkspaceBudgetResponse:
r"""Delete a workspace budget
Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.DeleteWorkspaceBudgetRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
interval=interval,
)
req = self._build_request_async(
method="DELETE",
path="/workspaces/{id}/budgets/{interval}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.DeleteWorkspaceBudgetGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="deleteWorkspaceBudget",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.DeleteWorkspaceBudgetResponse, http_res
)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def set_budget(
self,
*,
id: str,
interval: components.WorkspaceBudgetInterval,
limit_usd: float,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.UpsertWorkspaceBudgetResponse:
r"""Create or update a workspace budget
Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
:param limit_usd: Spending limit in USD. Must be greater than 0.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.UpsertWorkspaceBudgetRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
interval=interval,
upsert_workspace_budget_request=components.UpsertWorkspaceBudgetRequest(
limit_usd=limit_usd,
),
)
req = self._build_request(
method="PUT",
path="/workspaces/{id}/budgets/{interval}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.UpsertWorkspaceBudgetGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request.upsert_workspace_budget_request,
False,
False,
"json",
components.UpsertWorkspaceBudgetRequest,
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="upsertWorkspaceBudget",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.UpsertWorkspaceBudgetResponse, http_res
)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def set_budget_async(
self,
*,
id: str,
interval: components.WorkspaceBudgetInterval,
limit_usd: float,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.UpsertWorkspaceBudgetResponse:
r"""Create or update a workspace budget
Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
:param id: The workspace ID (UUID) or slug
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
:param limit_usd: Spending limit in USD. Must be greater than 0.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
: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
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.UpsertWorkspaceBudgetRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
interval=interval,
upsert_workspace_budget_request=components.UpsertWorkspaceBudgetRequest(
limit_usd=limit_usd,
),
)
req = self._build_request_async(
method="PUT",
path="/workspaces/{id}/budgets/{interval}",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=True,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.UpsertWorkspaceBudgetGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request.upsert_workspace_budget_request,
False,
False,
"json",
components.UpsertWorkspaceBudgetRequest,
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="upsertWorkspaceBudget",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "404", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.UpsertWorkspaceBudgetResponse, http_res
)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "404", "application/json"):
response_data = unmarshal_json_response(
errors.NotFoundResponseErrorData, http_res
)
raise errors.NotFoundResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def bulk_add_members( def bulk_add_members(
self, self,
*, *,
Generated
+1 -1
View File
@@ -220,7 +220,7 @@ wheels = [
[[package]] [[package]]
name = "openrouter" name = "openrouter"
version = "0.9.2" version = "0.10.0"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "httpcore" }, { name = "httpcore" },