From 2d48a7c2a4b561235b2bea7b468e2d38b9f7fb97 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 1 Jul 2026 16:15:03 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.beta.responses.send()`: * `request.tools[].union(openrouter:files)` **Added** * `open_router.chat.send()`: * `request.tools[].union(FilesServerTool)` **Added** * `open_router.presets.create_presets_chat_completions()`: * `request.tools[].union(FilesServerTool)` **Added** * `open_router.presets.create_presets_responses()`: * `request.tools[].union(openrouter:files)` **Added** --- .speakeasy/gen.lock | 61 +++++++++++++------ .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 23 +++++++ .speakeasy/workflow.lock | 10 +-- README-PYPI.md | 2 +- RELEASES.md | 12 +++- docs/components/chatfunctiontool.mdx | 6 ++ docs/components/filesservertool.mdx | 13 ++++ docs/components/filesservertoolconfig.mdx | 11 ++++ docs/components/filesservertooltype.mdx | 15 +++++ docs/components/responsesrequesttoolunion.mdx | 6 ++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 19 ++++++ src/openrouter/components/chatfunctiontool.py | 3 + src/openrouter/components/filesservertool.py | 44 +++++++++++++ .../components/filesservertoolconfig.py | 13 ++++ src/openrouter/components/responsesrequest.py | 11 ++-- uv.lock | 4 +- 19 files changed, 224 insertions(+), 37 deletions(-) create mode 100644 docs/components/filesservertool.mdx create mode 100644 docs/components/filesservertoolconfig.mdx create mode 100644 docs/components/filesservertooltype.mdx create mode 100644 src/openrouter/components/filesservertool.py create mode 100644 src/openrouter/components/filesservertoolconfig.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0835fc69..d1c9c66c 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: e7ae838af3f89aafec730d6f56a6264b + docChecksum: 31a453ec8245c65098405a9010d2ff54 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.0 - configChecksum: 0cc32c51a9844c59f9cd217ce216b21c + releaseVersion: 0.11.1 + configChecksum: 85e803126e799123b660fa86fbd0594f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c839d647-64f5-4526-a33c-0c3774fc797a - pristine_commit_hash: 9a098fc679175e7a0474845099057e728c15610b - pristine_tree_hash: 38a622bfa243847a4fc99417b953b35d7d643ae0 + generation_id: 2fd172e4-2ed7-47d2-959b-76faccc0db40 + pristine_commit_hash: 770c36dfd9d9611977f1d4f1b874b911010e7f2b + pristine_tree_hash: 752195cbe1fa7f997c727815c9f9ea4da62ac759 features: python: acceptHeaders: 3.0.0 @@ -862,8 +862,8 @@ trackedFiles: pristine_git_object: f5cbc93e1277fe0ed97bb520e331a58837e91ab4 docs/components/chatfunctiontool.mdx: id: 13433a4eb5b0 - last_write_checksum: sha1:c00f06f8a13d6d99f7d1be5b0509f9bcc8d1c04a - pristine_git_object: 5b8e5f47bb4798e364f3f9d5511c00d5826b79a6 + last_write_checksum: sha1:d3b6abd613e7866de1fb7074e9e794543c8a940f + pristine_git_object: 41b4523f970c7a81f2512587ef8dd3a8db150f89 docs/components/chatfunctiontoolfunction.mdx: id: b9f813a5b0c9 last_write_checksum: sha1:1daf25e4f31b7013fcbcd43f86678ce1548c8423 @@ -1692,6 +1692,18 @@ trackedFiles: id: 2b477049dcd1 last_write_checksum: sha1:e6d7bff818ad43690daeb4a41b2b30b5895d6a04 pristine_git_object: 570219253720d0f7f682e6b5a8b510ea60abd066 + docs/components/filesservertool.mdx: + id: 7b15d2a7ba50 + last_write_checksum: sha1:6fcbd963de8797fc622b28c97b5d03b24e1b733d + pristine_git_object: 7720ba432a313dbdc1ec4bc793280f629c19c666 + docs/components/filesservertoolconfig.mdx: + id: 4786db8c4bad + last_write_checksum: sha1:bea44aab79ccddb9dff37eb6dc30ef8cf8a13872 + pristine_git_object: 2a1990e4b9a54b1974af9e1581e177ef2340723e + docs/components/filesservertooltype.mdx: + id: 2518fc00979d + last_write_checksum: sha1:12e23c87834ede010604d6f4faa85685899cfb74 + pristine_git_object: e9d25567d44fbaaa6506ebebe1b75e8bb1a5cffd docs/components/filters.mdx: id: eb61c97e25a7 last_write_checksum: sha1:4e20881809ca6f0e0ecc3d572919f96f7ba4088d @@ -4078,8 +4090,8 @@ trackedFiles: pristine_git_object: 5f6cc606242e0f8343c7bef1d54e640fef620a80 docs/components/responsesrequesttoolunion.mdx: id: 96bafa5d19b1 - last_write_checksum: sha1:dffc61ec70129b12bdf684ccd82c48fd88fcd089 - pristine_git_object: 504c087337285b6612ec9e203d561985b45d7db2 + last_write_checksum: sha1:ea0dca57eedbc520f2a5097b8e0adc1b1f831be2 + pristine_git_object: bfec11b6f951665f3b0467a8e8f98e7f224a9350 docs/components/responsesrequesttype.mdx: id: b2720876d384 last_write_checksum: sha1:9ed21e9f3c79e3936a4f6bc9df24eea499cc1e56 @@ -6342,8 +6354,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:09396501f993eff974d032f893f8777b2515ad5e - pristine_git_object: 8064de806ae7235f1d2e4e9af7e2ee60057f0b86 + last_write_checksum: sha1:315748f12aad769a99d497d7f7b72b1bfd6d79ab + pristine_git_object: 60601548fd081896f4b477f701e887facde0de63 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6370,8 +6382,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:0a66803222e13119adf3f0159a762fa469916728 - pristine_git_object: ec5d51ee05aedbb8948714d3e0a34560dc1a9a4d + last_write_checksum: sha1:c775f28ffba30ec6110b067674d42628dfe28b1e + pristine_git_object: 30f0645017b376be4851dddedda35fdbcd70fb48 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6410,8 +6422,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:cccdd548ea87a1fc407f4777d55048ffa2a56bc0 - pristine_git_object: f3f0d61c5923a35b661bbb3a850307f2147e6ed2 + last_write_checksum: sha1:f1a79345c2156a1e659b55a506babccbdd392463 + pristine_git_object: c0bbbca94f36baba1ca34b27a0827a97cf47ed00 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6822,8 +6834,8 @@ trackedFiles: pristine_git_object: 7a6140f2b8afb0cde9b031322a4284c9cbce7e33 src/openrouter/components/chatfunctiontool.py: id: 1fcf92f8a7da - last_write_checksum: sha1:008f3de8033d1b64f741c4b8f279425a1ac5734b - pristine_git_object: 3525ecad7e6aead245dcc143e92857c9f7f85883 + last_write_checksum: sha1:f5a4e444028732635ae55ff627f8f3e4f2d5695b + pristine_git_object: b62a155adffc32102f97f4160386c212b943c875 src/openrouter/components/chatjsonschemaconfig.py: id: d2278e414fab last_write_checksum: sha1:73791c8aa5f3dec4a25903dcc9c61118fc88a4f3 @@ -7168,6 +7180,14 @@ trackedFiles: id: 8ecc4d4a0ddd last_write_checksum: sha1:f6de01b0ed57b987896035e7e21681ca7fe7f1f8 pristine_git_object: 5f5b45a9f0fc9dc42d1ebde7ac80354be5f0b2bf + src/openrouter/components/filesservertool.py: + id: 725f58d5d419 + last_write_checksum: sha1:ea2af05c4a8f992c2edeab81e6ca4279b4978010 + pristine_git_object: 7e9f36a52234438568462ea061f782505a599c26 + src/openrouter/components/filesservertoolconfig.py: + id: 8353a3e97cfc + last_write_checksum: sha1:8cbb3c05f6f3304e3f54c0f8bfb8d11a0ac0cdc3 + pristine_git_object: bca5442a696e2489662d71d5bd7e26fb4c0eaeaa src/openrouter/components/forbiddenresponseerrordata.py: id: 93ae47a0c337 last_write_checksum: sha1:1da3bc6a3399aa3539b27e96c400b23bb6fd188f @@ -8126,8 +8146,8 @@ trackedFiles: pristine_git_object: 1c7f8a0ef6bc011cd6196c4a4c77a94b1cbb6b73 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:6b38eb5974b587c6aa930c88184dc8e3c1212335 - pristine_git_object: 0686331f05f102c12d80f1ad7d42c40044d1df98 + last_write_checksum: sha1:101e67249f64b2d28693f05935aa964a94109467 + pristine_git_object: 53cacf214278aeecf2d9219374316ebde6c1c726 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -10580,3 +10600,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.tools[].union(openrouter:files)` **Added**\n* `open_router.chat.send()`: \n * `request.tools[].union(FilesServerTool)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(FilesServerTool)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.tools[].union(openrouter:files)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 42273435..c14d6f5e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.0 + version: 0.11.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e9a1b121..3ff05edf 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4532,6 +4532,7 @@ components: - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' - $ref: '#/components/schemas/BashServerTool' - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - $ref: '#/components/schemas/ChatSearchModelsServerTool' - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' @@ -7555,6 +7556,27 @@ components: - type - vector_store_ids type: object + FilesServerTool: + description: >- + OpenRouter built-in server tool: read, write, edit, and list workspace files via the Files API. Requires the `x-openrouter-file-ids: openrouter` request header. + example: + parameters: {} + type: openrouter:files + properties: + parameters: + $ref: '#/components/schemas/FilesServerToolConfig' + type: + enum: + - openrouter:files + type: string + required: + - type + type: object + FilesServerToolConfig: + description: Configuration for the openrouter:files server tool + example: {} + properties: {} + type: object ForbiddenResponse: description: Forbidden - Authentication successful but insufficient permissions example: @@ -19755,6 +19777,7 @@ components: - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - $ref: '#/components/schemas/ChatSearchModelsServerTool' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0a9d59a4..d7018bfe 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:86c0ff20804c52cf4d1ecd247f6414b4209721628be768bb0e471fa8f2643a36 - sourceBlobDigest: sha256:203cdb354ce296155f3b322907ecf7b02345a894ef5eaa042c2c9c86a3f513c8 + sourceRevisionDigest: sha256:f55ad0f499156d20c6b57efb38c3ae9ed94c860e434405e7d52338e61eb6f79c + sourceBlobDigest: sha256:90e75fce2c45d81d02e9eaeb0a1be6e2d4a214ac796334b5680996b911d4e9c5 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:86c0ff20804c52cf4d1ecd247f6414b4209721628be768bb0e471fa8f2643a36 - sourceBlobDigest: sha256:203cdb354ce296155f3b322907ecf7b02345a894ef5eaa042c2c9c86a3f513c8 + sourceRevisionDigest: sha256:f55ad0f499156d20c6b57efb38c3ae9ed94c860e434405e7d52338e61eb6f79c + sourceBlobDigest: sha256:90e75fce2c45d81d02e9eaeb0a1be6e2d4a214ac796334b5680996b911d4e9c5 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:73cd7995d2c186ab5098f0824cad26228baf3c6c9e02400959dde933f8b38439 + codeSamplesRevisionDigest: sha256:32b3050b10d3e0f8cbe39300fb98b5c0e1ee9b07ff7c1c4bcef85045d844b33c workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/README-PYPI.md b/README-PYPI.md index 7af33435..9fdbe277 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -55,7 +55,7 @@ It's also possible to write a standalone Python script without needing to set up ```python #!/usr/bin/env -S uv run --script # /// script -# requires-python = ">=3.9" +# requires-python = ">=3.10" # dependencies = [ # "openrouter", # ] diff --git a/RELEASES.md b/RELEASES.md index c35ed2f3..06b3d82b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -108,4 +108,14 @@ Based on: ### Generated - [python v0.10.8] . ### Releases -- [PyPI v0.10.8] https://pypi.org/project/openrouter/0.10.8 - . \ No newline at end of file +- [PyPI v0.10.8] https://pypi.org/project/openrouter/0.10.8 - . + +## 2026-07-01 16:13:11 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.1] . +### Releases +- [PyPI v0.11.1] https://pypi.org/project/openrouter/0.11.1 - . \ No newline at end of file diff --git a/docs/components/chatfunctiontool.mdx b/docs/components/chatfunctiontool.mdx index 5b8e5f47..41b4523f 100644 --- a/docs/components/chatfunctiontool.mdx +++ b/docs/components/chatfunctiontool.mdx @@ -31,6 +31,12 @@ value: components.BashServerTool = /* values here */ value: components.DatetimeServerTool = /* values here */ ``` +### `components.FilesServerTool` + +```python +value: components.FilesServerTool = /* values here */ +``` + ### `components.ImageGenerationServerToolOpenRouter` ```python diff --git a/docs/components/filesservertool.mdx b/docs/components/filesservertool.mdx new file mode 100644 index 00000000..7720ba43 --- /dev/null +++ b/docs/components/filesservertool.mdx @@ -0,0 +1,13 @@ +--- +title: "FilesServerTool" +--- + +OpenRouter built-in server tool: read, write, edit, and list workspace files via the Files API. Requires the `x-openrouter-file-ids: openrouter` request header. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `parameters` | [Optional[components.FilesServerToolConfig]](../components/filesservertoolconfig.mdx) | :heavy_minus_sign: | Configuration for the openrouter:files server tool | \{} | +| `type` | [components.FilesServerToolType](../components/filesservertooltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/filesservertoolconfig.mdx b/docs/components/filesservertoolconfig.mdx new file mode 100644 index 00000000..2a1990e4 --- /dev/null +++ b/docs/components/filesservertoolconfig.mdx @@ -0,0 +1,11 @@ +--- +title: "FilesServerToolConfig" +--- + +Configuration for the openrouter:files server tool + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/components/filesservertooltype.mdx b/docs/components/filesservertooltype.mdx new file mode 100644 index 00000000..e9d25567 --- /dev/null +++ b/docs/components/filesservertooltype.mdx @@ -0,0 +1,15 @@ +--- +title: "FilesServerToolType" +--- + +## Example Usage + +```python +from openrouter.components import FilesServerToolType +value: FilesServerToolType = "openrouter:files" +``` + + +## Values + +- `"openrouter:files"` diff --git a/docs/components/responsesrequesttoolunion.mdx b/docs/components/responsesrequesttoolunion.mdx index 504c0873..bfec11b6 100644 --- a/docs/components/responsesrequesttoolunion.mdx +++ b/docs/components/responsesrequesttoolunion.mdx @@ -106,6 +106,12 @@ value: components.SubagentServerToolOpenRouter = /* values here */ value: components.DatetimeServerTool = /* values here */ ``` +### `components.FilesServerTool` + +```python +value: components.FilesServerTool = /* values here */ +``` + ### `components.FusionServerToolOpenRouter` ```python diff --git a/pyproject.toml b/pyproject.toml index 8064de80..60601548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.0" +version = "0.11.1" 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 ec5d51ee..30f06450 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.0" +__version__: str = "0.11.1" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.0 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.1 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index f3f0d61c..c0bbbca9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -893,6 +893,15 @@ RankingOptionsTypedDict, TypeFileSearch, ) + from .filesservertool import ( + FilesServerTool, + FilesServerToolType, + FilesServerToolTypedDict, + ) + from .filesservertoolconfig import ( + FilesServerToolConfig, + FilesServerToolConfigTypedDict, + ) from .forbiddenresponseerrordata import ( ForbiddenResponseErrorData, ForbiddenResponseErrorDataTypedDict, @@ -3349,6 +3358,11 @@ "FileSearchServerToolValue2", "FileSearchServerToolValue2TypedDict", "FileTypedDict", + "FilesServerTool", + "FilesServerToolConfig", + "FilesServerToolConfigTypedDict", + "FilesServerToolType", + "FilesServerToolTypedDict", "Filters", "FiltersType", "FiltersTypedDict", @@ -5312,6 +5326,11 @@ "RankingOptions": ".filesearchservertool", "RankingOptionsTypedDict": ".filesearchservertool", "TypeFileSearch": ".filesearchservertool", + "FilesServerTool": ".filesservertool", + "FilesServerToolType": ".filesservertool", + "FilesServerToolTypedDict": ".filesservertool", + "FilesServerToolConfig": ".filesservertoolconfig", + "FilesServerToolConfigTypedDict": ".filesservertoolconfig", "ForbiddenResponseErrorData": ".forbiddenresponseerrordata", "ForbiddenResponseErrorDataTypedDict": ".forbiddenresponseerrordata", "FormatJSONObjectConfig": ".formatjsonobjectconfig", diff --git a/src/openrouter/components/chatfunctiontool.py b/src/openrouter/components/chatfunctiontool.py index 3525ecad..b62a155a 100644 --- a/src/openrouter/components/chatfunctiontool.py +++ b/src/openrouter/components/chatfunctiontool.py @@ -19,6 +19,7 @@ ChatWebSearchShorthandTypedDict, ) from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict +from .filesservertool import FilesServerTool, FilesServerToolTypedDict from .imagegenerationservertool_openrouter import ( ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouterTypedDict, @@ -141,6 +142,7 @@ def serialize_model(self, handler): AdvisorServerToolOpenRouterTypedDict, BashServerToolTypedDict, DatetimeServerToolTypedDict, + FilesServerToolTypedDict, ImageGenerationServerToolOpenRouterTypedDict, ChatSearchModelsServerToolTypedDict, SubagentServerToolOpenRouterTypedDict, @@ -159,6 +161,7 @@ def serialize_model(self, handler): AdvisorServerToolOpenRouter, BashServerTool, DatetimeServerTool, + FilesServerTool, ImageGenerationServerToolOpenRouter, ChatSearchModelsServerTool, SubagentServerToolOpenRouter, diff --git a/src/openrouter/components/filesservertool.py b/src/openrouter/components/filesservertool.py new file mode 100644 index 00000000..7e9f36a5 --- /dev/null +++ b/src/openrouter/components/filesservertool.py @@ -0,0 +1,44 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .filesservertoolconfig import FilesServerToolConfig, FilesServerToolConfigTypedDict +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +FilesServerToolType = Literal["openrouter:files",] + + +class FilesServerToolTypedDict(TypedDict): + r"""OpenRouter built-in server tool: read, write, edit, and list workspace files via the Files API. Requires the `x-openrouter-file-ids: openrouter` request header.""" + + type: FilesServerToolType + parameters: NotRequired[FilesServerToolConfigTypedDict] + r"""Configuration for the openrouter:files server tool""" + + +class FilesServerTool(BaseModel): + r"""OpenRouter built-in server tool: read, write, edit, and list workspace files via the Files API. Requires the `x-openrouter-file-ids: openrouter` request header.""" + + type: FilesServerToolType + + parameters: Optional[FilesServerToolConfig] = None + r"""Configuration for the openrouter:files server tool""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["parameters"]) + 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/filesservertoolconfig.py b/src/openrouter/components/filesservertoolconfig.py new file mode 100644 index 00000000..bca5442a --- /dev/null +++ b/src/openrouter/components/filesservertoolconfig.py @@ -0,0 +1,13 @@ +"""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 FilesServerToolConfigTypedDict(TypedDict): + r"""Configuration for the openrouter:files server tool""" + + +class FilesServerToolConfig(BaseModel): + r"""Configuration for the openrouter:files server tool""" diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 0686331f..53cacf21 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -35,6 +35,7 @@ from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict from .fileparserplugin import FileParserPlugin, FileParserPluginTypedDict from .filesearchservertool import FileSearchServerTool, FileSearchServerToolTypedDict +from .filesservertool import FilesServerTool, FilesServerToolTypedDict from .fusionplugin import FusionPlugin, FusionPluginTypedDict from .fusionservertool_openrouter import ( FusionServerToolOpenRouter, @@ -217,25 +218,26 @@ def serialize_model(self, handler): CodexLocalShellToolTypedDict, ApplyPatchServerToolTypedDict, ShellServerToolTypedDict, + FusionServerToolOpenRouterTypedDict, ImageGenerationServerToolOpenRouterTypedDict, - ChatSearchModelsServerToolTypedDict, ShellServerToolOpenRouterTypedDict, BashServerToolTypedDict, CodeInterpreterServerToolTypedDict, ApplyPatchServerToolOpenRouterTypedDict, WebSearchServerToolOpenRouterTypedDict, WebFetchServerToolTypedDict, - FusionServerToolOpenRouterTypedDict, + ChatSearchModelsServerToolTypedDict, + FilesServerToolTypedDict, DatetimeServerToolTypedDict, - SubagentServerToolOpenRouterTypedDict, AdvisorServerToolOpenRouterTypedDict, + SubagentServerToolOpenRouterTypedDict, CustomToolTypedDict, ComputerUseServerToolTypedDict, ResponsesRequestToolFunctionTypedDict, FileSearchServerToolTypedDict, PreviewWebSearchServerToolTypedDict, - Preview20250311WebSearchServerToolTypedDict, WebSearchServerToolTypedDict, + Preview20250311WebSearchServerToolTypedDict, LegacyWebSearchServerToolTypedDict, McpServerToolTypedDict, ImageGenerationServerToolTypedDict, @@ -264,6 +266,7 @@ def serialize_model(self, handler): Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")], Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")], Annotated[DatetimeServerTool, Tag("openrouter:datetime")], + Annotated[FilesServerTool, Tag("openrouter:files")], Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")], Annotated[ ImageGenerationServerToolOpenRouter, Tag("openrouter:image_generation") diff --git a/uv.lock b/uv.lock index 110a921e..68cc8206 100644 --- a/uv.lock +++ b/uv.lock @@ -75,7 +75,7 @@ name = "exceptiongroup" version = "1.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, + { name = "typing-extensions" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0b/9f/a65090624ecf468cdca03533906e7c69ed7588582240cfe7cc9e770b50eb/exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88", size = 29749, upload-time = "2025-05-10T17:42:51.123Z" } wheels = [ @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.0" +version = "0.11.1" source = { editable = "." } dependencies = [ { name = "httpcore" }, From b02f2ba7eae1c19b0f1681c765112187ae60b07e Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:15:18 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow