Skip to content

Commit 206db95

Browse files
committed
## Python SDK Changes:
* `open_router.batch.cancel()`: **Added**
1 parent ce814b9 commit 206db95

17 files changed

Lines changed: 679 additions & 39 deletions

File tree

‎.speakeasy/gen.lock‎

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
lockVersion: 2.0.0
22
id: c48cf606-fb42-4a45-9c23-8f0555307828
33
management:
4-
docChecksum: d400e55b15e2a2ae2a255ae0774a55ca
4+
docChecksum: fe7bb52072a7794e3f45f29b6197af42
55
docVersion: 1.0.0
66
speakeasyVersion: 1.803.2
77
generationVersion: 2.950.13
8-
releaseVersion: 1.3.229
9-
configChecksum: bc7bc68b68a0b355a7076fc106a19ac7
8+
releaseVersion: 1.3.230
9+
configChecksum: 508a1e3ebc5bbb0b12eb9ffcb67b1148
1010
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
1111
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
1212
published: true
1313
persistentEdits:
14-
generation_id: 77639645-43cf-4375-b62c-4575579fe4df
15-
pristine_commit_hash: b2124ee8c2e1856217922344a1fc7caaae8efdd8
16-
pristine_tree_hash: da1233bc3553a5e1def1838fec5b734a55d1aa48
14+
generation_id: 4eafa3c1-7515-49bf-b2a7-affc6f8f8545
15+
pristine_commit_hash: d8c081df637782a4bce857ef067ac3ba01a8ef44
16+
pristine_tree_hash: 76c93c468190733a0cf292b0226728ce00c0d648
1717
features:
1818
python:
1919
acceptHeaders: 3.0.0
@@ -10226,6 +10226,14 @@ trackedFiles:
1022610226
id: db4a10e02011
1022710227
last_write_checksum: sha1:3be9f4acdea977d0907288f33ed0f79fe3389443
1022810228
pristine_git_object: ed8aded072683a1daefb4174a1c85e367e845cdd
10229+
docs/operations/cancelbatchglobals.mdx:
10230+
id: 7d5dfc5f85f6
10231+
last_write_checksum: sha1:3f50636695cef4ee34c644ebb0c26b28465858ba
10232+
pristine_git_object: 60421ffbc03553b3620eb146f4749e070d3ab1db
10233+
docs/operations/cancelbatchrequest.mdx:
10234+
id: c4457b710399
10235+
last_write_checksum: sha1:c987d14e76dfea38f17410c473bdba1f16d53bef
10236+
pristine_git_object: e392b4a5e348353d9bf83971845d67ac12e5cc2d
1022910237
docs/operations/changeapikeypolicyassignmentglobals.mdx:
1023010238
id: beeb3f2813ca
1023110239
last_write_checksum: sha1:1a0ef422718684ceca1dc4f96c37214f833439f4
@@ -12236,8 +12244,8 @@ trackedFiles:
1223612244
pristine_git_object: e1c261779c6ccbc2b6cf70738af9bf5b5a9925aa
1223712245
docs/sdks/batch/README.mdx:
1223812246
id: e367aa4f4295
12239-
last_write_checksum: sha1:3b4b5a6cc9875a34e7aef2b5a458a35739ef6f41
12240-
pristine_git_object: 6d828a2f0c8e25e0a46fb4f0a99bea0f126fc9e4
12247+
last_write_checksum: sha1:03ddfbe3833af9b7ac3b683e1f57b16bab4aa667
12248+
pristine_git_object: e974a6eda93ac9e3f5eeb83a665e790f0ba06758
1224112249
docs/sdks/benchmarks/README.mdx:
1224212250
id: 5b483a6770ba
1224312251
last_write_checksum: sha1:10a8edbf3bc300bab53ce72c3a37c974971b74bd
@@ -12312,8 +12320,8 @@ trackedFiles:
1231212320
pristine_git_object: a330c3f121d866703e37cd7274051b1caa6023eb
1231312321
docs/sdks/models/README.mdx:
1231412322
id: 58f1ca464e0b
12315-
last_write_checksum: sha1:2e89247b7ad63c2bdcf9da989ac4f2e758eee729
12316-
pristine_git_object: 005bce4cf4181e5481bae659bc732b06ec6783c3
12323+
last_write_checksum: sha1:f9c8722391e2a7aa6a7234f57e3ee57bd862dccb
12324+
pristine_git_object: 97bc481cdd542560de7051d7e3b08d48cbf09329
1231712325
docs/sdks/oauth/README.mdx:
1231812326
id: 42b5079343d2
1231912327
last_write_checksum: sha1:ed962f2d4afda6e456d031d8783a4825aeb85b97
@@ -12388,8 +12396,8 @@ trackedFiles:
1238812396
pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544
1238912397
pyproject.toml:
1239012398
id: 5d07e7d72637
12391-
last_write_checksum: sha1:f2c7d0d17b7ffa44991a632dfac10508c764fd02
12392-
pristine_git_object: 1372fe6a79dd3e463a09a2e5507f5dfa92afa93a
12399+
last_write_checksum: sha1:b35a57f8ca54edaff98f66c3b036a90765f69c8a
12400+
pristine_git_object: 999ad9ef92bbf333e1eb507ea3489e2698146ffd
1239312401
scripts/prepare_readme.py:
1239412402
id: e0c5957a6035
1239512403
last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54
@@ -12416,8 +12424,8 @@ trackedFiles:
1241612424
pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137
1241712425
src/openrouter/_version.py:
1241812426
id: d8d15ad6c586
12419-
last_write_checksum: sha1:0d714c038e6c572201ae52e2972e78a332ad81b9
12420-
pristine_git_object: 200b7a2dc144afdf65fe9dde05f9625bc349efbf
12427+
last_write_checksum: sha1:30874dfbdb7f4acdabe13127f14c8fd933e9ff10
12428+
pristine_git_object: 515ee52e04cee710287b89b96e1ec460a5dadb4c
1242112429
src/openrouter/alpha.py:
1242212430
id: 306c4d93308d
1242312431
last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766
@@ -12436,8 +12444,8 @@ trackedFiles:
1243612444
pristine_git_object: 7a562e21c7e66c9db666ead83748b73adefe4278
1243712445
src/openrouter/batch.py:
1243812446
id: 148f61e34d5b
12439-
last_write_checksum: sha1:29652e72df1414686e65cd8f4df75eb871cb2881
12440-
pristine_git_object: f71c1f3f98d9b886fa5cf0c46b1dbc46db279735
12447+
last_write_checksum: sha1:66bf7726b079d007ce8d6eaff76ab3a95a2ea88c
12448+
pristine_git_object: 1110b2127b77436a1b3ee7acda5ff3f5040fdf56
1244112449
src/openrouter/benchmarks.py:
1244212450
id: 178d2ad8d706
1244312451
last_write_checksum: sha1:be86f24d07ba86e9585f7d2bc2c384dba5185727
@@ -16668,8 +16676,8 @@ trackedFiles:
1666816676
pristine_git_object: 5b741456655ff48919d17ffd552a6410f0587966
1666916677
src/openrouter/models_.py:
1667016678
id: 4e1ae1fe5b98
16671-
last_write_checksum: sha1:7e3e5275d99180adffb5a4b044a5d93af02fb796
16672-
pristine_git_object: e4a9e3e4f9aee7c6fbb8b9c3b35bea9873e34646
16679+
last_write_checksum: sha1:e672fdc72d2c4a4acaa56b104d2c5cf0c58f4812
16680+
pristine_git_object: 822afd885d0a7308a4f8f939396262ec60bd3927
1667316681
src/openrouter/oauth.py:
1667416682
id: 1948ce27255b
1667516683
last_write_checksum: sha1:938c8b5ac63c1410e1173a2873b9c2493d720a1d
@@ -16680,8 +16688,8 @@ trackedFiles:
1668016688
pristine_git_object: 039fd484b407d7ca13177a892db5939b312ee50d
1668116689
src/openrouter/operations/__init__.py:
1668216690
id: 9afcea1e7161
16683-
last_write_checksum: sha1:4bd14f64e187e92c36bbfbfb10c4d5ca8041199b
16684-
pristine_git_object: b5a6b1701ce79c3ee1aebb2511b779038eb048d1
16691+
last_write_checksum: sha1:b307a82a88fcc61b302e44093de78f264461a9dc
16692+
pristine_git_object: 96120c9d11e8bc2f5a75fdc89c241c4cb84c8ce6
1668516693
src/openrouter/operations/activateprivateendpoint.py:
1668616694
id: 3b39eec5d66f
1668716695
last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36
@@ -16710,6 +16718,10 @@ trackedFiles:
1671016718
id: 8127aafae1ef
1671116719
last_write_checksum: sha1:7e1a34d0a1629bd6ed183a85b71a6897202a02bf
1671216720
pristine_git_object: ff2fc0c099bd5ade18b89e6d39698293ae65e87c
16721+
src/openrouter/operations/cancelbatch.py:
16722+
id: 4e0c278a1b4e
16723+
last_write_checksum: sha1:73485b5a6176b0781056f29a14821ea87304ce0b
16724+
pristine_git_object: a5e7d4f18ced703a68576ccb4edf0b9a67b6237a
1671316725
src/openrouter/operations/changeapikeypolicyassignment.py:
1671416726
id: d51b3fed8944
1671516727
last_write_checksum: sha1:79b58a542c1e2fbbd07534aa5596e5d593e98ea3
@@ -17428,8 +17440,8 @@ trackedFiles:
1742817440
pristine_git_object: c06eab04cb453a67f98177d6f1f28aa1578e9c02
1742917441
src/openrouter/sdk.py:
1743017442
id: ee9846c4c9c5
17431-
last_write_checksum: sha1:e2ac234f50cf2fa57417f0be1c9222dc8cfcf947
17432-
pristine_git_object: a015bc43a8823e977e7c5f6bdcd46c7cbe2725b8
17443+
last_write_checksum: sha1:16fcee50f867efef65dce82d1d51ad88bdb3584e
17444+
pristine_git_object: f385609baf912074872f6742d5b992e75d6f8deb
1743317445
src/openrouter/sdkconfiguration.py:
1743417446
id: 55773bb98d7c
1743517447
last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001
@@ -22781,4 +22793,19 @@ examples:
2278122793
application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}}
2278222794
"500":
2278322795
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
22796+
cancelBatch:
22797+
speakeasy-default-cancel-batch:
22798+
parameters:
22799+
path:
22800+
id: "batch_abc123"
22801+
responses:
22802+
"200":
22803+
application/json: {"completion_window": "24h", "created_at": 532952, "endpoint": "<value>", "error": {"message": "<value>"}, "expires_at": 340450, "finalized_at": 285267, "id": "<id>", "model": "Taurus", "object": "batch", "provider": "<value>", "request_counts": {"completed": 228691, "failed": 283504, "total": 213468}, "results": [], "status": "expired", "usage": {"completion_tokens": 41402, "prompt_tokens": 122283, "total_tokens": 34931}}
22804+
"400":
22805+
application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}}
22806+
"500":
22807+
application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}}
2278422808
examplesVersion: 1.0.2
22809+
releaseNotes: |
22810+
## Python SDK Changes:
22811+
* `open_router.batch.cancel()`: **Added**

