From f623014fac936a9a2ccff8cbf6b0e3b393c6aab4 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 18 Nov 2026 23:30:06 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.private_endpoints.create()`: * `request.settings.prompt_caching` **Added** * `open_router.private_endpoints.get()`: `response.data.settings.prompt_caching` **Added** * `open_router.private_endpoints.update()`: * `request.settings.prompt_caching` **Added** * `response.data.settings.prompt_caching` **Added** --- .speakeasy/gen.lock | 65 ++++++++++++------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 42 ++++++++++++ .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 +++- docs/components/privateendpoint.mdx | 36 +++++----- .../privateendpointpromptcaching.mdx | 13 ++++ docs/components/privateendpointresponse.mdx | 6 +- docs/components/privateendpointsettings.mdx | 1 + .../updateprivateendpointpromptcaching.mdx | 13 ++++ .../updateprivateendpointsettingsrequest.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 16 +++++ .../privateendpointpromptcaching.py | 24 +++++++ .../components/privateendpointsettings.py | 28 +++++++- .../updateprivateendpointpromptcaching.py | 42 ++++++++++++ .../updateprivateendpointsettingsrequest.py | 10 +++ uv.lock | 2 +- 19 files changed, 270 insertions(+), 59 deletions(-) create mode 100644 docs/components/privateendpointpromptcaching.mdx create mode 100644 docs/components/updateprivateendpointpromptcaching.mdx create mode 100644 src/openrouter/components/privateendpointpromptcaching.py create mode 100644 src/openrouter/components/updateprivateendpointpromptcaching.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 69b4ce271..7ffccf792 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: c9da7072b344134eb20731bd712ce638 + docChecksum: 0757b19ad4945cb53518a7b8c704e3d9 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.190 - configChecksum: b445739770bcc6cd2794ad0a87e6e945 + releaseVersion: 1.3.191 + configChecksum: 77ffe7400092550305f5f5e6a67abe82 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a0ff5c3e-f728-4bdc-a59a-ba041061beec - pristine_commit_hash: c87692e30d60600c239be623c3e44e81af0c0d36 - pristine_tree_hash: 6e0f16ed895970b58095bea1e671720732b3a96d + generation_id: dc212f4f-2d93-45d7-8c6c-7d1068544357 + pristine_commit_hash: f8744635ad4d01c48172043961f11b0a86329837 + pristine_tree_hash: 827ba748328ecd25f113afae7c1c0c7e447438c4 features: python: acceptHeaders: 3.0.0 @@ -7288,8 +7288,8 @@ trackedFiles: pristine_git_object: 6a99a2737d18a3c227bf7fcabf58b481d3c7d94b docs/components/privateendpoint.mdx: id: 139c5b16dd66 - last_write_checksum: sha1:41eb9890a3c84dc83008f321ad6e8d4cb2036179 - pristine_git_object: f668081e031fcb73bf8bd7658c5a2476872a6990 + last_write_checksum: sha1:904d1f62e82df16da8af49d94cadefc9ef11f33b + pristine_git_object: 9c4ccd84c3194c7f42ba390d9e8d9e96f2163d67 docs/components/privateendpointactivation.mdx: id: c5cea1d4e39d last_write_checksum: sha1:ebb8d73296264d3c10b4cc76ecc94d4b3d0ff8dd @@ -7318,6 +7318,10 @@ trackedFiles: id: 16264ba816a0 last_write_checksum: sha1:7f5757f15d55242f1632af55da00886221fc1fc3 pristine_git_object: 39c75b1536bc48dba971e42dd5a17b1ea67e6040 + docs/components/privateendpointpromptcaching.mdx: + id: e185b93a4db9 + last_write_checksum: sha1:fb7ada567924bdac4c5fc97c200f2cfbf93f1161 + pristine_git_object: b411ee8e54d07219ac3c9a2888e7e349f0aebdd9 docs/components/privateendpointquantization.mdx: id: 5f4c25ee2e5a last_write_checksum: sha1:e2a1a4b70c13660740bb22feee4c2008a74cc46a @@ -7328,12 +7332,12 @@ trackedFiles: pristine_git_object: 329af60e08c83461303aec47f441c925f11edfcf docs/components/privateendpointresponse.mdx: id: 5844d85b61d8 - last_write_checksum: sha1:ec90e4d6c30386ed0aebbfb5a3f702e71e7cc889 - pristine_git_object: 35ec3c4fcfe1c0f832ba6f7c54378bf7b96d0395 + last_write_checksum: sha1:6e89e8cf16d61e5672ba800b0365564f5acc63f0 + pristine_git_object: 7ed5846f033f12f75827316caaa72f326c43dcc0 docs/components/privateendpointsettings.mdx: id: aa8d95ab2a71 - last_write_checksum: sha1:103bee400b2633c0d8117c6e8fd82c3a3e059151 - pristine_git_object: 4f794ebbc6179a98d0c784ad31cb161a20949621 + last_write_checksum: sha1:412d6f77e922d7eeeebbbee92b80c5dba9d39a85 + pristine_git_object: 82eae996074556476d0cd598277e30c4d1a68e1d docs/components/privateendpointsettingscompletions.mdx: id: 917fd268a507 last_write_checksum: sha1:4ffef539437210d355e19775abe8b2711259d2d7 @@ -9014,6 +9018,10 @@ trackedFiles: id: 38c4ebf7f509 last_write_checksum: sha1:c412b92e1d6af7963cece5db3f59736cdc41bb0d pristine_git_object: ec3df81fe733a4e648afc6c07b2aa00c830a74b3 + docs/components/updateprivateendpointpromptcaching.mdx: + id: ea6ae13d5f7a + last_write_checksum: sha1:f9d1b4b18a45dfe37b29a5067d51ddf0ff48ae1c + pristine_git_object: 836a76e525c0397f56197d100c8a5cdd853314c8 docs/components/updateprivateendpointrequest.mdx: id: 8a1aa4763af9 last_write_checksum: sha1:92290beb45d2607a2571f8e1ff756be3ee97db2a @@ -9024,8 +9032,8 @@ trackedFiles: pristine_git_object: 6627ee9dbb618278fe272acde18f649c5db57552 docs/components/updateprivateendpointsettingsrequest.mdx: id: f9146ce8d00c - last_write_checksum: sha1:8bda7119b1e90c8bd030ba08665e62c206ede3d2 - pristine_git_object: 0f5e5ee1df6109d488a21b107a653c8c5cc162c0 + last_write_checksum: sha1:9c747c716ed58b1b9d5bf79eb246df029cf9fe30 + pristine_git_object: 736c1b44b735766596d066c13387b13090cd1b09 docs/components/updateprivateendpointsettingsrequestcompletions.mdx: id: d04ee87c23e5 last_write_checksum: sha1:962048f34074e161a6b7f4da45efa1724c5fd034 @@ -11684,8 +11692,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:4b7f55d26346f021c209beef8eb917767d419a53 - pristine_git_object: 8276a5a66036d4b6c5dd3e48a8b55f5ee87ae894 + last_write_checksum: sha1:9d7f793798655e4b3b5a4637046a59146096e720 + pristine_git_object: 98e4968a2b8cca32c51531a378f8961eb2f9e09d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11712,8 +11720,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:47380d7d68265343e57dbb94215f504a0ef965c1 - pristine_git_object: dada0df7f1278e386e9b1982e017787d242279ab + last_write_checksum: sha1:b6223a11e70c47051e3b7932ec4e3943e74de0fe + pristine_git_object: e17a622767c3f9f68cdcaa60b22ff71f8fbe0cb1 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11760,8 +11768,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ad85b19e4df5bcb98cbdf7e4602bd005bff68e41 - pristine_git_object: 63c4ac1dddec2fc2992e4413222b2faea7724416 + last_write_checksum: sha1:085379c69ae3ac2d55f8e812046986c648936293 + pristine_git_object: 63c91de662a590176a6c124a5de542adf74c596a src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -14662,6 +14670,10 @@ trackedFiles: id: 2d8979e18f5b last_write_checksum: sha1:9573cef75311eee6c467e4a051308dbfd9a22ec4 pristine_git_object: 8ab720b740586c7709f13f4bdba16214327a73b0 + src/openrouter/components/privateendpointpromptcaching.py: + id: 225dcedffcf9 + last_write_checksum: sha1:cea37f022bdba126a5d5b60a392c5e408eeb03ce + pristine_git_object: 4904cdb2b026773128e107f75aed7a2525cd0971 src/openrouter/components/privateendpointquantization.py: id: 6365eda62b77 last_write_checksum: sha1:97c7fadefe3d6664f5ecb01d5b65a0a9be0af9ed @@ -14676,8 +14688,8 @@ trackedFiles: pristine_git_object: 75b7eaee3b2aea9aa60a6b3a94e947148e9b15a9 src/openrouter/components/privateendpointsettings.py: id: 2d18a4690908 - last_write_checksum: sha1:086b9d8f07f641a1a0d0bf188233e99ff4d503b6 - pristine_git_object: 9557860a58bb84b8b72ec9921a3ad45c0912bfbc + last_write_checksum: sha1:8d36f39acb22ed9284a90cddfc872309fee959d2 + pristine_git_object: 417b317b172abbeb1734ae69c53f5c17173627f5 src/openrouter/components/privateendpointstatus.py: id: c997d801be04 last_write_checksum: sha1:d31ca8b19b14c86ecb41e2f5825071c109b5881d @@ -15398,14 +15410,18 @@ trackedFiles: id: 2d255d9e4ac4 last_write_checksum: sha1:6b703da8963b0173865bd4692d53bd53b50b42a0 pristine_git_object: add97f9dbdd883540c97aaeffb4a9f227097b07e + src/openrouter/components/updateprivateendpointpromptcaching.py: + id: 79e2f95dcd61 + last_write_checksum: sha1:efc99cd7e57568097880297b66647c62d1aae3fa + pristine_git_object: 8fadd77bad4522b22abe8935bb4699dcaac04606 src/openrouter/components/updateprivateendpointrequest.py: id: 51a950d71ff3 last_write_checksum: sha1:7d0d90d6a715ecf9f05973da4f0a0b69deb1b91c pristine_git_object: 781779489a3864583f1bc1fd758797dfb07c08fa src/openrouter/components/updateprivateendpointsettingsrequest.py: id: 5e27265a3151 - last_write_checksum: sha1:66c49c54b08c084b95c2d46db1e373c73a116045 - pristine_git_object: 4a3a6a0f3ce45aaffa2301eec6b10133bb6e948a + last_write_checksum: sha1:368c44b34a297b555ef48ef7b31762744b8487a4 + pristine_git_object: e1dc7b0094d23ceaaa39a3d0815038d95235c7f6 src/openrouter/components/updateprivateproviderrequest.py: id: 62230b3a1857 last_write_checksum: sha1:6519b721854aaec8576b50255f67b955f292169b @@ -21727,3 +21743,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.private_endpoints.create()`: \n * `request.settings.prompt_caching` **Added**\n* `open_router.private_endpoints.get()`: `response.data.settings.prompt_caching` **Added**\n* `open_router.private_endpoints.update()`: \n * `request.settings.prompt_caching` **Added**\n * `response.data.settings.prompt_caching` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 3f2b7fc54..2d752fb6f 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.190 + version: 1.3.191 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index f641f1084..9e96aa140 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -30179,6 +30179,9 @@ components: image_urls: true max_completion_tokens: 16384 max_prompt_tokens: null + prompt_caching: + cache_control: false + prompt_cache_key: false quantization: 'bf16' reasoning: return_mechanism: 'reasoning' @@ -30447,6 +30450,24 @@ components: - 'prompt' - 'completion' type: 'object' + PrivateEndpointPromptCaching: + description: 'Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults.' + example: + cache_control: false + prompt_cache_key: false + properties: + cache_control: + description: 'Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.' + example: false + type: 'boolean' + prompt_cache_key: + description: 'Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.' + example: false + type: 'boolean' + required: + - 'cache_control' + - 'prompt_cache_key' + type: 'object' PrivateEndpointQuantization: description: 'Weight precision the deployment runs at; `unknown` when not stated.' enum: @@ -30502,6 +30523,9 @@ components: image_urls: true max_completion_tokens: 16384 max_prompt_tokens: null + prompt_caching: + cache_control: false + prompt_cache_key: false quantization: 'bf16' reasoning: return_mechanism: 'reasoning' @@ -30618,6 +30642,8 @@ components: type: - 'integer' - 'null' + prompt_caching: + $ref: '#/components/schemas/PrivateEndpointPromptCaching' quantization: $ref: '#/components/schemas/PrivateEndpointQuantization' reasoning: @@ -37651,6 +37677,20 @@ components: required: - 'is_filtered_model_catalog_enabled' type: 'object' + UpdatePrivateEndpointPromptCaching: + description: 'Change only the named prompt-caching flags; omitted flags keep their stored value.' + example: + cache_control: true + properties: + cache_control: + description: 'Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.' + example: false + type: 'boolean' + prompt_cache_key: + description: 'Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.' + example: false + type: 'boolean' + type: 'object' UpdatePrivateEndpointRequest: description: 'Only the fields present change. `base_url` and `upstream_model_id` are accepted on a draft only; `declared_zdr` and `declared_region` on drafts and active endpoints; `pricing` and `declared_parameters` replace their value; `settings` is itself a partial update where `null` clears a limit or restores the provider default.' example: @@ -37808,6 +37848,8 @@ components: type: - 'integer' - 'null' + prompt_caching: + $ref: '#/components/schemas/UpdatePrivateEndpointPromptCaching' quantization: $ref: '#/components/schemas/PrivateEndpointQuantization' reasoning: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 68e71490d..da7e4a7bb 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:fb951fb28c28426dbf4366c208b8a19c02cc79c2480929e5180646bce86fcc83 - sourceBlobDigest: sha256:cbf13970f8a5daa031d7a82948a5150f4dc0f546fa5a23fd0d173ef9991ceae6 + sourceRevisionDigest: sha256:0e8fc65b5edd30387f64d4f89b3b749769b1e1a6c469a027e4749dba278261e2 + sourceBlobDigest: sha256:7f0db687134bc4af9b4691ef2f86e70c436f8ffda7a420e9e9e0d248888a76d5 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fb951fb28c28426dbf4366c208b8a19c02cc79c2480929e5180646bce86fcc83 - sourceBlobDigest: sha256:cbf13970f8a5daa031d7a82948a5150f4dc0f546fa5a23fd0d173ef9991ceae6 + sourceRevisionDigest: sha256:0e8fc65b5edd30387f64d4f89b3b749769b1e1a6c469a027e4749dba278261e2 + sourceBlobDigest: sha256:7f0db687134bc4af9b4691ef2f86e70c436f8ffda7a420e9e9e0d248888a76d5 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:625d43d565e08b87680a132d5015bd9a18784fc9340f9ad18cc26593f3099455 + codeSamplesRevisionDigest: sha256:7c253f4501836d372987b5968da43deb82cb26eb08d44a4c31cd242e254fda34 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 6368915cc..023c59d2f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4669,4 +4669,14 @@ Based on: ### Generated - [python v1.3.190] . ### Releases -- [PyPI v1.3.190] https://pypi.org/project/openrouter/1.3.190 - . \ No newline at end of file +- [PyPI v1.3.190] https://pypi.org/project/openrouter/1.3.190 - . + +## 2026-11-18 23:26:42 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.191] . +### Releases +- [PyPI v1.3.191] https://pypi.org/project/openrouter/1.3.191 - . \ No newline at end of file diff --git a/docs/components/privateendpoint.mdx b/docs/components/privateendpoint.mdx index f668081e0..9c4ccd84c 100644 --- a/docs/components/privateendpoint.mdx +++ b/docs/components/privateendpoint.mdx @@ -4,21 +4,21 @@ title: "PrivateEndpoint" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `base_url` | *Nullable[str]* | ✔️ | HTTPS base URL of your deployment, or `null` for providers whose URL is derived from the BYOK credential (Azure, Amazon Bedrock, Google Vertex). | https://contoso.openai.azure.com | -| `declared_parameters` | List[*str*] | ✔️ | Parameters you declared the upstream supports. Requests that use a parameter only route to this endpoint when it is tested or declared. | [
"temperature",
"seed"
] | -| `declared_region` | [Nullable[components.PrivateEndpointDeclaredRegion]](../components/privateendpointdeclaredregion.mdx) | ✔️ | Where you attest this deployment processes data. `global` means not regional; `null` means undeclared. | us | -| `declared_zdr` | *Nullable[bool]* | ✔️ | Whether you attest this deployment retains no prompt or completion data. `null` means undeclared. | true | -| `id` | *str* | ✔️ | Stable identifier of the private endpoint. | 5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11 | -| `max_completion_tokens` | *OptionalNullable[int]* | ➖ | Most completion tokens a request routed to this endpoint can produce, or `null` when the endpoint sets no cap beyond the model context length. | 131072 | -| `model_name` | *Nullable[str]* | ✔️ | Display name of the model, or `null` when the model is no longer listed. | OpenAI: GPT-4o | -| `model_permaslug` | *str* | ✔️ | Permanent slug of the model this endpoint serves. | openai/gpt-4o-2024-08-06 | -| `model_slug` | *Nullable[str]* | ✔️ | Public model slug, or `null` when the model is no longer listed. | openai/gpt-4o | -| `pricing` | [components.PrivateEndpointPricing](../components/privateendpointpricing.mdx) | ✔️ | Negotiated per-token rates reported for requests routed to this endpoint. | \{
"cache_read": "0.00000025",
"cache_write": "0.000003125",
"completion": "0.00001",
"prompt": "0.0000025"
} | -| `provider_name` | *str* | ✔️ | Display name of the upstream provider. | Azure | -| `provider_slug` | *Nullable[str]* | ✔️ | Slug of the upstream provider, or `null` when the provider is no longer listed. | azure | -| `settings` | [components.PrivateEndpointSettings](../components/privateendpointsettings.mdx) | ✔️ | Capabilities and limits routing uses for this endpoint. A new endpoint copies them from the public endpoint for the same model and provider, or from the model, and the owner can change them. Rate limits are not part of this object: a private endpoint is billed to its own upstream key, so request limits stay with the provider. | \{
"completions": \{
"chat": true,
"text": false
},
"context_length": 128000,
"excluded_parameters": [
"logit_bias"
],
"inputs": \{
"audio": false,
"base64_files": null,
"base64_images": true,
"file_urls": null,
"image_urls": true
},
"max_completion_tokens": 16384,
"max_prompt_tokens": null,
"quantization": "bf16",
"reasoning": \{
"return_mechanism": "reasoning",
"supported": true
},
"tool_choice": \{
"auto": true,
"function": false,
"none": true,
"required": true
}
} | -| `status` | [components.PrivateEndpointStatus](../components/privateendpointstatus.mdx) | ✔️ | Lifecycle state. `draft` endpoints are not routable until validated and activated; `disabled` endpoints are activated but temporarily not routable. | active | -| `tested_parameters` | List[*str*] | ✔️ | Parameters a validation run proved the upstream honors (`tools`, `tool_choice`, `response_format`, `structured_outputs`, `stop`). Read-only; cleared when the upstream configuration changes. | [
"tools",
"tool_choice",
"response_format"
] | -| `upstream_model_id` | *str* | ✔️ | Model or deployment identifier sent to the upstream provider. | gpt-4o-prod | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `base_url` | *Nullable[str]* | ✔️ | HTTPS base URL of your deployment, or `null` for providers whose URL is derived from the BYOK credential (Azure, Amazon Bedrock, Google Vertex). | https://contoso.openai.azure.com | +| `declared_parameters` | List[*str*] | ✔️ | Parameters you declared the upstream supports. Requests that use a parameter only route to this endpoint when it is tested or declared. | [
"temperature",
"seed"
] | +| `declared_region` | [Nullable[components.PrivateEndpointDeclaredRegion]](../components/privateendpointdeclaredregion.mdx) | ✔️ | Where you attest this deployment processes data. `global` means not regional; `null` means undeclared. | us | +| `declared_zdr` | *Nullable[bool]* | ✔️ | Whether you attest this deployment retains no prompt or completion data. `null` means undeclared. | true | +| `id` | *str* | ✔️ | Stable identifier of the private endpoint. | 5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11 | +| `max_completion_tokens` | *OptionalNullable[int]* | ➖ | Most completion tokens a request routed to this endpoint can produce, or `null` when the endpoint sets no cap beyond the model context length. | 131072 | +| `model_name` | *Nullable[str]* | ✔️ | Display name of the model, or `null` when the model is no longer listed. | OpenAI: GPT-4o | +| `model_permaslug` | *str* | ✔️ | Permanent slug of the model this endpoint serves. | openai/gpt-4o-2024-08-06 | +| `model_slug` | *Nullable[str]* | ✔️ | Public model slug, or `null` when the model is no longer listed. | openai/gpt-4o | +| `pricing` | [components.PrivateEndpointPricing](../components/privateendpointpricing.mdx) | ✔️ | Negotiated per-token rates reported for requests routed to this endpoint. | \{
"cache_read": "0.00000025",
"cache_write": "0.000003125",
"completion": "0.00001",
"prompt": "0.0000025"
} | +| `provider_name` | *str* | ✔️ | Display name of the upstream provider. | Azure | +| `provider_slug` | *Nullable[str]* | ✔️ | Slug of the upstream provider, or `null` when the provider is no longer listed. | azure | +| `settings` | [components.PrivateEndpointSettings](../components/privateendpointsettings.mdx) | ✔️ | Capabilities and limits routing uses for this endpoint. A new endpoint copies them from the public endpoint for the same model and provider, or from the model, and the owner can change them. Rate limits are not part of this object: a private endpoint is billed to its own upstream key, so request limits stay with the provider. | \{
"completions": \{
"chat": true,
"text": false
},
"context_length": 128000,
"excluded_parameters": [
"logit_bias"
],
"inputs": \{
"audio": false,
"base64_files": null,
"base64_images": true,
"file_urls": null,
"image_urls": true
},
"max_completion_tokens": 16384,
"max_prompt_tokens": null,
"prompt_caching": \{
"cache_control": false,
"prompt_cache_key": false
},
"quantization": "bf16",
"reasoning": \{
"return_mechanism": "reasoning",
"supported": true
},
"tool_choice": \{
"auto": true,
"function": false,
"none": true,
"required": true
}
} | +| `status` | [components.PrivateEndpointStatus](../components/privateendpointstatus.mdx) | ✔️ | Lifecycle state. `draft` endpoints are not routable until validated and activated; `disabled` endpoints are activated but temporarily not routable. | active | +| `tested_parameters` | List[*str*] | ✔️ | Parameters a validation run proved the upstream honors (`tools`, `tool_choice`, `response_format`, `structured_outputs`, `stop`). Read-only; cleared when the upstream configuration changes. | [
"tools",
"tool_choice",
"response_format"
] | +| `upstream_model_id` | *str* | ✔️ | Model or deployment identifier sent to the upstream provider. | gpt-4o-prod | \ No newline at end of file diff --git a/docs/components/privateendpointpromptcaching.mdx b/docs/components/privateendpointpromptcaching.mdx new file mode 100644 index 000000000..b411ee8e5 --- /dev/null +++ b/docs/components/privateendpointpromptcaching.mdx @@ -0,0 +1,13 @@ +--- +title: "PrivateEndpointPromptCaching" +--- + +Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_control` | *bool* | ✔️ | Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly. | false | +| `prompt_cache_key` | *bool* | ✔️ | Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention. | false | \ No newline at end of file diff --git a/docs/components/privateendpointresponse.mdx b/docs/components/privateendpointresponse.mdx index 35ec3c4fc..7ed5846f0 100644 --- a/docs/components/privateendpointresponse.mdx +++ b/docs/components/privateendpointresponse.mdx @@ -4,6 +4,6 @@ title: "PrivateEndpointResponse" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.PrivateEndpoint](../components/privateendpoint.mdx) | ✔️ | N/A | \{
"base_url": "https://contoso.openai.azure.com",
"declared_parameters": [
"temperature",
"seed"
],
"declared_region": "us",
"declared_zdr": true,
"id": "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
"max_completion_tokens": 131072,
"model_name": "OpenAI: GPT-4o",
"model_permaslug": "openai/gpt-4o-2024-08-06",
"model_slug": "openai/gpt-4o",
"pricing": \{
"cache_read": "0.00000025",
"cache_write": "0.000003125",
"completion": "0.00001",
"prompt": "0.0000025"
},
"provider_name": "Azure",
"provider_slug": "azure",
"settings": \{
"completions": \{
"chat": true,
"text": false
},
"context_length": 128000,
"excluded_parameters": [
"logit_bias"
],
"inputs": \{
"audio": false,
"base64_files": null,
"base64_images": true,
"file_urls": null,
"image_urls": true
},
"max_completion_tokens": 16384,
"max_prompt_tokens": null,
"quantization": "bf16",
"reasoning": \{
"return_mechanism": "reasoning",
"supported": true
},
"tool_choice": \{
"auto": true,
"function": false,
"none": true,
"required": true
}
},
"status": "active",
"tested_parameters": [
"tools",
"tool_choice",
"response_format"
],
"upstream_model_id": "gpt-4o-prod"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.PrivateEndpoint](../components/privateendpoint.mdx) | ✔️ | N/A | \{
"base_url": "https://contoso.openai.azure.com",
"declared_parameters": [
"temperature",
"seed"
],
"declared_region": "us",
"declared_zdr": true,
"id": "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
"max_completion_tokens": 131072,
"model_name": "OpenAI: GPT-4o",
"model_permaslug": "openai/gpt-4o-2024-08-06",
"model_slug": "openai/gpt-4o",
"pricing": \{
"cache_read": "0.00000025",
"cache_write": "0.000003125",
"completion": "0.00001",
"prompt": "0.0000025"
},
"provider_name": "Azure",
"provider_slug": "azure",
"settings": \{
"completions": \{
"chat": true,
"text": false
},
"context_length": 128000,
"excluded_parameters": [
"logit_bias"
],
"inputs": \{
"audio": false,
"base64_files": null,
"base64_images": true,
"file_urls": null,
"image_urls": true
},
"max_completion_tokens": 16384,
"max_prompt_tokens": null,
"prompt_caching": \{
"cache_control": false,
"prompt_cache_key": false
},
"quantization": "bf16",
"reasoning": \{
"return_mechanism": "reasoning",
"supported": true
},
"tool_choice": \{
"auto": true,
"function": false,
"none": true,
"required": true
}
},
"status": "active",
"tested_parameters": [
"tools",
"tool_choice",
"response_format"
],
"upstream_model_id": "gpt-4o-prod"
} | \ No newline at end of file diff --git a/docs/components/privateendpointsettings.mdx b/docs/components/privateendpointsettings.mdx index 4f794ebbc..82eae9960 100644 --- a/docs/components/privateendpointsettings.mdx +++ b/docs/components/privateendpointsettings.mdx @@ -15,6 +15,7 @@ Capabilities and limits routing uses for this endpoint. A new endpoint copies th | `inputs` | [components.PrivateEndpointSettingsInputs](../components/privateendpointsettingsinputs.mdx) | ✔️ | N/A | | | `max_completion_tokens` | *Nullable[int]* | ✔️ | Longest completion the upstream returns, in tokens, or `null` to keep the model default. | 16384 | | `max_prompt_tokens` | *Nullable[int]* | ✔️ | Longest prompt, in tokens, or `null` for no cap below the context length. Cannot exceed `context_length`, or the model context length while `context_length` is `null`. | null | +| `prompt_caching` | [Optional[components.PrivateEndpointPromptCaching]](../components/privateendpointpromptcaching.mdx) | ➖ | Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults. | \{
"cache_control": false,
"prompt_cache_key": false
} | | `quantization` | [components.PrivateEndpointQuantization](../components/privateendpointquantization.mdx) | ✔️ | Weight precision the deployment runs at; `unknown` when not stated. | bf16 | | `reasoning` | [components.PrivateEndpointSettingsReasoning](../components/privateendpointsettingsreasoning.mdx) | ✔️ | N/A | | | `tool_choice` | [components.PrivateEndpointSettingsToolChoice](../components/privateendpointsettingstoolchoice.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/updateprivateendpointpromptcaching.mdx b/docs/components/updateprivateendpointpromptcaching.mdx new file mode 100644 index 000000000..836a76e52 --- /dev/null +++ b/docs/components/updateprivateendpointpromptcaching.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdatePrivateEndpointPromptCaching" +--- + +Change only the named prompt-caching flags; omitted flags keep their stored value. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_control` | *Optional[bool]* | ➖ | Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly. | false | +| `prompt_cache_key` | *Optional[bool]* | ➖ | Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention. | false | \ No newline at end of file diff --git a/docs/components/updateprivateendpointsettingsrequest.mdx b/docs/components/updateprivateendpointsettingsrequest.mdx index 0f5e5ee1d..736c1b44b 100644 --- a/docs/components/updateprivateendpointsettingsrequest.mdx +++ b/docs/components/updateprivateendpointsettingsrequest.mdx @@ -15,6 +15,7 @@ Capabilities and limits to set over the ones copied from the public endpoint for | `inputs` | [Optional[components.UpdatePrivateEndpointSettingsRequestInputs]](../components/updateprivateendpointsettingsrequestinputs.mdx) | ➖ | N/A | | | `max_completion_tokens` | *OptionalNullable[int]* | ➖ | Longest completion the upstream returns, in tokens, or `null` to keep the model default. | 16384 | | `max_prompt_tokens` | *OptionalNullable[int]* | ➖ | Longest prompt, in tokens, or `null` for no cap below the context length. Cannot exceed `context_length`, or the model context length while `context_length` is `null`. | null | +| `prompt_caching` | [Optional[components.UpdatePrivateEndpointPromptCaching]](../components/updateprivateendpointpromptcaching.mdx) | ➖ | Change only the named prompt-caching flags; omitted flags keep their stored value. | \{
"cache_control": true
} | | `quantization` | [Optional[components.PrivateEndpointQuantization]](../components/privateendpointquantization.mdx) | ➖ | Weight precision the deployment runs at; `unknown` when not stated. | bf16 | | `reasoning` | [Optional[components.UpdatePrivateEndpointSettingsRequestReasoning]](../components/updateprivateendpointsettingsrequestreasoning.mdx) | ➖ | N/A | | | `tool_choice` | [Optional[components.UpdatePrivateEndpointSettingsRequestToolChoice]](../components/updateprivateendpointsettingsrequesttoolchoice.mdx) | ➖ | N/A | | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8276a5a66..98e4968a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.190" +version = "1.3.191" 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 dada0df7f..e17a62276 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.190" +__version__: str = "1.3.191" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.190 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.191 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 63c4ac1dd..63c91de66 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -4111,6 +4111,10 @@ PrivateEndpointPricing, PrivateEndpointPricingTypedDict, ) + from .privateendpointpromptcaching import ( + PrivateEndpointPromptCaching, + PrivateEndpointPromptCachingTypedDict, + ) from .privateendpointquantization import PrivateEndpointQuantization from .privateendpointreasoningreturnmechanism import ( PrivateEndpointReasoningReturnMechanism, @@ -4859,6 +4863,10 @@ UpdateOrganizationSettingsRequest, UpdateOrganizationSettingsRequestTypedDict, ) + from .updateprivateendpointpromptcaching import ( + UpdatePrivateEndpointPromptCaching, + UpdatePrivateEndpointPromptCachingTypedDict, + ) from .updateprivateendpointrequest import ( UpdatePrivateEndpointRequest, UpdatePrivateEndpointRequestDeclaredRegion, @@ -7993,6 +8001,8 @@ "PrivateEndpointParameterCheckTypedDict", "PrivateEndpointPricing", "PrivateEndpointPricingTypedDict", + "PrivateEndpointPromptCaching", + "PrivateEndpointPromptCachingTypedDict", "PrivateEndpointQuantization", "PrivateEndpointReasoningReturnMechanism", "PrivateEndpointResponse", @@ -8713,6 +8723,8 @@ "UpdateObservabilityDestinationResponseTypedDict", "UpdateOrganizationSettingsRequest", "UpdateOrganizationSettingsRequestTypedDict", + "UpdatePrivateEndpointPromptCaching", + "UpdatePrivateEndpointPromptCachingTypedDict", "UpdatePrivateEndpointRequest", "UpdatePrivateEndpointRequestDeclaredRegion", "UpdatePrivateEndpointRequestTypedDict", @@ -11891,6 +11903,8 @@ "PrivateEndpointParameterCheckTypedDict": ".privateendpointparametercheck", "PrivateEndpointPricing": ".privateendpointpricing", "PrivateEndpointPricingTypedDict": ".privateendpointpricing", + "PrivateEndpointPromptCaching": ".privateendpointpromptcaching", + "PrivateEndpointPromptCachingTypedDict": ".privateendpointpromptcaching", "PrivateEndpointQuantization": ".privateendpointquantization", "PrivateEndpointReasoningReturnMechanism": ".privateendpointreasoningreturnmechanism", "PrivateEndpointResponse": ".privateendpointresponse", @@ -12436,6 +12450,8 @@ "UpdateObservabilityDestinationResponseTypedDict": ".updateobservabilitydestinationresponse", "UpdateOrganizationSettingsRequest": ".updateorganizationsettingsrequest", "UpdateOrganizationSettingsRequestTypedDict": ".updateorganizationsettingsrequest", + "UpdatePrivateEndpointPromptCaching": ".updateprivateendpointpromptcaching", + "UpdatePrivateEndpointPromptCachingTypedDict": ".updateprivateendpointpromptcaching", "UpdatePrivateEndpointRequest": ".updateprivateendpointrequest", "UpdatePrivateEndpointRequestDeclaredRegion": ".updateprivateendpointrequest", "UpdatePrivateEndpointRequestTypedDict": ".updateprivateendpointrequest", diff --git a/src/openrouter/components/privateendpointpromptcaching.py b/src/openrouter/components/privateendpointpromptcaching.py new file mode 100644 index 000000000..4904cdb2b --- /dev/null +++ b/src/openrouter/components/privateendpointpromptcaching.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class PrivateEndpointPromptCachingTypedDict(TypedDict): + r"""Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults.""" + + cache_control: bool + r"""Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.""" + prompt_cache_key: bool + r"""Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.""" + + +class PrivateEndpointPromptCaching(BaseModel): + r"""Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults.""" + + cache_control: bool + r"""Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.""" + + prompt_cache_key: bool + r"""Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.""" diff --git a/src/openrouter/components/privateendpointsettings.py b/src/openrouter/components/privateendpointsettings.py index 9557860a5..417b317b1 100644 --- a/src/openrouter/components/privateendpointsettings.py +++ b/src/openrouter/components/privateendpointsettings.py @@ -1,14 +1,18 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .privateendpointpromptcaching import ( + PrivateEndpointPromptCaching, + PrivateEndpointPromptCachingTypedDict, +) from .privateendpointquantization import PrivateEndpointQuantization from .privateendpointreasoningreturnmechanism import ( PrivateEndpointReasoningReturnMechanism, ) from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer -from typing import List, Literal, Union -from typing_extensions import TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict class PrivateEndpointSettingsCompletionsTypedDict(TypedDict): @@ -188,6 +192,8 @@ class PrivateEndpointSettingsTypedDict(TypedDict): r"""Weight precision the deployment runs at; `unknown` when not stated.""" reasoning: PrivateEndpointSettingsReasoningTypedDict tool_choice: PrivateEndpointSettingsToolChoiceTypedDict + prompt_caching: NotRequired[PrivateEndpointPromptCachingTypedDict] + r"""Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults.""" class PrivateEndpointSettings(BaseModel): @@ -216,16 +222,32 @@ class PrivateEndpointSettings(BaseModel): tool_choice: PrivateEndpointSettingsToolChoice + prompt_caching: Optional[PrivateEndpointPromptCaching] = None + r"""Prompt-caching controls for an OpenAI-compatible private endpoint. Accepted fields default on after validation; explicit owner settings override the defaults.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): + optional_fields = set(["prompt_caching"]) + nullable_fields = set( + ["context_length", "max_completion_tokens", "max_prompt_tokens"] + ) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - m[k] = val + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val return m diff --git a/src/openrouter/components/updateprivateendpointpromptcaching.py b/src/openrouter/components/updateprivateendpointpromptcaching.py new file mode 100644 index 000000000..8fadd77ba --- /dev/null +++ b/src/openrouter/components/updateprivateendpointpromptcaching.py @@ -0,0 +1,42 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdatePrivateEndpointPromptCachingTypedDict(TypedDict): + r"""Change only the named prompt-caching flags; omitted flags keep their stored value.""" + + cache_control: NotRequired[bool] + r"""Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.""" + prompt_cache_key: NotRequired[bool] + r"""Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.""" + + +class UpdatePrivateEndpointPromptCaching(BaseModel): + r"""Change only the named prompt-caching flags; omitted flags keep their stored value.""" + + cache_control: Optional[bool] = None + r"""Forward top-level, message, and tool cache_control markers. Defaults on after endpoint validation accepts these fields; otherwise off. Set false to opt out, or true to declare support explicitly.""" + + prompt_cache_key: Optional[bool] = None + r"""Send an OpenRouter-derived, customer-isolated prompt_cache_key, not the caller-supplied key. Defaults on after endpoint validation accepts the field; otherwise off. Set false to opt out, or true to declare support explicitly. HIPAA and unknown workspace posture withhold OpenRouter caching directives and the derived key; this does not control upstream retention.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cache_control", "prompt_cache_key"]) + 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/components/updateprivateendpointsettingsrequest.py b/src/openrouter/components/updateprivateendpointsettingsrequest.py index 4a3a6a0f3..e1dc7b009 100644 --- a/src/openrouter/components/updateprivateendpointsettingsrequest.py +++ b/src/openrouter/components/updateprivateendpointsettingsrequest.py @@ -5,6 +5,10 @@ from .privateendpointreasoningreturnmechanism import ( PrivateEndpointReasoningReturnMechanism, ) +from .updateprivateendpointpromptcaching import ( + UpdatePrivateEndpointPromptCaching, + UpdatePrivateEndpointPromptCachingTypedDict, +) from openrouter.types import ( BaseModel, Nullable, @@ -246,6 +250,8 @@ class UpdatePrivateEndpointSettingsRequestTypedDict(TypedDict): r"""Longest completion the upstream returns, in tokens, or `null` to keep the model default.""" max_prompt_tokens: NotRequired[Nullable[int]] r"""Longest prompt, in tokens, or `null` for no cap below the context length. Cannot exceed `context_length`, or the model context length while `context_length` is `null`.""" + prompt_caching: NotRequired[UpdatePrivateEndpointPromptCachingTypedDict] + r"""Change only the named prompt-caching flags; omitted flags keep their stored value.""" quantization: NotRequired[PrivateEndpointQuantization] r"""Weight precision the deployment runs at; `unknown` when not stated.""" reasoning: NotRequired[UpdatePrivateEndpointSettingsRequestReasoningTypedDict] @@ -273,6 +279,9 @@ class UpdatePrivateEndpointSettingsRequest(BaseModel): max_prompt_tokens: OptionalNullable[int] = UNSET r"""Longest prompt, in tokens, or `null` for no cap below the context length. Cannot exceed `context_length`, or the model context length while `context_length` is `null`.""" + prompt_caching: Optional[UpdatePrivateEndpointPromptCaching] = None + r"""Change only the named prompt-caching flags; omitted flags keep their stored value.""" + quantization: Optional[PrivateEndpointQuantization] = None r"""Weight precision the deployment runs at; `unknown` when not stated.""" @@ -290,6 +299,7 @@ def serialize_model(self, handler): "inputs", "max_completion_tokens", "max_prompt_tokens", + "prompt_caching", "quantization", "reasoning", "tool_choice", diff --git a/uv.lock b/uv.lock index ca34fc03e..db590f394 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.190" +version = "1.3.191" source = { editable = "." } dependencies = [ { name = "httpcore" }, From c3dadd23ee3854da5a19a27b77965aafc010a3ae Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 23:30:14 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow