diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ed599a3c..38cf1c35 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: 1399a961b6d0a2f35e428d48864064db + docChecksum: e579a3223c8c1359c9769fb563fd61c3 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.90 - configChecksum: c28142f462e8cc19ac66f39fc501f7f9 + releaseVersion: 1.1.91 + configChecksum: f97c74418c6b0f25b75cef735e391532 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 67c4ddad-6c0c-4461-a2ac-66fdcbe1d53d - pristine_commit_hash: 96cb29d1679688f60c40ec3f5d598677500e69d9 - pristine_tree_hash: 61171c160980f9d8cdf063075fa9e59bad5eb612 + generation_id: 67ff633e-56a1-487c-9420-ea3dd7375e13 + pristine_commit_hash: 68e70d8b342f15b30646a7e9ca417febb262a9aa + pristine_tree_hash: b77709400a7b144f5938fb98d30357edcc29645a features: python: acceptHeaders: 3.0.0 @@ -2362,8 +2362,8 @@ trackedFiles: pristine_git_object: bccd158982dba4b4ed810b98b5f7d4a6c04afaa7 docs/components/imagegenerationrequest.mdx: id: b093cb0f5e81 - last_write_checksum: sha1:3bc4fcfbd60811c1b4f67b2b4a8dfd66631bbdbf - pristine_git_object: 96a06ccb53d71cbd38ba7b8aa2f4cf77773baffc + last_write_checksum: sha1:e66f2ed453490ba50a171826016338ba869875ce + pristine_git_object: 68f653b5fdd4a2a93d4c399658e10ae30c09bd71 docs/components/imagegenerationrequestaspectratio.mdx: id: bda89377f32d last_write_checksum: sha1:9cc231ee222c01ce471ecff3804a9e5acb8a054f @@ -7326,8 +7326,8 @@ trackedFiles: pristine_git_object: 448b81faf70c44ac312c1183731ac31aadec6cb6 docs/sdks/images/README.mdx: id: 534a6c102c4f - last_write_checksum: sha1:bb22509015ad414847d101ba719689163a7cd42a - pristine_git_object: f2b9be80c1eeca1c982f9a982803d011491f5a6a + last_write_checksum: sha1:bc62f91590ac816c58ad954f4a888a46aee71bb9 + pristine_git_object: 6ee346c73844495c95009346a1242ed6f37d58b5 docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:34535ca4139b5892da3c9beaa5636cd9d362399b @@ -7386,8 +7386,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:78dd517a5da7ba579c7184883d6bd0b150ff2eaa - pristine_git_object: 0eb05d43a029c6289e4849b125b04f2c4c3767ae + last_write_checksum: sha1:02b518a5f9d31eee3c265939cfa6ff21bf5601b4 + pristine_git_object: 22a50bd359c07f5585397a8ccf921437481d0581 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7414,8 +7414,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:5a8813e8e1a4434589fa8e4e877fa3640aaf2a9a - pristine_git_object: a78909fc4ea77e5b6e84a2b5ff14308679ec38eb + last_write_checksum: sha1:92c89eb588563dfd3419095f7c578d5bb4a9d1e6 + pristine_git_object: 815f9ec5862ec99e6f9232f7821b3ccecf1c0977 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -8514,8 +8514,8 @@ trackedFiles: pristine_git_object: 0af5d2b63da236adfbb20fa80530a296f5127df8 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:f7225ba0f6ca57f86fb4c07e6ceeaf9a44a0f7df - pristine_git_object: 5c79bb3b4818e09784e44a8ea811492900763877 + last_write_checksum: sha1:06040315f7f05be92a5ef2db7908b31d07bb2921 + pristine_git_object: d681ed7ba2e46f7ef1351a9d2ae5571f23e09790 src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 @@ -10046,8 +10046,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/openrouter/images.py: id: c4d7adf63ae0 - last_write_checksum: sha1:c794ec7ad6e3dcc1c57239b3b869aa628eb8a424 - pristine_git_object: 29a8a6a34d931ba33dcbae8f1c3575f6f860be87 + last_write_checksum: sha1:a49be8ca6e374b9808cfebfb348741a8b1c461e0 + pristine_git_object: b7abaae4a3b605f2fe374fc9189841f3268cf4ab src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -12457,3 +12457,6 @@ examples: "503": application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Python SDK Changes: + * `open_router.images.generate()`: `request.user` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 7ece8400..5b309b55 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.90 + version: 1.1.91 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index ce5377f5..631dc12b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -10653,6 +10653,10 @@ components: stream: description: 'If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.' type: 'boolean' + user: + description: 'A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.' + example: 'end-user-abc123' + type: 'string' required: - 'model' - 'prompt' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 66540112..191265d2 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:3dc5488760063ddc32216104271a3c12a2fa46a613269b4c65d5378730b0df45 - sourceBlobDigest: sha256:a44fa84bc753df180bf93c118992517157f58d85f05060594ec5db8a8df722e9 + sourceRevisionDigest: sha256:0fca4fc755e3b2a2c6dd519faeb4112c9d3fa11e550bfb1bdb17bff7a0f6916b + sourceBlobDigest: sha256:e6a89329a7ffc8e70b19f15074c725d833ebc2d48b4f175292f3848d27fe4030 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3dc5488760063ddc32216104271a3c12a2fa46a613269b4c65d5378730b0df45 - sourceBlobDigest: sha256:a44fa84bc753df180bf93c118992517157f58d85f05060594ec5db8a8df722e9 + sourceRevisionDigest: sha256:0fca4fc755e3b2a2c6dd519faeb4112c9d3fa11e550bfb1bdb17bff7a0f6916b + sourceBlobDigest: sha256:e6a89329a7ffc8e70b19f15074c725d833ebc2d48b4f175292f3848d27fe4030 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:78d1e498502fa4ba5f24037192aec3074e192aad4d4703552edc049e9190b2e0 + codeSamplesRevisionDigest: sha256:1c0fdec8655eadaad225ddec51c96f6218855f0e7c11c9463e181b1d50e7c6f3 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 372fcd11..2c1c2405 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1689,4 +1689,14 @@ Based on: ### Generated - [python v1.1.90] . ### Releases -- [PyPI v1.1.90] https://pypi.org/project/openrouter/1.1.90 - . \ No newline at end of file +- [PyPI v1.1.90] https://pypi.org/project/openrouter/1.1.90 - . + +## 2026-08-26 08:21:04 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.91] . +### Releases +- [PyPI v1.1.91] https://pypi.org/project/openrouter/1.1.91 - . \ No newline at end of file diff --git a/docs/components/imagegenerationrequest.mdx b/docs/components/imagegenerationrequest.mdx index 96a06ccb..68f653b5 100644 --- a/docs/components/imagegenerationrequest.mdx +++ b/docs/components/imagegenerationrequest.mdx @@ -22,4 +22,5 @@ Image generation request input | `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | \ No newline at end of file +| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | +| `user` | *Optional[str]* | :heavy_minus_sign: | A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. | end-user-abc123 | \ No newline at end of file diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx index f2b9be80..6ee346c7 100644 --- a/docs/sdks/images/README.mdx +++ b/docs/sdks/images/README.mdx @@ -61,6 +61,7 @@ with OpenRouter( | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | | `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | +| `user` | *Optional[str]* | :heavy_minus_sign: | A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. | end-user-abc123 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 0eb05d43..22a50bd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.90" +version = "1.1.91" 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 a78909fc..815f9ec5 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.90" +__version__: str = "1.1.91" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.90 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.91 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index 5c79bb3b..d681ed7b 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -120,6 +120,8 @@ class ImageGenerationRequestTypedDict(TypedDict): r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400.""" stream: NotRequired[bool] r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" + user: NotRequired[str] + r"""A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.""" class ImageGenerationRequest(BaseModel): @@ -167,6 +169,9 @@ class ImageGenerationRequest(BaseModel): stream: Optional[bool] = None r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" + user: Optional[str] = None + r"""A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -183,6 +188,7 @@ def serialize_model(self, handler): "seed", "size", "stream", + "user", ] ) serialized = handler(self) diff --git a/src/openrouter/images.py b/src/openrouter/images.py index 29a8a6a3..b7abaae4 100644 --- a/src/openrouter/images.py +++ b/src/openrouter/images.py @@ -43,6 +43,7 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Union[Literal[False], None] = None, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -73,6 +74,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -110,6 +112,7 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Literal[True], + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -140,6 +143,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -177,6 +181,7 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: bool, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -210,6 +215,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -246,6 +252,7 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Optional[bool] = None, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -279,6 +286,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -317,6 +325,7 @@ def generate( seed=seed, size=size, stream=stream, + user=user, ), ) @@ -523,6 +532,7 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Union[Literal[False], None] = None, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -553,6 +563,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -590,6 +601,7 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Literal[True], + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -620,6 +632,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -657,6 +670,7 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: bool, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -690,6 +704,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -726,6 +741,7 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Optional[bool] = None, + user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -759,6 +775,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :param user: A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -797,6 +814,7 @@ async def generate_async( seed=seed, size=size, stream=stream, + user=user, ), ) diff --git a/uv.lock b/uv.lock index 2a6f2b71..40e5e7a7 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.90" +version = "1.1.91" source = { editable = "." } dependencies = [ { name = "httpcore" },