‎.speakeasy/gen.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ generation:
3737
documentation: mintlify
3838
preApplyUnionDiscriminators: true
3939
python:
40-
version: 1.3.229
40+
version: 1.3.230
4141
additionalDependencies:
4242
dev:
4343
pytest: '>=8.3'

‎.speakeasy/out.openapi.yaml‎

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44900,6 +44900,125 @@ paths:
4490044900
- $ref: "#/components/parameters/AppIdentifier"
4490144901
- $ref: "#/components/parameters/AppDisplayName"
4490244902
- $ref: "#/components/parameters/AppCategories"
44903+
/batches/{id}/cancel:
44904+
post:
44905+
description: 'Asks the provider to stop a batch that is still running. Cancellation is enabled per organization; other organizations get `403`. The response is the batch in its current status: it stays `in_progress` until the provider confirms, then becomes `cancelled`, or `completed`, `failed`, or `expired` when the provider job ended first. Poll until the batch has any final status. Repeating the call is safe while the batch is still `in_progress`; once it has a final status the call returns `409`. OpenRouter returns no result rows for a cancelled batch, and the provider still charges for the requests that finished before the cancellation. When the batch wrote its output to your own storage, retrieving the batch can still return that location, and the rows the provider wrote there stay yours to read. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).'
44906+
operationId: 'cancelBatch'
44907+
parameters:
44908+
- description: 'The batch job id returned from submit.'
44909+
in: 'path'
44910+
name: 'id'
44911+
required: true
44912+
schema:
44913+
description: 'The batch job id returned from submit.'
44914+
example: 'batch_abc123'
44915+
minLength: 1
44916+
type: 'string'
44917+
responses:
44918+
'200':
44919+
content:
44920+
application/json:
44921+
schema:
44922+
$ref: '#/components/schemas/BatchObject'
44923+
description: 'The provider accepted the cancellation, or the provider job had already ended while OpenRouter still stores the batch as running. Poll the batch for its final status.'
44924+
'400':
44925+
content:
44926+
application/json:
44927+
example:
44928+
error:
44929+
code: 400
44930+
message: 'No active workspace resolved for this request.'
44931+
schema:
44932+
$ref: '#/components/schemas/BatchErrorResponse'
44933+
description: 'The API key resolved no active workspace.'
44934+
'401':
44935+
content:
44936+
application/json:
44937+
example:
44938+
error:
44939+
code: 401
44940+
message: 'No auth credentials found.'
44941+
schema:
44942+
$ref: '#/components/schemas/BatchErrorResponse'
44943+
description: 'Missing or invalid API key.'
44944+
'403':
44945+
content:
44946+
application/json:
44947+
example:
44948+
error:
44949+
code: 403
44950+
message: 'Batch cancellation is not enabled for this organization.'
44951+
schema:
44952+
$ref: '#/components/schemas/BatchErrorResponse'
44953+
description: 'Batch cancellation is not enabled for the organization.'
44954+
'404':
44955+
content:
44956+
application/json:
44957+
example:
44958+
error:
44959+
code: 404
44960+
message: 'Batch not found.'
44961+
schema:
44962+
$ref: '#/components/schemas/BatchErrorResponse'
44963+
description: 'No batch exists for the given id.'
44964+
'409':
44965+
content:
44966+
application/json:
44967+
example:
44968+
error:
44969+
code: 409
44970+
message: 'This batch has already ended and cannot be cancelled.'
44971+
schema:
44972+
$ref: '#/components/schemas/BatchErrorResponse'
44973+
description: 'The batch has already ended, has not reached the provider yet, runs on a provider without a cancel call, or its required provider key is unavailable.'
44974+
'429':
44975+
content:
44976+
application/json:
44977+
example:
44978+
error:
44979+
code: 429
44980+
message: 'Rate limit exceeded.'
44981+
schema:
44982+
$ref: '#/components/schemas/BatchErrorResponse'
44983+
description: 'Batch API rate limit exceeded for the billable entity.'
44984+
'500':
44985+
content:
44986+
application/json:
44987+
example:
44988+
error:
44989+
code: 500
44990+
message: 'Internal server error.'
44991+
schema:
44992+
$ref: '#/components/schemas/BatchErrorResponse'
44993+
description: 'Unexpected error in the ingress or upstream batch-api.'
44994+
'502':
44995+
content:
44996+
application/json:
44997+
example:
44998+
error:
44999+
code: 502
45000+
message: 'Upstream batch-api is unavailable.'
45001+
schema:
45002+
$ref: '#/components/schemas/BatchErrorResponse'
45003+
description: 'The batch service is unavailable, or an upstream provider operation failed.'
45004+
'503':
45005+
content:
45006+
application/json:
45007+
example:
45008+
error:
45009+
code: 503
45010+
message: 'Service Unavailable'
45011+
schema:
45012+
$ref: '#/components/schemas/BatchErrorResponse'
45013+
description: 'OpenRouter could not check whether the caller may cancel the batch. No cancellation is sent to the provider. Retry the request.'
45014+
summary: 'Cancel a batch'
45015+
tags:
45016+
- 'Batch'
45017+
x-speakeasy-name-override: 'cancel'
45018+
parameters:
45019+
- $ref: "#/components/parameters/AppIdentifier"
45020+
- $ref: "#/components/parameters/AppDisplayName"
45021+
- $ref: "#/components/parameters/AppCategories"
4490345022
/batches/{id}/results:
4490445023
get:
4490545024
description: 'Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page''s `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).'
@@ -55883,6 +56002,7 @@ paths:
5588356002
- $ref: "#/components/parameters/AppCategories"
5588456003
/models:
5588556004
get:
56005+
description: 'Lists the models available to the caller with their pricing, context length, modalities, and supported parameters, plus presets when the caller is authenticated. An unfiltered call returns every text-output model (often several hundred KB of JSON or more; set `output_modalities` to list models with other outputs); use `limit` and `offset` to cap the result and filters such as `q`, `output_modalities`, `input_modalities`, or `supported_parameters` to narrow it (`sort` only reorders), or call `GET /api/v1/model/{author}/{slug}` to inspect a single catalog model. `category` is a usage shortlist, not a catalog filter: it returns only the top 20 models in that category by past-week token usage, never presets, and cannot be combined with `limit`, `offset`, or `supported_parameters`.'
5588656006
operationId: 'getModels'
5588756007
parameters:
5588856008
- description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned'
@@ -66727,7 +66847,7 @@ tags:
6672766847
name: 'Anthropic Messages'
6672866848
- description: 'BYOK endpoints'
6672966849
name: 'BYOK'
66730-
- description: 'Submit, list, poll, and delete asynchronous batches of inference requests. See https://openrouter.ai/docs/batch-quickstart.'
66850+
- description: 'Submit, list, poll, cancel, and delete asynchronous batches of inference requests. See https://openrouter.ai/docs/batch-quickstart.'
6673166851
name: 'Batch'
6673266852
- description: 'Benchmarks endpoints'
6673366853
name: 'Benchmarks'

