From a4ee2ba10eda7790735ac49f944c8f9a912026f2 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 14 Jul 2026 14:51:25 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides[]` **Changed** * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides[]` **Changed** * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides[]` **Changed** * `open_router.models.get()`: `response.data.pricing.overrides[]` **Changed** * `open_router.models.list()`: `response.data[].pricing.overrides[]` **Changed** * `open_router.models.list_for_user()`: `response.data[].pricing.overrides[]` **Changed** --- .speakeasy/gen.lock | 51 +++++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 15 ++++-- .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/pricing.mdx | 36 +++++++------- docs/components/pricingoverride.mdx | 24 ++++----- docs/components/publicpricing.mdx | 36 +++++++------- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/pricingoverride.py | 16 +++++- src/openrouter/components/publicendpoint.py | 4 +- src/openrouter/components/publicpricing.py | 4 +- uv.lock | 2 +- 14 files changed, 128 insertions(+), 90 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fa92dd7..a66bcf8 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 913314e7b77524966693bb56c9a3dd24 + docChecksum: ff4478e1428e58273d7375ea639734d6 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.28 - configChecksum: ce48138720beb4eb8841b187c03d254f + releaseVersion: 0.11.29 + configChecksum: e092e139147af5b5a502f15607d75192 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: e656f374-a717-4315-90c0-6ee70ed0cf9c - pristine_commit_hash: 3d5b10a16d484690e232f230a59576340aa52303 - pristine_tree_hash: f9fc6333f4a8952a56a6ca33eb92a50cc9b98d90 + generation_id: d53fc2a4-a065-484e-b315-dc8906615c95 + pristine_commit_hash: a593a152775480385c6cd2612c40dfb00014f443 + pristine_tree_hash: 4c87fa8a5b2aa4e90475f48c263b2f8da0222530 features: python: acceptHeaders: 3.0.0 @@ -3890,12 +3890,12 @@ trackedFiles: pristine_git_object: 3d340325d192b54a5d039336cce2bd35d12445ac docs/components/pricing.mdx: id: 6816d700f8b1 - last_write_checksum: sha1:c9f49a270c1ddcaf2b354b2c0f7ceb277ca5eff4 - pristine_git_object: 0ca9bdf9bf2b1909a4a78e99b58fde78b311becd + last_write_checksum: sha1:4b1943b79c3f1b054236d4e35f843b91108decd0 + pristine_git_object: e60ec6cfd7c0882a02067bfbe246e5cf6d5208c0 docs/components/pricingoverride.mdx: id: 74675f38c1c6 - last_write_checksum: sha1:5e64e9edbb013f04ee3741fe7c5dbd2fa54b544b - pristine_git_object: f8291256ac4a4aeed8bf79f1bad1e3b45cbaa354 + last_write_checksum: sha1:ca4bf606df26dd9e2b636d7d9e9f0fd183b21145 + pristine_git_object: 5fb1b765b2b0e46d40042f341bbcc91aa0d92762 docs/components/promptcachebreakpoint.mdx: id: c135956dc623 last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 @@ -3974,8 +3974,8 @@ trackedFiles: pristine_git_object: 4498d08fd82f26a210eeed2b9659e6a0b321f9ef docs/components/publicpricing.mdx: id: 61fb18b7ff94 - last_write_checksum: sha1:53550f414931189b91a148ca9039aefb5899a7ee - pristine_git_object: 4a17b2b3dd05ea85ea9847689c13692540007f07 + last_write_checksum: sha1:e241420249fcbd1bf515b0f5e84934de0b207948 + pristine_git_object: 894ca95c033795d50895fec5b8a6a18cd4a459c3 docs/components/quantization.mdx: id: 9d062e4ee362 last_write_checksum: sha1:4cb3588933fe1ca8592669f8ec1bef1cf0986e28 @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:04c19e27f55c549187e8134f7ff3696cd428f3df - pristine_git_object: 38e011e2029916eabc14394ca864b6516da19017 + last_write_checksum: sha1:1117ced9033fbecc539bceaa0497773110a561fa + pristine_git_object: 390707512d3febdc96fb763f9d077eee7567d046 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:fd94190abbfad4aff1ecc18a06a3b466ddd7c2b8 - pristine_git_object: fb15497c9ae07185c9379f5151156e976ce297f5 + last_write_checksum: sha1:fda5045f9e84313bfc3c002291fef7a1dba3ee40 + pristine_git_object: 86673258f99094629fb4fd3a5c17d5f944bf63fd src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -8358,8 +8358,8 @@ trackedFiles: pristine_git_object: 90bdb267893360608210843a5da0d5d68e80d41e src/openrouter/components/pricingoverride.py: id: 8984e4cc7422 - last_write_checksum: sha1:0e2c06a0d510bb2fcf64b03f74c693f26c9825ad - pristine_git_object: 21c25933126937fe7c1d10898a42bbe711cf7b9f + last_write_checksum: sha1:0f72b9806164907aacce785f2d0c79a3e9374ac9 + pristine_git_object: a7c4599ac6ab794f54968f12cd6b15c3137a5159 src/openrouter/components/promptcachebreakpoint.py: id: f1e589a13300 last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d @@ -8402,12 +8402,12 @@ trackedFiles: pristine_git_object: 1798ae9dd8c2e4b629bb99cc5c643827895e8231 src/openrouter/components/publicendpoint.py: id: 848aa2ef9129 - last_write_checksum: sha1:a94a8a30e3656955780285fa004a2b7e5d162c57 - pristine_git_object: b647b5f88242565b228e6d0bf11d151e6650f6f8 + last_write_checksum: sha1:cfd3d1e8d5c62bbd494bd35e92d4d574103a189a + pristine_git_object: f91d6ae5aa526c51cf218eaaed2cb77514737ae8 src/openrouter/components/publicpricing.py: id: 96d115d83cc5 - last_write_checksum: sha1:a3733ee6d92eda73562ea1fa2bc834e3a14ac6db - pristine_git_object: 037f4b4e9aa72510a4021e695fe39516eb88d1f3 + last_write_checksum: sha1:fd8c320ac83b282eaf2405045329b55076d4311a + pristine_git_object: 34b9d18bf50bcce3c150fffff684f41e8e79a2bd src/openrouter/components/quantization.py: id: bde317b3d703 last_write_checksum: sha1:96b042899bfb818f20d282be76ad37fc948a599d @@ -11147,4 +11147,9 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.images.generate()`: `response` **Changed** + * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides[]` **Changed** + * `open_router.models.get()`: `response.data.pricing.overrides[]` **Changed** + * `open_router.models.list()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.models.list_for_user()`: `response.data[].pricing.overrides[]` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f6d28fd..0db77a9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.28 + version: 0.11.29 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index cfa4187..a825e61 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -18295,7 +18295,7 @@ components: type: object PricingOverride: description: >- - A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. + A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. example: completion: '0.00002' min_prompt_tokens: 200000 @@ -18327,6 +18327,15 @@ components: prompt: description: Overridden price in USD per token for prompt (input) processing type: string + utc_end: + description: 'Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)' + format: double + type: number + utc_start: + description: >- + Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end). + format: double + type: number type: object PromptCacheBreakpoint: description: >- @@ -19438,7 +19447,7 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. items: $ref: '#/components/schemas/PricingOverride' type: array @@ -19561,7 +19570,7 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. items: $ref: '#/components/schemas/PricingOverride' type: array diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 05cc9df..d77ab63 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec - sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 + sourceRevisionDigest: sha256:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 + sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec - sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 + sourceRevisionDigest: sha256:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 + sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:2f083adce0aad1ea67dd838546080b632140c054b28495cc56c4f449cfc35f2e + codeSamplesRevisionDigest: sha256:7273c5d01f944ef1d07660238a38770b6cf0bcf8fe421b90c142f70bd9182305 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index efcceda..ffddaf3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -388,4 +388,14 @@ Based on: ### Generated - [python v0.11.28] . ### Releases -- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - . \ No newline at end of file +- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - . + +## 2026-07-14 14:49:30 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.29] . +### Releases +- [PyPI v0.11.29] https://pypi.org/project/openrouter/0.11.29 - . \ No newline at end of file diff --git a/docs/components/pricing.mdx b/docs/components/pricing.mdx index 0ca9bdf..e60ec6c 100644 --- a/docs/components/pricing.mdx +++ b/docs/components/pricing.mdx @@ -4,21 +4,21 @@ title: "Pricing" ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/docs/components/pricingoverride.mdx b/docs/components/pricingoverride.mdx index f829125..5fb1b76 100644 --- a/docs/components/pricingoverride.mdx +++ b/docs/components/pricingoverride.mdx @@ -2,18 +2,20 @@ title: "PricingOverride" --- -A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. +A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per audio input token | -| `completion` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for completion (output) generation | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cache-write token | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per 1-hour cache-write token | -| `min_prompt_tokens` | *Optional[float]* | :heavy_minus_sign: | Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for prompt (input) processing | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per audio input token | +| `completion` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for completion (output) generation | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cache-write token | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per 1-hour cache-write token | +| `min_prompt_tokens` | *Optional[float]* | :heavy_minus_sign: | Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for prompt (input) processing | +| `utc_end` | *Optional[float]* | :heavy_minus_sign: | Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00) | +| `utc_start` | *Optional[float]* | :heavy_minus_sign: | Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end). | \ No newline at end of file diff --git a/docs/components/publicpricing.mdx b/docs/components/publicpricing.mdx index 4a17b2b..894ca95 100644 --- a/docs/components/publicpricing.mdx +++ b/docs/components/publicpricing.mdx @@ -7,21 +7,21 @@ Pricing information for the model ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 38e011e..3907075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.28" +version = "0.11.29" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index fb15497..8667325 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.28" +__version__: str = "0.11.29" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.28 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.29 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/pricingoverride.py b/src/openrouter/components/pricingoverride.py index 21c2593..a7c4599 100644 --- a/src/openrouter/components/pricingoverride.py +++ b/src/openrouter/components/pricingoverride.py @@ -8,7 +8,7 @@ class PricingOverrideTypedDict(TypedDict): - r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" audio: NotRequired[str] r"""Overridden price in USD per audio input token""" @@ -26,10 +26,14 @@ class PricingOverrideTypedDict(TypedDict): r"""Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold""" prompt: NotRequired[str] r"""Overridden price in USD per token for prompt (input) processing""" + utc_end: NotRequired[float] + r"""Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)""" + utc_start: NotRequired[float] + r"""Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end).""" class PricingOverride(BaseModel): - r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" audio: Optional[str] = None r"""Overridden price in USD per audio input token""" @@ -55,6 +59,12 @@ class PricingOverride(BaseModel): prompt: Optional[str] = None r"""Overridden price in USD per token for prompt (input) processing""" + utc_end: Optional[float] = None + r"""Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)""" + + utc_start: Optional[float] = None + r"""Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end).""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -67,6 +77,8 @@ def serialize_model(self, handler): "input_cache_write_1h", "min_prompt_tokens", "prompt", + "utc_end", + "utc_start", ] ) serialized = handler(self) diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index b647b5f..f91d6ae 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -40,7 +40,7 @@ class PricingTypedDict(TypedDict): internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" overrides: NotRequired[List[PricingOverrideTypedDict]] - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -88,7 +88,7 @@ class Pricing(BaseModel): r"""Price in USD per internal reasoning token""" overrides: Optional[List[PricingOverride]] = None - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: Optional[str] = None r"""Price in USD per request""" diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 037f4b4..34b9d18 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -38,7 +38,7 @@ class PublicPricingTypedDict(TypedDict): internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" overrides: NotRequired[List[PricingOverrideTypedDict]] - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -88,7 +88,7 @@ class PublicPricing(BaseModel): r"""Price in USD per internal reasoning token""" overrides: Optional[List[PricingOverride]] = None - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: Optional[str] = None r"""Price in USD per request""" diff --git a/uv.lock b/uv.lock index 0c59b75..914f2ad 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.28" +version = "0.11.29" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 6f3b3c57dc13c51ce3d7106c905fbfcc8a73b491 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:51:32 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow