From ac7a7e585e5b0b76f5b797ce7ade94ba2c21730a Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Mon, 28 Sep 2026 20:08:51 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.interns.get_intern_daemon()`: **Added** * `open_router.interns.get_intern_daemon_access()`: **Deprecated** * `open_router.presets.create_presets_messages()`: * `request.thinking.union(between_tools)` **Added** --- .speakeasy/gen.lock | 78 ++++-- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 116 +++++++- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/thinking.mdx | 6 + docs/components/thinkingbetweentools.mdx | 9 + docs/components/typebetweentools.mdx | 15 ++ docs/operations/getinterndaemonglobals.mdx | 11 + docs/operations/getinterndaemonrequest.mdx | 12 + docs/sdks/interns/README.mdx | 54 +++- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 9 + src/openrouter/components/messagesrequest.py | 17 +- src/openrouter/interns.py | 269 ++++++++++++++++++- src/openrouter/operations/__init__.py | 14 + src/openrouter/operations/getinterndaemon.py | 146 ++++++++++ uv.lock | 2 +- 19 files changed, 746 insertions(+), 42 deletions(-) create mode 100644 docs/components/thinkingbetweentools.mdx create mode 100644 docs/components/typebetweentools.mdx create mode 100644 docs/operations/getinterndaemonglobals.mdx create mode 100644 docs/operations/getinterndaemonrequest.mdx create mode 100644 src/openrouter/operations/getinterndaemon.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 3feb61af..161400da 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: 6cc0d48bfdb4976e09baf54df6158694 + docChecksum: a68b13fdcd5390dae9fe5b31a8862ee2 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.2.33 - configChecksum: 58719407cb0c2ba626b2f1d762c70de0 + releaseVersion: 1.2.34 + configChecksum: f31eb68dbbf9fa0a1b8efdba3435c142 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a7ddbbdb-6d06-4927-b244-bccaf9c2e3e6 - pristine_commit_hash: 49523f4989d804be9af111c9a6c3bb1108d9ce2c - pristine_tree_hash: 386dbcfb15d5e45f8ab5124f9d7cd7888d4e7544 + generation_id: 6198ec44-5913-4ba3-bc10-bc6695a93298 + pristine_commit_hash: 180a65c1c3eb9d31b46df39b15f7e00ed0b1226e + pristine_tree_hash: 7db81c79e309f4c6c334bbf16b8bdc5751cd7250 features: python: acceptHeaders: 3.0.0 @@ -6651,12 +6651,16 @@ trackedFiles: pristine_git_object: 83129fca047441e3fbcda675010679cd79efdf90 docs/components/thinking.mdx: id: 8d7292f65441 - last_write_checksum: sha1:747fc54885c54d140e7c398d5fd5de79606ce248 - pristine_git_object: 2a631dc98969c3dd18eff57cbf4d630ce39dfe53 + last_write_checksum: sha1:3fda9a3c7e080e1d9275dc1b8b414d53ff7df78f + pristine_git_object: 857c79a710fc5b83e5f62bc6a2f280cdf0f9f771 docs/components/thinkingadaptive.mdx: id: d3e5fe2a4135 last_write_checksum: sha1:a2b989fde2d8b36193cf86b48f2d66b8559f58da pristine_git_object: eea8c5cd10de2df04fe255ee82c535e5612b0f7a + docs/components/thinkingbetweentools.mdx: + id: ba08ea334e2c + last_write_checksum: sha1:0f9a535e5c877f1dd49732df18f4f164692ff58f + pristine_git_object: 52bebea402ee1980b475a287bb1c6af49aad0faf docs/components/thinkingdisabled.mdx: id: cf4dce085103 last_write_checksum: sha1:9a16b391d2f8e4caed2ec0a94783ea31f802c6c8 @@ -6837,6 +6841,10 @@ trackedFiles: id: 0f1fed4892ca last_write_checksum: sha1:b57f67ff665ddf959a9078d1fcbd2b1eb9df7a6d pristine_git_object: 02338a09349f6a610ed5313dd972a509b088b518 + docs/components/typebetweentools.mdx: + id: dd3698fc2dc0 + last_write_checksum: sha1:28d18c282da04f0ac699c332a67dcdd233bc7626 + pristine_git_object: 29fd1b7b21e97ebc5e416ba9a48975642d7ec59d docs/components/typeclearthinking20251015.mdx: id: 67f48aa5899b last_write_checksum: sha1:14110e0a9ffa2fd935e6d0cc8a0ab17021bf8114 @@ -8161,6 +8169,14 @@ trackedFiles: id: d3656df0343d last_write_checksum: sha1:14d4198519fb1fe68d97ef6aa980714875bc051e pristine_git_object: e2035a9f0347f8403d43f00136d20fc0e4641887 + docs/operations/getinterndaemonglobals.mdx: + id: da2fcc18ec1f + last_write_checksum: sha1:39e2ceca098bd6a76fcdff47d8de191802056aaf + pristine_git_object: b2ba0d173ad11afd00cf1657b1deab7de641df7d + docs/operations/getinterndaemonrequest.mdx: + id: f275c0103d98 + last_write_checksum: sha1:e99e1b5727148bd43de02d30b6f1ebff309b6efb + pristine_git_object: cdfbaafc1e5c94bfc7cc585ebc075e891160c388 docs/operations/getinternglobals.mdx: id: 9bfe3e0e8a6f last_write_checksum: sha1:7f2d43fe0f91149b2982edebe432faed9bfb3bea @@ -9139,8 +9155,8 @@ trackedFiles: pristine_git_object: 08c687694efbecf50406ae7929029d39fb121295 docs/sdks/interns/README.mdx: id: 2f8a053ffe78 - last_write_checksum: sha1:97e0c819e111876dca07cb7025c6e2f302f2b25d - pristine_git_object: d6f17ba1f24969030acb3452a8a7b05d5adbb159 + last_write_checksum: sha1:e7bbdc193de66e0a79a6a1be3f75897fd6ade785 + pristine_git_object: 9b2e94a1efa1ab6d1f80082f61d25bdb9f01d43f docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:093dd30ebdd18b9763a6956915e0dcae4ae7d5e5 @@ -9207,8 +9223,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:98851babb0a77721eca71165b105e28a5a60e452 - pristine_git_object: a21ee9a4834b33cf106bd58cd9308fad1e629710 + last_write_checksum: sha1:b3f4cd9d7530677335f3245e22f0be29bb84be9b + pristine_git_object: 5dd063d139c776a66d592f8b551ca22f3c82fbab scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -9235,8 +9251,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:b4baecc43ac609d4e81a60af019da14a3f241775 - pristine_git_object: ec10a9e28e5b82f889990168a6a6178d8cd6d0d4 + last_write_checksum: sha1:8738cc5ed484735d90f91b7ba49b92cc9594994e + pristine_git_object: 04b0605f4b9076957fc3ea37dae9bc5028178fd3 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -9283,8 +9299,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:e1aabbe8578b0aa28b25c1ea380cead2b88c6876 - pristine_git_object: d56562d6944eae0809a82e28520c235e9c082ed1 + last_write_checksum: sha1:b65ee612b76b0c889742f132aec0e481770c8f1e + pristine_git_object: 58ea8afb885c27d87573cbcdb7d230ec29c14d03 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -11099,8 +11115,8 @@ trackedFiles: pristine_git_object: 7e69d1f775baece5f94b03d35bcd884d5e6f519d src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:b5abcd9ebdda9e2f62b497d2376bcd798108db64 - pristine_git_object: abb8605093cfb0af7babc6cf8acda945b5c12845 + last_write_checksum: sha1:bc002830b658a7215f6dbf67967f35be24a5efc6 + pristine_git_object: 21aeffb2da5b1f0104aa7804b8105cf1f8381740 src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -12527,8 +12543,8 @@ trackedFiles: pristine_git_object: 50643a126668498dd668c7cceb9f78c03d413d32 src/openrouter/interns.py: id: d18df05c5c6d - last_write_checksum: sha1:d41ea2e1bb8e680c52f8d486652ceadc280587f1 - pristine_git_object: 1aea95b41529d094b64d648bbb3d80af02e65e88 + last_write_checksum: sha1:0047c1e5a89ca5b44b26ce2a735658de2beac333 + pristine_git_object: dfcd3255b87bb272ef8fbc4bfcf23197af3b28c8 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -12555,8 +12571,8 @@ trackedFiles: pristine_git_object: 8680343bbc90107ae6413bd5686012b1fd75d665 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:17c8b0aaac2f2d28ff282aa3d6dc162e25a970a3 - pristine_git_object: bfbb96deeafe455604d608c9b2795437044775c8 + last_write_checksum: sha1:2e8c81f954915a0d74656fce25cdb588c03070e3 + pristine_git_object: 9f8212cdb280d19e7fb3f1eb2b2231e37855582d src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -12793,6 +12809,10 @@ trackedFiles: id: 9169bcde1477 last_write_checksum: sha1:b0efb3c2205f580b8bad328ccca792dfa8eb18aa pristine_git_object: 137abb8f6a48c3a7a0463370d6a254d6af406cad + src/openrouter/operations/getinterndaemon.py: + id: ffa3cab7de3b + last_write_checksum: sha1:6ff5d4d67457f1be58426a4b81ff66251ede39b2 + pristine_git_object: d85bf67f5c67c3690a27a8314eeab55bf5c278c2 src/openrouter/operations/getinterndaemonaccess.py: id: 30c4fbbddd94 last_write_checksum: sha1:c9a4991c38d8588d2f272710f24fa430975d4fab @@ -16537,5 +16557,17 @@ examples: application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} "500": application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} + getInternDaemon: + speakeasy-default-get-intern-daemon: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "200": + application/json: {"origin": "https://research-assistant-7c9e6679.or.bot", "token": "daemon_token"} + "401": + application/json: {"error": {"code": 404, "message": "Intern not found"}} + "500": + application/json: {"error": {"code": 404, "message": "Intern not found"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.batch.create_batches()`: `response.results[].response.body.union(class (2)).content[].union(web_fetch_tool_result).content.union(web_fetch_tool_result_error).error_code.enum(url_not_in_prior_context)` **Added**\n* `open_router.batch.get_batches()`: `response.results[].response.body.union(class (2)).content[].union(web_fetch_tool_result).content.union(web_fetch_tool_result_error).error_code.enum(url_not_in_prior_context)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].native_tools` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].native_tools` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.messages[].content.union(Array<>)[].union(web_search_tool_result).content.union(class (1)).error_code.enum(request_too_large)` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.interns.get_intern_daemon()`: **Added**\n* `open_router.interns.get_intern_daemon_access()`: **Deprecated**\n* `open_router.presets.create_presets_messages()`: \n * `request.thinking.union(between_tools)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 70965d23..3e1aed48 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.2.33 + version: 1.2.34 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index fa660732..150a4282 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -16747,6 +16747,15 @@ components: required: - 'type' type: 'object' + - additionalProperties: false + properties: + type: + enum: + - 'between_tools' + type: 'string' + required: + - 'type' + type: 'object' tool_choice: oneOf: - properties: @@ -39873,10 +39882,10 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /interns/{internId}/daemon-access: + /interns/{internId}/daemon: get: description: 'Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' - operationId: 'getInternDaemonAccess' + operationId: 'getInternDaemon' parameters: - description: 'ID of an intern visible to the authenticated API key.' in: 'path' @@ -39975,6 +39984,109 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /interns/{internId}/daemon-access: + get: + deprecated: true + description: 'Deprecated alias of `GET /interns/{internId}/daemon` with the same request, response, and errors. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' + operationId: 'getInternDaemonAccess' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/InternDaemonAccess' + description: 'Daemon origin and token.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Intern not found' + metadata: + reason: 'not_found' + retryable: false + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Operation timed out after 10s. Please try again later.' + metadata: + reason: 'timeout' + retryable: true + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline. The deadline quoted in the message is the route''s own, so it differs between operations.' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'This intern is not running.' + metadata: + reason: 'intern_not_running' + retryable: false + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern cannot be attached to. `metadata.reason` is `intern_not_running`, `intern_unreachable` when it has no usable address yet, or `intern_needs_restart` when it was provisioned before daemon access was available.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'The request could not be completed' + metadata: + reason: 'internal_error' + retryable: true + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.' + security: + - apiKey: [] + summary: 'Get an intern''s daemon access (deprecated alias)' + tags: + - 'Interns' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /interns/{internId}/invoke: post: description: "Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.\n\nSend the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.\n\nRuns started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).\n\nAvailable to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`." diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 34aa45a7..dd7b8c0c 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:ac4e63eb072f8b6a5d1e7a1bdbfba032d2f9037573a0d6834c5ce73277610721 - sourceBlobDigest: sha256:1ba13db83a2100228294b7f20e85808581164f67a255ed28d6eafe1286ae0f24 + sourceRevisionDigest: sha256:35963524e6df9f802d7eceaba8b27879d27f5838a0346a312a8b17c1bd88bf97 + sourceBlobDigest: sha256:f5e2c8ec98a26fe8ac68be7099e73d8a04244a09e0d48aad54db5930809268b5 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ac4e63eb072f8b6a5d1e7a1bdbfba032d2f9037573a0d6834c5ce73277610721 - sourceBlobDigest: sha256:1ba13db83a2100228294b7f20e85808581164f67a255ed28d6eafe1286ae0f24 + sourceRevisionDigest: sha256:35963524e6df9f802d7eceaba8b27879d27f5838a0346a312a8b17c1bd88bf97 + sourceBlobDigest: sha256:f5e2c8ec98a26fe8ac68be7099e73d8a04244a09e0d48aad54db5930809268b5 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:6d5051603d47f45c00e6540a8954ed797c1b6e32699f84d04b2147ec62dcef44 + codeSamplesRevisionDigest: sha256:63da70e7fb5d93ad61a1cbf041719741e497d76df605ff1610fc4d80436f1050 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 76fa72ef..37b8d7c7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2739,4 +2739,14 @@ Based on: ### Generated - [python v1.2.33] . ### Releases -- [PyPI v1.2.33] https://pypi.org/project/openrouter/1.2.33 - . \ No newline at end of file +- [PyPI v1.2.33] https://pypi.org/project/openrouter/1.2.33 - . + +## 2026-09-28 20:06:43 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.2.34] . +### Releases +- [PyPI v1.2.34] https://pypi.org/project/openrouter/1.2.34 - . \ No newline at end of file diff --git a/docs/components/thinking.mdx b/docs/components/thinking.mdx index 2a631dc9..857c79a7 100644 --- a/docs/components/thinking.mdx +++ b/docs/components/thinking.mdx @@ -22,3 +22,9 @@ value: components.ThinkingDisabled = /* values here */ value: components.ThinkingAdaptive = /* values here */ ``` +### `components.ThinkingBetweenTools` + +```python +value: components.ThinkingBetweenTools = /* values here */ +``` + diff --git a/docs/components/thinkingbetweentools.mdx b/docs/components/thinkingbetweentools.mdx new file mode 100644 index 00000000..52bebea4 --- /dev/null +++ b/docs/components/thinkingbetweentools.mdx @@ -0,0 +1,9 @@ +--- +title: "ThinkingBetweenTools" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `type` | [components.TypeBetweenTools](../components/typebetweentools.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/typebetweentools.mdx b/docs/components/typebetweentools.mdx new file mode 100644 index 00000000..29fd1b7b --- /dev/null +++ b/docs/components/typebetweentools.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeBetweenTools" +--- + +## Example Usage + +```python +from openrouter.components import TypeBetweenTools +value: TypeBetweenTools = "between_tools" +``` + + +## Values + +- `"between_tools"` diff --git a/docs/operations/getinterndaemonglobals.mdx b/docs/operations/getinterndaemonglobals.mdx new file mode 100644 index 00000000..b2ba0d17 --- /dev/null +++ b/docs/operations/getinterndaemonglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetInternDaemonGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getinterndaemonrequest.mdx b/docs/operations/getinterndaemonrequest.mdx new file mode 100644 index 00000000..cdfbaafc --- /dev/null +++ b/docs/operations/getinterndaemonrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "GetInternDaemonRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/sdks/interns/README.mdx b/docs/sdks/interns/README.mdx index d6f17ba1..9b2e94a1 100644 --- a/docs/sdks/interns/README.mdx +++ b/docs/sdks/interns/README.mdx @@ -14,7 +14,8 @@ Create, inspect, update, provision, suspend and delete OpenRouter interns throug * [delete_intern](#delete_intern) - Delete an intern * [get_intern](#get_intern) - Get an intern * [update_intern](#update_intern) - Update an intern -* [get_intern_daemon_access](#get_intern_daemon_access) - Get an intern's daemon access +* [get_intern_daemon](#get_intern_daemon) - Get an intern's daemon access +* [~~get_intern_daemon_access~~](#get_intern_daemon_access) - Get an intern's daemon access (deprecated alias) :warning: **Deprecated** * [provision_intern](#provision_intern) - Provision an intern * [suspend_intern](#suspend_intern) - Suspend an intern * [chat](#chat) - Stream a chat completion with an intern @@ -269,7 +270,7 @@ with OpenRouter( | errors.InternLifecycleError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | -## get_intern_daemon_access +## get_intern_daemon Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. @@ -280,6 +281,55 @@ from openrouter import OpenRouter import os +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.interns.get_intern_daemon(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.InternDaemonAccess](../../components/interndaemonaccess.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 401, 403, 404, 408, 409 | application/json | +| errors.InternLifecycleError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## ~~get_intern_daemon_access~~ + +Deprecated alias of `GET /interns/{internId}/daemon` with the same request, response, and errors. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + with OpenRouter( http_referer="", x_open_router_title="", diff --git a/pyproject.toml b/pyproject.toml index a21ee9a4..5dd063d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.2.33" +version = "1.2.34" 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 ec10a9e2..04b0605f 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.2.33" +__version__: str = "1.2.34" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.2.33 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.2.34 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 d56562d6..58ea8afb 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2442,6 +2442,8 @@ Thinking, ThinkingAdaptive, ThinkingAdaptiveTypedDict, + ThinkingBetweenTools, + ThinkingBetweenToolsTypedDict, ThinkingDisabled, ThinkingDisabledTypedDict, ThinkingEnabled, @@ -2480,6 +2482,7 @@ TypeAdvisor20260301, TypeAny, TypeBash20250124, + TypeBetweenTools, TypeClearThinking20251015, TypeClearToolUses20250919, TypeCompact20260112, @@ -6649,6 +6652,8 @@ "Thinking", "ThinkingAdaptive", "ThinkingAdaptiveTypedDict", + "ThinkingBetweenTools", + "ThinkingBetweenToolsTypedDict", "ThinkingDisabled", "ThinkingDisabledTypedDict", "ThinkingEnabled", @@ -6721,6 +6726,7 @@ "TypeAllowlist", "TypeAny", "TypeBash20250124", + "TypeBetweenTools", "TypeClearThinking20251015", "TypeClearToolUses20250919", "TypeCodeInterpreter", @@ -8730,6 +8736,8 @@ "Thinking": ".messagesrequest", "ThinkingAdaptive": ".messagesrequest", "ThinkingAdaptiveTypedDict": ".messagesrequest", + "ThinkingBetweenTools": ".messagesrequest", + "ThinkingBetweenToolsTypedDict": ".messagesrequest", "ThinkingDisabled": ".messagesrequest", "ThinkingDisabledTypedDict": ".messagesrequest", "ThinkingEnabled": ".messagesrequest", @@ -8768,6 +8776,7 @@ "TypeAdvisor20260301": ".messagesrequest", "TypeAny": ".messagesrequest", "TypeBash20250124": ".messagesrequest", + "TypeBetweenTools": ".messagesrequest", "TypeClearThinking20251015": ".messagesrequest", "TypeClearToolUses20250919": ".messagesrequest", "TypeCompact20260112": ".messagesrequest", diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index abb86050..21aeffb2 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -424,6 +424,17 @@ def serialize_model(self, handler): System = TypeAliasType("System", Union[str, List[AnthropicTextBlockParam]]) +TypeBetweenTools = Literal["between_tools",] + + +class ThinkingBetweenToolsTypedDict(TypedDict): + type: TypeBetweenTools + + +class ThinkingBetweenTools(BaseModel): + type: TypeBetweenTools + + TypeAdaptive = Literal["adaptive",] @@ -525,7 +536,10 @@ def serialize_model(self, handler): ThinkingTypedDict = TypeAliasType( "ThinkingTypedDict", Union[ - ThinkingDisabledTypedDict, ThinkingAdaptiveTypedDict, ThinkingEnabledTypedDict + ThinkingDisabledTypedDict, + ThinkingBetweenToolsTypedDict, + ThinkingAdaptiveTypedDict, + ThinkingEnabledTypedDict, ], ) @@ -535,6 +549,7 @@ def serialize_model(self, handler): Annotated[ThinkingEnabled, Tag("enabled")], Annotated[ThinkingDisabled, Tag("disabled")], Annotated[ThinkingAdaptive, Tag("adaptive")], + Annotated[ThinkingBetweenTools, Tag("between_tools")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/interns.py b/src/openrouter/interns.py index 1aea95b4..dfcd3255 100644 --- a/src/openrouter/interns.py +++ b/src/openrouter/interns.py @@ -8,6 +8,7 @@ from openrouter.utils import eventstreaming, get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Iterable, List, Mapping, Optional, Union +from typing_extensions import deprecated class ChatAcceptEnum(str, Enum): @@ -1448,7 +1449,135 @@ async def update_intern_async( raise errors.OpenRouterDefaultError("Unexpected response received", http_res) - def get_intern_daemon_access( + def get_intern_daemon( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.InternDaemonAccess: + r"""Get an intern's daemon access + + Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetInternDaemonRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request( + method="GET", + path="/interns/{internId}/daemon", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetInternDaemonGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + allowed_fields=["api_key"], + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getInternDaemon", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Interns"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.InternDaemonAccess, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_intern_daemon_async( self, *, intern_id: str, @@ -1474,6 +1603,137 @@ def get_intern_daemon_access( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetInternDaemonRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request_async( + method="GET", + path="/interns/{internId}/daemon", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetInternDaemonGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + allowed_fields=["api_key"], + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getInternDaemon", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Interns"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.InternDaemonAccess, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + @deprecated( + "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ) + def get_intern_daemon_access( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.InternDaemonAccess: + r"""Get an intern's daemon access (deprecated alias) + + Deprecated alias of `GET /interns/{internId}/daemon` with the same request, response, and errors. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1576,6 +1836,9 @@ def get_intern_daemon_access( raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + @deprecated( + "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ) async def get_intern_daemon_access_async( self, *, @@ -1588,9 +1851,9 @@ async def get_intern_daemon_access_async( timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> components.InternDaemonAccess: - r"""Get an intern's daemon access + r"""Get an intern's daemon access (deprecated alias) - Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. + Deprecated alias of `GET /interns/{internId}/daemon` with the same request, response, and errors. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. If set, this operation will use `api_key` from the global security. diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index bfbb96de..9f8212cd 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -487,6 +487,12 @@ GetInternRequest, GetInternRequestTypedDict, ) + from .getinterndaemon import ( + GetInternDaemonGlobals, + GetInternDaemonGlobalsTypedDict, + GetInternDaemonRequest, + GetInternDaemonRequestTypedDict, + ) from .getinterndaemonaccess import ( GetInternDaemonAccessGlobals, GetInternDaemonAccessGlobalsTypedDict, @@ -1367,6 +1373,10 @@ "GetInternDaemonAccessGlobalsTypedDict", "GetInternDaemonAccessRequest", "GetInternDaemonAccessRequestTypedDict", + "GetInternDaemonGlobals", + "GetInternDaemonGlobalsTypedDict", + "GetInternDaemonRequest", + "GetInternDaemonRequestTypedDict", "GetInternGlobals", "GetInternGlobalsTypedDict", "GetInternRequest", @@ -2154,6 +2164,10 @@ "GetInternGlobalsTypedDict": ".getintern", "GetInternRequest": ".getintern", "GetInternRequestTypedDict": ".getintern", + "GetInternDaemonGlobals": ".getinterndaemon", + "GetInternDaemonGlobalsTypedDict": ".getinterndaemon", + "GetInternDaemonRequest": ".getinterndaemon", + "GetInternDaemonRequestTypedDict": ".getinterndaemon", "GetInternDaemonAccessGlobals": ".getinterndaemonaccess", "GetInternDaemonAccessGlobalsTypedDict": ".getinterndaemonaccess", "GetInternDaemonAccessRequest": ".getinterndaemonaccess", diff --git a/src/openrouter/operations/getinterndaemon.py b/src/openrouter/operations/getinterndaemon.py new file mode 100644 index 00000000..d85bf67f --- /dev/null +++ b/src/openrouter/operations/getinterndaemon.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetInternDaemonGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetInternDaemonGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetInternDaemonRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetInternDaemonRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/uv.lock b/uv.lock index 4f4e641c..1f1c5b39 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.2.33" +version = "1.2.34" source = { editable = "." } dependencies = [ { name = "httpcore" }, From d8efa60f435106c24d594b11ebfa80e1ab440854 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Mon, 28 Sep 2026 20:08:59 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow