diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 8f57a9738..314be1580 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: 40e2bc23f7c4aa3f3ce0d470a469148e + docChecksum: 9e161a46647f3a4d07b24c8d00578c22 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.76 - configChecksum: ce947364c5392aadce4db6c772e33a89 + releaseVersion: 1.3.77 + configChecksum: 9b873bdd9890526d751c7121a80a9ac2 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 689c33fb-8a90-47f7-b2d1-032588a65df7 - pristine_commit_hash: cd29ae9fa1a0b5bab48df3c2939cf6121cf9b0ef - pristine_tree_hash: 7bf7b0845609b4efb3525fed8446b305fbd5fe44 + generation_id: b3c0f80b-3f8f-4427-9801-fa8155208c56 + pristine_commit_hash: 8601a2c8f2fee7271a9d1d79e423f33eff695f07 + pristine_tree_hash: a23281b0eb793aa1deca0f2680611a1ac1b1a8fa features: python: acceptHeaders: 3.0.0 @@ -6336,8 +6336,8 @@ trackedFiles: pristine_git_object: d82f235f03d49c49a8051659a00a64753630d9b8 docs/components/privateendpointpricing.mdx: id: 16264ba816a0 - last_write_checksum: sha1:18134f67a96280dbf944223036f9f473221eb342 - pristine_git_object: 3004d03302ab6b06f44c41c8fad4eead79aac399 + last_write_checksum: sha1:e1fc22fca61fcbf36c2b3d48908af0b1de0f8370 + pristine_git_object: 98c2b6bacd5e87a81285558abed783d7c5e24bc3 docs/components/privateendpointresponse.mdx: id: 5844d85b61d8 last_write_checksum: sha1:e303f61ad992a12c3f9e1008beba2b3b277c9157 @@ -10316,8 +10316,8 @@ trackedFiles: pristine_git_object: 6a18aef850a89e56f8f7b0c507c24ab1eed0022c docs/sdks/generations/README.mdx: id: a754fecc8514 - last_write_checksum: sha1:46ab209542cabc2de53c1ec07eebfdaf2601f48a - pristine_git_object: bc1a56cbb41c8f9114c81b547713632272184da6 + last_write_checksum: sha1:0a7baa6b26938066352a5d4d668d19e17776643a + pristine_git_object: b22a992e0447d12837d88f04133ef911aafcfaaf docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa last_write_checksum: sha1:8a7bd8b43337d429726ac461e248aca8100b54cf @@ -10404,8 +10404,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:0d11d5c53be5d0b7fb677bb0faa39d950cb895ec - pristine_git_object: 7f8ab233be116ad0ee4aab4d2eed41a443e48652 + last_write_checksum: sha1:297a6ffb1c170ddc23d42034497ee1d080fc8a86 + pristine_git_object: e31d0b8dd00bae68efea9cdf6ac571e31f090002 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10432,8 +10432,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:16375f7c967b1e7c112bc04e9fb6dec662429676 - pristine_git_object: 8ceb70f1181bb17a3da10f81b19354345e48b5fa + last_write_checksum: sha1:bcfc37be6676e3aa3f367bda551234104c64c73a + pristine_git_object: 36d3d822fe628a30968823f18d3facd145954487 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -13084,8 +13084,8 @@ trackedFiles: pristine_git_object: 6a8d44a0b8ed4313318a9ebc0220de6b098cd01a src/openrouter/components/privateendpointpricing.py: id: 2d8979e18f5b - last_write_checksum: sha1:7e95e077f70d016fdaa0256ac622d19e91e0d7cb - pristine_git_object: 861d9bf7b206b4da322b7facdcafd43e7805a1ec + last_write_checksum: sha1:9573cef75311eee6c467e4a051308dbfd9a22ec4 + pristine_git_object: 8ab720b740586c7709f13f4bdba16214327a73b0 src/openrouter/components/privateendpointresponse.py: id: 38a49c864b72 last_write_checksum: sha1:e9cbd209c0e4128c69645f4b4fb59508b40bb6eb @@ -14108,8 +14108,8 @@ trackedFiles: pristine_git_object: 5702b46b8a0ac74ee34216b31154b0c3928a2e7f src/openrouter/generations.py: id: 70e1c21042bc - last_write_checksum: sha1:b4ae45620a9ad38402e72ed42abea516aeb3aa32 - pristine_git_object: 5698c384a36929846530cae98f69ce83a0966217 + last_write_checksum: sha1:26521fe0a5a034c9a3c4ce763410daf99e839860 + pristine_git_object: b899aac81fa41d1a3e6b3fee13a2cab2176e65cb src/openrouter/guardrails.py: id: 705839f34e66 last_write_checksum: sha1:156c955e4e751a229100a3261e297d2898b5d089 @@ -16662,6 +16662,8 @@ examples: application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} listScimGroupMappings: speakeasy-default-list-scim-group-mappings: parameters: @@ -19239,17 +19241,4 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.byok.list()`: `error.status[403]` **Added** - * `open_router.byok.delete()`: `error.status[403]` **Added** - * `open_router.byok.get()`: `error.status[403]` **Added** - * `open_router.observability.list()`: `error.status[403]` **Added** - * `open_router.observability.delete()`: `error.status[403]` **Added** - * `open_router.observability.get()`: `error.status[403]` **Added** - * `open_router.scim.list_mappings()`: `error.status[403]` **Added** - * `open_router.scim.create()`: `error.status[403]` **Added** - * `open_router.scim.delete()`: `error.status[403]` **Added** - * `open_router.scim.read()`: `error.status[403]` **Added** - * `open_router.scim.update()`: `error.status[403]` **Added** - * `open_router.scim.list_groups()`: `error.status[403]` **Added** - * `open_router.scim.create_sync_job()`: `error.status[403]` **Added** - * `open_router.scim.get_sync_job()`: `error.status[403]` **Added** + * `open_router.generations.submit_feedback()`: `error.status[409]` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 3fe2a329f..7d4e897da 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.76 + version: 1.3.77 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8e44f3fbc..616b7b628 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -26521,12 +26521,12 @@ components: prompt: '0.0000025' properties: cache_read: - description: 'USD per cache-read prompt token, as a decimal string. Omit it to bill cache reads at the provider pricing strategy''s default, which for most strategies is the prompt rate.' + description: 'USD per cache-read prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-read to prompt ratio, or left at the pricing strategy default when it publishes no cache-read rate. Required when there is no such endpoint and the provider bills cache reads.' example: '0.00000025' pattern: '^\d+(\.\d+)?$' type: 'string' cache_write: - description: 'USD per cache-write prompt token, as a decimal string. Omit it to bill cache writes at the provider pricing strategy''s default.' + description: 'USD per cache-write prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-write to prompt ratio, or left at the pricing strategy default when it publishes no cache-write rate. Required when there is no such endpoint and the provider bills cache writes.' example: '0.000003125' pattern: '^\d+(\.\d+)?$' type: 'string' @@ -41097,6 +41097,16 @@ paths: schema: $ref: '#/components/schemas/NotFoundResponse' description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Feedback was already submitted for this generation' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Feedback was already submitted for this generation by this account. The first submission is kept.' '429': content: application/json: @@ -42840,7 +42850,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -42972,6 +42982,14 @@ paths: content: application/json: examples: + lifecycle_writes_disabled: + value: + error: + code: 403 + message: 'Intern lifecycle writes are not enabled for this account' + metadata: + reason: 'lifecycle_writes_disabled' + retryable: false no_acting_user: value: error: @@ -42990,7 +43008,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The key acts as an organization and has no member who can own the intern, the workspace does not allow interns, or regional access is refused.' + description: 'The key acts as an organization and has no member who can own the intern, the workspace does not allow interns, lifecycle writes are not enabled for the caller, or regional access is refused.' '404': content: application/json: @@ -43003,7 +43021,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -43161,10 +43179,13 @@ paths: example: error: code: 403 - message: 'Forbidden' + message: 'Intern lifecycle writes are not enabled for this account' + metadata: + reason: 'lifecycle_writes_disabled' + retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The key owner no longer has access, or the request used a regional hostname.' + description: 'The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).' '404': content: application/json: @@ -43177,7 +43198,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -43331,7 +43352,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -43439,10 +43460,13 @@ paths: example: error: code: 403 - message: 'Forbidden' + message: 'Intern lifecycle writes are not enabled for this account' + metadata: + reason: 'lifecycle_writes_disabled' + retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The key owner no longer has access, or the request used a regional hostname.' + description: 'The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).' '404': content: application/json: @@ -43455,7 +43479,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -43846,7 +43870,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -43935,7 +43959,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44038,7 +44062,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44163,7 +44187,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44321,7 +44345,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44465,7 +44489,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44764,10 +44788,13 @@ paths: example: error: code: 403 - message: 'Forbidden' + message: 'Intern lifecycle writes are not enabled for this account' + metadata: + reason: 'lifecycle_writes_disabled' + retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The key owner no longer has access, or the request used a regional hostname.' + description: 'The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).' '404': content: application/json: @@ -44780,7 +44807,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: @@ -44920,10 +44947,13 @@ paths: example: error: code: 403 - message: 'Forbidden' + message: 'Intern lifecycle writes are not enabled for this account' + metadata: + reason: 'lifecycle_writes_disabled' + retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The key owner no longer has access, or the request used a regional hostname.' + description: 'The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).' '404': content: application/json: @@ -44936,7 +44966,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternLifecycleError' - description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + description: 'The caller is outside the Intern API programme, or the intern is hidden.' '408': content: application/json: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b38de749d..a8a528fbb 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:a0d6d1179366adb7bad868511f5d67a9dd3b6b693eefbe1d8f6f355f1f439f84 - sourceBlobDigest: sha256:f250fc1f30aa4bf26f599271b4c6e83dfc9e074466db14491d5fc05ceabffe40 + sourceRevisionDigest: sha256:c3feeeecedf52684a6b76e204aefc63ce907533a5e69dba1ab8736b5ce220c56 + sourceBlobDigest: sha256:dbef6078446089006f0fccd11f8c57a140a0fafd95566e685f60eb7d2fd9b13b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:a0d6d1179366adb7bad868511f5d67a9dd3b6b693eefbe1d8f6f355f1f439f84 - sourceBlobDigest: sha256:f250fc1f30aa4bf26f599271b4c6e83dfc9e074466db14491d5fc05ceabffe40 + sourceRevisionDigest: sha256:c3feeeecedf52684a6b76e204aefc63ce907533a5e69dba1ab8736b5ce220c56 + sourceBlobDigest: sha256:dbef6078446089006f0fccd11f8c57a140a0fafd95566e685f60eb7d2fd9b13b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:1d15e58880618bd0c1b6c6ed964f7d6539a810f8092764700a1fc0ff1382327d + codeSamplesRevisionDigest: sha256:e6e7f318dcfc319f84d58fc1b4cab485802b13541cf0defa901efe78479da5f7 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 5acafd3b0..1a3a63f11 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3529,4 +3529,14 @@ Based on: ### Generated - [python v1.3.76] . ### Releases -- [PyPI v1.3.76] https://pypi.org/project/openrouter/1.3.76 - . \ No newline at end of file +- [PyPI v1.3.76] https://pypi.org/project/openrouter/1.3.76 - . + +## 2026-10-22 18:21:56 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.77] . +### Releases +- [PyPI v1.3.77] https://pypi.org/project/openrouter/1.3.77 - . \ No newline at end of file diff --git a/docs/components/privateendpointpricing.mdx b/docs/components/privateendpointpricing.mdx index 84c4f25d2..d9c2a699a 100644 --- a/docs/components/privateendpointpricing.mdx +++ b/docs/components/privateendpointpricing.mdx @@ -7,9 +7,9 @@ Negotiated per-token rates reported for requests routed to this endpoint. ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_read` | *Optional[str]* | ➖ | USD per cache-read prompt token, as a decimal string. Omit it to bill cache reads at the provider pricing strategy's default, which for most strategies is the prompt rate. | 0.00000025 | -| `cache_write` | *Optional[str]* | ➖ | USD per cache-write prompt token, as a decimal string. Omit it to bill cache writes at the provider pricing strategy's default. | 0.000003125 | -| `completion` | *str* | ✅ | USD per completion token, as a decimal string. | 0.00001 | -| `prompt` | *str* | ✅ | USD per prompt token, as a decimal string. | 0.0000025 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_read` | *Optional[str]* | ➖ | USD per cache-read prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-read to prompt ratio, or left at the pricing strategy default when it publishes no cache-read rate. Required when there is no such endpoint and the provider bills cache reads. | 0.00000025 | +| `cache_write` | *Optional[str]* | ➖ | USD per cache-write prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-write to prompt ratio, or left at the pricing strategy default when it publishes no cache-write rate. Required when there is no such endpoint and the provider bills cache writes. | 0.000003125 | +| `completion` | *str* | ✅ | USD per completion token, as a decimal string. | 0.00001 | +| `prompt` | *str* | ✅ | USD per prompt token, as a decimal string. | 0.0000025 | \ No newline at end of file diff --git a/docs/sdks/generations/README.mdx b/docs/sdks/generations/README.mdx index 65c5e926d..dfdfb5fda 100644 --- a/docs/sdks/generations/README.mdx +++ b/docs/sdks/generations/README.mdx @@ -169,6 +169,7 @@ with OpenRouter( | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7f8ab233b..e31d0b8dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.76" +version = "1.3.77" 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 8ceb70f11..36d3d822f 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.76" +__version__: str = "1.3.77" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.76 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.77 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/privateendpointpricing.py b/src/openrouter/components/privateendpointpricing.py index 861d9bf7b..8ab720b74 100644 --- a/src/openrouter/components/privateendpointpricing.py +++ b/src/openrouter/components/privateendpointpricing.py @@ -15,9 +15,9 @@ class PrivateEndpointPricingTypedDict(TypedDict): prompt: str r"""USD per prompt token, as a decimal string.""" cache_read: NotRequired[str] - r"""USD per cache-read prompt token, as a decimal string. Omit it to bill cache reads at the provider pricing strategy's default, which for most strategies is the prompt rate.""" + r"""USD per cache-read prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-read to prompt ratio, or left at the pricing strategy default when it publishes no cache-read rate. Required when there is no such endpoint and the provider bills cache reads.""" cache_write: NotRequired[str] - r"""USD per cache-write prompt token, as a decimal string. Omit it to bill cache writes at the provider pricing strategy's default.""" + r"""USD per cache-write prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-write to prompt ratio, or left at the pricing strategy default when it publishes no cache-write rate. Required when there is no such endpoint and the provider bills cache writes.""" class PrivateEndpointPricing(BaseModel): @@ -30,10 +30,10 @@ class PrivateEndpointPricing(BaseModel): r"""USD per prompt token, as a decimal string.""" cache_read: Optional[str] = None - r"""USD per cache-read prompt token, as a decimal string. Omit it to bill cache reads at the provider pricing strategy's default, which for most strategies is the prompt rate.""" + r"""USD per cache-read prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-read to prompt ratio, or left at the pricing strategy default when it publishes no cache-read rate. Required when there is no such endpoint and the provider bills cache reads.""" cache_write: Optional[str] = None - r"""USD per cache-write prompt token, as a decimal string. Omit it to bill cache writes at the provider pricing strategy's default.""" + r"""USD per cache-write prompt token, as a decimal string. When omitted, inherited from the public endpoint of the same model and provider: scaled by its cache-write to prompt ratio, or left at the pricing strategy default when it publishes no cache-write rate. Required when there is no such endpoint and the provider bills cache writes.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index 5698c384a..b899aac81 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -772,6 +772,11 @@ def submit_feedback( errors.NotFoundResponseErrorData, http_res ) raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) if utils.match_response(http_res, "429", "application/json"): response_data = unmarshal_json_response( errors.TooManyRequestsResponseErrorData, http_res @@ -927,6 +932,11 @@ async def submit_feedback_async( errors.NotFoundResponseErrorData, http_res ) raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) if utils.match_response(http_res, "429", "application/json"): response_data = unmarshal_json_response( errors.TooManyRequestsResponseErrorData, http_res diff --git a/uv.lock b/uv.lock index 791a902f6..41748780f 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.76" +version = "1.3.77" source = { editable = "." } dependencies = [ { name = "httpcore" },