diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fc469655..e3392fa9 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: 7bc4e2b7ddaf5ff60ed1f4fdf4e6014b + docChecksum: 96852a8e676c17daffcd8a465ec163bf docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.2.11 - configChecksum: 18db98838c528641464154ac5df7e0aa + releaseVersion: 1.2.12 + configChecksum: d16185d65c9bdfcdfb73869b3b6a621f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 6ba811c3-4b2b-4301-b318-3a4cd0c8895d - pristine_commit_hash: 138cf1bb159aef251699270741f4b7489b8c232b - pristine_tree_hash: 20a96672f32eeacc5d9710f928293f0f8b693627 + generation_id: d885c5e1-35f6-47af-b676-213af835c000 + pristine_commit_hash: f4a328dddf5613836eba5c89d018635e0cb26805 + pristine_tree_hash: 8c106e26e23bd5d9f341ae4137b4f85bab642b6b features: python: acceptHeaders: 3.0.0 @@ -559,8 +559,8 @@ trackedFiles: pristine_git_object: 53c45463b67a1365c2700f73ddb7330b048e79f0 docs/components/apitype.mdx: id: 1a902c4c05f3 - last_write_checksum: sha1:b44371fc91cba50217bc1bea88874bc308308a1e - pristine_git_object: 32e8ae19301296d4eb6cc2d58574a4682e5814c4 + last_write_checksum: sha1:16bd16cad6941c0f50ca57224d5792ae2efdc8dd + pristine_git_object: d43e0f95c7d37c2a51033cebc9549b08d861f56d docs/components/applypatchcallitem.mdx: id: 00fd75573009 last_write_checksum: sha1:8650be12909ab98cefc237e3499b73d9a79cf3d3 @@ -847,8 +847,8 @@ trackedFiles: pristine_git_object: 8dd2b456e53244a5eaf7e3e957b00840f6fd9601 docs/components/byokkey.mdx: id: f67303c7207c - last_write_checksum: sha1:0a2caaf66c089c787addf36885e49bc9fdacdf01 - pristine_git_object: a30dd4d969fae3008b81fb428f0b1a0f6769262d + last_write_checksum: sha1:fe8cc7b80b0b01c07683163c02ac1c8f7ad36d47 + pristine_git_object: 21f69ce3212aa1fca5c7ce02b78d9b249f15f3ff docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 last_write_checksum: sha1:53f9d2353dba7cd7815e75282d273514d9d916d1 @@ -1643,12 +1643,12 @@ trackedFiles: pristine_git_object: eeda364d2acbb840c15a3f5cc143cf10d1044c74 docs/components/createbyokkeyrequest.mdx: id: 2af3019aa2a7 - last_write_checksum: sha1:bbfd45f22b97f8e3d910e93d3ce3925937d8089d - pristine_git_object: abaa7493badd3a1d95c0d5aff904bf201afb691e + last_write_checksum: sha1:fa51de3c0917b6ae7a96bce2bcb74aeac5a5d9cf + pristine_git_object: 95230b2a6fed0f73db656faec2ce8e6aaa926436 docs/components/createbyokkeyresponse.mdx: id: 73f247dc0e33 - last_write_checksum: sha1:dbfc66ccf928a6675bcabbf84f7f807ef312d9c1 - pristine_git_object: 171266f203c549bda88f1c705421ef57d824f50f + last_write_checksum: sha1:30861793800a2851105bfa5b9406520320129f06 + pristine_git_object: 18d6a80440f1dc702eae3a3917a53a2def1fca72 docs/components/createguardrailrequest.mdx: id: c1a768f054c0 last_write_checksum: sha1:d32d712d132971b34f6d81d28ff45d22d919f4ac @@ -2439,8 +2439,8 @@ trackedFiles: pristine_git_object: d8beea524e93ab8059a7eca00b12316e681252da docs/components/getbyokkeyresponse.mdx: id: 451f36940fbd - last_write_checksum: sha1:fa59fd86561039867053db8c9bed10c017c8b462 - pristine_git_object: 9ba2819574bd41baeabe760977e6961a74033141 + last_write_checksum: sha1:eb48f4135b67e3098078260259b9077ede26578c + pristine_git_object: 26ce72e64459f02c6247db183d67a853e3b0de32 docs/components/getguardrailresponse.mdx: id: a5ffd4aa91ea last_write_checksum: sha1:1b5cf22952bbe43de45da9ce526eff0229c6abd6 @@ -3025,6 +3025,14 @@ trackedFiles: id: 6cf9cf093489 last_write_checksum: sha1:a0555dca77b390a95c2bc79aae41b2ae53eb96f0 pristine_git_object: 77b2e34176730645168f5953bca6c98134dc37e8 + docs/components/internchatsteeredresponse.mdx: + id: 9e93a736a63b + last_write_checksum: sha1:0c8fec19cce78719791ff8b59c672ff51ca58ef9 + pristine_git_object: 51fdf717853566f95dba70470cbcf414414f1d80 + docs/components/internchatsteeredresponsestatus.mdx: + id: 47fb740d8f87 + last_write_checksum: sha1:9fc59dfe45b19a09b077a2dbd30c88561406b61c + pristine_git_object: 1ac306e63cb6601a5d9b123c09675175232436a9 docs/components/internchatstreamerror.mdx: id: d960f7518865 last_write_checksum: sha1:93c6917119e7a9b36c8736c614a505ea86c8f7de @@ -6083,12 +6091,12 @@ trackedFiles: pristine_git_object: 5a7e1816ae9370995ad90941ba4ba288d170d421 docs/components/updatebyokkeyrequest.mdx: id: db0862ec6814 - last_write_checksum: sha1:7e93a859e834cdb41fee4873a16b92e7a67f607a - pristine_git_object: d349f605bc1806d1e81e5f8e6aa71ad1cf3c3ba0 + last_write_checksum: sha1:1c349220240b1ff823e050cb05a62cc1d20b8886 + pristine_git_object: d496aaeae691dbcbfe6b1337fddb8b9b32ae0bf8 docs/components/updatebyokkeyresponse.mdx: id: 9b4490c340b4 - last_write_checksum: sha1:89f4cac116b333285ee9bd6796c172877f6f8bd8 - pristine_git_object: 5b502ce1a0efb996a17d68140252755ae9f4acbb + last_write_checksum: sha1:5ca8cef381afdb1c03ce16df023738e163dab13b + pristine_git_object: cad8d3e654b3c1c1b570f80f73f1173a72e17db2 docs/components/updateguardrailrequest.mdx: id: 450912b18db6 last_write_checksum: sha1:f0e2aaf8ecb96d8b53a02768ec260472490963cd @@ -6723,8 +6731,8 @@ trackedFiles: pristine_git_object: 6c0f59590a3d8a4377b7be09672cfca88605359e docs/operations/createinternchatcompletionresponseresult.mdx: id: 266a0e6c2271 - last_write_checksum: sha1:dbd3b8c92f4b7d2ec1cd9c6af6730b82bf9d3cd5 - pristine_git_object: df62ccd54237a8c5dd59e31bf51a5b789a540d72 + last_write_checksum: sha1:bac4089c3a8038cc24187d1e75ba90d2eaf2a0f4 + pristine_git_object: b91c4809ecf8b501336052097400f0c70f649010 docs/operations/createinternglobals.mdx: id: 45b4d0de1076 last_write_checksum: sha1:d9bae324793bf0ceed41e23e92bf267574cd7834 @@ -7375,8 +7383,8 @@ trackedFiles: pristine_git_object: f55e2c02b03447091d650816e02b71aa2d5ee562 docs/operations/listbyokkeysresponse.mdx: id: ad2f5a3c160a - last_write_checksum: sha1:339ffcf7263677ae9eac3d9bed76af577c1d1f8d - pristine_git_object: 6614535bdabbfd0f9f0a3b0df091c1e06d86109a + last_write_checksum: sha1:d4acf188154a0868e3996127dad92c05dff40a33 + pristine_git_object: 24f7bad2b0740b139960ffdc836943c3ba76732a docs/operations/listcontainerfilesglobals.mdx: id: 89c4df41f2bf last_write_checksum: sha1:0aaf5478ab48cac7f3c7dc011b5b7fdf0f040491 @@ -8067,8 +8075,8 @@ trackedFiles: pristine_git_object: 08ef8d73c050b6baab18ef6e246a1d074179b21f docs/sdks/byok/README.mdx: id: 17792f3b180d - last_write_checksum: sha1:8e2664cb1e98c4e170fc20d364e2a3bb40715cc8 - pristine_git_object: 4a64250d82ec39d28856b8dbcb3d3d6831ca4976 + last_write_checksum: sha1:7d9373a5a1d5c41b8dc333641812c07a4837965b + pristine_git_object: 9326d7d136af4b87609a5794331bc4a78bd6bdde docs/sdks/chat/README.mdx: id: 1dd859c23fe1 last_write_checksum: sha1:75cf7ecf14bdaae4b3e2c767dc3d2c9d9e41d31c @@ -8187,8 +8195,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:cf86197fe77b35a04bc2bfb53ac21533998114b6 - pristine_git_object: 4f3dc63192bcc162b105326871f5f5fb18aaa360 + last_write_checksum: sha1:0f27a908caef2f59a9b4f38c0d813cbca2196002 + pristine_git_object: 94c5228ca40a2560aac632886116adaccc0d5028 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -8215,8 +8223,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:73e68e10ce3f843ddc8a90298772d8ac15eca3a2 - pristine_git_object: 4a594e6072be0f35dafcda7f40fc6e72c97ab192 + last_write_checksum: sha1:473aead99878d6d7b03c8ebf23946926083e816d + pristine_git_object: 4ceb9dbd91bbcbf683170e3f2d82c979970a1cf0 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:0c25a52ed5fb688ec1e923e4e82bcfc9cae49465 @@ -8247,8 +8255,8 @@ trackedFiles: pristine_git_object: 412aed86e32b1fd166d27e06e562463fa2b04395 src/openrouter/byok.py: id: bec352462ae1 - last_write_checksum: sha1:ddb52d17b77021f5d53ab22fb9ffef447a61682e - pristine_git_object: 22834caf78784ff99d3be6cd4fe3f4eea01ac859 + last_write_checksum: sha1:ed4d5ecf5b0bf3fd004cc8629474ec0e100c0df5 + pristine_git_object: 2cc6ba136f9a53803849ba48ab3c85db9ed12436 src/openrouter/chat.py: id: 723fdce15c1d last_write_checksum: sha1:1a4e5375fb95884be6db0f508e1c2c9cda27b20e @@ -8259,8 +8267,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:e94914ac35c3a452f21a0ea52e9a137bf5ee7674 - pristine_git_object: 32e9db7534eae3fa697da87935cae18fbf391c27 + last_write_checksum: sha1:22f126f19f0c274c6b088c353a4870b0c06e5bd6 + pristine_git_object: 737e3eb96b8cc6f5ce5d0d5020a515d6a317090d src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8631,8 +8639,8 @@ trackedFiles: pristine_git_object: 219148fc990faf0541310cf55cf11ffbcccc2e55 src/openrouter/components/byokkey.py: id: 94a3339e7dfc - last_write_checksum: sha1:dc2022d664fd6d0966949f4f746134dc6c6d2f0f - pristine_git_object: faaeb8190aed90e810758aadaf59184aabe0b0d3 + last_write_checksum: sha1:a8f0cf319e0402e9243e182baad52fa8d6954240 + pristine_git_object: 22f7dfead05fc7561df8b836371fd7a2c83188d6 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf last_write_checksum: sha1:e1a48daaa5ca076c76f00ad49c2e85d8aa96400c @@ -8975,8 +8983,8 @@ trackedFiles: pristine_git_object: 15b66bb18088bd61cccfa17e1cb5ef26c02abc84 src/openrouter/components/createbyokkeyrequest.py: id: 238e868445b4 - last_write_checksum: sha1:450f68577d97eec17129e43079938d027d1d0983 - pristine_git_object: ec75ee3640ab3dc8384b0cfb23f62f37951e5b82 + last_write_checksum: sha1:75e268ee84fc014142b555487c53d1913c12cc2b + pristine_git_object: 593ecbdc4f56e4dff6a7128d0154a9b9f34ab0f4 src/openrouter/components/createbyokkeyresponse.py: id: 2b6c5e13270a last_write_checksum: sha1:a7a2a40b9ac16a975a4c5ecc8802fc0b7785691c @@ -9323,8 +9331,8 @@ trackedFiles: pristine_git_object: 5caeacf169f3edff5b6e9823264aeeff8be1e8ff src/openrouter/components/generationresponse.py: id: 84d4e3e7da8b - last_write_checksum: sha1:5f7053e062244d74159db0eea89a43cfd35f5c1d - pristine_git_object: 2d84649ead8f1173b79176d5bee4daf5402b5712 + last_write_checksum: sha1:08ca137ea6dce62a09e0eb8d16f0821cee769a66 + pristine_git_object: f09bb92b8ae24346009107a3b14a7f826645ec1f src/openrouter/components/getbyokkeyresponse.py: id: ca3a8db80018 last_write_checksum: sha1:9b428028a01ffb73915a278096ca51bd1c660326 @@ -9593,6 +9601,10 @@ trackedFiles: id: db8fcf7252a0 last_write_checksum: sha1:551079dcc7a264200845ed175ba23246a8e54797 pristine_git_object: 592244a0e5455e3cb419bc725413c859d25f6ad9 + src/openrouter/components/internchatsteeredresponse.py: + id: 0193362595df + last_write_checksum: sha1:14f5cfb8ea1b9c0c3eef641831209f518ef66152 + pristine_git_object: 811d58ee11f2d4209cb7333b30a04ba5c48046b9 src/openrouter/components/internchatstreamerror.py: id: c4e363e9080c last_write_checksum: sha1:574315e1f05594bdaec0f34ff6b7052fbe3af23c @@ -10819,8 +10831,8 @@ trackedFiles: pristine_git_object: 696d3c578c6b09f9768e52a7dd000284fb62f1b7 src/openrouter/components/updatebyokkeyrequest.py: id: 5edad69c278d - last_write_checksum: sha1:a17d7f0f7eefb4e21b67267991711ad7efe07c20 - pristine_git_object: e60d79612613b0aeeeb336ccd97c3bed7905b667 + last_write_checksum: sha1:0946f9ccd054880656aa98643be4e773b276a9af + pristine_git_object: c2b4fb7d1982557f6e3e8b6a1090ebbdee5ace17 src/openrouter/components/updatebyokkeyresponse.py: id: 31338080f7cc last_write_checksum: sha1:794d77355ae37451076a6b5754c6c8cc77063047 @@ -11163,8 +11175,8 @@ trackedFiles: pristine_git_object: 50643a126668498dd668c7cceb9f78c03d413d32 src/openrouter/interns.py: id: d18df05c5c6d - last_write_checksum: sha1:2842133a9360e0c3f26c20dbf93b87a6d180c395 - pristine_git_object: 087c09b4896bd56a5cc4e2d86f9686a1e747f86e + last_write_checksum: sha1:ee8a7854d254cdaf039db80a5e9daa06c3f846dc + pristine_git_object: 817b8db61748eb72909ecd1441c689002491b4d6 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -11263,8 +11275,8 @@ trackedFiles: pristine_git_object: 4443b789b7d9f68a1d25d085da8aeb80cadd2f8f src/openrouter/operations/createinternchatcompletion.py: id: 3d0567b5533b - last_write_checksum: sha1:45a571239c1fbe5030712cfa0eb4594a0d2e366e - pristine_git_object: de66beac18f237ad536b93094a36352366788f6e + last_write_checksum: sha1:f4db00ec08c8b0a0ebaaf4699fc9911e50e5c825 + pristine_git_object: e25761cb500ef9cc21adf91165fb9f11fb8379da src/openrouter/operations/createkeys.py: id: 64ad31fdaa6c last_write_checksum: sha1:92e122bf7ca252e6cc1f4200cbcd6ded9a0d35a7 @@ -12685,7 +12697,7 @@ examples: limit: 50 responses: "200": - application/json: {"data": [{"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}], "total_count": 1} + application/json: {"data": [{"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "declared_zdr": null, "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}], "total_count": 1} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": @@ -12698,7 +12710,7 @@ examples: application/json: {"key": "sk-proj-abc123...", "provider": "openai"} responses: "201": - application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} + application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "declared_zdr": null, "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -12728,7 +12740,7 @@ examples: id: "11111111-2222-3333-4444-555555555555" responses: "200": - application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} + application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "declared_zdr": null, "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -12744,7 +12756,7 @@ examples: application/json: {} responses: "200": - application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} + application/json: {"data": {"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "declared_zdr": null, "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_byok_only": false, "is_fallback": false, "is_required": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -14998,6 +15010,8 @@ examples: application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} "503": application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} + "202": + application/json: {"session_id": "sess_01j9x0k4q7v8r2t3m6n5p8w9y1", "status": "steered"} createSystemone: speakeasy-default-create-systemone: requestBody: @@ -15030,4 +15044,4 @@ examples: "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: `request` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: `request` **Changed**\n* `open_router.presets.create_presets_messages()`: `request` **Changed**\n* `open_router.presets.create_presets_responses()`: `request` **Changed**\n* `open_router.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.beta.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.interns.chat()`: `response.status[202]` **Added** (Breaking ⚠️)\n* `open_router.byok.list()`: `response.data[].declared_zdr` **Added**\n* `open_router.byok.create()`: \n * `request.declared_zdr` **Added**\n * `response.data.declared_zdr` **Added**\n* `open_router.byok.get()`: `response.data.declared_zdr` **Added**\n* `open_router.byok.update()`: \n * `request.declared_zdr` **Added**\n * `response.data.declared_zdr` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index bd8e6946..3ee55956 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.2.11 + version: 1.2.12 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 83ef3f95..a0038f96 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4570,6 +4570,7 @@ components: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -4613,6 +4614,12 @@ components: description: 'ISO timestamp of when the credential was created.' example: '2025-08-24T10:30:00Z' type: 'string' + declared_zdr: + description: 'Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter''s data policy for the provider''s endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.' + example: null + type: + - 'boolean' + - 'null' disabled: description: 'Whether this credential is currently disabled.' example: false @@ -4666,6 +4673,7 @@ components: - 'is_fallback' - 'is_required' - 'is_byok_only' + - 'declared_zdr' - 'allowed_models' - 'allowed_api_key_hashes' - 'allowed_user_ids' @@ -7383,6 +7391,12 @@ components: type: - 'array' - 'null' + declared_zdr: + description: 'Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter''s data policy for the provider''s endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.' + example: null + type: + - 'boolean' + - 'null' disabled: description: 'Whether this credential should be created in a disabled state.' example: false @@ -7429,6 +7443,7 @@ components: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -10214,11 +10229,11 @@ components: - 'completions' - 'embeddings' - 'rerank' + - 'decisions' + - 'video' - 'tts' - 'stt' - - 'video' - 'image' - - 'decisions' - null type: - 'string' @@ -10535,6 +10550,7 @@ components: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -12858,6 +12874,25 @@ components: required: - 'cached_tokens' type: 'object' + InternChatSteeredResponse: + description: 'The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here.' + example: + session_id: 'sess_01j9x0k4q7v8r2t3m6n5p8w9y1' + status: 'steered' + properties: + session_id: + description: 'The session of the running turn the message was delivered to.' + example: 'sess_01j9x0k4q7v8r2t3m6n5p8w9y1' + type: 'string' + status: + description: 'The message was handed to the turn already running on this session.' + enum: + - 'steered' + type: 'string' + required: + - 'session_id' + - 'status' + type: 'object' InternChatStreamError: description: 'A failure after the response headers were sent. The chunk that carries it has `finish_reason: "error"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.' example: @@ -13267,6 +13302,7 @@ components: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -27776,6 +27812,12 @@ components: type: - 'array' - 'null' + declared_zdr: + description: 'Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter''s data policy for the provider''s endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.' + example: null + type: + - 'boolean' + - 'null' disabled: description: 'Whether this credential is disabled.' example: false @@ -27812,6 +27854,7 @@ components: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -31562,6 +31605,7 @@ paths: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -31644,6 +31688,7 @@ paths: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -31785,6 +31830,7 @@ paths: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -31864,6 +31910,7 @@ paths: allowed_models: null allowed_user_ids: null created_at: '2025-08-24T10:30:00Z' + declared_zdr: null disabled: false id: '11111111-2222-3333-4444-555555555555' is_byok_only: false @@ -37238,6 +37285,12 @@ paths: schema: $ref: '#/components/schemas/InternChatCompletionChunk' description: 'The streamed completion. Chunks carry text, then a finish chunk: `finish_reason: "stop"` when the turn is complete, `finish_reason: "tool_calls"` when the intern is waiting for an answer, or `finish_reason: "error"` for a failure after this status. A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the intern reported usage, and always `null` after `tool_calls`), and the stream ends with `data: [DONE]`.' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/InternChatSteeredResponse' + description: 'A turn is already running on this intern for the same `session_id`, and the message was delivered into it instead of starting a new turn. Nothing streams here: the intern takes the message up on the running turn, whose stream continues on the request that started it. Sent only for a `user` message with a `session_id`; a `tool` reply, a request without a `session_id`, or one for another session gets `409 busy`, as does a message the intern could not take.' '400': content: application/json: @@ -37309,7 +37362,7 @@ paths: retryable: false schema: $ref: '#/components/schemas/InternChatErrorResponse' - description: 'The intern is not running (`intern_not_ready`), another turn is already running on this intern (`busy`), the question is no longer waiting (`interaction_not_pending`), or another request is already attached to the run (`attachment_failed`). The turn lock is per intern, not per session. `intern_not_ready` and `busy` report `retryable: true`, and a `busy` refusal carries `Retry-After`.' + description: 'The intern is not running (`intern_not_ready`), another turn is already running on this intern for a different session, for no session, or for a `tool` reply (`busy`), the question is no longer waiting (`interaction_not_pending`), or another request is already attached to the run (`attachment_failed`). The turn lock is per intern, not per session. `intern_not_ready` and `busy` report `retryable: true`, and a `busy` refusal carries `Retry-After`.' headers: Retry-After: description: 'Seconds to wait before retrying this request. Present only on a `busy` refusal.' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 98493994..40029cfe 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:74de8f20bb42a350b592daa622a1adf3f86b82145addc9650f1150ba07c5ba96 - sourceBlobDigest: sha256:8d2ecb843db7a0b1f4e7ab4db9ccf09fc4531b264789b8fac03f3337f92ea5e4 + sourceRevisionDigest: sha256:c35dc5499ca6883e191f921c4a50e5c45ae09daccd130f34af46cb7ee18a44f4 + sourceBlobDigest: sha256:fc62c51c841c1730b744b0177d7b714def70ebcc12b313f96fc925f4d4ad84d7 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:74de8f20bb42a350b592daa622a1adf3f86b82145addc9650f1150ba07c5ba96 - sourceBlobDigest: sha256:8d2ecb843db7a0b1f4e7ab4db9ccf09fc4531b264789b8fac03f3337f92ea5e4 + sourceRevisionDigest: sha256:c35dc5499ca6883e191f921c4a50e5c45ae09daccd130f34af46cb7ee18a44f4 + sourceBlobDigest: sha256:fc62c51c841c1730b744b0177d7b714def70ebcc12b313f96fc925f4d4ad84d7 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:e3ae5ea70e5b2b1730d77e0084828c0c02d908cc22ff455eed790ca263a223d1 + codeSamplesRevisionDigest: sha256:1b8e0a86712a06b4708ccd9196d1f6d5dcc25249fd34c99323bd89586af4aa97 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 2c7a2cf6..ede5c909 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2519,4 +2519,14 @@ Based on: ### Generated - [python v1.2.11] . ### Releases -- [PyPI v1.2.11] https://pypi.org/project/openrouter/1.2.11 - . \ No newline at end of file +- [PyPI v1.2.11] https://pypi.org/project/openrouter/1.2.11 - . + +## 2026-09-21 20:58:16 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.2.12] . +### Releases +- [PyPI v1.2.12] https://pypi.org/project/openrouter/1.2.12 - . \ No newline at end of file diff --git a/docs/components/apitype.mdx b/docs/components/apitype.mdx index 32e8ae19..d43e0f95 100644 --- a/docs/components/apitype.mdx +++ b/docs/components/apitype.mdx @@ -21,8 +21,8 @@ This is an open enum. Unrecognized values will not fail type checks. - `"completions"` - `"embeddings"` - `"rerank"` +- `"decisions"` +- `"video"` - `"tts"` - `"stt"` -- `"video"` - `"image"` -- `"decisions"` diff --git a/docs/components/byokkey.mdx b/docs/components/byokkey.mdx index a30dd4d9..21f69ce3 100644 --- a/docs/components/byokkey.mdx +++ b/docs/components/byokkey.mdx @@ -4,19 +4,20 @@ title: "BYOKKey" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_api_key_hashes` | List[*str*] | :heavy_check_mark: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | -| `allowed_models` | List[*str*] | :heavy_check_mark: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | -| `allowed_user_ids` | List[*str*] | :heavy_check_mark: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | -| `created_at` | *str* | :heavy_check_mark: | ISO timestamp of when the credential was created. | 2025-08-24T10:30:00Z | -| `disabled` | *bool* | :heavy_check_mark: | Whether this credential is currently disabled. | false | -| `id` | *str* | :heavy_check_mark: | Stable public identifier for this BYOK credential. | 11111111-2222-3333-4444-555555555555 | -| `is_byok_only` | *bool* | :heavy_check_mark: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. | false | -| `is_fallback` | *bool* | :heavy_check_mark: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | -| `is_required` | *bool* | :heavy_check_mark: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. | false | -| `label` | *str* | :heavy_check_mark: | Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI. | sk-...AbCd | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | -| `provider` | [components.BYOKProviderSlug](../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | -| `sort_order` | *int* | :heavy_check_mark: | Position within the provider — credentials are tried in ascending sort order. | 0 | -| `workspace_id` | *Nullable[str]* | :heavy_check_mark: | The workspace this credential is scoped to, or `null` when it is global — usable across every workspace in the account. A `null` value does not mean the default workspace. | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_api_key_hashes` | List[*str*] | :heavy_check_mark: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | +| `allowed_models` | List[*str*] | :heavy_check_mark: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | +| `allowed_user_ids` | List[*str*] | :heavy_check_mark: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | +| `created_at` | *str* | :heavy_check_mark: | ISO timestamp of when the credential was created. | 2025-08-24T10:30:00Z | +| `declared_zdr` | *Nullable[bool]* | :heavy_check_mark: | Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. | null | +| `disabled` | *bool* | :heavy_check_mark: | Whether this credential is currently disabled. | false | +| `id` | *str* | :heavy_check_mark: | Stable public identifier for this BYOK credential. | 11111111-2222-3333-4444-555555555555 | +| `is_byok_only` | *bool* | :heavy_check_mark: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. | false | +| `is_fallback` | *bool* | :heavy_check_mark: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | +| `is_required` | *bool* | :heavy_check_mark: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. | false | +| `label` | *str* | :heavy_check_mark: | Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI. | sk-...AbCd | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | +| `provider` | [components.BYOKProviderSlug](../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | +| `sort_order` | *int* | :heavy_check_mark: | Position within the provider — credentials are tried in ascending sort order. | 0 | +| `workspace_id` | *Nullable[str]* | :heavy_check_mark: | The workspace this credential is scoped to, or `null` when it is global — usable across every workspace in the account. A `null` value does not mean the default workspace. | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file diff --git a/docs/components/createbyokkeyrequest.mdx b/docs/components/createbyokkeyrequest.mdx index abaa7493..95230b2a 100644 --- a/docs/components/createbyokkeyrequest.mdx +++ b/docs/components/createbyokkeyrequest.mdx @@ -4,16 +4,17 @@ title: "CreateBYOKKeyRequest" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | -| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | -| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential should be created in a disabled state. | false | -| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. | false | -| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | -| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Defaults to `false`. | false | -| `key` | *str* | :heavy_check_mark: | The raw provider API key or credential. This value is encrypted at rest and never returned in API responses. | sk-proj-abc123... | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | -| `provider` | [components.BYOKProviderSlug](../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to scope the credential to. When omitted, the credential is created in the account's default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | +| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | +| `declared_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`. | null | +| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential should be created in a disabled state. | false | +| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. | false | +| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | +| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Defaults to `false`. | false | +| `key` | *str* | :heavy_check_mark: | The raw provider API key or credential. This value is encrypted at rest and never returned in API responses. | sk-proj-abc123... | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | +| `provider` | [components.BYOKProviderSlug](../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to scope the credential to. When omitted, the credential is created in the account's default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file diff --git a/docs/components/createbyokkeyresponse.mdx b/docs/components/createbyokkeyresponse.mdx index 171266f2..18d6a804 100644 --- a/docs/components/createbyokkeyresponse.mdx +++ b/docs/components/createbyokkeyresponse.mdx @@ -4,6 +4,6 @@ title: "CreateBYOKKeyResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"declared_zdr": null,
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file diff --git a/docs/components/getbyokkeyresponse.mdx b/docs/components/getbyokkeyresponse.mdx index 9ba28195..26ce72e6 100644 --- a/docs/components/getbyokkeyresponse.mdx +++ b/docs/components/getbyokkeyresponse.mdx @@ -4,6 +4,6 @@ title: "GetBYOKKeyResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"declared_zdr": null,
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file diff --git a/docs/components/internchatsteeredresponse.mdx b/docs/components/internchatsteeredresponse.mdx new file mode 100644 index 00000000..51fdf717 --- /dev/null +++ b/docs/components/internchatsteeredresponse.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatSteeredResponse" +--- + +The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `session_id` | *str* | :heavy_check_mark: | The session of the running turn the message was delivered to. | sess_01j9x0k4q7v8r2t3m6n5p8w9y1 | +| `status` | [components.InternChatSteeredResponseStatus](../components/internchatsteeredresponsestatus.mdx) | :heavy_check_mark: | The message was handed to the turn already running on this session. | | \ No newline at end of file diff --git a/docs/components/internchatsteeredresponsestatus.mdx b/docs/components/internchatsteeredresponsestatus.mdx new file mode 100644 index 00000000..1ac306e6 --- /dev/null +++ b/docs/components/internchatsteeredresponsestatus.mdx @@ -0,0 +1,17 @@ +--- +title: "InternChatSteeredResponseStatus" +--- + +The message was handed to the turn already running on this session. + +## Example Usage + +```python +from openrouter.components import InternChatSteeredResponseStatus +value: InternChatSteeredResponseStatus = "steered" +``` + + +## Values + +- `"steered"` diff --git a/docs/components/updatebyokkeyrequest.mdx b/docs/components/updatebyokkeyrequest.mdx index d349f605..d496aaea 100644 --- a/docs/components/updatebyokkeyrequest.mdx +++ b/docs/components/updatebyokkeyrequest.mdx @@ -4,14 +4,15 @@ title: "UpdateBYOKKeyRequest" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | -| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | -| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is disabled. | false | -| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. | false | -| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. | false | -| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Omit to leave the stored value unchanged. | false | -| `key` | *Optional[str]* | :heavy_minus_sign: | A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses. | sk-proj-newkey456... | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Updated OpenAI Key | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | +| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | +| `declared_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration. | null | +| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is disabled. | false | +| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. | false | +| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. | false | +| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Omit to leave the stored value unchanged. | false | +| `key` | *Optional[str]* | :heavy_minus_sign: | A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses. | sk-proj-newkey456... | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Updated OpenAI Key | \ No newline at end of file diff --git a/docs/components/updatebyokkeyresponse.mdx b/docs/components/updatebyokkeyresponse.mdx index 5b502ce1..cad8d3e6 100644 --- a/docs/components/updatebyokkeyresponse.mdx +++ b/docs/components/updatebyokkeyresponse.mdx @@ -4,6 +4,6 @@ title: "UpdateBYOKKeyResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.BYOKKey](../components/byokkey.mdx) | :heavy_check_mark: | N/A | \{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"declared_zdr": null,
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
} | \ No newline at end of file diff --git a/docs/operations/createinternchatcompletionresponseresult.mdx b/docs/operations/createinternchatcompletionresponseresult.mdx index df62ccd5..b91c4809 100644 --- a/docs/operations/createinternchatcompletionresponseresult.mdx +++ b/docs/operations/createinternchatcompletionresponseresult.mdx @@ -16,3 +16,9 @@ value: Union[eventstreaming.EventStream[components.InternChatCompletionChunk], e value: components.InternChatCompletionChunk = /* values here */ ``` +### `components.InternChatSteeredResponse` + +```python +value: components.InternChatSteeredResponse = /* values here */ +``` + diff --git a/docs/operations/listbyokkeysresponse.mdx b/docs/operations/listbyokkeysresponse.mdx index 6614535b..24f7bad2 100644 --- a/docs/operations/listbyokkeysresponse.mdx +++ b/docs/operations/listbyokkeysresponse.mdx @@ -4,6 +4,6 @@ title: "ListBYOKKeysResponse" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | [components.ListBYOKKeysResponse](../components/listbyokkeysresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"total_count": 1
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListBYOKKeysResponse](../components/listbyokkeysresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"allowed_api_key_hashes": null,
"allowed_models": null,
"allowed_user_ids": null,
"created_at": "2025-08-24T10:30:00Z",
"declared_zdr": null,
"disabled": false,
"id": "11111111-2222-3333-4444-555555555555",
"is_byok_only": false,
"is_fallback": false,
"is_required": false,
"label": "sk-...AbCd",
"name": "Production OpenAI Key",
"provider": "openai",
"sort_order": 0,
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"total_count": 1
} | \ No newline at end of file diff --git a/docs/sdks/byok/README.mdx b/docs/sdks/byok/README.mdx index 4a64250d..9326d7d1 100644 --- a/docs/sdks/byok/README.mdx +++ b/docs/sdks/byok/README.mdx @@ -95,23 +95,24 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `key` | *str* | :heavy_check_mark: | The raw provider API key or credential. This value is encrypted at rest and never returned in API responses. | sk-proj-abc123... | -| `provider` | [components.BYOKProviderSlug](../../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | -| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | -| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential should be created in a disabled state. | false | -| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. | false | -| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | -| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Defaults to `false`. | false | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to scope the credential to. When omitted, the credential is created in the account's default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 550e8400-e29b-41d4-a716-446655440000 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `key` | *str* | :heavy_check_mark: | The raw provider API key or credential. This value is encrypted at rest and never returned in API responses. | sk-proj-abc123... | +| `provider` | [components.BYOKProviderSlug](../../components/byokproviderslug.mdx) | :heavy_check_mark: | The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`). | openai | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | +| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | +| `declared_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`. | null | +| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential should be created in a disabled state. | false | +| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. | false | +| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. | false | +| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Defaults to `false`. | false | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Production OpenAI Key | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to scope the credential to. When omitted, the credential is created in the account's default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 550e8400-e29b-41d4-a716-446655440000 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -250,22 +251,23 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The BYOK credential ID (UUID). | 11111111-2222-3333-4444-555555555555 | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | -| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | -| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is disabled. | false | -| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. | false | -| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. | false | -| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Omit to leave the stored value unchanged. | false | -| `key` | *Optional[str]* | :heavy_minus_sign: | A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses. | sk-proj-newkey456... | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Updated OpenAI Key | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The BYOK credential ID (UUID). | 11111111-2222-3333-4444-555555555555 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allowed_api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. | [
"f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Optional allowlist of model slugs this credential may be used for. `null` means no restriction. | null | +| `allowed_user_ids` | List[*str*] | :heavy_minus_sign: | Optional allowlist of user IDs that may use this credential. `null` means no restriction. | null | +| `declared_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration. | null | +| `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is disabled. | false | +| `is_byok_only` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. | false | +| `is_fallback` | *Optional[bool]* | :heavy_minus_sign: | Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. | false | +| `is_required` | *Optional[bool]* | :heavy_minus_sign: | Whether OpenRouter's shared endpoints on this provider are removed for the models this credential applies to (its `allowed_models`, or every model when `null`). Requests for those models run only on your keys; models outside the allowlist may still fall back to shared capacity on this provider. Omit to leave the stored value unchanged. | false | +| `key` | *Optional[str]* | :heavy_minus_sign: | A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses. | sk-proj-newkey456... | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional human-readable name for the credential. | Updated OpenAI Key | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 4f3dc631..94c5228c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.2.11" +version = "1.2.12" 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 4a594e60..4ceb9dbd 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.2.11" +__version__: str = "1.2.12" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.2.11 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.2.12 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/byok.py b/src/openrouter/byok.py index 22834caf..2cc6ba13 100644 --- a/src/openrouter/byok.py +++ b/src/openrouter/byok.py @@ -369,6 +369,7 @@ def create( allowed_api_key_hashes: OptionalNullable[Iterable[str]] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET, + declared_zdr: OptionalNullable[bool] = UNSET, disabled: Optional[bool] = None, is_byok_only: Optional[bool] = None, is_fallback: Optional[bool] = None, @@ -396,6 +397,7 @@ def create( :param allowed_api_key_hashes: Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. :param allowed_models: Optional allowlist of model slugs this credential may be used for. `null` means no restriction. :param allowed_user_ids: Optional allowlist of user IDs that may use this credential. `null` means no restriction. + :param declared_zdr: Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`. :param disabled: Whether this credential should be created in a disabled state. :param is_byok_only: Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. :param is_fallback: Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. @@ -431,6 +433,7 @@ def create( allowed_user_ids=utils.unmarshal( allowed_user_ids, OptionalNullable[List[str]] ), + declared_zdr=declared_zdr, disabled=disabled, is_byok_only=is_byok_only, is_fallback=is_fallback, @@ -547,6 +550,7 @@ async def create_async( allowed_api_key_hashes: OptionalNullable[Iterable[str]] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET, + declared_zdr: OptionalNullable[bool] = UNSET, disabled: Optional[bool] = None, is_byok_only: Optional[bool] = None, is_fallback: Optional[bool] = None, @@ -574,6 +578,7 @@ async def create_async( :param allowed_api_key_hashes: Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. :param allowed_models: Optional allowlist of model slugs this credential may be used for. `null` means no restriction. :param allowed_user_ids: Optional allowlist of user IDs that may use this credential. `null` means no restriction. + :param declared_zdr: Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`. :param disabled: Whether this credential should be created in a disabled state. :param is_byok_only: Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Defaults to `false`. :param is_fallback: Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. @@ -609,6 +614,7 @@ async def create_async( allowed_user_ids=utils.unmarshal( allowed_user_ids, OptionalNullable[List[str]] ), + declared_zdr=declared_zdr, disabled=disabled, is_byok_only=is_byok_only, is_fallback=is_fallback, @@ -1236,6 +1242,7 @@ def update( allowed_api_key_hashes: OptionalNullable[Iterable[str]] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET, + declared_zdr: OptionalNullable[bool] = UNSET, disabled: Optional[bool] = None, is_byok_only: Optional[bool] = None, is_fallback: Optional[bool] = None, @@ -1262,6 +1269,7 @@ def update( :param allowed_api_key_hashes: Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. :param allowed_models: Optional allowlist of model slugs this credential may be used for. `null` means no restriction. :param allowed_user_ids: Optional allowlist of user IDs that may use this credential. `null` means no restriction. + :param declared_zdr: Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration. :param disabled: Whether this credential is disabled. :param is_byok_only: Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. :param is_fallback: Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. @@ -1298,6 +1306,7 @@ def update( allowed_user_ids=utils.unmarshal( allowed_user_ids, OptionalNullable[List[str]] ), + declared_zdr=declared_zdr, disabled=disabled, is_byok_only=is_byok_only, is_fallback=is_fallback, @@ -1416,6 +1425,7 @@ async def update_async( allowed_api_key_hashes: OptionalNullable[Iterable[str]] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET, + declared_zdr: OptionalNullable[bool] = UNSET, disabled: Optional[bool] = None, is_byok_only: Optional[bool] = None, is_fallback: Optional[bool] = None, @@ -1442,6 +1452,7 @@ async def update_async( :param allowed_api_key_hashes: Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400. :param allowed_models: Optional allowlist of model slugs this credential may be used for. `null` means no restriction. :param allowed_user_ids: Optional allowlist of user IDs that may use this credential. `null` means no restriction. + :param declared_zdr: Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration. :param disabled: Whether this credential is disabled. :param is_byok_only: Whether OpenRouter's shared endpoints on this provider are removed for every model, including models outside `allowed_models` and after all of your keys for the provider fail. The provider is skipped instead of spending OpenRouter credits. Only valid on non-fallback credentials. Omit to leave the stored value unchanged. :param is_fallback: Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried. Cannot be combined with `is_byok_only`. Omit to leave the stored value unchanged. @@ -1478,6 +1489,7 @@ async def update_async( allowed_user_ids=utils.unmarshal( allowed_user_ids, OptionalNullable[List[str]] ), + declared_zdr=declared_zdr, disabled=disabled, is_byok_only=is_byok_only, is_fallback=is_fallback, diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 32e9db75..737e3eb9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1660,6 +1660,11 @@ InternChatPromptTokensDetails, InternChatPromptTokensDetailsTypedDict, ) + from .internchatsteeredresponse import ( + InternChatSteeredResponse, + InternChatSteeredResponseStatus, + InternChatSteeredResponseTypedDict, + ) from .internchatstreamerror import ( InternChatStreamError, InternChatStreamErrorTypedDict, @@ -4673,6 +4678,9 @@ "InternChatMessageTypedDict", "InternChatPromptTokensDetails", "InternChatPromptTokensDetailsTypedDict", + "InternChatSteeredResponse", + "InternChatSteeredResponseStatus", + "InternChatSteeredResponseTypedDict", "InternChatStreamError", "InternChatStreamErrorTypedDict", "InternChatStreamingResponse", @@ -7209,6 +7217,9 @@ "InternChatMessageContentTypedDict": ".internchatmessagecontent", "InternChatPromptTokensDetails": ".internchatprompttokensdetails", "InternChatPromptTokensDetailsTypedDict": ".internchatprompttokensdetails", + "InternChatSteeredResponse": ".internchatsteeredresponse", + "InternChatSteeredResponseStatus": ".internchatsteeredresponse", + "InternChatSteeredResponseTypedDict": ".internchatsteeredresponse", "InternChatStreamError": ".internchatstreamerror", "InternChatStreamErrorTypedDict": ".internchatstreamerror", "InternChatStreamingResponse": ".internchatstreamingresponse", diff --git a/src/openrouter/components/byokkey.py b/src/openrouter/components/byokkey.py index faaeb819..22f7dfea 100644 --- a/src/openrouter/components/byokkey.py +++ b/src/openrouter/components/byokkey.py @@ -23,6 +23,8 @@ class BYOKKeyTypedDict(TypedDict): r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction.""" created_at: str r"""ISO timestamp of when the credential was created.""" + declared_zdr: Nullable[bool] + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.""" disabled: bool r"""Whether this credential is currently disabled.""" id: str @@ -58,6 +60,9 @@ class BYOKKey(BaseModel): created_at: str r"""ISO timestamp of when the credential was created.""" + declared_zdr: Nullable[bool] + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.""" + disabled: bool r"""Whether this credential is currently disabled.""" @@ -96,6 +101,7 @@ def serialize_model(self, handler): "allowed_api_key_hashes", "allowed_models", "allowed_user_ids", + "declared_zdr", "name", "workspace_id", ] diff --git a/src/openrouter/components/createbyokkeyrequest.py b/src/openrouter/components/createbyokkeyrequest.py index ec75ee36..593ecbdc 100644 --- a/src/openrouter/components/createbyokkeyrequest.py +++ b/src/openrouter/components/createbyokkeyrequest.py @@ -25,6 +25,8 @@ class CreateBYOKKeyRequestTypedDict(TypedDict): r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction.""" allowed_user_ids: NotRequired[Nullable[List[str]]] r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction.""" + declared_zdr: NotRequired[Nullable[bool]] + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.""" disabled: NotRequired[bool] r"""Whether this credential should be created in a disabled state.""" is_byok_only: NotRequired[bool] @@ -55,6 +57,9 @@ class CreateBYOKKeyRequest(BaseModel): allowed_user_ids: OptionalNullable[List[str]] = UNSET r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction.""" + declared_zdr: OptionalNullable[bool] = UNSET + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.""" + disabled: Optional[bool] = None r"""Whether this credential should be created in a disabled state.""" @@ -80,6 +85,7 @@ def serialize_model(self, handler): "allowed_api_key_hashes", "allowed_models", "allowed_user_ids", + "declared_zdr", "disabled", "is_byok_only", "is_fallback", @@ -89,7 +95,13 @@ def serialize_model(self, handler): ] ) nullable_fields = set( - ["allowed_api_key_hashes", "allowed_models", "allowed_user_ids", "name"] + [ + "allowed_api_key_hashes", + "allowed_models", + "allowed_user_ids", + "declared_zdr", + "name", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/generationresponse.py b/src/openrouter/components/generationresponse.py index 2d84649e..f09bb92b 100644 --- a/src/openrouter/components/generationresponse.py +++ b/src/openrouter/components/generationresponse.py @@ -20,11 +20,11 @@ "completions", "embeddings", "rerank", + "decisions", + "video", "tts", "stt", - "video", "image", - "decisions", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/internchatsteeredresponse.py b/src/openrouter/components/internchatsteeredresponse.py new file mode 100644 index 00000000..811d58ee --- /dev/null +++ b/src/openrouter/components/internchatsteeredresponse.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +InternChatSteeredResponseStatus = Literal["steered",] +r"""The message was handed to the turn already running on this session.""" + + +class InternChatSteeredResponseTypedDict(TypedDict): + r"""The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here.""" + + session_id: str + r"""The session of the running turn the message was delivered to.""" + status: InternChatSteeredResponseStatus + r"""The message was handed to the turn already running on this session.""" + + +class InternChatSteeredResponse(BaseModel): + r"""The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here.""" + + session_id: str + r"""The session of the running turn the message was delivered to.""" + + status: InternChatSteeredResponseStatus + r"""The message was handed to the turn already running on this session.""" diff --git a/src/openrouter/components/updatebyokkeyrequest.py b/src/openrouter/components/updatebyokkeyrequest.py index e60d7961..c2b4fb7d 100644 --- a/src/openrouter/components/updatebyokkeyrequest.py +++ b/src/openrouter/components/updatebyokkeyrequest.py @@ -20,6 +20,8 @@ class UpdateBYOKKeyRequestTypedDict(TypedDict): r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction.""" allowed_user_ids: NotRequired[Nullable[List[str]]] r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction.""" + declared_zdr: NotRequired[Nullable[bool]] + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.""" disabled: NotRequired[bool] r"""Whether this credential is disabled.""" is_byok_only: NotRequired[bool] @@ -44,6 +46,9 @@ class UpdateBYOKKeyRequest(BaseModel): allowed_user_ids: OptionalNullable[List[str]] = UNSET r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction.""" + declared_zdr: OptionalNullable[bool] = UNSET + r"""Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.""" + disabled: Optional[bool] = None r"""Whether this credential is disabled.""" @@ -69,6 +74,7 @@ def serialize_model(self, handler): "allowed_api_key_hashes", "allowed_models", "allowed_user_ids", + "declared_zdr", "disabled", "is_byok_only", "is_fallback", @@ -78,7 +84,13 @@ def serialize_model(self, handler): ] ) nullable_fields = set( - ["allowed_api_key_hashes", "allowed_models", "allowed_user_ids", "name"] + [ + "allowed_api_key_hashes", + "allowed_models", + "allowed_user_ids", + "declared_zdr", + "name", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/interns.py b/src/openrouter/interns.py index 087c09b4..817b8db6 100644 --- a/src/openrouter/interns.py +++ b/src/openrouter/interns.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK +from enum import Enum from openrouter import components, errors, operations, utils from openrouter._hooks import HookContext from openrouter.types import OptionalNullable, UNSET @@ -9,6 +10,11 @@ from typing import Any, Iterable, List, Mapping, Optional, Union +class ChatAcceptEnum(str, Enum): + APPLICATION_JSON = "application/json" + TEXT_EVENT_STREAM = "text/event-stream" + + class Interns(BaseSDK): r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.""" @@ -1978,12 +1984,10 @@ def chat( session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, + accept_header_override: Optional[ChatAcceptEnum] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> Union[ - operations.CreateInternChatCompletionResponse, - operations.CreateInternChatCompletionResponse, - ]: + ) -> operations.CreateInternChatCompletionResponse: r"""Stream a chat completion with an intern Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: \"tool_calls\"`, and the run stays open on the intern. @@ -2017,6 +2021,7 @@ def chat( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method :param http_headers: Additional headers to set or replace on requests. """ base_url = None @@ -2054,9 +2059,9 @@ def chat( request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value="text/event-stream" - if getattr(request, "stream", False) is True - else "application/json", + accept_header_value=accept_header_override.value + if accept_header_override is not None + else "application/json;q=1, text/event-stream;q=0", http_headers=http_headers, _globals=operations.CreateInternChatCompletionGlobals( http_referer=self.sdk_configuration.globals.http_referer, @@ -2102,7 +2107,7 @@ def chat( ), request=req, is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=getattr(request, "stream", False) is True, + stream=True, retry_config=retry_config, ) @@ -2127,6 +2132,14 @@ def chat( ), headers={}, ) + if utils.match_response(http_res, "202", "application/json"): + http_res_text = utils.stream_to_text(http_res) + return operations.CreateInternChatCompletionResponse( + result=unmarshal_json_response( + components.InternChatSteeredResponse, http_res, http_res_text + ), + headers={}, + ) if utils.match_response( http_res, ["400", "401", "403", "404", "408", "410", "413"], @@ -2187,12 +2200,10 @@ async def chat_async( session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, + accept_header_override: Optional[ChatAcceptEnum] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> Union[ - operations.CreateInternChatCompletionResponse, - operations.CreateInternChatCompletionResponse, - ]: + ) -> operations.CreateInternChatCompletionResponse: r"""Stream a chat completion with an intern Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: \"tool_calls\"`, and the run stays open on the intern. @@ -2226,6 +2237,7 @@ async def chat_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method :param http_headers: Additional headers to set or replace on requests. """ base_url = None @@ -2263,9 +2275,9 @@ async def chat_async( request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value="text/event-stream" - if getattr(request, "stream", False) is True - else "application/json", + accept_header_value=accept_header_override.value + if accept_header_override is not None + else "application/json;q=1, text/event-stream;q=0", http_headers=http_headers, _globals=operations.CreateInternChatCompletionGlobals( http_referer=self.sdk_configuration.globals.http_referer, @@ -2311,7 +2323,7 @@ async def chat_async( ), request=req, is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=getattr(request, "stream", False) is True, + stream=True, retry_config=retry_config, ) @@ -2336,6 +2348,14 @@ async def chat_async( ), headers={}, ) + if utils.match_response(http_res, "202", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + return operations.CreateInternChatCompletionResponse( + result=unmarshal_json_response( + components.InternChatSteeredResponse, http_res, http_res_text + ), + headers={}, + ) if utils.match_response( http_res, ["400", "401", "403", "404", "408", "410", "413"], diff --git a/src/openrouter/operations/createinternchatcompletion.py b/src/openrouter/operations/createinternchatcompletion.py index de66beac..e25761cb 100644 --- a/src/openrouter/operations/createinternchatcompletion.py +++ b/src/openrouter/operations/createinternchatcompletion.py @@ -4,6 +4,7 @@ from openrouter.components import ( internchatcompletionchunk as components_internchatcompletionchunk, internchatcompletionrequest as components_internchatcompletionrequest, + internchatsteeredresponse as components_internchatsteeredresponse, ) from openrouter.types import BaseModel, UNSET_SENTINEL from openrouter.utils import ( @@ -167,6 +168,7 @@ def serialize_model(self, handler): CreateInternChatCompletionResponseResultTypedDict = TypeAliasType( "CreateInternChatCompletionResponseResultTypedDict", Union[ + components_internchatsteeredresponse.InternChatSteeredResponseTypedDict, components_internchatcompletionchunk.InternChatCompletionChunkTypedDict, Union[ eventstreaming.EventStream[ @@ -183,6 +185,7 @@ def serialize_model(self, handler): CreateInternChatCompletionResponseResult = TypeAliasType( "CreateInternChatCompletionResponseResult", Union[ + components_internchatsteeredresponse.InternChatSteeredResponse, components_internchatcompletionchunk.InternChatCompletionChunk, Union[ eventstreaming.EventStream[ diff --git a/uv.lock b/uv.lock index eaa61ce6..d31d55a3 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.2.11" +version = "1.2.12" source = { editable = "." } dependencies = [ { name = "httpcore" },