diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9e32abfd..40cc844d 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: a4b4ee77d44e7138e1f47168f14951c4 + docChecksum: 38338bd281ff472ac24044db0a12cc6a docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.135 - configChecksum: b8528f4962f0149fe2fc73ca88dc8641 + releaseVersion: 1.3.136 + configChecksum: d45fc3c35924ecc20e84934c16e9cb34 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 8c9796fc-3794-4282-a931-32d6f2368721 - pristine_commit_hash: 4e55cd60625d98bb755e362a88d4b881ef0c3868 - pristine_tree_hash: 91a6498ea72ed956778bbbbc3c542be3bf47d3c9 + generation_id: f0adead1-531c-43e9-a0c1-036bb5fb92cb + pristine_commit_hash: 9aa25fe696b7f04046cffb1c109a61e5a142c098 + pristine_tree_hash: 39116fe02f2f0d412f6094e6de36a6602d4f159b features: python: acceptHeaders: 3.0.0 @@ -3036,8 +3036,8 @@ trackedFiles: pristine_git_object: 25965bd951348fa314dd0ed345763df881df6f68 docs/components/decisionsnoulanswer.mdx: id: fbb03486d0c5 - last_write_checksum: sha1:be520c2a30bc25843ae325e6df748978b9f0cb8e - pristine_git_object: 5f5a6c53c83079324777add5be8f9da1f42f180e + last_write_checksum: sha1:0d08da04056f61582640545c79908f32adcf98ba + pristine_git_object: db0e4608d20cb5e0d758e16077086195a9034159 docs/components/decisionsnoulanswertype.mdx: id: 2f6441f45095 last_write_checksum: sha1:3820e84651269af56e1bce6e8a4f248b26691acf @@ -9776,24 +9776,24 @@ trackedFiles: pristine_git_object: f6af0e4e21faac835e366abd424eda79974aaf57 docs/operations/createpresetschatcompletionsrequest.mdx: id: 39f1178223c5 - last_write_checksum: sha1:c7639386a76016b0a36cf4c8e112089c71c3307d - pristine_git_object: e2012a8b837960eadf1a2ee628f9198b8e16909d + last_write_checksum: sha1:7aaa6e517356a8db5cd7f06ea1a53708ff8ef402 + pristine_git_object: 6c49b8fd1b0e1e040f36e1627ec989013428c0c0 docs/operations/createpresetsmessagesglobals.mdx: id: 3480905d3f56 last_write_checksum: sha1:38818aaa22cff31c5832e2cb726ca06a0ff456cf pristine_git_object: 49374471b605acda0e35f52a432693a7a70743f7 docs/operations/createpresetsmessagesrequest.mdx: id: fb3300b6e323 - last_write_checksum: sha1:eeb05beee4b3daafb5ac8f81a388015c41b24c59 - pristine_git_object: 632ee591d19b4b23c28f41817c963b6dd5d864ca + last_write_checksum: sha1:5521ab909f1df1a0910823bc60708eab20469273 + pristine_git_object: b9b3de1c8f9d8a8e98b1639c7601a5fd5e885d71 docs/operations/createpresetsresponsesglobals.mdx: id: 88e0cbfc3d73 last_write_checksum: sha1:015bc5b26913801ad7b8d228d0307549551c1d1f pristine_git_object: f410ec4d4dbf3768da9a1cb68c3489a40abee2b4 docs/operations/createpresetsresponsesrequest.mdx: id: 6f3505cc8829 - last_write_checksum: sha1:b51ff8b2ea51767fbdb0a7e430c80f20ba2011ac - pristine_git_object: 639512044e118ea0ead8c167d6e85e7e11a6901e + last_write_checksum: sha1:90eec9d99e4a3b596d6312cf6a7092433ebf3704 + pristine_git_object: 7455c712d8ea0139fe58d49b21d438db1a9ef242 docs/operations/createprivateendpointglobals.mdx: id: b0efb5dcb7f7 last_write_checksum: sha1:fddea5dbb750e51aa56c3c0b4a7b014b8f6d75ae @@ -11508,8 +11508,8 @@ trackedFiles: pristine_git_object: 4762825df814e75d1f9c2c4067444270f4ec7b60 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:3f1c467508c8efa76a7ed482e1ec9db8ef059cb6 - pristine_git_object: 10dbc7da31e08f14827c9bab01ff6997b5837094 + last_write_checksum: sha1:9c6be322c49f2303b38e40abc1d4fc8be1072b40 + pristine_git_object: f5e755b96f1f4f749ecd8c02a6ce1f67d5803df3 docs/sdks/privateendpoints/README.mdx: id: 54dee70b8cc7 last_write_checksum: sha1:df30945c0fcc9fa7e507ea2dbbfc275946151ebd @@ -11568,8 +11568,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:64580e8affa06e934741726c9dc8ec5f0702c85e - pristine_git_object: 5af69cb461a7323d556b64b92575c08bf6d28e91 + last_write_checksum: sha1:95ff9b94543ae2f431ec44ebddfb3c3951a48906 + pristine_git_object: 8e2435e484a454751df8985b15c7ad426f697c6a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11596,8 +11596,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:95c492e5022d06d245533d9c330753e7a439afdc - pristine_git_object: e048fa8bceac02ec4890c13596bd528c06a32ea9 + last_write_checksum: sha1:77fae83adc57a896212a721bb073472e3f08e68e + pristine_git_object: adc2e21b2355da8514fdd2bee226347efa23b8c1 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12936,8 +12936,8 @@ trackedFiles: pristine_git_object: 8162c0bcf821ae6652a570952af18a68181e45cf src/openrouter/components/decisionsnoulanswer.py: id: 6970afd97d95 - last_write_checksum: sha1:b7b1b9b31fb71cb4d0d16c8135c3627605ad06b5 - pristine_git_object: 144095e118b62c54d8e6e0abdc7a29a69634c82c + last_write_checksum: sha1:3e7b4eec603aa0af76d3fb074463bb48a199cf6e + pristine_git_object: b7e51b7ed3ed8977f0a53cc4f40d1a77f3b5635a src/openrouter/components/decisionsnoulquestion.py: id: a04589349064 last_write_checksum: sha1:0bbb911853969cfe003ded8e16880c90ced1cf06 @@ -15764,16 +15764,16 @@ trackedFiles: pristine_git_object: debb2873f91e98e56a12c112f59f1c7634dfd4df src/openrouter/operations/createpresetschatcompletions.py: id: 946ce40bf5bf - last_write_checksum: sha1:89f255f235167dae2d4cd41ba0e8c49cab7026c2 - pristine_git_object: 2bcf91e05810e50c395875449e273dae5afb49ff + last_write_checksum: sha1:eb730461fbd4e8a0c9b78bea3ba741c7ad48f1fa + pristine_git_object: 5bd641f0888065d169ac8f66fca72b00f695ebe2 src/openrouter/operations/createpresetsmessages.py: id: 62021b3fbcdd - last_write_checksum: sha1:ef33fadff276b4626c2ccc7d5f38361b33011f8d - pristine_git_object: 90392c9cc65b122ca8774c1935960f2888c64ce5 + last_write_checksum: sha1:8fbb43d4999f37c3df0eecc765f01eea8015d0af + pristine_git_object: 12a2642ff10567b655b02a84fa1a711ec52a2680 src/openrouter/operations/createpresetsresponses.py: id: 42f8d73c9c81 - last_write_checksum: sha1:05916f443a7d08b3f5a86bec00b617e267f59e33 - pristine_git_object: becc8c5f5af5402ce510eda9784ba2ff675d6a94 + last_write_checksum: sha1:204ad9a62fd2af24e1464e32117d47fb3d49405a + pristine_git_object: 4291ce0ee9720d11ff4698ce79b1b262d011dd4b src/openrouter/operations/createprivateendpoint.py: id: 4c2fd54c9685 last_write_checksum: sha1:1b90429bdf4fce7a572624bff66ca21bff48b546 @@ -16316,8 +16316,8 @@ trackedFiles: pristine_git_object: 228602282f43dd94fb7703bb47b45a570c1aa8d2 src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:894f5db393b856f7f745ce938a358b161efc58f2 - pristine_git_object: 4edc4e886abe1848022ee7931877859e2d809bfb + last_write_checksum: sha1:083e5bc8695b6eaee33576a647f97bf347907e89 + pristine_git_object: c817b96c018977b20069d5d3a6eb63237bbdd379 src/openrouter/private_endpoints.py: id: fdbce8846ed0 last_write_checksum: sha1:3d7385776334bff0c853f956633941c4fe1bc42e @@ -21503,6 +21503,8 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.presets.create_presets_chat_completions()`: `request.deferred_tools` **Changed** - * `open_router.presets.create_presets_messages()`: `request.deferred_tools` **Changed** - * `open_router.presets.create_presets_responses()`: `request.deferred_tools` **Changed** + * `open_router.alpha.decisions.create()`: `response.answers.Map.union(noul).confidence` **Added** + * `open_router.presets.create_presets_chat_completions()`: `request.workspace_id` **Added** + * `open_router.presets.create_presets_messages()`: `request.workspace_id` **Added** + * `open_router.presets.create_presets_responses()`: `request.workspace_id` **Added** + * `open_router.system_one.create()`: `response.answers.Map.union(noul).confidence` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4756df05..451e1b3d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.135 + version: 1.3.136 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 1474c29c..6367f366 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -11795,6 +11795,9 @@ components: type: 'object' DecisionsNoulAnswer: properties: + confidence: + format: 'double' + type: 'number' noul: format: 'double' type: 'number' @@ -53612,7 +53615,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /presets/{slug}/chat/completions: post: - description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.' + description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.' operationId: 'createPresetsChatCompletions' parameters: - description: 'URL-safe slug identifying the preset. Created if it does not exist.' @@ -53624,6 +53627,15 @@ paths: example: 'my-preset' minLength: 1 type: 'string' + - description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + in: 'query' + name: 'workspace_id' + required: false + schema: + description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + example: '750e8400-e29b-41d4-a716-446655440002' + format: 'uuid' + type: 'string' requestBody: content: application/json: @@ -53740,7 +53752,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /presets/{slug}/messages: post: - description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.' + description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.' operationId: 'createPresetsMessages' parameters: - description: 'URL-safe slug identifying the preset. Created if it does not exist.' @@ -53752,6 +53764,15 @@ paths: example: 'my-preset' minLength: 1 type: 'string' + - description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + in: 'query' + name: 'workspace_id' + required: false + schema: + description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + example: '750e8400-e29b-41d4-a716-446655440002' + format: 'uuid' + type: 'string' requestBody: content: application/json: @@ -53867,7 +53888,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /presets/{slug}/responses: post: - description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.' + description: 'Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.' operationId: 'createPresetsResponses' parameters: - description: 'URL-safe slug identifying the preset. Created if it does not exist.' @@ -53879,6 +53900,15 @@ paths: example: 'my-preset' minLength: 1 type: 'string' + - description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + in: 'query' + name: 'workspace_id' + required: false + schema: + description: 'Workspace to create the preset in. Defaults to the key''s workspace for a key limited to one workspace, otherwise to the account''s default workspace.' + example: '750e8400-e29b-41d4-a716-446655440002' + format: 'uuid' + type: 'string' requestBody: content: application/json: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0e7675e2..d99a98f1 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:17d431cc2b441bd24a7e6da415e0803a785bf77a04af3fd1495d1690e277c8b8 - sourceBlobDigest: sha256:d4d80c90a12f9704a8cc4c2d4fe2000627cf68e83a7904f94d8046df35dec466 + sourceRevisionDigest: sha256:1b74398ba617614b8bbff3e3fdf682fe6423ed653317ac49480b76e9cc2ef932 + sourceBlobDigest: sha256:09d2f1549e7279d0a6688d15cfbeafb2eaf38f31d4d704b2a96ea10f1f1647cb tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:17d431cc2b441bd24a7e6da415e0803a785bf77a04af3fd1495d1690e277c8b8 - sourceBlobDigest: sha256:d4d80c90a12f9704a8cc4c2d4fe2000627cf68e83a7904f94d8046df35dec466 + sourceRevisionDigest: sha256:1b74398ba617614b8bbff3e3fdf682fe6423ed653317ac49480b76e9cc2ef932 + sourceBlobDigest: sha256:09d2f1549e7279d0a6688d15cfbeafb2eaf38f31d4d704b2a96ea10f1f1647cb codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:a63434ddbe1e3bbac8b718e0db88c44b2bae6c29c2e5f2e97704c21f4e032811 + codeSamplesRevisionDigest: sha256:1ead51407ba20d9adde30e8d3ecd8e5d9c6bd2ada3229aed90b743036312f98d workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index dbce763b..9afcbda4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4119,4 +4119,14 @@ Based on: ### Generated - [python v1.3.135] . ### Releases -- [PyPI v1.3.135] https://pypi.org/project/openrouter/1.3.135 - . \ No newline at end of file +- [PyPI v1.3.135] https://pypi.org/project/openrouter/1.3.135 - . + +## 2026-11-06 21:43:08 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.136] . +### Releases +- [PyPI v1.3.136] https://pypi.org/project/openrouter/1.3.136 - . \ No newline at end of file diff --git a/docs/components/decisionsnoulanswer.mdx b/docs/components/decisionsnoulanswer.mdx index 5f5a6c53..db0e4608 100644 --- a/docs/components/decisionsnoulanswer.mdx +++ b/docs/components/decisionsnoulanswer.mdx @@ -6,5 +6,6 @@ title: "DecisionsNoulAnswer" | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `confidence` | *Optional[float]* | ➖ | N/A | | `noul` | *float* | ✔️ | N/A | | `type` | [components.DecisionsNoulAnswerType](../components/decisionsnoulanswertype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/createpresetschatcompletionsrequest.mdx b/docs/operations/createpresetschatcompletionsrequest.mdx index e2012a8b..6c49b8fd 100644 --- a/docs/operations/createpresetschatcompletionsrequest.mdx +++ b/docs/operations/createpresetschatcompletionsrequest.mdx @@ -10,4 +10,5 @@ title: "CreatePresetsChatCompletionsRequest" | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `slug` | *str* | ✔️ | URL-safe slug identifying the preset. Created if it does not exist. | my-preset | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `chat_request` | [components.ChatRequest](../components/chatrequest.mdx) | ✔️ | N/A | \{
"max_tokens": 150,
"messages": [
\{
"content": "You are a helpful assistant.",
"role": "system"
},
\{
"content": "What is the capital of France?",
"role": "user"
}
],
"model": "openai/gpt-4",
"temperature": 0.7
} | \ No newline at end of file diff --git a/docs/operations/createpresetsmessagesrequest.mdx b/docs/operations/createpresetsmessagesrequest.mdx index 632ee591..b9b3de1c 100644 --- a/docs/operations/createpresetsmessagesrequest.mdx +++ b/docs/operations/createpresetsmessagesrequest.mdx @@ -10,4 +10,5 @@ title: "CreatePresetsMessagesRequest" | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `slug` | *str* | ✔️ | URL-safe slug identifying the preset. Created if it does not exist. | my-preset | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `messages_request` | [components.MessagesRequest](../components/messagesrequest.mdx) | ✔️ | N/A | \{
"max_tokens": 1024,
"messages": [
\{
"content": "Hello, how are you?",
"role": "user"
}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7
} | \ No newline at end of file diff --git a/docs/operations/createpresetsresponsesrequest.mdx b/docs/operations/createpresetsresponsesrequest.mdx index 63951204..7455c712 100644 --- a/docs/operations/createpresetsresponsesrequest.mdx +++ b/docs/operations/createpresetsresponsesrequest.mdx @@ -10,4 +10,5 @@ title: "CreatePresetsResponsesRequest" | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `slug` | *str* | ✔️ | URL-safe slug identifying the preset. Created if it does not exist. | my-preset | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `responses_request` | [components.ResponsesRequest](../components/responsesrequest.mdx) | ✔️ | N/A | \{
"input": [
\{
"content": "Hello, how are you?",
"role": "user",
"type": "message"
}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7,
"tools": [
\{
"description": "Get the current weather in a given location",
"name": "get_current_weather",
"parameters": \{
"properties": \{
"location": \{
"type": "string"
}
},
"type": "object"
},
"type": "function"
}
],
"top_p": 0.9
} | \ No newline at end of file diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index 10dbc7da..f5e755b9 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -123,7 +123,7 @@ with OpenRouter( ## create_presets_chat_completions -Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. +Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. ### Example Usage @@ -164,6 +164,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | @@ -225,7 +226,7 @@ with OpenRouter( ## create_presets_messages -Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. +Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. ### Example Usage @@ -263,6 +264,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `context_management` | [OptionalNullable[components.ContextManagement]](../../components/contextmanagement.mdx) | ➖ | N/A | | | `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | @@ -309,7 +311,7 @@ with OpenRouter( ## create_presets_responses -Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. +Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. ### Example Usage @@ -340,6 +342,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `access_programs` | [Optional[components.ResponsesRequestAccessPrograms]](../../components/responsesrequestaccessprograms.mdx) | ➖ | OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. | \{
"cyber": "standard"
} | | `background` | *OptionalNullable[bool]* | ➖ | N/A | | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | diff --git a/pyproject.toml b/pyproject.toml index 5af69cb4..8e2435e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.135" +version = "1.3.136" 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 e048fa8b..adc2e21b 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.135" +__version__: str = "1.3.136" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.135 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.136 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/decisionsnoulanswer.py b/src/openrouter/components/decisionsnoulanswer.py index 144095e1..b7e51b7e 100644 --- a/src/openrouter/components/decisionsnoulanswer.py +++ b/src/openrouter/components/decisionsnoulanswer.py @@ -1,9 +1,10 @@ """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 +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict DecisionsNoulAnswerType = Literal["noul",] @@ -12,9 +13,28 @@ class DecisionsNoulAnswerTypedDict(TypedDict): noul: float type: DecisionsNoulAnswerType + confidence: NotRequired[float] class DecisionsNoulAnswer(BaseModel): noul: float type: DecisionsNoulAnswerType + + confidence: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["confidence"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createpresetschatcompletions.py b/src/openrouter/operations/createpresetschatcompletions.py index 2bcf91e0..5bd641f0 100644 --- a/src/openrouter/operations/createpresetschatcompletions.py +++ b/src/openrouter/operations/createpresetschatcompletions.py @@ -7,6 +7,7 @@ FieldMetadata, HeaderMetadata, PathParamMetadata, + QueryParamMetadata, RequestMetadata, ) import pydantic @@ -96,6 +97,8 @@ class CreatePresetsChatCompletionsRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + workspace_id: NotRequired[str] + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" class CreatePresetsChatCompletionsRequest(BaseModel): @@ -137,10 +140,21 @@ class CreatePresetsChatCompletionsRequest(BaseModel): """ + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "workspace_id", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/operations/createpresetsmessages.py b/src/openrouter/operations/createpresetsmessages.py index 90392c9c..12a2642f 100644 --- a/src/openrouter/operations/createpresetsmessages.py +++ b/src/openrouter/operations/createpresetsmessages.py @@ -7,6 +7,7 @@ FieldMetadata, HeaderMetadata, PathParamMetadata, + QueryParamMetadata, RequestMetadata, ) import pydantic @@ -96,6 +97,8 @@ class CreatePresetsMessagesRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + workspace_id: NotRequired[str] + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" class CreatePresetsMessagesRequest(BaseModel): @@ -137,10 +140,21 @@ class CreatePresetsMessagesRequest(BaseModel): """ + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "workspace_id", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/operations/createpresetsresponses.py b/src/openrouter/operations/createpresetsresponses.py index becc8c5f..4291ce0e 100644 --- a/src/openrouter/operations/createpresetsresponses.py +++ b/src/openrouter/operations/createpresetsresponses.py @@ -7,6 +7,7 @@ FieldMetadata, HeaderMetadata, PathParamMetadata, + QueryParamMetadata, RequestMetadata, ) import pydantic @@ -96,6 +97,8 @@ class CreatePresetsResponsesRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + workspace_id: NotRequired[str] + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" class CreatePresetsResponsesRequest(BaseModel): @@ -137,10 +140,21 @@ class CreatePresetsResponsesRequest(BaseModel): """ + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "workspace_id", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 4edc4e88..c817b96c 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -671,6 +671,7 @@ def create_presets_chat_completions( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, cache_control: Optional[ Union[ components.AnthropicCacheControlDirective, @@ -776,7 +777,7 @@ def create_presets_chat_completions( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a chat-completions request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -789,6 +790,7 @@ def create_presets_chat_completions( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. @@ -850,6 +852,7 @@ def create_presets_chat_completions( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, chat_request=components.ChatRequest( cache_control=utils.get_pydantic_model( cache_control, Optional[components.AnthropicCacheControlDirective] @@ -1048,6 +1051,7 @@ async def create_presets_chat_completions_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, cache_control: Optional[ Union[ components.AnthropicCacheControlDirective, @@ -1153,7 +1157,7 @@ async def create_presets_chat_completions_async( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a chat-completions request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -1166,6 +1170,7 @@ async def create_presets_chat_completions_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. @@ -1227,6 +1232,7 @@ async def create_presets_chat_completions_async( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, chat_request=components.ChatRequest( cache_control=utils.get_pydantic_model( cache_control, Optional[components.AnthropicCacheControlDirective] @@ -1428,6 +1434,7 @@ def create_presets_messages( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, cache_control: Optional[ Union[ components.AnthropicCacheControlDirective, @@ -1518,7 +1525,7 @@ def create_presets_messages( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a messages request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -1532,6 +1539,7 @@ def create_presets_messages( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. @@ -1578,6 +1586,7 @@ def create_presets_messages( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, messages_request=components.MessagesRequest( cache_control=utils.get_pydantic_model( cache_control, Optional[components.AnthropicCacheControlDirective] @@ -1760,6 +1769,7 @@ async def create_presets_messages_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, cache_control: Optional[ Union[ components.AnthropicCacheControlDirective, @@ -1850,7 +1860,7 @@ async def create_presets_messages_async( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a messages request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -1864,6 +1874,7 @@ async def create_presets_messages_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. @@ -1910,6 +1921,7 @@ async def create_presets_messages_async( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, messages_request=components.MessagesRequest( cache_control=utils.get_pydantic_model( cache_control, Optional[components.AnthropicCacheControlDirective] @@ -2085,6 +2097,7 @@ def create_presets_responses( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, access_programs: Optional[ Union[ components.ResponsesRequestAccessPrograms, @@ -2199,7 +2212,7 @@ def create_presets_responses( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a responses request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -2211,6 +2224,7 @@ def create_presets_responses( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param access_programs: OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. :param background: :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. @@ -2272,6 +2286,7 @@ def create_presets_responses( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, responses_request=components.ResponsesRequest( access_programs=utils.get_pydantic_model( access_programs, Optional[components.ResponsesRequestAccessPrograms] @@ -2467,6 +2482,7 @@ async def create_presets_responses_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + workspace_id: Optional[str] = None, access_programs: Optional[ Union[ components.ResponsesRequestAccessPrograms, @@ -2581,7 +2597,7 @@ async def create_presets_responses_async( ) -> components.CreatePresetFromInferenceResponse: r"""Create a preset from a responses request body - Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. + Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. If set, this operation will use `api_key` from the global security. @@ -2593,6 +2609,7 @@ async def create_presets_responses_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :param access_programs: OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. :param background: :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. @@ -2654,6 +2671,7 @@ async def create_presets_responses_async( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, slug=slug, + workspace_id=workspace_id, responses_request=components.ResponsesRequest( access_programs=utils.get_pydantic_model( access_programs, Optional[components.ResponsesRequestAccessPrograms] diff --git a/uv.lock b/uv.lock index 72974935..f495422f 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.135" +version = "1.3.136" source = { editable = "." } dependencies = [ { name = "httpcore" },