diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b01267c7..a97fb281 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: 0339725e33577ba5dda2b1a3dd2a4178 + docChecksum: 3fbca70c0595aef917597974a6ec3112 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.147 - configChecksum: 2c2dbced52857c6b47b66ca5c3c6c1a0 + releaseVersion: 1.3.148 + configChecksum: 99007b4804f4469f75075fda740467bc repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 487a13b0-4500-4c73-b4d5-d39079308282 - pristine_commit_hash: bcf674cee9ed7ff479b8b3058ebe805d3978a721 - pristine_tree_hash: 0a8e5279cc4d5375ddc19c861de5083eb925ab28 + generation_id: 92ea4476-31b6-48b3-aa1f-f4c838a4a408 + pristine_commit_hash: 3529b86bd2b18aacc97ce7a86c2ec2da9e3ef8c8 + pristine_tree_hash: a8ab00d9265398e7f979982dec50d2a7b25d8397 features: python: acceptHeaders: 3.0.0 @@ -11588,8 +11588,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:0d3c5de90e8a1c6d93eaac9d2cb2d2f80b1be723 - pristine_git_object: 86ea998bbf21a766bed00acc75b901a8f9256e39 + last_write_checksum: sha1:34a5fece6e070a9f1cb88d6609536f44c9cda8c4 + pristine_git_object: 5db78718f185e045b426cfb2282971e8a90b365f scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11616,8 +11616,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:64d92b84ee5d26fc768eb32caf32ffc3a74d23b1 - pristine_git_object: 66dca2e10eec2437ae159c2bc111d44e67bd5941 + last_write_checksum: sha1:31c214c179c96691530daf05a143aee66d67d942 + pristine_git_object: 6d36583ddb0eb3ad4437931894a21097c3a3376c src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -21573,6 +21573,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.o_auth.create_auth_code()`: `error.status[503]` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index e853d4a9..a61ca8f5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.147 + version: 1.3.148 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 951c99ca..1fcfc08f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -10504,6 +10504,15 @@ components: required: - 'data' type: 'object' + CreateCreditPurchaseRequest: + properties: + credit_amount_usd: + description: 'Credits to buy, in USD with at most two decimals. The platform fee is added on top and shown in the challenge and the receipt.' + example: '25.00' + type: 'string' + required: + - 'credit_amount_usd' + type: 'object' CreatedEvent: description: 'Event emitted when a response is created' example: @@ -11390,6 +11399,53 @@ components: required: - 'data' type: 'object' + CreditPurchase: + properties: + created_at: + type: 'string' + credit_amount_usd: + type: 'string' + failure_reason: + type: + - 'string' + - 'null' + id: + description: 'Purchase id, the Stripe PaymentIntent that owns the deposit address.' + type: 'string' + network: + type: 'string' + platform_fee_usd: + type: 'string' + protocol: + type: 'string' + status: + enum: + - 'awaiting_payment' + - 'processing' + - 'credited' + - 'failed' + type: 'string' + x-speakeasy-unknown-values: allow + total_charged_usd: + type: 'string' + required: + - 'id' + - 'status' + - 'credit_amount_usd' + - 'platform_fee_usd' + - 'total_charged_usd' + - 'protocol' + - 'network' + - 'failure_reason' + - 'created_at' + type: 'object' + CreditPurchaseResponse: + properties: + data: + $ref: '#/components/schemas/CreditPurchase' + required: + - 'data' + type: 'object' CustomTool: description: 'Custom tool configuration' example: @@ -43047,6 +43103,240 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /credits/purchases: + post: + description: 'Starts an agent credit purchase paid with a Machine Payments Protocol (MPP) credential on Tempo. The first call answers `402` with a `WWW-Authenticate: Payment ...` challenge; retry the same request, same `Idempotency-Key`, with the signed credential in `Payment-Authorization: Payment ...` (or in `Authorization: Payment ...` when the management key is sent as `X-Api-Key`). A paid request answers `202`: the transfer was broadcast and Stripe is still screening the payment, so credits arrive asynchronously. Poll the URL in the `Location` header, `GET /api/v1/credits/purchases/{id}`, until `status` is `credited` or `failed`.' + operationId: 'createCreditsPurchases' + parameters: + - description: 'Identifies the purchase. Send the same value on the unpaid request and on the paid retry; use a new value for a new purchase.' + in: 'header' + name: 'idempotency-key' + required: true + schema: + description: 'Identifies the purchase. Send the same value on the unpaid request and on the paid retry; use a new value for a new purchase.' + example: '6f1f7f0e-2b1a-4f57-9a43-3c1f6f3e8b0d' + maxLength: 255 + minLength: 1 + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCreditPurchaseRequest' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/CreditPurchaseResponse' + description: 'Payment accepted; credits are minted when the PaymentIntent succeeds.' + headers: + Location: + description: 'The purchase to poll: `GET /api/v1/credits/purchases/{id}`.' + required: true + schema: + description: 'The purchase to poll: `GET /api/v1/credits/purchases/{id}`.' + example: '/api/v1/credits/purchases/pi_3PqXyZ2eZvKYlo2C0abc1234' + type: 'string' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '402': + content: + application/json: + schema: + $ref: '#/components/schemas/CreditPurchaseResponse' + description: 'Payment required. An unpaid request carries the MPP challenge in `WWW-Authenticate`.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - Rate limit exceeded' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: + - bearerAuth: [] + summary: 'Buy credits with a machine payment' + tags: + - 'Credits' + x-fern-ignore: true + x-hidden: true + x-speakeasy-ignore: true + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /credits/purchases/{id}: + get: + description: 'Returns one agent credit purchase of the calling account, read from its Stripe PaymentIntent. Poll this after a `202` until `status` is `credited` or `failed`.' + operationId: 'listCreditsPurchases' + parameters: + - in: 'path' + name: 'id' + required: true + schema: + pattern: '^pi_[A-Za-z0-9]{1,64}$' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreditPurchaseResponse' + description: 'The purchase.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - Rate limit exceeded' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: + - bearerAuth: [] + summary: 'Get a credit purchase' + tags: + - 'Credits' + x-fern-ignore: true + x-hidden: true + x-speakeasy-ignore: true + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /datasets/app-rankings: get: description: "Returns the top public apps on OpenRouter ranked by token usage inside the requested\ndate window, matching the public apps marketplace on openrouter.ai/apps. Token totals\nare `prompt_tokens + completion_tokens`; hidden and private apps are excluded and\ntraffic from related app aliases is merged into the canonical visible app.\n\n`sort=popular` (default) ranks by total token volume inside the window.\n`sort=trending` ranks by absolute excess token growth: window volume minus the average\nvolume of the three equal-length periods immediately preceding the window. Apps with\nno excess growth are omitted, so `trending` may return fewer than `limit` rows.\n\nFilter with `category` (marketplace category group, e.g. `coding`) or `subcategory`\n(e.g. `cli-agent`). Ranks are re-numbered 1..N after filtering. Page with `offset` —\n`rank` stays absolute, so the first row of `offset=50` is `rank: 51`.\n\nAuthenticate with any valid OpenRouter API key (same key used for inference).\nRate-limited to 30 requests/minute per key and 500 requests/day per account.\n\nWhen republishing or quoting this dataset, OpenRouter must be cited as:\n\"Source: OpenRouter (openrouter.ai/apps), as of {as_of}.\"\n\nToken counts come from each upstream provider's own tokenizer, so a token attributed\nto one app is not directly comparable to a token attributed to another app whose\ntraffic flows through a different provider.\n\nLicensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse and republish with attribution to OpenRouter." diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index c20591b2..431a1343 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:f056f5433e4e2c2f8714fa931873e4ce4f5939ab31127837779c634a0e0b06b5 - sourceBlobDigest: sha256:5f9da02b3302611755c0a6fbce04ecb311710a9d3bed85963140baefd11a181f + sourceRevisionDigest: sha256:883f9437ba9d1be72040901a0f9592a9deb20a846559ce499bb0a1a51d2ca033 + sourceBlobDigest: sha256:0c24a116c8ae0e0624611b7746f4e69de4aa0b91003a7ee90ac8c45b5bbce363 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:f056f5433e4e2c2f8714fa931873e4ce4f5939ab31127837779c634a0e0b06b5 - sourceBlobDigest: sha256:5f9da02b3302611755c0a6fbce04ecb311710a9d3bed85963140baefd11a181f + sourceRevisionDigest: sha256:883f9437ba9d1be72040901a0f9592a9deb20a846559ce499bb0a1a51d2ca033 + sourceBlobDigest: sha256:0c24a116c8ae0e0624611b7746f4e69de4aa0b91003a7ee90ac8c45b5bbce363 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:301a42c3b95d1001fdfe168603d0c3521b3fe1d72d7a82c55fc79e7a1fd8fea9 + codeSamplesRevisionDigest: sha256:66be0450009b7620874e6cf742a6ab4bbf298e5ccb0c3fe9097ac4962155d0f5 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 40f8ecfb..438b12f7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4239,4 +4239,14 @@ Based on: ### Generated - [python v1.3.147] . ### Releases -- [PyPI v1.3.147] https://pypi.org/project/openrouter/1.3.147 - . \ No newline at end of file +- [PyPI v1.3.147] https://pypi.org/project/openrouter/1.3.147 - . + +## 2026-11-10 07:04:01 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.148] . +### Releases +- [PyPI v1.3.148] https://pypi.org/project/openrouter/1.3.148 - . \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 86ea998b..5db78718 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.147" +version = "1.3.148" 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 66dca2e1..6d36583d 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.147" +__version__: str = "1.3.148" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.147 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.148 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/uv.lock b/uv.lock index 5e6bf4c5..4477f9f8 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.147" +version = "1.3.148" source = { editable = "." } dependencies = [ { name = "httpcore" },