diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fffd18e0b..3077e7a5e 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: e01ffe7b661442f6d7676a411bf91c6c + docChecksum: 2f3c2d6332d03987fdded9c1782bd4b3 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.63 - configChecksum: 42bea9cd112b3e4ca83bfb77b9aacde9 + releaseVersion: 1.3.64 + configChecksum: 93623c4550edd6d6c410e7601a3a4ab5 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c2fb6894-3dc9-4017-b200-637267205747 - pristine_commit_hash: ca2d50b74882f241b59c922176444c479a50a959 - pristine_tree_hash: 74f35974ba3f61e26a12819f2de3474787c9fbd6 + generation_id: d11a47cc-2faa-444b-b752-69db10b8d9b4 + pristine_commit_hash: a5c05f68a37e017629b4ac48673f3d9e8ac1491e + pristine_tree_hash: 11a418f2ab39b15eafd49d69aa932fb1cc6feaa5 features: python: acceptHeaders: 3.0.0 @@ -1580,8 +1580,8 @@ trackedFiles: pristine_git_object: d25f8767c5f193ee085eca684f5af8c606392c17 docs/components/batchsubmitbody.mdx: id: 2102d576a5e0 - last_write_checksum: sha1:fa3a1334e13197b14bec1223e1e5a029435831c6 - pristine_git_object: 5f85713cfa1bc27f312cfa9a40edd7c628b743d3 + last_write_checksum: sha1:5cbfb92fe2511a231af84a80b84bf4a10b4e1fd4 + pristine_git_object: 9b985919b35b254116b74a8da83ff9ca508d6e75 docs/components/batchsubmitbodycompletionwindow.mdx: id: 71af0bee298c last_write_checksum: sha1:8fbf3915f9a5f59a214bd5144758f57d7f9d2485 @@ -10180,8 +10180,8 @@ trackedFiles: pristine_git_object: fb5a440518f114c99eb8a4bf306f33e07697e22c docs/sdks/batch/README.mdx: id: e367aa4f4295 - last_write_checksum: sha1:03ef59395c1bc1a4ffa14dd68ca2a77a72601080 - pristine_git_object: 9fb69f19b90c7db149f1f80f3bac20b4b155f904 + last_write_checksum: sha1:17ebabdebf4160a3f2f1769daab0d6e06a2977e6 + pristine_git_object: cf0f3a1fdfed48320443b7acc1df0bfa6630b169 docs/sdks/benchmarks/README.mdx: id: 5b483a6770ba last_write_checksum: sha1:885b70fcbd2be60f51a2f58e133fd6452eb21600 @@ -10324,8 +10324,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3f99e30f16eea08c09f4c8554c6b3135182f6590 - pristine_git_object: 25151a6717dbd9ed6289ec853a9c61c4ccdcd3cb + last_write_checksum: sha1:2d91c61a0c444376c90f8b6608c4dade6d98c621 + pristine_git_object: c9e6bbb93276862ce8253e03467ada10705db3ec scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10352,8 +10352,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:4691fc06ccdde0d099269056f70b2213abf918e5 - pristine_git_object: ffcc6273611510a24e696a2d9b77fc6f0bc94230 + last_write_checksum: sha1:e930798d37bc425ae1c9cfbc56cc80de636847a3 + pristine_git_object: bc97c1931639824175f2506696a962fdbced468a src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -10372,8 +10372,8 @@ trackedFiles: pristine_git_object: 7a562e21c7e66c9db666ead83748b73adefe4278 src/openrouter/batch.py: id: 148f61e34d5b - last_write_checksum: sha1:d88ee31a648fa3027e7d6610d5b789a42ad80aae - pristine_git_object: 51b8ec5e8b4ebd204b5991bf767da38fcfb3ce5b + last_write_checksum: sha1:76413ab7c07fb6fed4895cacb148862821d32f60 + pristine_git_object: 246c6fb9beb539d61925df849ae71dd506ecbfd4 src/openrouter/benchmarks.py: id: 178d2ad8d706 last_write_checksum: sha1:15b8a7ea05a7550032afb15981958aa73b756881 @@ -11072,8 +11072,8 @@ trackedFiles: pristine_git_object: b2bbac635f94d6fe9f4eba2eded41b1990a9d5da src/openrouter/components/batchsubmitbody.py: id: 26e5100bce4e - last_write_checksum: sha1:80dc631bcd20eacb2a96606b7b66e94026411017 - pristine_git_object: 072a6220d737bd1dd4405ee25316d930607211e7 + last_write_checksum: sha1:79d5faf2a9409736410fdaf809f93f157b0765a9 + pristine_git_object: a2658ae96d5f95d4fa7cf4b31c33e07002689780 src/openrouter/components/booleancapability.py: id: 6009fd660c03 last_write_checksum: sha1:2615f4f9eecdf753ece20adc9897553404c71cc1 @@ -18836,3 +18836,6 @@ examples: "500": application/json: {"error": {"code": 404, "message": "Intern not found"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Python SDK Changes: + * `open_router.batch.create_batches()`: `request.callback_url` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c29ee74af..867054e72 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.63 + version: 1.3.64 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2df94e031..64931b430 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -6503,6 +6503,10 @@ components: BatchSubmitBody: description: 'Batch submit request body.' properties: + callback_url: + description: 'HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body.' + format: 'uri' + type: 'string' completion_window: default: '24h' enum: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8d012484b..af5437b81 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:2407e42f6fee99c7e0a6ba39f2f6bd4a84b5b8f4a78a42d767f0826e9f84a10d - sourceBlobDigest: sha256:d0440089b4e39c4571eb1cccd41c494cff997c7f7994e899aaf16a121354b10a + sourceRevisionDigest: sha256:fa064d6165a0f7e1d77909689f328e6d5226b7728c1729a64888da89e301c5a3 + sourceBlobDigest: sha256:7c2b45cff7db069caa60641482cb12fd6c6324fcc52fd151ebfe6d0611d88991 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:2407e42f6fee99c7e0a6ba39f2f6bd4a84b5b8f4a78a42d767f0826e9f84a10d - sourceBlobDigest: sha256:d0440089b4e39c4571eb1cccd41c494cff997c7f7994e899aaf16a121354b10a + sourceRevisionDigest: sha256:fa064d6165a0f7e1d77909689f328e6d5226b7728c1729a64888da89e301c5a3 + sourceBlobDigest: sha256:7c2b45cff7db069caa60641482cb12fd6c6324fcc52fd151ebfe6d0611d88991 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f5aaf6363aa13833ea76a48e50b5324d0b3f81b5346e2e1093431f965f2f5692 + codeSamplesRevisionDigest: sha256:c69acbacacf0daa4ecb22221d69e72688b629675c8360a9c4ca2353a75b71710 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 729ef3f05..e8c22b370 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3399,4 +3399,14 @@ Based on: ### Generated - [python v1.3.63] . ### Releases -- [PyPI v1.3.63] https://pypi.org/project/openrouter/1.3.63 - . \ No newline at end of file +- [PyPI v1.3.63] https://pypi.org/project/openrouter/1.3.63 - . + +## 2026-10-17 21:42:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.64] . +### Releases +- [PyPI v1.3.64] https://pypi.org/project/openrouter/1.3.64 - . \ No newline at end of file diff --git a/docs/components/batchsubmitbody.mdx b/docs/components/batchsubmitbody.mdx index f6af1fb5b..2ae98d388 100644 --- a/docs/components/batchsubmitbody.mdx +++ b/docs/components/batchsubmitbody.mdx @@ -7,10 +7,11 @@ Batch submit request body. ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../components/batchsubmitbodycompletionwindow.mdx) | ➖ | N/A | | -| `endpoint` | [components.Endpoint](../components/endpoint.mdx) | ✅ | N/A | | -| `model` | *str* | ✅ | N/A | | -| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../components/batchproviderpreferences.mdx) | ➖ | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | -| `requests` | List[[components.Request](../components/request.mdx)] | ✅ | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `callback_url` | *Optional[str]* | ➖ | HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body. | | +| `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../components/batchsubmitbodycompletionwindow.mdx) | ➖ | N/A | | +| `endpoint` | [components.Endpoint](../components/endpoint.mdx) | ✅ | N/A | | +| `model` | *str* | ✅ | N/A | | +| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../components/batchproviderpreferences.mdx) | ➖ | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | +| `requests` | List[[components.Request](../components/request.mdx)] | ✅ | N/A | | \ No newline at end of file diff --git a/docs/sdks/batch/README.mdx b/docs/sdks/batch/README.mdx index c7f0cd1dc..6896a4c91 100644 --- a/docs/sdks/batch/README.mdx +++ b/docs/sdks/batch/README.mdx @@ -212,17 +212,18 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `endpoint` | [components.Endpoint](../../components/endpoint.mdx) | ✅ | N/A | | -| `model` | *str* | ✅ | N/A | | -| `requests` | List[[components.Request](../../components/request.mdx)] | ✅ | N/A | | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../../components/batchsubmitbodycompletionwindow.mdx) | ➖ | N/A | | -| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../../components/batchproviderpreferences.mdx) | ➖ | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `endpoint` | [components.Endpoint](../../components/endpoint.mdx) | ✅ | N/A | | +| `model` | *str* | ✅ | N/A | | +| `requests` | List[[components.Request](../../components/request.mdx)] | ✅ | N/A | | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `callback_url` | *Optional[str]* | ➖ | HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body. | | +| `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../../components/batchsubmitbodycompletionwindow.mdx) | ➖ | N/A | | +| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../../components/batchproviderpreferences.mdx) | ➖ | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 25151a671..c9e6bbb93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.63" +version = "1.3.64" 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 ffcc62736..bc97c1931 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.63" +__version__: str = "1.3.64" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.63 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.64 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/batch.py b/src/openrouter/batch.py index 51b8ec5e8..246c6fb9b 100644 --- a/src/openrouter/batch.py +++ b/src/openrouter/batch.py @@ -371,6 +371,7 @@ def create_batches( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + callback_url: Optional[str] = None, completion_window: Optional[components.BatchSubmitBodyCompletionWindow] = "24h", provider: OptionalNullable[ Union[ @@ -397,6 +398,7 @@ def create_batches( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param callback_url: HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body. :param completion_window: :param provider: Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. :param retries: Override the default retry configuration for this method @@ -419,6 +421,7 @@ def create_batches( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, batch_submit_body=components.BatchSubmitBody( + callback_url=callback_url, completion_window=completion_window, endpoint=endpoint, model=model, @@ -528,6 +531,7 @@ async def create_batches_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + callback_url: Optional[str] = None, completion_window: Optional[components.BatchSubmitBodyCompletionWindow] = "24h", provider: OptionalNullable[ Union[ @@ -554,6 +558,7 @@ async def create_batches_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param callback_url: HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body. :param completion_window: :param provider: Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. :param retries: Override the default retry configuration for this method @@ -576,6 +581,7 @@ async def create_batches_async( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, batch_submit_body=components.BatchSubmitBody( + callback_url=callback_url, completion_window=completion_window, endpoint=endpoint, model=model, diff --git a/src/openrouter/components/batchsubmitbody.py b/src/openrouter/components/batchsubmitbody.py index 072a6220d..a2658ae96 100644 --- a/src/openrouter/components/batchsubmitbody.py +++ b/src/openrouter/components/batchsubmitbody.py @@ -51,6 +51,8 @@ class BatchSubmitBodyTypedDict(TypedDict): endpoint: Endpoint model: str requests: List[RequestTypedDict] + callback_url: NotRequired[str] + r"""HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body.""" completion_window: NotRequired[BatchSubmitBodyCompletionWindow] provider: NotRequired[Nullable[BatchProviderPreferencesTypedDict]] r"""Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.""" @@ -65,6 +67,9 @@ class BatchSubmitBody(BaseModel): requests: List[Request] + callback_url: Optional[str] = None + r"""HTTPS URL that receives a `batch.completed`, `batch.failed`, `batch.cancelled` or `batch.expired` webhook event when the batch reaches a terminal status. Must appear before `requests` in the request body.""" + completion_window: Optional[BatchSubmitBodyCompletionWindow] = "24h" provider: OptionalNullable[BatchProviderPreferences] = UNSET @@ -72,7 +77,7 @@ class BatchSubmitBody(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["completion_window", "provider"]) + optional_fields = set(["callback_url", "completion_window", "provider"]) nullable_fields = set(["provider"]) serialized = handler(self) m = {} diff --git a/uv.lock b/uv.lock index 43cb11e29..348e82d91 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.63" +version = "1.3.64" source = { editable = "." } dependencies = [ { name = "httpcore" },