diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index 7bcf87ca..1fdb3f17 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: 992dd7bf5d636d875da8e17e4faaed29
+ docChecksum: a444511ee53d41b62d62b2d23ddd3b64
docVersion: 1.0.0
speakeasyVersion: 1.787.0
generationVersion: 2.914.0
- releaseVersion: 0.11.24
- configChecksum: b26850041dd0457b248bd1e3bb936fa6
+ releaseVersion: 0.11.25
+ configChecksum: b10f43281932fd64b0c43f8577a40816
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true
persistentEdits:
- generation_id: d85ca6f5-dca8-4c80-9b34-a859642d0dd5
- pristine_commit_hash: d8a45b3c5aa026db485cc892cce4ce59f9b2d9e3
- pristine_tree_hash: cb0f77756ac02a67faf406ee499b1f9ea70061f0
+ generation_id: 554b7889-8ccd-4aef-a14b-c347df957007
+ pristine_commit_hash: 95be3ea8a18d40e9df231449f23161356fdfd5ff
+ pristine_tree_hash: e9b22615b85a97ffd1078604414fc174d55b227f
features:
python:
acceptHeaders: 3.0.0
@@ -2084,10 +2084,6 @@ trackedFiles:
id: ccedea0ab250
last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4
pristine_git_object: 9e0a058e6a19b68f470eb0938670dff51b47f4b5
- docs/components/ignore.mdx:
- id: 2714aa9d51d7
- last_write_checksum: sha1:fd8114687442350261ba507cd41d1f0ebb067928
- pristine_git_object: 8ba131528ef679ebd2880be85b7732ad5a078174
docs/components/imageconfig.mdx:
id: 455a9f530ea8
last_write_checksum: sha1:3ec5e8ac11e823479e41115da31aae29d2a1cbd3
@@ -2136,10 +2132,34 @@ trackedFiles:
id: dd9998bc9093
last_write_checksum: sha1:a7d7c52d0a7c5128a40fd9f1524e8b6f372a9061
pristine_git_object: df5a9a53d2ea20bb548913c902b0bffdf2dc5d15
+ docs/components/imagegenerationproviderpreferences.mdx:
+ id: 96067cea4257
+ last_write_checksum: sha1:63f1caa2d78a1e1d32c1222e8275155417e7e87f
+ pristine_git_object: b98f786f64edd693499cd395774d60fca698aa85
+ docs/components/imagegenerationproviderpreferencesignore.mdx:
+ id: 0c7b1553ce53
+ last_write_checksum: sha1:6d55c341ed1a68b8656b8b4564794941881b3487
+ pristine_git_object: 5f20d5e467c508d7814a43897a4ae35e907b0740
+ docs/components/imagegenerationproviderpreferencesonly.mdx:
+ id: c8343461ec27
+ last_write_checksum: sha1:8e2ed740ce1cf64959b7732c12bf664f5cc4a8f3
+ pristine_git_object: 11f1471c8b6c04f52af89d74d6dec2e9d12c2d82
+ docs/components/imagegenerationproviderpreferencesoptions.mdx:
+ id: 32d5c4b3e06b
+ last_write_checksum: sha1:2e7bf9676997ff8ee9a42928a7f236a7870023bb
+ pristine_git_object: 15d1f0fccbd55826da587a1224021132c9731d6e
+ docs/components/imagegenerationproviderpreferencesorder.mdx:
+ id: 0547877073f3
+ last_write_checksum: sha1:3e890c691097373cc9a2d7e47c3594f56b57809c
+ pristine_git_object: 3125f8b2ec3ee98a992c7397978917d47e1043cd
+ docs/components/imagegenerationproviderpreferencessort.mdx:
+ id: ce43ddb42deb
+ last_write_checksum: sha1:acd4609eea738b06a6252ee2ea0a4621eeaad2bd
+ pristine_git_object: 7696bf5f4a2c4a1f05e148513b70fe96b2f948a8
docs/components/imagegenerationrequest.mdx:
id: b093cb0f5e81
- last_write_checksum: sha1:4a0e2091a23f660c3e706c0e695504fb090e94d1
- pristine_git_object: f9b74f407b1fbc065f271341d42c94142b2e2503
+ last_write_checksum: sha1:1bccab895149605ba994e84b202c1f7b50c6ccb2
+ pristine_git_object: 36805ca3350396bfded85776a3fe88e268ca0a35
docs/components/imagegenerationrequestaspectratio.mdx:
id: bda89377f32d
last_write_checksum: sha1:9cc231ee222c01ce471ecff3804a9e5acb8a054f
@@ -2148,18 +2168,10 @@ trackedFiles:
id: cab3c6c6dfc6
last_write_checksum: sha1:ea6f2fa5f8f63600e2d1a67a784e6a93cf295975
pristine_git_object: 8501680bcfebabb3af52b518c01f732d18282120
- docs/components/imagegenerationrequestoptions.mdx:
- id: 2245ece0aaf8
- last_write_checksum: sha1:feec51e178c169d3550ef010a94c69c16e137afc
- pristine_git_object: 39c52366e3516de4554c93613d8bbbc8b64a8a5a
docs/components/imagegenerationrequestoutputformat.mdx:
id: 380f12bf77bd
last_write_checksum: sha1:afb479dc34118828e988888a8f49e7a5a50a45ab
pristine_git_object: 4901416246fb4e34fc9227d3dc0bbbc08aa717e2
- docs/components/imagegenerationrequestprovider.mdx:
- id: 8b592ddbab98
- last_write_checksum: sha1:c67183fc76f6e46530829fc5b85b8c164a4c2557
- pristine_git_object: 51188d0f86b2208ae9dc3d797ce3595961162602
docs/components/imagegenerationrequestquality.mdx:
id: 7699c7fce91f
last_write_checksum: sha1:e0c8abee1332b182aeb1228b9c7a7f4cec83e99b
@@ -3112,10 +3124,6 @@ trackedFiles:
id: 35262d81b0a1
last_write_checksum: sha1:53220ed66cf059d9f06df81b7f5bb0f2d87f5283
pristine_git_object: bf3c27b8d2da352bd80bb18179159839e69b9b0a
- docs/components/only.mdx:
- id: cee5f91a1c3b
- last_write_checksum: sha1:abccbc4844ea73ff3641b1aa2a98bdfaebf8d216
- pristine_git_object: cc284e22005d61c156fac73624aee6ead3c1e9eb
docs/components/openairesponsecustomtoolcall.mdx:
id: 090c07768006
last_write_checksum: sha1:34b7e423654fb097e3420b2fa3ef010f15821796
@@ -3320,10 +3328,6 @@ trackedFiles:
id: f88a0ae3ee7d
last_write_checksum: sha1:196dfc00e44fa232c6e4f0f496f265a163ffe66b
pristine_git_object: b4df5fb4757522576e8452d88f22499cee204278
- docs/components/order.mdx:
- id: ae1a6aab00d6
- last_write_checksum: sha1:efc73cd83c8f4e0095ba6901df6dc95349b822a2
- pristine_git_object: edc1ffcd263a4fffa0d4d5b7da1e2c0315a61cb8
docs/components/outcome.mdx:
id: dc555505ef36
last_write_checksum: sha1:5e99185f9d49f3f404ca4e54ef84d0cdbf31546c
@@ -3918,8 +3922,24 @@ trackedFiles:
pristine_git_object: 05bcfceecf3e74def73684391a76fa68829271a3
docs/components/providerpreferences.mdx:
id: adbdfaa46438
- last_write_checksum: sha1:d0f7b534fbaed359e2f2abd736bd669367371462
- pristine_git_object: 750d3a21ada3133dba71217f0444c2064b2ff081
+ last_write_checksum: sha1:26ef79be79d733e12a89acc7687ccbd87ebc2f2e
+ pristine_git_object: a312c6f654c101959c3f182c268556c01e578a40
+ docs/components/providerpreferencesignore.mdx:
+ id: e0455b31c87b
+ last_write_checksum: sha1:823f56c785a5c80949105fc0f4297a5b0ff2c2b2
+ pristine_git_object: 77ecc57935ce0edf477099eac9550490515be515
+ docs/components/providerpreferencesonly.mdx:
+ id: a72941ff2735
+ last_write_checksum: sha1:614acb6d266ffd00b1f4f0b7fb4ab6cee551bc96
+ pristine_git_object: a6e0692f2fe4e5f87d3816797118dd19f0ebd480
+ docs/components/providerpreferencesorder.mdx:
+ id: a1fce55fe271
+ last_write_checksum: sha1:ccbc5120235aa6a8c3aefe791a49bf1539bde74f
+ pristine_git_object: b9fce30d460f0ed187b5c81225d41c8f4217d1e8
+ docs/components/providerpreferencessort.mdx:
+ id: 64d54fd9ff0b
+ last_write_checksum: sha1:4eb43e63950c0481fae29816afe807226bdda4ea
+ pristine_git_object: 72d68077694236233f2bde5d65959b550210a20d
docs/components/providerresponse.mdx:
id: 36e1a24f90b6
last_write_checksum: sha1:512adc6bd7e7854ce01d5e5c46ce76b26a1b1174
@@ -4364,10 +4384,6 @@ trackedFiles:
id: b35cae5eacec
last_write_checksum: sha1:6865169ff4445d70d63c674092812b47236f213f
pristine_git_object: 1c0dd3c44cfce8b531e7d89e3db6b2787f060984
- docs/components/sort.mdx:
- id: 2423f4a05690
- last_write_checksum: sha1:3443886b2481e8685a1c390530dfd7b763d9f237
- pristine_git_object: b12340f49cd6973329dc305d88b7190bcb5c163b
docs/components/sourcecontent.mdx:
id: d211413b56ad
last_write_checksum: sha1:e9ec235c28760da429e35fea006321e7a697e5c4
@@ -6586,8 +6602,8 @@ trackedFiles:
pristine_git_object: 52efbd96250f06588fea44689bed93f27f2e0230
docs/sdks/images/README.mdx:
id: 534a6c102c4f
- last_write_checksum: sha1:eb919a70e20e9bde335ff1e8ae52ba0a309ca5c3
- pristine_git_object: 8277c7710decc3ee152c7fe725c90bac9784800a
+ last_write_checksum: sha1:1c0a9c704bdd9090f5a0a74f4d9ae0c4360707bb
+ pristine_git_object: 4b3508543942b711f2d74df5436748e1815619e2
docs/sdks/models/README.mdx:
id: 58f1ca464e0b
last_write_checksum: sha1:90e4f262bc449464226d1d83c731709e3352bbb1
@@ -6642,8 +6658,8 @@ trackedFiles:
pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544
pyproject.toml:
id: 5d07e7d72637
- last_write_checksum: sha1:451a4be23fc081294b962e2bc0c6f0dbae2c43ab
- pristine_git_object: 88b38af4fdfc0341a41fae784c7c78c1137e00a3
+ last_write_checksum: sha1:ecba4ec7fe5c538617fb6e42582204ae5711d106
+ pristine_git_object: 6804383f389474f6b72740ce0a281ba45ed8251d
scripts/prepare_readme.py:
id: e0c5957a6035
last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54
@@ -6670,8 +6686,8 @@ trackedFiles:
pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137
src/openrouter/_version.py:
id: d8d15ad6c586
- last_write_checksum: sha1:5a4d07dc0be8788ed4abef1a2b48b18cdaa1afb1
- pristine_git_object: e328286d4babd45c447a377612162c30d1220393
+ last_write_checksum: sha1:a776602f2cf82d2f44e51bbbd69dfeee7a7f46f3
+ pristine_git_object: d272f6c0b2f426b678e025f6181287b08ea995ed
src/openrouter/analytics.py:
id: cb406b5aaabb
last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841
@@ -6710,8 +6726,8 @@ trackedFiles:
pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1
src/openrouter/components/__init__.py:
id: 81754e97b3f4
- last_write_checksum: sha1:1d909d376196542b7bd1a320346e7bbda7cb5f48
- pristine_git_object: 1f755537449f9869a6c5e548ae39bdb03b8f777f
+ last_write_checksum: sha1:045cf74eb4e03399ac8521ff3db0a2ed9f33b002
+ pristine_git_object: 43900430f099cab065756d44e23f9c4118c99180
src/openrouter/components/aabenchmarkentry.py:
id: e2e0f0b48c82
last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c
@@ -7660,10 +7676,14 @@ trackedFiles:
id: 7a791a02cb5b
last_write_checksum: sha1:497f9be381527fd1ee961450a2364a898dba875b
pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41
+ src/openrouter/components/imagegenerationproviderpreferences.py:
+ id: 100a82a54e2d
+ last_write_checksum: sha1:63973ed1d6c151ffdb2977626461d911ca8869b4
+ pristine_git_object: 692420fd5cf21e77ff5caad6dc34995710cb734c
src/openrouter/components/imagegenerationrequest.py:
id: f8291a7be9a0
- last_write_checksum: sha1:348c6aa7d1b7a02694e44396e51ab56e20853bb9
- pristine_git_object: 9866560ee4d4d61c0bec89e276bb0a39f6d215ad
+ last_write_checksum: sha1:48a9640c0b9f48833d5514c7671bfa4b76aac776
+ pristine_git_object: 9f5f9caf2d762e3db6affdd2aa20612978821dee
src/openrouter/components/imagegenerationresponse.py:
id: 53354cd0cbfc
last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2
@@ -8350,8 +8370,8 @@ trackedFiles:
pristine_git_object: c85a381a5f596fcbc2e3e599a65e8d03d62fabcd
src/openrouter/components/providerpreferences.py:
id: cdd58c8d664d
- last_write_checksum: sha1:381d12826558a405f980ca338413e472296c12a2
- pristine_git_object: abbb3cb3d7d8946aabdbd5e6b07b2e45954f6948
+ last_write_checksum: sha1:93405c39357e66bfe8cb60010622a884122b9197
+ pristine_git_object: 2d44eabbe3200d884a5e01589732570d3a3ab7e1
src/openrouter/components/providerresponse.py:
id: ad3887be54c5
last_write_checksum: sha1:b8868ce7950808be5b37e964607abab8348e2ab6
@@ -9046,8 +9066,8 @@ trackedFiles:
pristine_git_object: 89560b566073785535643e694c112bedbd3db13d
src/openrouter/images.py:
id: c4d7adf63ae0
- last_write_checksum: sha1:2237619daf56a48c3ee0c8980178d36443ca1b13
- pristine_git_object: b7a120ad3562280aab790be56cbf482286fe40b4
+ last_write_checksum: sha1:277721bb6c89aabdc3fd5b8bbb73b9dc6e98d2f9
+ pristine_git_object: 8a3080f7b51f197bb357e5e264b173d230b1f293
src/openrouter/models/__init__.py:
id: ed73b93abb3f
last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea
@@ -11109,4 +11129,6 @@ examples:
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
examplesVersion: 1.0.2
-releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_messages()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n* `open_router.models.list()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.observability.list()`: `request` **Changed**\n* `open_router.guardrails.list_guardrail_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_key_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list()`: `request` **Changed**\n* `open_router.models.list_for_user()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.guardrails.list_guardrail_key_assignments()`: `request` **Changed**\n* `open_router.organization.list_members()`: `request` **Changed**\n* `open_router.presets.list()`: `request` **Changed**\n* `open_router.embeddings.list_models()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.byok.list()`: `request` **Changed**\n* `open_router.presets.list_versions()`: `request` **Changed**\n* `open_router.workspaces.list()`: `request` **Changed**\n* `open_router.workspaces.list_members()`: `request` **Changed**\n"
+releaseNotes: |
+ ## Python SDK Changes:
+ * `open_router.images.generate()`: `request.provider` **Changed**
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 0640159e..46c17839 100644
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -36,7 +36,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
python:
- version: 0.11.24
+ version: 0.11.25
additionalDependencies:
dev: {}
main: {}
diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml
index 2fd440fd..e3401486 100644
--- a/.speakeasy/out.openapi.yaml
+++ b/.speakeasy/out.openapi.yaml
@@ -9590,6 +9590,75 @@ components:
- b64_json
- created
type: object
+ ImageGenerationProviderPreferences:
+ description: Provider routing preferences and provider-specific passthrough configuration.
+ example:
+ allow_fallbacks: false
+ only:
+ - google-ai-studio
+ properties:
+ allow_fallbacks:
+ description: >
+ Whether to allow backup providers to serve requests
+
+ - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
+
+ - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
+
+ nullable: true
+ type: boolean
+ ignore:
+ description: >-
+ List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
+ example:
+ - openai
+ - anthropic
+ items:
+ anyOf:
+ - $ref: '#/components/schemas/ProviderName'
+ - type: string
+ nullable: true
+ type: array
+ only:
+ description: >-
+ List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
+ example:
+ - openai
+ - anthropic
+ items:
+ anyOf:
+ - $ref: '#/components/schemas/ProviderName'
+ - type: string
+ nullable: true
+ type: array
+ options:
+ allOf:
+ - $ref: '#/components/schemas/ProviderOptions'
+ - example:
+ black-forest-labs:
+ guidance: 3
+ steps: 40
+ order:
+ description: >-
+ An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
+ example:
+ - openai
+ - anthropic
+ items:
+ anyOf:
+ - $ref: '#/components/schemas/ProviderName'
+ - type: string
+ nullable: true
+ type: array
+ sort:
+ anyOf:
+ - $ref: '#/components/schemas/ProviderSort'
+ - $ref: '#/components/schemas/ProviderSortConfig'
+ - nullable: true
+ description: >-
+ The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
+ example: price
+ type: object
ImageGenerationRequest:
description: Image generation request input
example:
@@ -9668,16 +9737,7 @@ components:
minLength: 1
type: string
provider:
- description: Provider-specific passthrough configuration
- properties:
- options:
- allOf:
- - $ref: '#/components/schemas/ProviderOptions'
- - example:
- black-forest-labs:
- guidance: 3
- steps: 40
- type: object
+ $ref: '#/components/schemas/ImageGenerationProviderPreferences'
quality:
description: Rendering quality. Providers without a quality knob ignore this.
enum:
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index ddd35cc9..650819fb 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:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4
- sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845
+ sourceRevisionDigest: sha256:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d
+ sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b
tags:
- latest
- 1.0.0
@@ -11,10 +11,10 @@ targets:
open-router:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
- sourceRevisionDigest: sha256:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4
- sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845
+ sourceRevisionDigest: sha256:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d
+ sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b
codeSamplesNamespace: open-router-python-code-samples
- codeSamplesRevisionDigest: sha256:252d3909d3f6fce4c2605924214b126af1fe4c3162dd52ba9cf9ad32ddd7dbda
+ codeSamplesRevisionDigest: sha256:b959c03fc95af18ab71b3e8edc54d3a74d06d0a3f0d786576f3ab1a1c049cdd0
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.787.0
diff --git a/RELEASES.md b/RELEASES.md
index f8b0a1d5..ab81e86c 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -348,4 +348,14 @@ Based on:
### Generated
- [python v0.11.24] .
### Releases
-- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - .
\ No newline at end of file
+- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - .
+
+## 2026-07-13 19:18:28
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v0.11.25] .
+### Releases
+- [PyPI v0.11.25] https://pypi.org/project/openrouter/0.11.25 - .
\ No newline at end of file
diff --git a/docs/components/imagegenerationproviderpreferences.mdx b/docs/components/imagegenerationproviderpreferences.mdx
new file mode 100644
index 00000000..b98f786f
--- /dev/null
+++ b/docs/components/imagegenerationproviderpreferences.mdx
@@ -0,0 +1,17 @@
+---
+title: "ImageGenerationProviderPreferences"
+---
+
+Provider routing preferences and provider-specific passthrough configuration.
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| |
+| `ignore` | List[[components.ImageGenerationProviderPreferencesIgnore](../components/imagegenerationproviderpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] |
+| `only` | List[[components.ImageGenerationProviderPreferencesOnly](../components/imagegenerationproviderpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] |
+| `options` | [Optional[components.ImageGenerationProviderPreferencesOptions]](../components/imagegenerationproviderpreferencesoptions.mdx) | :heavy_minus_sign: | N/A | \{
"black-forest-labs": \{
"guidance": 3,
"steps": 40
}
} |
+| `order` | List[[components.ImageGenerationProviderPreferencesOrder](../components/imagegenerationproviderpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] |
+| `sort` | [OptionalNullable[components.ImageGenerationProviderPreferencesSort]](../components/imagegenerationproviderpreferencessort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
\ No newline at end of file
diff --git a/docs/components/imagegenerationproviderpreferencesignore.mdx b/docs/components/imagegenerationproviderpreferencesignore.mdx
new file mode 100644
index 00000000..5f20d5e4
--- /dev/null
+++ b/docs/components/imagegenerationproviderpreferencesignore.mdx
@@ -0,0 +1,18 @@
+---
+title: "ImageGenerationProviderPreferencesIgnore"
+---
+
+## Supported Types
+
+### `components.ProviderName`
+
+```python
+value: components.ProviderName = /* values here */
+```
+
+### `str`
+
+```python
+value: str = /* values here */
+```
+
diff --git a/docs/components/imagegenerationproviderpreferencesonly.mdx b/docs/components/imagegenerationproviderpreferencesonly.mdx
new file mode 100644
index 00000000..11f1471c
--- /dev/null
+++ b/docs/components/imagegenerationproviderpreferencesonly.mdx
@@ -0,0 +1,18 @@
+---
+title: "ImageGenerationProviderPreferencesOnly"
+---
+
+## Supported Types
+
+### `components.ProviderName`
+
+```python
+value: components.ProviderName = /* values here */
+```
+
+### `str`
+
+```python
+value: str = /* values here */
+```
+
diff --git a/docs/components/imagegenerationrequestoptions.mdx b/docs/components/imagegenerationproviderpreferencesoptions.mdx
similarity index 99%
rename from docs/components/imagegenerationrequestoptions.mdx
rename to docs/components/imagegenerationproviderpreferencesoptions.mdx
index 39c52366..15d1f0fc 100644
--- a/docs/components/imagegenerationrequestoptions.mdx
+++ b/docs/components/imagegenerationproviderpreferencesoptions.mdx
@@ -1,5 +1,5 @@
---
-title: "ImageGenerationRequestOptions"
+title: "ImageGenerationProviderPreferencesOptions"
---
Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
diff --git a/docs/components/imagegenerationproviderpreferencesorder.mdx b/docs/components/imagegenerationproviderpreferencesorder.mdx
new file mode 100644
index 00000000..3125f8b2
--- /dev/null
+++ b/docs/components/imagegenerationproviderpreferencesorder.mdx
@@ -0,0 +1,18 @@
+---
+title: "ImageGenerationProviderPreferencesOrder"
+---
+
+## Supported Types
+
+### `components.ProviderName`
+
+```python
+value: components.ProviderName = /* values here */
+```
+
+### `str`
+
+```python
+value: str = /* values here */
+```
+
diff --git a/docs/components/imagegenerationproviderpreferencessort.mdx b/docs/components/imagegenerationproviderpreferencessort.mdx
new file mode 100644
index 00000000..7696bf5f
--- /dev/null
+++ b/docs/components/imagegenerationproviderpreferencessort.mdx
@@ -0,0 +1,27 @@
+---
+title: "ImageGenerationProviderPreferencesSort"
+---
+
+The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
+
+
+## Supported Types
+
+### `components.ProviderSort`
+
+```python
+value: components.ProviderSort = /* values here */
+```
+
+### `components.ProviderSortConfig`
+
+```python
+value: components.ProviderSortConfig = /* values here */
+```
+
+### `Any`
+
+```python
+value: Any = /* values here */
+```
+
diff --git a/docs/components/imagegenerationrequest.mdx b/docs/components/imagegenerationrequest.mdx
index f9b74f40..36805ca3 100644
--- a/docs/components/imagegenerationrequest.mdx
+++ b/docs/components/imagegenerationrequest.mdx
@@ -17,7 +17,7 @@ Image generation request input
| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 |
| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png |
| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting |
-| `provider` | [Optional[components.ImageGenerationRequestProvider]](../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | |
+| `provider` | [Optional[components.ImageGenerationProviderPreferences]](../components/imagegenerationproviderpreferences.mdx) | :heavy_minus_sign: | Provider routing preferences and provider-specific passthrough configuration. | \{
"allow_fallbacks": false,
"only": [
"google-ai-studio"
]
} |
| `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high |
| `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. | |
diff --git a/docs/components/imagegenerationrequestprovider.mdx b/docs/components/imagegenerationrequestprovider.mdx
deleted file mode 100644
index 51188d0f..00000000
--- a/docs/components/imagegenerationrequestprovider.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: "ImageGenerationRequestProvider"
----
-
-Provider-specific passthrough configuration
-
-
-## Fields
-
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
-| `options` | [Optional[components.ImageGenerationRequestOptions]](../components/imagegenerationrequestoptions.mdx) | :heavy_minus_sign: | N/A | \{
"black-forest-labs": \{
"guidance": 3,
"steps": 40
}
} |
\ No newline at end of file
diff --git a/docs/components/providerpreferences.mdx b/docs/components/providerpreferences.mdx
index 750d3a21..a312c6f6 100644
--- a/docs/components/providerpreferences.mdx
+++ b/docs/components/providerpreferences.mdx
@@ -12,13 +12,13 @@ When multiple model providers are available, optionally indicate your routing pr
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| |
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.mdx) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data. | allow |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
-| `ignore` | List[[components.Ignore](../components/ignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] |
+| `ignore` | List[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] |
| `max_price` | [Optional[components.MaxPrice]](../components/maxprice.mdx) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
-| `only` | List[[components.Only](../components/only.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] |
-| `order` | List[[components.Order](../components/order.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] |
+| `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] |
+| `order` | List[[components.ProviderPreferencesOrder](../components/providerpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] |
| `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.mdx) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 |
| `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.mdx) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 |
| `quantizations` | List[[components.Quantization](../components/quantization.mdx)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
-| `sort` | [OptionalNullable[components.Sort]](../components/sort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
+| `sort` | [OptionalNullable[components.ProviderPreferencesSort]](../components/providerpreferencessort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
\ No newline at end of file
diff --git a/docs/components/only.mdx b/docs/components/providerpreferencesignore.mdx
similarity index 83%
rename from docs/components/only.mdx
rename to docs/components/providerpreferencesignore.mdx
index cc284e22..77ecc579 100644
--- a/docs/components/only.mdx
+++ b/docs/components/providerpreferencesignore.mdx
@@ -1,5 +1,5 @@
---
-title: "Only"
+title: "ProviderPreferencesIgnore"
---
## Supported Types
diff --git a/docs/components/ignore.mdx b/docs/components/providerpreferencesonly.mdx
similarity index 84%
rename from docs/components/ignore.mdx
rename to docs/components/providerpreferencesonly.mdx
index 8ba13152..a6e0692f 100644
--- a/docs/components/ignore.mdx
+++ b/docs/components/providerpreferencesonly.mdx
@@ -1,5 +1,5 @@
---
-title: "Ignore"
+title: "ProviderPreferencesOnly"
---
## Supported Types
diff --git a/docs/components/order.mdx b/docs/components/providerpreferencesorder.mdx
similarity index 84%
rename from docs/components/order.mdx
rename to docs/components/providerpreferencesorder.mdx
index edc1ffcd..b9fce30d 100644
--- a/docs/components/order.mdx
+++ b/docs/components/providerpreferencesorder.mdx
@@ -1,5 +1,5 @@
---
-title: "Order"
+title: "ProviderPreferencesOrder"
---
## Supported Types
diff --git a/docs/components/sort.mdx b/docs/components/providerpreferencessort.mdx
similarity index 92%
rename from docs/components/sort.mdx
rename to docs/components/providerpreferencessort.mdx
index b12340f4..72d68077 100644
--- a/docs/components/sort.mdx
+++ b/docs/components/providerpreferencessort.mdx
@@ -1,5 +1,5 @@
---
-title: "Sort"
+title: "ProviderPreferencesSort"
---
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx
index 8277c771..4b350854 100644
--- a/docs/sdks/images/README.mdx
+++ b/docs/sdks/images/README.mdx
@@ -55,7 +55,7 @@ with OpenRouter(
| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 |
| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 |
| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png |
-| `provider` | [Optional[components.ImageGenerationRequestProvider]](../../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | |
+| `provider` | [Optional[components.ImageGenerationProviderPreferences]](../../components/imagegenerationproviderpreferences.mdx) | :heavy_minus_sign: | Provider routing preferences and provider-specific passthrough configuration. | \{
"allow_fallbacks": false,
"only": [
"google-ai-studio"
]
} |
| `quality` | [Optional[components.ImageGenerationRequestQuality]](../../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high |
| `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. | |
diff --git a/pyproject.toml b/pyproject.toml
index 88b38af4..6804383f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "openrouter"
-version = "0.11.24"
+version = "0.11.25"
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 e328286d..d272f6c0 100644
--- a/src/openrouter/_version.py
+++ b/src/openrouter/_version.py
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "openrouter"
-__version__: str = "0.11.24"
+__version__: str = "0.11.25"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.914.0"
-__user_agent__: str = "speakeasy-sdk/python 0.11.24 2.914.0 1.0.0 openrouter"
+__user_agent__: str = "speakeasy-sdk/python 0.11.25 2.914.0 1.0.0 openrouter"
try:
if __package__ is not None:
diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py
index 1f755537..43900430 100644
--- a/src/openrouter/components/__init__.py
+++ b/src/openrouter/components/__init__.py
@@ -1149,15 +1149,25 @@
ImageGenCompletedEventType,
ImageGenCompletedEventTypedDict,
)
+ from .imagegenerationproviderpreferences import (
+ ImageGenerationProviderPreferences,
+ ImageGenerationProviderPreferencesIgnore,
+ ImageGenerationProviderPreferencesIgnoreTypedDict,
+ ImageGenerationProviderPreferencesOnly,
+ ImageGenerationProviderPreferencesOnlyTypedDict,
+ ImageGenerationProviderPreferencesOptions,
+ ImageGenerationProviderPreferencesOptionsTypedDict,
+ ImageGenerationProviderPreferencesOrder,
+ ImageGenerationProviderPreferencesOrderTypedDict,
+ ImageGenerationProviderPreferencesSort,
+ ImageGenerationProviderPreferencesSortTypedDict,
+ ImageGenerationProviderPreferencesTypedDict,
+ )
from .imagegenerationrequest import (
ImageGenerationRequest,
ImageGenerationRequestAspectRatio,
ImageGenerationRequestBackground,
- ImageGenerationRequestOptions,
- ImageGenerationRequestOptionsTypedDict,
ImageGenerationRequestOutputFormat,
- ImageGenerationRequestProvider,
- ImageGenerationRequestProviderTypedDict,
ImageGenerationRequestQuality,
ImageGenerationRequestResolution,
ImageGenerationRequestTypedDict,
@@ -2212,18 +2222,18 @@
)
from .providerpreferences import (
DataCollection,
- Ignore,
- IgnoreTypedDict,
MaxPrice,
MaxPriceTypedDict,
- Only,
- OnlyTypedDict,
- Order,
- OrderTypedDict,
ProviderPreferences,
+ ProviderPreferencesIgnore,
+ ProviderPreferencesIgnoreTypedDict,
+ ProviderPreferencesOnly,
+ ProviderPreferencesOnlyTypedDict,
+ ProviderPreferencesOrder,
+ ProviderPreferencesOrderTypedDict,
+ ProviderPreferencesSort,
+ ProviderPreferencesSortTypedDict,
ProviderPreferencesTypedDict,
- Sort,
- SortTypedDict,
)
from .providerresponse import (
ProviderResponse,
@@ -3625,8 +3635,6 @@
"Guardrail",
"GuardrailInterval",
"GuardrailTypedDict",
- "Ignore",
- "IgnoreTypedDict",
"ImageConfig",
"ImageConfigTypedDict",
"ImageEndpoint",
@@ -3658,14 +3666,22 @@
"ImageGenTextChunkEventPhase",
"ImageGenTextChunkEventType",
"ImageGenTextChunkEventTypedDict",
+ "ImageGenerationProviderPreferences",
+ "ImageGenerationProviderPreferencesIgnore",
+ "ImageGenerationProviderPreferencesIgnoreTypedDict",
+ "ImageGenerationProviderPreferencesOnly",
+ "ImageGenerationProviderPreferencesOnlyTypedDict",
+ "ImageGenerationProviderPreferencesOptions",
+ "ImageGenerationProviderPreferencesOptionsTypedDict",
+ "ImageGenerationProviderPreferencesOrder",
+ "ImageGenerationProviderPreferencesOrderTypedDict",
+ "ImageGenerationProviderPreferencesSort",
+ "ImageGenerationProviderPreferencesSortTypedDict",
+ "ImageGenerationProviderPreferencesTypedDict",
"ImageGenerationRequest",
"ImageGenerationRequestAspectRatio",
"ImageGenerationRequestBackground",
- "ImageGenerationRequestOptions",
- "ImageGenerationRequestOptionsTypedDict",
"ImageGenerationRequestOutputFormat",
- "ImageGenerationRequestProvider",
- "ImageGenerationRequestProviderTypedDict",
"ImageGenerationRequestQuality",
"ImageGenerationRequestResolution",
"ImageGenerationRequestTypedDict",
@@ -4041,8 +4057,6 @@
"ObservabilityWebhookDestinationConfigTypedDict",
"ObservabilityWebhookDestinationType",
"ObservabilityWebhookDestinationTypedDict",
- "Only",
- "OnlyTypedDict",
"OpenAIResponseCustomToolCall",
"OpenAIResponseCustomToolCallOutput",
"OpenAIResponseCustomToolCallOutputOutput1",
@@ -4119,8 +4133,6 @@
"OpenRouterWebSearchServerToolType",
"OpenRouterWebSearchServerToolTypedDict",
"Operator",
- "Order",
- "OrderTypedDict",
"Outcome",
"OutcomeExit",
"OutcomeExitTypedDict",
@@ -4348,6 +4360,14 @@
"ProviderOverloadedResponseErrorData",
"ProviderOverloadedResponseErrorDataTypedDict",
"ProviderPreferences",
+ "ProviderPreferencesIgnore",
+ "ProviderPreferencesIgnoreTypedDict",
+ "ProviderPreferencesOnly",
+ "ProviderPreferencesOnlyTypedDict",
+ "ProviderPreferencesOrder",
+ "ProviderPreferencesOrderTypedDict",
+ "ProviderPreferencesSort",
+ "ProviderPreferencesSortTypedDict",
"ProviderPreferencesTypedDict",
"ProviderResponse",
"ProviderResponseProviderName",
@@ -4534,8 +4554,6 @@
"ShellServerToolOpenRouterTypedDict",
"ShellServerToolType",
"ShellServerToolTypedDict",
- "Sort",
- "SortTypedDict",
"SourceContent",
"SourceContentTypedDict",
"SourceType",
@@ -5694,14 +5712,22 @@
"ImageGenCompletedEvent": ".imagegencompletedevent",
"ImageGenCompletedEventType": ".imagegencompletedevent",
"ImageGenCompletedEventTypedDict": ".imagegencompletedevent",
+ "ImageGenerationProviderPreferences": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesIgnore": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesIgnoreTypedDict": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOnly": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOnlyTypedDict": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOptions": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOptionsTypedDict": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOrder": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesOrderTypedDict": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesSort": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesSortTypedDict": ".imagegenerationproviderpreferences",
+ "ImageGenerationProviderPreferencesTypedDict": ".imagegenerationproviderpreferences",
"ImageGenerationRequest": ".imagegenerationrequest",
"ImageGenerationRequestAspectRatio": ".imagegenerationrequest",
"ImageGenerationRequestBackground": ".imagegenerationrequest",
- "ImageGenerationRequestOptions": ".imagegenerationrequest",
- "ImageGenerationRequestOptionsTypedDict": ".imagegenerationrequest",
"ImageGenerationRequestOutputFormat": ".imagegenerationrequest",
- "ImageGenerationRequestProvider": ".imagegenerationrequest",
- "ImageGenerationRequestProviderTypedDict": ".imagegenerationrequest",
"ImageGenerationRequestQuality": ".imagegenerationrequest",
"ImageGenerationRequestResolution": ".imagegenerationrequest",
"ImageGenerationRequestTypedDict": ".imagegenerationrequest",
@@ -6529,18 +6555,18 @@
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
"DataCollection": ".providerpreferences",
- "Ignore": ".providerpreferences",
- "IgnoreTypedDict": ".providerpreferences",
"MaxPrice": ".providerpreferences",
"MaxPriceTypedDict": ".providerpreferences",
- "Only": ".providerpreferences",
- "OnlyTypedDict": ".providerpreferences",
- "Order": ".providerpreferences",
- "OrderTypedDict": ".providerpreferences",
"ProviderPreferences": ".providerpreferences",
+ "ProviderPreferencesIgnore": ".providerpreferences",
+ "ProviderPreferencesIgnoreTypedDict": ".providerpreferences",
+ "ProviderPreferencesOnly": ".providerpreferences",
+ "ProviderPreferencesOnlyTypedDict": ".providerpreferences",
+ "ProviderPreferencesOrder": ".providerpreferences",
+ "ProviderPreferencesOrderTypedDict": ".providerpreferences",
+ "ProviderPreferencesSort": ".providerpreferences",
+ "ProviderPreferencesSortTypedDict": ".providerpreferences",
"ProviderPreferencesTypedDict": ".providerpreferences",
- "Sort": ".providerpreferences",
- "SortTypedDict": ".providerpreferences",
"ProviderResponse": ".providerresponse",
"ProviderResponseProviderName": ".providerresponse",
"ProviderResponseTypedDict": ".providerresponse",
diff --git a/src/openrouter/components/imagegenerationproviderpreferences.py b/src/openrouter/components/imagegenerationproviderpreferences.py
new file mode 100644
index 00000000..692420fd
--- /dev/null
+++ b/src/openrouter/components/imagegenerationproviderpreferences.py
@@ -0,0 +1,699 @@
+"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
+
+from __future__ import annotations
+from .providername import ProviderName
+from .providersort import ProviderSort
+from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict
+from openrouter.types import (
+ BaseModel,
+ Nullable,
+ OptionalNullable,
+ UNSET,
+ UNSET_SENTINEL,
+)
+import pydantic
+from pydantic import model_serializer
+from typing import Any, Dict, List, Optional, Union
+from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
+
+
+ImageGenerationProviderPreferencesIgnoreTypedDict = TypeAliasType(
+ "ImageGenerationProviderPreferencesIgnoreTypedDict", Union[ProviderName, str]
+)
+
+
+ImageGenerationProviderPreferencesIgnore = TypeAliasType(
+ "ImageGenerationProviderPreferencesIgnore", Union[ProviderName, str]
+)
+
+
+ImageGenerationProviderPreferencesOnlyTypedDict = TypeAliasType(
+ "ImageGenerationProviderPreferencesOnlyTypedDict", Union[ProviderName, str]
+)
+
+
+ImageGenerationProviderPreferencesOnly = TypeAliasType(
+ "ImageGenerationProviderPreferencesOnly", Union[ProviderName, str]
+)
+
+
+class ImageGenerationProviderPreferencesOptionsTypedDict(TypedDict):
+ r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
+
+ oneai: NotRequired[Dict[str, Nullable[Any]]]
+ ai21: NotRequired[Dict[str, Nullable[Any]]]
+ aion_labs: NotRequired[Dict[str, Nullable[Any]]]
+ akashml: NotRequired[Dict[str, Nullable[Any]]]
+ alibaba: NotRequired[Dict[str, Nullable[Any]]]
+ amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]]
+ amazon_nova: NotRequired[Dict[str, Nullable[Any]]]
+ ambient: NotRequired[Dict[str, Nullable[Any]]]
+ anthropic: NotRequired[Dict[str, Nullable[Any]]]
+ anyscale: NotRequired[Dict[str, Nullable[Any]]]
+ arcee_ai: NotRequired[Dict[str, Nullable[Any]]]
+ atlas_cloud: NotRequired[Dict[str, Nullable[Any]]]
+ atoma: NotRequired[Dict[str, Nullable[Any]]]
+ avian: NotRequired[Dict[str, Nullable[Any]]]
+ azure: NotRequired[Dict[str, Nullable[Any]]]
+ baidu: NotRequired[Dict[str, Nullable[Any]]]
+ baseten: NotRequired[Dict[str, Nullable[Any]]]
+ black_forest_labs: NotRequired[Dict[str, Nullable[Any]]]
+ byteplus: NotRequired[Dict[str, Nullable[Any]]]
+ centml: NotRequired[Dict[str, Nullable[Any]]]
+ cerebras: NotRequired[Dict[str, Nullable[Any]]]
+ chutes: NotRequired[Dict[str, Nullable[Any]]]
+ cirrascale: NotRequired[Dict[str, Nullable[Any]]]
+ clarifai: NotRequired[Dict[str, Nullable[Any]]]
+ cloudflare: NotRequired[Dict[str, Nullable[Any]]]
+ cohere: NotRequired[Dict[str, Nullable[Any]]]
+ crofai: NotRequired[Dict[str, Nullable[Any]]]
+ crucible: NotRequired[Dict[str, Nullable[Any]]]
+ crusoe: NotRequired[Dict[str, Nullable[Any]]]
+ darkbloom: NotRequired[Dict[str, Nullable[Any]]]
+ decart: NotRequired[Dict[str, Nullable[Any]]]
+ deepgram: NotRequired[Dict[str, Nullable[Any]]]
+ deepinfra: NotRequired[Dict[str, Nullable[Any]]]
+ deepseek: NotRequired[Dict[str, Nullable[Any]]]
+ dekallm: NotRequired[Dict[str, Nullable[Any]]]
+ digitalocean: NotRequired[Dict[str, Nullable[Any]]]
+ enfer: NotRequired[Dict[str, Nullable[Any]]]
+ fake_provider: NotRequired[Dict[str, Nullable[Any]]]
+ featherless: NotRequired[Dict[str, Nullable[Any]]]
+ fireworks: NotRequired[Dict[str, Nullable[Any]]]
+ friendli: NotRequired[Dict[str, Nullable[Any]]]
+ gmicloud: NotRequired[Dict[str, Nullable[Any]]]
+ google_ai_studio: NotRequired[Dict[str, Nullable[Any]]]
+ google_vertex: NotRequired[Dict[str, Nullable[Any]]]
+ gopomelo: NotRequired[Dict[str, Nullable[Any]]]
+ groq: NotRequired[Dict[str, Nullable[Any]]]
+ heygen: NotRequired[Dict[str, Nullable[Any]]]
+ huggingface: NotRequired[Dict[str, Nullable[Any]]]
+ hyperbolic: NotRequired[Dict[str, Nullable[Any]]]
+ hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]]
+ inception: NotRequired[Dict[str, Nullable[Any]]]
+ inceptron: NotRequired[Dict[str, Nullable[Any]]]
+ inferact_vllm: NotRequired[Dict[str, Nullable[Any]]]
+ inference_net: NotRequired[Dict[str, Nullable[Any]]]
+ infermatic: NotRequired[Dict[str, Nullable[Any]]]
+ inflection: NotRequired[Dict[str, Nullable[Any]]]
+ inocloud: NotRequired[Dict[str, Nullable[Any]]]
+ io_net: NotRequired[Dict[str, Nullable[Any]]]
+ ionstream: NotRequired[Dict[str, Nullable[Any]]]
+ klusterai: NotRequired[Dict[str, Nullable[Any]]]
+ lambda_: NotRequired[Dict[str, Nullable[Any]]]
+ lepton: NotRequired[Dict[str, Nullable[Any]]]
+ liquid: NotRequired[Dict[str, Nullable[Any]]]
+ lynn: NotRequired[Dict[str, Nullable[Any]]]
+ lynn_private: NotRequired[Dict[str, Nullable[Any]]]
+ mancer: NotRequired[Dict[str, Nullable[Any]]]
+ mancer_old: NotRequired[Dict[str, Nullable[Any]]]
+ mara: NotRequired[Dict[str, Nullable[Any]]]
+ meta: NotRequired[Dict[str, Nullable[Any]]]
+ minimax: NotRequired[Dict[str, Nullable[Any]]]
+ mistral: NotRequired[Dict[str, Nullable[Any]]]
+ modal: NotRequired[Dict[str, Nullable[Any]]]
+ modelrun: NotRequired[Dict[str, Nullable[Any]]]
+ modular: NotRequired[Dict[str, Nullable[Any]]]
+ moonshotai: NotRequired[Dict[str, Nullable[Any]]]
+ morph: NotRequired[Dict[str, Nullable[Any]]]
+ ncompass: NotRequired[Dict[str, Nullable[Any]]]
+ nebius: NotRequired[Dict[str, Nullable[Any]]]
+ nex_agi: NotRequired[Dict[str, Nullable[Any]]]
+ nextbit: NotRequired[Dict[str, Nullable[Any]]]
+ nineteen: NotRequired[Dict[str, Nullable[Any]]]
+ novita: NotRequired[Dict[str, Nullable[Any]]]
+ nvidia: NotRequired[Dict[str, Nullable[Any]]]
+ octoai: NotRequired[Dict[str, Nullable[Any]]]
+ open_inference: NotRequired[Dict[str, Nullable[Any]]]
+ openai: NotRequired[Dict[str, Nullable[Any]]]
+ parasail: NotRequired[Dict[str, Nullable[Any]]]
+ perceptron: NotRequired[Dict[str, Nullable[Any]]]
+ perplexity: NotRequired[Dict[str, Nullable[Any]]]
+ phala: NotRequired[Dict[str, Nullable[Any]]]
+ poolside: NotRequired[Dict[str, Nullable[Any]]]
+ quiver: NotRequired[Dict[str, Nullable[Any]]]
+ recraft: NotRequired[Dict[str, Nullable[Any]]]
+ recursal: NotRequired[Dict[str, Nullable[Any]]]
+ reflection: NotRequired[Dict[str, Nullable[Any]]]
+ reka: NotRequired[Dict[str, Nullable[Any]]]
+ relace: NotRequired[Dict[str, Nullable[Any]]]
+ replicate: NotRequired[Dict[str, Nullable[Any]]]
+ sakana: NotRequired[Dict[str, Nullable[Any]]]
+ sambanova: NotRequired[Dict[str, Nullable[Any]]]
+ sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]]
+ seed: NotRequired[Dict[str, Nullable[Any]]]
+ sf_compute: NotRequired[Dict[str, Nullable[Any]]]
+ siliconflow: NotRequired[Dict[str, Nullable[Any]]]
+ sourceful: NotRequired[Dict[str, Nullable[Any]]]
+ stealth: NotRequired[Dict[str, Nullable[Any]]]
+ stepfun: NotRequired[Dict[str, Nullable[Any]]]
+ streamlake: NotRequired[Dict[str, Nullable[Any]]]
+ switchpoint: NotRequired[Dict[str, Nullable[Any]]]
+ targon: NotRequired[Dict[str, Nullable[Any]]]
+ tenstorrent: NotRequired[Dict[str, Nullable[Any]]]
+ together: NotRequired[Dict[str, Nullable[Any]]]
+ together_lite: NotRequired[Dict[str, Nullable[Any]]]
+ ubicloud: NotRequired[Dict[str, Nullable[Any]]]
+ upstage: NotRequired[Dict[str, Nullable[Any]]]
+ venice: NotRequired[Dict[str, Nullable[Any]]]
+ wafer: NotRequired[Dict[str, Nullable[Any]]]
+ wandb: NotRequired[Dict[str, Nullable[Any]]]
+ xai: NotRequired[Dict[str, Nullable[Any]]]
+ xiaomi: NotRequired[Dict[str, Nullable[Any]]]
+ z_ai: NotRequired[Dict[str, Nullable[Any]]]
+
+
+class ImageGenerationProviderPreferencesOptions(BaseModel):
+ r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
+
+ oneai: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
+ ] = None
+
+ ai21: Optional[Dict[str, Nullable[Any]]] = None
+
+ aion_labs: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs")
+ ] = None
+
+ akashml: Optional[Dict[str, Nullable[Any]]] = None
+
+ alibaba: Optional[Dict[str, Nullable[Any]]] = None
+
+ amazon_bedrock: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock")
+ ] = None
+
+ amazon_nova: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova")
+ ] = None
+
+ ambient: Optional[Dict[str, Nullable[Any]]] = None
+
+ anthropic: Optional[Dict[str, Nullable[Any]]] = None
+
+ anyscale: Optional[Dict[str, Nullable[Any]]] = None
+
+ arcee_ai: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai")
+ ] = None
+
+ atlas_cloud: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud")
+ ] = None
+
+ atoma: Optional[Dict[str, Nullable[Any]]] = None
+
+ avian: Optional[Dict[str, Nullable[Any]]] = None
+
+ azure: Optional[Dict[str, Nullable[Any]]] = None
+
+ baidu: Optional[Dict[str, Nullable[Any]]] = None
+
+ baseten: Optional[Dict[str, Nullable[Any]]] = None
+
+ black_forest_labs: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs")
+ ] = None
+
+ byteplus: Optional[Dict[str, Nullable[Any]]] = None
+
+ centml: Optional[Dict[str, Nullable[Any]]] = None
+
+ cerebras: Optional[Dict[str, Nullable[Any]]] = None
+
+ chutes: Optional[Dict[str, Nullable[Any]]] = None
+
+ cirrascale: Optional[Dict[str, Nullable[Any]]] = None
+
+ clarifai: Optional[Dict[str, Nullable[Any]]] = None
+
+ cloudflare: Optional[Dict[str, Nullable[Any]]] = None
+
+ cohere: Optional[Dict[str, Nullable[Any]]] = None
+
+ crofai: Optional[Dict[str, Nullable[Any]]] = None
+
+ crucible: Optional[Dict[str, Nullable[Any]]] = None
+
+ crusoe: Optional[Dict[str, Nullable[Any]]] = None
+
+ darkbloom: Optional[Dict[str, Nullable[Any]]] = None
+
+ decart: Optional[Dict[str, Nullable[Any]]] = None
+
+ deepgram: Optional[Dict[str, Nullable[Any]]] = None
+
+ deepinfra: Optional[Dict[str, Nullable[Any]]] = None
+
+ deepseek: Optional[Dict[str, Nullable[Any]]] = None
+
+ dekallm: Optional[Dict[str, Nullable[Any]]] = None
+
+ digitalocean: Optional[Dict[str, Nullable[Any]]] = None
+
+ enfer: Optional[Dict[str, Nullable[Any]]] = None
+
+ fake_provider: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider")
+ ] = None
+
+ featherless: Optional[Dict[str, Nullable[Any]]] = None
+
+ fireworks: Optional[Dict[str, Nullable[Any]]] = None
+
+ friendli: Optional[Dict[str, Nullable[Any]]] = None
+
+ gmicloud: Optional[Dict[str, Nullable[Any]]] = None
+
+ google_ai_studio: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio")
+ ] = None
+
+ google_vertex: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex")
+ ] = None
+
+ gopomelo: Optional[Dict[str, Nullable[Any]]] = None
+
+ groq: Optional[Dict[str, Nullable[Any]]] = None
+
+ heygen: Optional[Dict[str, Nullable[Any]]] = None
+
+ huggingface: Optional[Dict[str, Nullable[Any]]] = None
+
+ hyperbolic: Optional[Dict[str, Nullable[Any]]] = None
+
+ hyperbolic_quantized: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized")
+ ] = None
+
+ inception: Optional[Dict[str, Nullable[Any]]] = None
+
+ inceptron: Optional[Dict[str, Nullable[Any]]] = None
+
+ inferact_vllm: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm")
+ ] = None
+
+ inference_net: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net")
+ ] = None
+
+ infermatic: Optional[Dict[str, Nullable[Any]]] = None
+
+ inflection: Optional[Dict[str, Nullable[Any]]] = None
+
+ inocloud: Optional[Dict[str, Nullable[Any]]] = None
+
+ io_net: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net")
+ ] = None
+
+ ionstream: Optional[Dict[str, Nullable[Any]]] = None
+
+ klusterai: Optional[Dict[str, Nullable[Any]]] = None
+
+ lambda_: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda")
+ ] = None
+
+ lepton: Optional[Dict[str, Nullable[Any]]] = None
+
+ liquid: Optional[Dict[str, Nullable[Any]]] = None
+
+ lynn: Optional[Dict[str, Nullable[Any]]] = None
+
+ lynn_private: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private")
+ ] = None
+
+ mancer: Optional[Dict[str, Nullable[Any]]] = None
+
+ mancer_old: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old")
+ ] = None
+
+ mara: Optional[Dict[str, Nullable[Any]]] = None
+
+ meta: Optional[Dict[str, Nullable[Any]]] = None
+
+ minimax: Optional[Dict[str, Nullable[Any]]] = None
+
+ mistral: Optional[Dict[str, Nullable[Any]]] = None
+
+ modal: Optional[Dict[str, Nullable[Any]]] = None
+
+ modelrun: Optional[Dict[str, Nullable[Any]]] = None
+
+ modular: Optional[Dict[str, Nullable[Any]]] = None
+
+ moonshotai: Optional[Dict[str, Nullable[Any]]] = None
+
+ morph: Optional[Dict[str, Nullable[Any]]] = None
+
+ ncompass: Optional[Dict[str, Nullable[Any]]] = None
+
+ nebius: Optional[Dict[str, Nullable[Any]]] = None
+
+ nex_agi: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="nex-agi")
+ ] = None
+
+ nextbit: Optional[Dict[str, Nullable[Any]]] = None
+
+ nineteen: Optional[Dict[str, Nullable[Any]]] = None
+
+ novita: Optional[Dict[str, Nullable[Any]]] = None
+
+ nvidia: Optional[Dict[str, Nullable[Any]]] = None
+
+ octoai: Optional[Dict[str, Nullable[Any]]] = None
+
+ open_inference: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference")
+ ] = None
+
+ openai: Optional[Dict[str, Nullable[Any]]] = None
+
+ parasail: Optional[Dict[str, Nullable[Any]]] = None
+
+ perceptron: Optional[Dict[str, Nullable[Any]]] = None
+
+ perplexity: Optional[Dict[str, Nullable[Any]]] = None
+
+ phala: Optional[Dict[str, Nullable[Any]]] = None
+
+ poolside: Optional[Dict[str, Nullable[Any]]] = None
+
+ quiver: Optional[Dict[str, Nullable[Any]]] = None
+
+ recraft: Optional[Dict[str, Nullable[Any]]] = None
+
+ recursal: Optional[Dict[str, Nullable[Any]]] = None
+
+ reflection: Optional[Dict[str, Nullable[Any]]] = None
+
+ reka: Optional[Dict[str, Nullable[Any]]] = None
+
+ relace: Optional[Dict[str, Nullable[Any]]] = None
+
+ replicate: Optional[Dict[str, Nullable[Any]]] = None
+
+ sakana: Optional[Dict[str, Nullable[Any]]] = None
+
+ sambanova: Optional[Dict[str, Nullable[Any]]] = None
+
+ sambanova_cloaked: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked")
+ ] = None
+
+ seed: Optional[Dict[str, Nullable[Any]]] = None
+
+ sf_compute: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute")
+ ] = None
+
+ siliconflow: Optional[Dict[str, Nullable[Any]]] = None
+
+ sourceful: Optional[Dict[str, Nullable[Any]]] = None
+
+ stealth: Optional[Dict[str, Nullable[Any]]] = None
+
+ stepfun: Optional[Dict[str, Nullable[Any]]] = None
+
+ streamlake: Optional[Dict[str, Nullable[Any]]] = None
+
+ switchpoint: Optional[Dict[str, Nullable[Any]]] = None
+
+ targon: Optional[Dict[str, Nullable[Any]]] = None
+
+ tenstorrent: Optional[Dict[str, Nullable[Any]]] = None
+
+ together: Optional[Dict[str, Nullable[Any]]] = None
+
+ together_lite: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite")
+ ] = None
+
+ ubicloud: Optional[Dict[str, Nullable[Any]]] = None
+
+ upstage: Optional[Dict[str, Nullable[Any]]] = None
+
+ venice: Optional[Dict[str, Nullable[Any]]] = None
+
+ wafer: Optional[Dict[str, Nullable[Any]]] = None
+
+ wandb: Optional[Dict[str, Nullable[Any]]] = None
+
+ xai: Optional[Dict[str, Nullable[Any]]] = None
+
+ xiaomi: Optional[Dict[str, Nullable[Any]]] = None
+
+ z_ai: Annotated[
+ Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai")
+ ] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "01ai",
+ "ai21",
+ "aion-labs",
+ "akashml",
+ "alibaba",
+ "amazon-bedrock",
+ "amazon-nova",
+ "ambient",
+ "anthropic",
+ "anyscale",
+ "arcee-ai",
+ "atlas-cloud",
+ "atoma",
+ "avian",
+ "azure",
+ "baidu",
+ "baseten",
+ "black-forest-labs",
+ "byteplus",
+ "centml",
+ "cerebras",
+ "chutes",
+ "cirrascale",
+ "clarifai",
+ "cloudflare",
+ "cohere",
+ "crofai",
+ "crucible",
+ "crusoe",
+ "darkbloom",
+ "decart",
+ "deepgram",
+ "deepinfra",
+ "deepseek",
+ "dekallm",
+ "digitalocean",
+ "enfer",
+ "fake-provider",
+ "featherless",
+ "fireworks",
+ "friendli",
+ "gmicloud",
+ "google-ai-studio",
+ "google-vertex",
+ "gopomelo",
+ "groq",
+ "heygen",
+ "huggingface",
+ "hyperbolic",
+ "hyperbolic-quantized",
+ "inception",
+ "inceptron",
+ "inferact-vllm",
+ "inference-net",
+ "infermatic",
+ "inflection",
+ "inocloud",
+ "io-net",
+ "ionstream",
+ "klusterai",
+ "lambda",
+ "lepton",
+ "liquid",
+ "lynn",
+ "lynn-private",
+ "mancer",
+ "mancer-old",
+ "mara",
+ "meta",
+ "minimax",
+ "mistral",
+ "modal",
+ "modelrun",
+ "modular",
+ "moonshotai",
+ "morph",
+ "ncompass",
+ "nebius",
+ "nex-agi",
+ "nextbit",
+ "nineteen",
+ "novita",
+ "nvidia",
+ "octoai",
+ "open-inference",
+ "openai",
+ "parasail",
+ "perceptron",
+ "perplexity",
+ "phala",
+ "poolside",
+ "quiver",
+ "recraft",
+ "recursal",
+ "reflection",
+ "reka",
+ "relace",
+ "replicate",
+ "sakana",
+ "sambanova",
+ "sambanova-cloaked",
+ "seed",
+ "sf-compute",
+ "siliconflow",
+ "sourceful",
+ "stealth",
+ "stepfun",
+ "streamlake",
+ "switchpoint",
+ "targon",
+ "tenstorrent",
+ "together",
+ "together-lite",
+ "ubicloud",
+ "upstage",
+ "venice",
+ "wafer",
+ "wandb",
+ "xai",
+ "xiaomi",
+ "z-ai",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+ImageGenerationProviderPreferencesOrderTypedDict = TypeAliasType(
+ "ImageGenerationProviderPreferencesOrderTypedDict", Union[ProviderName, str]
+)
+
+
+ImageGenerationProviderPreferencesOrder = TypeAliasType(
+ "ImageGenerationProviderPreferencesOrder", Union[ProviderName, str]
+)
+
+
+ImageGenerationProviderPreferencesSortTypedDict = TypeAliasType(
+ "ImageGenerationProviderPreferencesSortTypedDict",
+ Union[ProviderSortConfigTypedDict, ProviderSort, Any],
+)
+r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
+
+
+ImageGenerationProviderPreferencesSort = TypeAliasType(
+ "ImageGenerationProviderPreferencesSort",
+ Union[ProviderSortConfig, ProviderSort, Any],
+)
+r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
+
+
+class ImageGenerationProviderPreferencesTypedDict(TypedDict):
+ r"""Provider routing preferences and provider-specific passthrough configuration."""
+
+ allow_fallbacks: NotRequired[Nullable[bool]]
+ r"""Whether to allow backup providers to serve requests
+ - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
+ - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
+
+ """
+ ignore: NotRequired[
+ Nullable[List[ImageGenerationProviderPreferencesIgnoreTypedDict]]
+ ]
+ r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
+ only: NotRequired[Nullable[List[ImageGenerationProviderPreferencesOnlyTypedDict]]]
+ r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
+ options: NotRequired[ImageGenerationProviderPreferencesOptionsTypedDict]
+ order: NotRequired[Nullable[List[ImageGenerationProviderPreferencesOrderTypedDict]]]
+ r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
+ sort: NotRequired[Nullable[ImageGenerationProviderPreferencesSortTypedDict]]
+ r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
+
+
+class ImageGenerationProviderPreferences(BaseModel):
+ r"""Provider routing preferences and provider-specific passthrough configuration."""
+
+ allow_fallbacks: OptionalNullable[bool] = UNSET
+ r"""Whether to allow backup providers to serve requests
+ - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
+ - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
+
+ """
+
+ ignore: OptionalNullable[List[ImageGenerationProviderPreferencesIgnore]] = UNSET
+ r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
+
+ only: OptionalNullable[List[ImageGenerationProviderPreferencesOnly]] = UNSET
+ r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
+
+ options: Optional[ImageGenerationProviderPreferencesOptions] = None
+
+ order: OptionalNullable[List[ImageGenerationProviderPreferencesOrder]] = UNSET
+ r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
+
+ sort: OptionalNullable[ImageGenerationProviderPreferencesSort] = UNSET
+ r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["allow_fallbacks", "ignore", "only", "options", "order", "sort"]
+ )
+ nullable_fields = set(["allow_fallbacks", "ignore", "only", "order", "sort"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
+
+ return m
+
+
+try:
+ ImageGenerationProviderPreferencesOptions.model_rebuild()
+except NameError:
+ pass
diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py
index 9866560e..9f5f9caf 100644
--- a/src/openrouter/components/imagegenerationrequest.py
+++ b/src/openrouter/components/imagegenerationrequest.py
@@ -2,11 +2,14 @@
from __future__ import annotations
from .contentpartimage import ContentPartImage, ContentPartImageTypedDict
-from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
-import pydantic
+from .imagegenerationproviderpreferences import (
+ ImageGenerationProviderPreferences,
+ ImageGenerationProviderPreferencesTypedDict,
+)
+from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
from pydantic import model_serializer
-from typing import Any, Dict, List, Literal, Optional, Union
-from typing_extensions import Annotated, NotRequired, TypedDict
+from typing import List, Literal, Optional, Union
+from typing_extensions import NotRequired, TypedDict
ImageGenerationRequestAspectRatio = Union[
@@ -62,592 +65,6 @@
r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`."""
-class ImageGenerationRequestOptionsTypedDict(TypedDict):
- r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
-
- oneai: NotRequired[Dict[str, Nullable[Any]]]
- ai21: NotRequired[Dict[str, Nullable[Any]]]
- aion_labs: NotRequired[Dict[str, Nullable[Any]]]
- akashml: NotRequired[Dict[str, Nullable[Any]]]
- alibaba: NotRequired[Dict[str, Nullable[Any]]]
- amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]]
- amazon_nova: NotRequired[Dict[str, Nullable[Any]]]
- ambient: NotRequired[Dict[str, Nullable[Any]]]
- anthropic: NotRequired[Dict[str, Nullable[Any]]]
- anyscale: NotRequired[Dict[str, Nullable[Any]]]
- arcee_ai: NotRequired[Dict[str, Nullable[Any]]]
- atlas_cloud: NotRequired[Dict[str, Nullable[Any]]]
- atoma: NotRequired[Dict[str, Nullable[Any]]]
- avian: NotRequired[Dict[str, Nullable[Any]]]
- azure: NotRequired[Dict[str, Nullable[Any]]]
- baidu: NotRequired[Dict[str, Nullable[Any]]]
- baseten: NotRequired[Dict[str, Nullable[Any]]]
- black_forest_labs: NotRequired[Dict[str, Nullable[Any]]]
- byteplus: NotRequired[Dict[str, Nullable[Any]]]
- centml: NotRequired[Dict[str, Nullable[Any]]]
- cerebras: NotRequired[Dict[str, Nullable[Any]]]
- chutes: NotRequired[Dict[str, Nullable[Any]]]
- cirrascale: NotRequired[Dict[str, Nullable[Any]]]
- clarifai: NotRequired[Dict[str, Nullable[Any]]]
- cloudflare: NotRequired[Dict[str, Nullable[Any]]]
- cohere: NotRequired[Dict[str, Nullable[Any]]]
- crofai: NotRequired[Dict[str, Nullable[Any]]]
- crucible: NotRequired[Dict[str, Nullable[Any]]]
- crusoe: NotRequired[Dict[str, Nullable[Any]]]
- darkbloom: NotRequired[Dict[str, Nullable[Any]]]
- decart: NotRequired[Dict[str, Nullable[Any]]]
- deepgram: NotRequired[Dict[str, Nullable[Any]]]
- deepinfra: NotRequired[Dict[str, Nullable[Any]]]
- deepseek: NotRequired[Dict[str, Nullable[Any]]]
- dekallm: NotRequired[Dict[str, Nullable[Any]]]
- digitalocean: NotRequired[Dict[str, Nullable[Any]]]
- enfer: NotRequired[Dict[str, Nullable[Any]]]
- fake_provider: NotRequired[Dict[str, Nullable[Any]]]
- featherless: NotRequired[Dict[str, Nullable[Any]]]
- fireworks: NotRequired[Dict[str, Nullable[Any]]]
- friendli: NotRequired[Dict[str, Nullable[Any]]]
- gmicloud: NotRequired[Dict[str, Nullable[Any]]]
- google_ai_studio: NotRequired[Dict[str, Nullable[Any]]]
- google_vertex: NotRequired[Dict[str, Nullable[Any]]]
- gopomelo: NotRequired[Dict[str, Nullable[Any]]]
- groq: NotRequired[Dict[str, Nullable[Any]]]
- heygen: NotRequired[Dict[str, Nullable[Any]]]
- huggingface: NotRequired[Dict[str, Nullable[Any]]]
- hyperbolic: NotRequired[Dict[str, Nullable[Any]]]
- hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]]
- inception: NotRequired[Dict[str, Nullable[Any]]]
- inceptron: NotRequired[Dict[str, Nullable[Any]]]
- inferact_vllm: NotRequired[Dict[str, Nullable[Any]]]
- inference_net: NotRequired[Dict[str, Nullable[Any]]]
- infermatic: NotRequired[Dict[str, Nullable[Any]]]
- inflection: NotRequired[Dict[str, Nullable[Any]]]
- inocloud: NotRequired[Dict[str, Nullable[Any]]]
- io_net: NotRequired[Dict[str, Nullable[Any]]]
- ionstream: NotRequired[Dict[str, Nullable[Any]]]
- klusterai: NotRequired[Dict[str, Nullable[Any]]]
- lambda_: NotRequired[Dict[str, Nullable[Any]]]
- lepton: NotRequired[Dict[str, Nullable[Any]]]
- liquid: NotRequired[Dict[str, Nullable[Any]]]
- lynn: NotRequired[Dict[str, Nullable[Any]]]
- lynn_private: NotRequired[Dict[str, Nullable[Any]]]
- mancer: NotRequired[Dict[str, Nullable[Any]]]
- mancer_old: NotRequired[Dict[str, Nullable[Any]]]
- mara: NotRequired[Dict[str, Nullable[Any]]]
- meta: NotRequired[Dict[str, Nullable[Any]]]
- minimax: NotRequired[Dict[str, Nullable[Any]]]
- mistral: NotRequired[Dict[str, Nullable[Any]]]
- modal: NotRequired[Dict[str, Nullable[Any]]]
- modelrun: NotRequired[Dict[str, Nullable[Any]]]
- modular: NotRequired[Dict[str, Nullable[Any]]]
- moonshotai: NotRequired[Dict[str, Nullable[Any]]]
- morph: NotRequired[Dict[str, Nullable[Any]]]
- ncompass: NotRequired[Dict[str, Nullable[Any]]]
- nebius: NotRequired[Dict[str, Nullable[Any]]]
- nex_agi: NotRequired[Dict[str, Nullable[Any]]]
- nextbit: NotRequired[Dict[str, Nullable[Any]]]
- nineteen: NotRequired[Dict[str, Nullable[Any]]]
- novita: NotRequired[Dict[str, Nullable[Any]]]
- nvidia: NotRequired[Dict[str, Nullable[Any]]]
- octoai: NotRequired[Dict[str, Nullable[Any]]]
- open_inference: NotRequired[Dict[str, Nullable[Any]]]
- openai: NotRequired[Dict[str, Nullable[Any]]]
- parasail: NotRequired[Dict[str, Nullable[Any]]]
- perceptron: NotRequired[Dict[str, Nullable[Any]]]
- perplexity: NotRequired[Dict[str, Nullable[Any]]]
- phala: NotRequired[Dict[str, Nullable[Any]]]
- poolside: NotRequired[Dict[str, Nullable[Any]]]
- quiver: NotRequired[Dict[str, Nullable[Any]]]
- recraft: NotRequired[Dict[str, Nullable[Any]]]
- recursal: NotRequired[Dict[str, Nullable[Any]]]
- reflection: NotRequired[Dict[str, Nullable[Any]]]
- reka: NotRequired[Dict[str, Nullable[Any]]]
- relace: NotRequired[Dict[str, Nullable[Any]]]
- replicate: NotRequired[Dict[str, Nullable[Any]]]
- sakana: NotRequired[Dict[str, Nullable[Any]]]
- sambanova: NotRequired[Dict[str, Nullable[Any]]]
- sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]]
- seed: NotRequired[Dict[str, Nullable[Any]]]
- sf_compute: NotRequired[Dict[str, Nullable[Any]]]
- siliconflow: NotRequired[Dict[str, Nullable[Any]]]
- sourceful: NotRequired[Dict[str, Nullable[Any]]]
- stealth: NotRequired[Dict[str, Nullable[Any]]]
- stepfun: NotRequired[Dict[str, Nullable[Any]]]
- streamlake: NotRequired[Dict[str, Nullable[Any]]]
- switchpoint: NotRequired[Dict[str, Nullable[Any]]]
- targon: NotRequired[Dict[str, Nullable[Any]]]
- tenstorrent: NotRequired[Dict[str, Nullable[Any]]]
- together: NotRequired[Dict[str, Nullable[Any]]]
- together_lite: NotRequired[Dict[str, Nullable[Any]]]
- ubicloud: NotRequired[Dict[str, Nullable[Any]]]
- upstage: NotRequired[Dict[str, Nullable[Any]]]
- venice: NotRequired[Dict[str, Nullable[Any]]]
- wafer: NotRequired[Dict[str, Nullable[Any]]]
- wandb: NotRequired[Dict[str, Nullable[Any]]]
- xai: NotRequired[Dict[str, Nullable[Any]]]
- xiaomi: NotRequired[Dict[str, Nullable[Any]]]
- z_ai: NotRequired[Dict[str, Nullable[Any]]]
-
-
-class ImageGenerationRequestOptions(BaseModel):
- r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
-
- oneai: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
- ] = None
-
- ai21: Optional[Dict[str, Nullable[Any]]] = None
-
- aion_labs: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs")
- ] = None
-
- akashml: Optional[Dict[str, Nullable[Any]]] = None
-
- alibaba: Optional[Dict[str, Nullable[Any]]] = None
-
- amazon_bedrock: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock")
- ] = None
-
- amazon_nova: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova")
- ] = None
-
- ambient: Optional[Dict[str, Nullable[Any]]] = None
-
- anthropic: Optional[Dict[str, Nullable[Any]]] = None
-
- anyscale: Optional[Dict[str, Nullable[Any]]] = None
-
- arcee_ai: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai")
- ] = None
-
- atlas_cloud: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud")
- ] = None
-
- atoma: Optional[Dict[str, Nullable[Any]]] = None
-
- avian: Optional[Dict[str, Nullable[Any]]] = None
-
- azure: Optional[Dict[str, Nullable[Any]]] = None
-
- baidu: Optional[Dict[str, Nullable[Any]]] = None
-
- baseten: Optional[Dict[str, Nullable[Any]]] = None
-
- black_forest_labs: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs")
- ] = None
-
- byteplus: Optional[Dict[str, Nullable[Any]]] = None
-
- centml: Optional[Dict[str, Nullable[Any]]] = None
-
- cerebras: Optional[Dict[str, Nullable[Any]]] = None
-
- chutes: Optional[Dict[str, Nullable[Any]]] = None
-
- cirrascale: Optional[Dict[str, Nullable[Any]]] = None
-
- clarifai: Optional[Dict[str, Nullable[Any]]] = None
-
- cloudflare: Optional[Dict[str, Nullable[Any]]] = None
-
- cohere: Optional[Dict[str, Nullable[Any]]] = None
-
- crofai: Optional[Dict[str, Nullable[Any]]] = None
-
- crucible: Optional[Dict[str, Nullable[Any]]] = None
-
- crusoe: Optional[Dict[str, Nullable[Any]]] = None
-
- darkbloom: Optional[Dict[str, Nullable[Any]]] = None
-
- decart: Optional[Dict[str, Nullable[Any]]] = None
-
- deepgram: Optional[Dict[str, Nullable[Any]]] = None
-
- deepinfra: Optional[Dict[str, Nullable[Any]]] = None
-
- deepseek: Optional[Dict[str, Nullable[Any]]] = None
-
- dekallm: Optional[Dict[str, Nullable[Any]]] = None
-
- digitalocean: Optional[Dict[str, Nullable[Any]]] = None
-
- enfer: Optional[Dict[str, Nullable[Any]]] = None
-
- fake_provider: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider")
- ] = None
-
- featherless: Optional[Dict[str, Nullable[Any]]] = None
-
- fireworks: Optional[Dict[str, Nullable[Any]]] = None
-
- friendli: Optional[Dict[str, Nullable[Any]]] = None
-
- gmicloud: Optional[Dict[str, Nullable[Any]]] = None
-
- google_ai_studio: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio")
- ] = None
-
- google_vertex: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex")
- ] = None
-
- gopomelo: Optional[Dict[str, Nullable[Any]]] = None
-
- groq: Optional[Dict[str, Nullable[Any]]] = None
-
- heygen: Optional[Dict[str, Nullable[Any]]] = None
-
- huggingface: Optional[Dict[str, Nullable[Any]]] = None
-
- hyperbolic: Optional[Dict[str, Nullable[Any]]] = None
-
- hyperbolic_quantized: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized")
- ] = None
-
- inception: Optional[Dict[str, Nullable[Any]]] = None
-
- inceptron: Optional[Dict[str, Nullable[Any]]] = None
-
- inferact_vllm: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm")
- ] = None
-
- inference_net: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net")
- ] = None
-
- infermatic: Optional[Dict[str, Nullable[Any]]] = None
-
- inflection: Optional[Dict[str, Nullable[Any]]] = None
-
- inocloud: Optional[Dict[str, Nullable[Any]]] = None
-
- io_net: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net")
- ] = None
-
- ionstream: Optional[Dict[str, Nullable[Any]]] = None
-
- klusterai: Optional[Dict[str, Nullable[Any]]] = None
-
- lambda_: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda")
- ] = None
-
- lepton: Optional[Dict[str, Nullable[Any]]] = None
-
- liquid: Optional[Dict[str, Nullable[Any]]] = None
-
- lynn: Optional[Dict[str, Nullable[Any]]] = None
-
- lynn_private: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private")
- ] = None
-
- mancer: Optional[Dict[str, Nullable[Any]]] = None
-
- mancer_old: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old")
- ] = None
-
- mara: Optional[Dict[str, Nullable[Any]]] = None
-
- meta: Optional[Dict[str, Nullable[Any]]] = None
-
- minimax: Optional[Dict[str, Nullable[Any]]] = None
-
- mistral: Optional[Dict[str, Nullable[Any]]] = None
-
- modal: Optional[Dict[str, Nullable[Any]]] = None
-
- modelrun: Optional[Dict[str, Nullable[Any]]] = None
-
- modular: Optional[Dict[str, Nullable[Any]]] = None
-
- moonshotai: Optional[Dict[str, Nullable[Any]]] = None
-
- morph: Optional[Dict[str, Nullable[Any]]] = None
-
- ncompass: Optional[Dict[str, Nullable[Any]]] = None
-
- nebius: Optional[Dict[str, Nullable[Any]]] = None
-
- nex_agi: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="nex-agi")
- ] = None
-
- nextbit: Optional[Dict[str, Nullable[Any]]] = None
-
- nineteen: Optional[Dict[str, Nullable[Any]]] = None
-
- novita: Optional[Dict[str, Nullable[Any]]] = None
-
- nvidia: Optional[Dict[str, Nullable[Any]]] = None
-
- octoai: Optional[Dict[str, Nullable[Any]]] = None
-
- open_inference: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference")
- ] = None
-
- openai: Optional[Dict[str, Nullable[Any]]] = None
-
- parasail: Optional[Dict[str, Nullable[Any]]] = None
-
- perceptron: Optional[Dict[str, Nullable[Any]]] = None
-
- perplexity: Optional[Dict[str, Nullable[Any]]] = None
-
- phala: Optional[Dict[str, Nullable[Any]]] = None
-
- poolside: Optional[Dict[str, Nullable[Any]]] = None
-
- quiver: Optional[Dict[str, Nullable[Any]]] = None
-
- recraft: Optional[Dict[str, Nullable[Any]]] = None
-
- recursal: Optional[Dict[str, Nullable[Any]]] = None
-
- reflection: Optional[Dict[str, Nullable[Any]]] = None
-
- reka: Optional[Dict[str, Nullable[Any]]] = None
-
- relace: Optional[Dict[str, Nullable[Any]]] = None
-
- replicate: Optional[Dict[str, Nullable[Any]]] = None
-
- sakana: Optional[Dict[str, Nullable[Any]]] = None
-
- sambanova: Optional[Dict[str, Nullable[Any]]] = None
-
- sambanova_cloaked: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked")
- ] = None
-
- seed: Optional[Dict[str, Nullable[Any]]] = None
-
- sf_compute: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute")
- ] = None
-
- siliconflow: Optional[Dict[str, Nullable[Any]]] = None
-
- sourceful: Optional[Dict[str, Nullable[Any]]] = None
-
- stealth: Optional[Dict[str, Nullable[Any]]] = None
-
- stepfun: Optional[Dict[str, Nullable[Any]]] = None
-
- streamlake: Optional[Dict[str, Nullable[Any]]] = None
-
- switchpoint: Optional[Dict[str, Nullable[Any]]] = None
-
- targon: Optional[Dict[str, Nullable[Any]]] = None
-
- tenstorrent: Optional[Dict[str, Nullable[Any]]] = None
-
- together: Optional[Dict[str, Nullable[Any]]] = None
-
- together_lite: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite")
- ] = None
-
- ubicloud: Optional[Dict[str, Nullable[Any]]] = None
-
- upstage: Optional[Dict[str, Nullable[Any]]] = None
-
- venice: Optional[Dict[str, Nullable[Any]]] = None
-
- wafer: Optional[Dict[str, Nullable[Any]]] = None
-
- wandb: Optional[Dict[str, Nullable[Any]]] = None
-
- xai: Optional[Dict[str, Nullable[Any]]] = None
-
- xiaomi: Optional[Dict[str, Nullable[Any]]] = None
-
- z_ai: Annotated[
- Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai")
- ] = None
-
- @model_serializer(mode="wrap")
- def serialize_model(self, handler):
- optional_fields = set(
- [
- "01ai",
- "ai21",
- "aion-labs",
- "akashml",
- "alibaba",
- "amazon-bedrock",
- "amazon-nova",
- "ambient",
- "anthropic",
- "anyscale",
- "arcee-ai",
- "atlas-cloud",
- "atoma",
- "avian",
- "azure",
- "baidu",
- "baseten",
- "black-forest-labs",
- "byteplus",
- "centml",
- "cerebras",
- "chutes",
- "cirrascale",
- "clarifai",
- "cloudflare",
- "cohere",
- "crofai",
- "crucible",
- "crusoe",
- "darkbloom",
- "decart",
- "deepgram",
- "deepinfra",
- "deepseek",
- "dekallm",
- "digitalocean",
- "enfer",
- "fake-provider",
- "featherless",
- "fireworks",
- "friendli",
- "gmicloud",
- "google-ai-studio",
- "google-vertex",
- "gopomelo",
- "groq",
- "heygen",
- "huggingface",
- "hyperbolic",
- "hyperbolic-quantized",
- "inception",
- "inceptron",
- "inferact-vllm",
- "inference-net",
- "infermatic",
- "inflection",
- "inocloud",
- "io-net",
- "ionstream",
- "klusterai",
- "lambda",
- "lepton",
- "liquid",
- "lynn",
- "lynn-private",
- "mancer",
- "mancer-old",
- "mara",
- "meta",
- "minimax",
- "mistral",
- "modal",
- "modelrun",
- "modular",
- "moonshotai",
- "morph",
- "ncompass",
- "nebius",
- "nex-agi",
- "nextbit",
- "nineteen",
- "novita",
- "nvidia",
- "octoai",
- "open-inference",
- "openai",
- "parasail",
- "perceptron",
- "perplexity",
- "phala",
- "poolside",
- "quiver",
- "recraft",
- "recursal",
- "reflection",
- "reka",
- "relace",
- "replicate",
- "sakana",
- "sambanova",
- "sambanova-cloaked",
- "seed",
- "sf-compute",
- "siliconflow",
- "sourceful",
- "stealth",
- "stepfun",
- "streamlake",
- "switchpoint",
- "targon",
- "tenstorrent",
- "together",
- "together-lite",
- "ubicloud",
- "upstage",
- "venice",
- "wafer",
- "wandb",
- "xai",
- "xiaomi",
- "z-ai",
- ]
- )
- serialized = handler(self)
- m = {}
-
- for n, f in type(self).model_fields.items():
- k = f.alias or n
- val = serialized.get(k, serialized.get(n))
-
- if val != UNSET_SENTINEL:
- if val is not None or k not in optional_fields:
- m[k] = val
-
- return m
-
-
-class ImageGenerationRequestProviderTypedDict(TypedDict):
- r"""Provider-specific passthrough configuration"""
-
- options: NotRequired[ImageGenerationRequestOptionsTypedDict]
-
-
-class ImageGenerationRequestProvider(BaseModel):
- r"""Provider-specific passthrough configuration"""
-
- options: Optional[ImageGenerationRequestOptions] = None
-
- @model_serializer(mode="wrap")
- def serialize_model(self, handler):
- optional_fields = set(["options"])
- serialized = handler(self)
- m = {}
-
- for n, f in type(self).model_fields.items():
- k = f.alias or n
- val = serialized.get(k, serialized.get(n))
-
- if val != UNSET_SENTINEL:
- if val is not None or k not in optional_fields:
- m[k] = val
-
- return m
-
-
ImageGenerationRequestQuality = Union[
Literal[
"auto",
@@ -691,8 +108,8 @@ class ImageGenerationRequestTypedDict(TypedDict):
r"""Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob."""
output_format: NotRequired[ImageGenerationRequestOutputFormat]
r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`."""
- provider: NotRequired[ImageGenerationRequestProviderTypedDict]
- r"""Provider-specific passthrough configuration"""
+ provider: NotRequired[ImageGenerationProviderPreferencesTypedDict]
+ r"""Provider routing preferences and provider-specific passthrough configuration."""
quality: NotRequired[ImageGenerationRequestQuality]
r"""Rendering quality. Providers without a quality knob ignore this."""
resolution: NotRequired[ImageGenerationRequestResolution]
@@ -732,8 +149,8 @@ class ImageGenerationRequest(BaseModel):
output_format: Optional[ImageGenerationRequestOutputFormat] = None
r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`."""
- provider: Optional[ImageGenerationRequestProvider] = None
- r"""Provider-specific passthrough configuration"""
+ provider: Optional[ImageGenerationProviderPreferences] = None
+ r"""Provider routing preferences and provider-specific passthrough configuration."""
quality: Optional[ImageGenerationRequestQuality] = None
r"""Rendering quality. Providers without a quality knob ignore this."""
@@ -780,9 +197,3 @@ def serialize_model(self, handler):
m[k] = val
return m
-
-
-try:
- ImageGenerationRequestOptions.model_rebuild()
-except NameError:
- pass
diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py
index abbb3cb3..2d44eabb 100644
--- a/src/openrouter/components/providerpreferences.py
+++ b/src/openrouter/components/providerpreferences.py
@@ -37,10 +37,14 @@
"""
-IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[ProviderName, str])
+ProviderPreferencesIgnoreTypedDict = TypeAliasType(
+ "ProviderPreferencesIgnoreTypedDict", Union[ProviderName, str]
+)
-Ignore = TypeAliasType("Ignore", Union[ProviderName, str])
+ProviderPreferencesIgnore = TypeAliasType(
+ "ProviderPreferencesIgnore", Union[ProviderName, str]
+)
class MaxPriceTypedDict(TypedDict):
@@ -93,25 +97,36 @@ def serialize_model(self, handler):
return m
-OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[ProviderName, str])
+ProviderPreferencesOnlyTypedDict = TypeAliasType(
+ "ProviderPreferencesOnlyTypedDict", Union[ProviderName, str]
+)
-Only = TypeAliasType("Only", Union[ProviderName, str])
+ProviderPreferencesOnly = TypeAliasType(
+ "ProviderPreferencesOnly", Union[ProviderName, str]
+)
-OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
+ProviderPreferencesOrderTypedDict = TypeAliasType(
+ "ProviderPreferencesOrderTypedDict", Union[ProviderName, str]
+)
-Order = TypeAliasType("Order", Union[ProviderName, str])
+ProviderPreferencesOrder = TypeAliasType(
+ "ProviderPreferencesOrder", Union[ProviderName, str]
+)
-SortTypedDict = TypeAliasType(
- "SortTypedDict", Union[ProviderSortConfigTypedDict, ProviderSort, Any]
+ProviderPreferencesSortTypedDict = TypeAliasType(
+ "ProviderPreferencesSortTypedDict",
+ Union[ProviderSortConfigTypedDict, ProviderSort, Any],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
-Sort = TypeAliasType("Sort", Union[ProviderSortConfig, ProviderSort, Any])
+ProviderPreferencesSort = TypeAliasType(
+ "ProviderPreferencesSort", Union[ProviderSortConfig, ProviderSort, Any]
+)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
@@ -132,13 +147,13 @@ class ProviderPreferencesTypedDict(TypedDict):
"""
enforce_distillable_text: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
- ignore: NotRequired[Nullable[List[IgnoreTypedDict]]]
+ ignore: NotRequired[Nullable[List[ProviderPreferencesIgnoreTypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
max_price: NotRequired[MaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
- only: NotRequired[Nullable[List[OnlyTypedDict]]]
+ only: NotRequired[Nullable[List[ProviderPreferencesOnlyTypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
- order: NotRequired[Nullable[List[OrderTypedDict]]]
+ order: NotRequired[Nullable[List[ProviderPreferencesOrderTypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@@ -148,7 +163,7 @@ class ProviderPreferencesTypedDict(TypedDict):
r"""A list of quantization levels to filter the provider by."""
require_parameters: NotRequired[Nullable[bool]]
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
- sort: NotRequired[Nullable[SortTypedDict]]
+ sort: NotRequired[Nullable[ProviderPreferencesSortTypedDict]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
zdr: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
@@ -174,16 +189,16 @@ class ProviderPreferences(BaseModel):
enforce_distillable_text: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
- ignore: OptionalNullable[List[Ignore]] = UNSET
+ ignore: OptionalNullable[List[ProviderPreferencesIgnore]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
max_price: Optional[MaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
- only: OptionalNullable[List[Only]] = UNSET
+ only: OptionalNullable[List[ProviderPreferencesOnly]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
- order: OptionalNullable[List[Order]] = UNSET
+ order: OptionalNullable[List[ProviderPreferencesOrder]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET
@@ -198,7 +213,7 @@ class ProviderPreferences(BaseModel):
require_parameters: OptionalNullable[bool] = UNSET
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
- sort: OptionalNullable[Sort] = UNSET
+ sort: OptionalNullable[ProviderPreferencesSort] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
zdr: OptionalNullable[bool] = UNSET
diff --git a/src/openrouter/images.py b/src/openrouter/images.py
index b7a120ad..8a3080f7 100644
--- a/src/openrouter/images.py
+++ b/src/openrouter/images.py
@@ -34,8 +34,8 @@ def generate(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -67,7 +67,7 @@ def generate(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -101,8 +101,8 @@ def generate(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -134,7 +134,7 @@ def generate(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -168,8 +168,8 @@ def generate(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -204,7 +204,7 @@ def generate(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -237,8 +237,8 @@ def generate(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -273,7 +273,7 @@ def generate(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -310,7 +310,7 @@ def generate(
output_format=output_format,
prompt=prompt,
provider=utils.get_pydantic_model(
- provider, Optional[components.ImageGenerationRequestProvider]
+ provider, Optional[components.ImageGenerationProviderPreferences]
),
quality=quality,
resolution=resolution,
@@ -514,8 +514,8 @@ async def generate_async(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -547,7 +547,7 @@ async def generate_async(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -581,8 +581,8 @@ async def generate_async(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -614,7 +614,7 @@ async def generate_async(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -648,8 +648,8 @@ async def generate_async(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -684,7 +684,7 @@ async def generate_async(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -717,8 +717,8 @@ async def generate_async(
output_format: Optional[components.ImageGenerationRequestOutputFormat] = None,
provider: Optional[
Union[
- components.ImageGenerationRequestProvider,
- components.ImageGenerationRequestProviderTypedDict,
+ components.ImageGenerationProviderPreferences,
+ components.ImageGenerationProviderPreferencesTypedDict,
]
] = None,
quality: Optional[components.ImageGenerationRequestQuality] = None,
@@ -753,7 +753,7 @@ async def generate_async(
:param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1.
:param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.
:param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
- :param provider: Provider-specific passthrough configuration
+ :param provider: Provider routing preferences and provider-specific passthrough configuration.
:param quality: Rendering quality. Providers without a quality knob ignore this.
:param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.
: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.
@@ -790,7 +790,7 @@ async def generate_async(
output_format=output_format,
prompt=prompt,
provider=utils.get_pydantic_model(
- provider, Optional[components.ImageGenerationRequestProvider]
+ provider, Optional[components.ImageGenerationProviderPreferences]
),
quality=quality,
resolution=resolution,
diff --git a/uv.lock b/uv.lock
index fa772e2f..07279f26 100644
--- a/uv.lock
+++ b/uv.lock
@@ -213,7 +213,7 @@ wheels = [
[[package]]
name = "openrouter"
-version = "0.11.24"
+version = "0.11.25"
source = { editable = "." }
dependencies = [
{ name = "httpcore" },