‎.speakeasy/workflow.lock‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ speakeasyVersion: 1.803.2
22
sources:
33
OpenRouter API:
44
sourceNamespace: open-router-chat-completions-api
5-
sourceRevisionDigest: sha256:9e232dde7b839ff47f4658c5dc38abaeb319267cd015acc54c297adcfa8eb791
6-
sourceBlobDigest: sha256:e69e7c1ef60161df4f8f7f234ed0d6edbdc236458b1e7377f191437096cb2b37
5+
sourceRevisionDigest: sha256:949837946fc92eb23fc848c709a1e91e906d898d728abf053c93cbfada84a1a6
6+
sourceBlobDigest: sha256:0839be120b5e22b32c31ec9183489f32a657f14855ed5338122da32b361a957d
77
tags:
88
- latest
99
- 1.0.0
1010
targets:
1111
open-router:
1212
source: OpenRouter API
1313
sourceNamespace: open-router-chat-completions-api
14-
sourceRevisionDigest: sha256:9e232dde7b839ff47f4658c5dc38abaeb319267cd015acc54c297adcfa8eb791
15-
sourceBlobDigest: sha256:e69e7c1ef60161df4f8f7f234ed0d6edbdc236458b1e7377f191437096cb2b37
14+
sourceRevisionDigest: sha256:949837946fc92eb23fc848c709a1e91e906d898d728abf053c93cbfada84a1a6
15+
sourceBlobDigest: sha256:0839be120b5e22b32c31ec9183489f32a657f14855ed5338122da32b361a957d
1616
codeSamplesNamespace: open-router-python-code-samples
17-
codeSamplesRevisionDigest: sha256:7a85751b9e3754b126cd72b5741151420b92924b7469f656ce6c9d2e81b340f1
17+
codeSamplesRevisionDigest: sha256:384a5798eaa429af85ff3fe34e128ea89de14c339e634a79dbc87e68b71b41e5
1818
workflow:
1919
workflowVersion: 1.0.0
2020
speakeasyVersion: 1.803.2

‎RELEASES.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5059,4 +5059,14 @@ Based on:
50595059
### Generated
50605060
- [python v1.3.229] .
50615061
### Releases
5062-
- [PyPI v1.3.229] https://pypi.org/project/openrouter/1.3.229 - .
5062+
- [PyPI v1.3.229] https://pypi.org/project/openrouter/1.3.229 - .
5063+
5064+
## 2026-12-02 07:30:28
5065+
### Changes
5066+
Based on:
5067+
- OpenAPI Doc
5068+
- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy
5069+
### Generated
5070+
- [python v1.3.230] .
5071+
### Releases
5072+
- [PyPI v1.3.230] https://pypi.org/project/openrouter/1.3.230 - .

0 commit comments

Comments
 (0)