diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 36becbe3..9e31c1eb 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: 279b5f97d142c9e39e195b0a84085c9d + docChecksum: 46c6c4f6880333ed58f4f9fded8834f8 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.66 - configChecksum: d60333aec60c8fc9660768e2c1487354 + releaseVersion: 1.3.67 + configChecksum: 6049c763bbae5418007cdd2d3ecac047 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 51013c78-9d03-44f4-ac2e-93284b41f297 - pristine_commit_hash: df1988e5cff6b0b03406873a3986cdaaf8dff042 - pristine_tree_hash: 1e738a4df36772d51cf0ada4ff040bb3429109b4 + generation_id: 45d37a74-bf6f-4184-b501-ff3531b9a92e + pristine_commit_hash: 0d30fef1c125936e6f7f5b68bc3362a1b867d002 + pristine_tree_hash: da4f1a85eeb0fdb4b6b2af299b959179eba01144 features: python: acceptHeaders: 3.0.0 @@ -3988,8 +3988,8 @@ trackedFiles: pristine_git_object: e3e71d16be9294f68ca671f76dbcc8b6d8ecc749 docs/components/intern.mdx: id: 95d0e0ffc539 - last_write_checksum: sha1:13508092e8edb3ecd4d7aed06dc722965823d4b3 - pristine_git_object: 71f5da0f992ab9ff76f92b2239cd8300d4a8b74f + last_write_checksum: sha1:1efaf0f73cb574f68983fdcf2d02f113876a07bc + pristine_git_object: 6959c6067cfe3ab926e62b35ae8bcdb700622478 docs/components/internalserverresponseerrordata.mdx: id: 9a443dea63c5 last_write_checksum: sha1:39c41704820f6cde2d67ec3b9f1bcac7bc1a81d0 @@ -9130,6 +9130,18 @@ trackedFiles: id: 9bfe3e0e8a6f last_write_checksum: sha1:7f2d43fe0f91149b2982edebe432faed9bfb3bea pristine_git_object: 118bb0d2fe8033480475600b890910226a389d65 + docs/operations/getinterniconglobals.mdx: + id: afca2a95de05 + last_write_checksum: sha1:ad615e690060f9fd36c21954928dbd711362dc2c + pristine_git_object: 542cb475e2a3aa6c1dcba78315b6f03ed662a7b9 + docs/operations/getinterniconrequest.mdx: + id: bbe139c71b51 + last_write_checksum: sha1:40fb590d80dac97224b8309e80a2984026e39972 + pristine_git_object: c55add4d062c1129570cb9f69404ae09253d21c6 + docs/operations/getinterniconresponse.mdx: + id: 004f6af691c2 + last_write_checksum: sha1:7ac81f37402cebd6b37a3126f298dcb26ab5363d + pristine_git_object: 24a2ce7247639a56341698fc7b1a4c3809d76d68 docs/operations/getinternrequest.mdx: id: 6e44684f038a last_write_checksum: sha1:e3b38672e96405461ef3069043f981eb45730bc1 @@ -10272,8 +10284,8 @@ trackedFiles: pristine_git_object: 08c687694efbecf50406ae7929029d39fb121295 docs/sdks/interns/README.mdx: id: 2f8a053ffe78 - last_write_checksum: sha1:78ad14c524469b4c89d30d0a90867da355bd090d - pristine_git_object: a72d409627f77eb58be18f3f8ba3074a135d465a + last_write_checksum: sha1:ebe5b0208ea925f4336b1620662fdc116de4e065 + pristine_git_object: a64bdbacaade03b943c76a4cda4a7a951af27347 docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:aab5b254f0a6dc7ab7c6d543b20c889113cc0dc9 @@ -10348,8 +10360,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:7337e6a742ddf8c0eace51964400336fa6230295 - pristine_git_object: 8f7be67ffe7f60cb9210dcf954af115205edf7c6 + last_write_checksum: sha1:4b196ba22fdb14a708a043966f53fe20ef6be545 + pristine_git_object: c91f84b40a3a02a828b9a09dd5e4e503879bf386 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10376,8 +10388,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:3d286e29d6efe05e4e3008093b349ba5bf9358ed - pristine_git_object: a003753cca71e6a74f155937fea572fe184c3172 + last_write_checksum: sha1:3f8c5a8ac3678a3d9203dbb6379abcb960b2a8b8 + pristine_git_object: da4c9b94cbdb5a6453e266de393dffb4d48244bd src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -12120,8 +12132,8 @@ trackedFiles: pristine_git_object: 4a58daf7d055e111ebf204b18ee413203f06b745 src/openrouter/components/intern.py: id: eed59a44b44f - last_write_checksum: sha1:de3378c82a4f22b53cd7fa6abd7b938e89c80c4f - pristine_git_object: 1dd62abe61d64b90bcfa178b73df6ae656f552bc + last_write_checksum: sha1:29b7a9aabd31b99bd0d6fb221a3f92e7e0dd9e6e + pristine_git_object: 0597b6a695a4b91f0dd5b793ccd5c63c17111f96 src/openrouter/components/internalserverresponseerrordata.py: id: 91397805fa13 last_write_checksum: sha1:6307236e36dc876dbfae76cfcc29ad49461b5b5d @@ -14060,8 +14072,8 @@ trackedFiles: pristine_git_object: 50643a126668498dd668c7cceb9f78c03d413d32 src/openrouter/interns.py: id: d18df05c5c6d - last_write_checksum: sha1:0e26b094dfe3e143d023a778b2c5a9415a5a458f - pristine_git_object: 56198d2f56c59f52eed5b35f59d54b5ec1f4247b + last_write_checksum: sha1:3fec15dfd9ba8948e454e4f7ed72bc432e50298a + pristine_git_object: 19f2e8da8c8b9042c2a0db8e65d67f0419e13ba7 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -14088,8 +14100,8 @@ trackedFiles: pristine_git_object: f01a5ab1865b16939c092d854fe8a7145c327058 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:4a40155b5857c17e8c8aaf072175bc2227f7769f - pristine_git_object: 3f4ec274171a7e3f68a07190b66f48b055a5985c + last_write_checksum: sha1:146b043847d9ecac862a002d90d355036100a2c5 + pristine_git_object: 265b76bdc1d266256302e03b6e6130b46e2b76cb src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -14366,6 +14378,10 @@ trackedFiles: id: 30c4fbbddd94 last_write_checksum: sha1:c9a4991c38d8588d2f272710f24fa430975d4fab pristine_git_object: 6632fbbbe4e59918369b70cf2a365880f2d315d6 + src/openrouter/operations/getinternicon.py: + id: 2d450ce18c27 + last_write_checksum: sha1:3a38094aaf42a84d058a7b79dfd07b4de54af134 + pristine_git_object: 77a979126ab6dcc56b5536d3b295191c2589103c src/openrouter/operations/getkey.py: id: d9769da90865 last_write_checksum: sha1:63a27034e350b578b6d5f29d6568111bc14c75c1 @@ -18989,5 +19005,24 @@ examples: responses: "504": application/json: {"error": {"code": 504, "message": "Vault request timed out"}} + getInternIcon: + speakeasy-default-get-intern-icon: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "200": + image/jpeg: "x-file: example.file" + image/png: "x-file: example.file" + "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.interns.sign_intern_daemon_access_request()`: \n * `request.route` **Added**\n * `response` **Changed**\n* `open_router.interns.sign_intern_daemon_request()`: \n * `request.route` **Added**\n * `response` **Changed**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.interns.get_intern_icon()`: **Added** + * `open_router.interns.list_interns()`: `response.data[]` **Changed** + * `open_router.interns.create_intern()`: `response` **Changed** + * `open_router.interns.get_intern()`: `response` **Changed** + * `open_router.interns.update_intern()`: `response` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f298cd91..97ca75f5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.66 + version: 1.3.67 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 82c168a4..e9ca15d7 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -15173,8 +15173,10 @@ components: example: attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -15194,6 +15196,9 @@ components: created_at: description: 'ISO 8601 creation time.' type: 'string' + created_by_you: + description: 'Whether the user behind the key created the intern. Present on list and retrieve; absent for organization keys, which act for no user.' + type: 'boolean' description: description: 'Free-form description.' type: @@ -15204,6 +15209,11 @@ components: type: - 'string' - 'null' + icon_sha256: + description: 'SHA-256 of the intern icon, or null when it has none. Present on list and retrieve; fetch the bytes from `GET /api/v1/interns/{intern_id}/icon`.' + type: + - 'string' + - 'null' id: description: 'Intern id.' type: 'string' @@ -15953,8 +15963,10 @@ components: data: - attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -42439,8 +42451,10 @@ paths: data: - attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -42563,8 +42577,10 @@ paths: example: attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -42584,8 +42600,10 @@ paths: example: attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -42935,8 +42953,10 @@ paths: example: attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -43043,8 +43063,10 @@ paths: example: attached_vault_id: null created_at: '2026-09-16T08:30:00.000Z' + created_by_you: true description: 'Researches customer questions' hostname: 'research-assistant.openrouter.ai' + icon_sha256: null id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' instructions: null last_failure_message: null @@ -43944,6 +43966,107 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /interns/{internId}/icon: + get: + description: 'Returns the icon image of one visible intern. Pass the intern''s `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern''s own API key sees only that intern: the collection and every other intern answer 404 to it. 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: 'getInternIcon' + 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' + - description: 'The `icon_sha256` the caller expects.' + in: 'query' + name: 'v' + required: false + schema: + description: 'The `icon_sha256` the caller expects.' + type: 'string' + responses: + '200': + content: + image/jpeg: + schema: + format: 'binary' + type: 'string' + image/png: + schema: + format: 'binary' + type: 'string' + description: 'Icon image bytes.' + '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.' + '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 icon' + 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 909f3ef4..7a163431 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:6a01fa8140088735ccb9c5e5e79272410e4a8d64f9caa9756592c1d540feb4da - sourceBlobDigest: sha256:44dc586b67df101e5b115b16c8d6a2991c4488257eef039c3e1491f4af69437f + sourceRevisionDigest: sha256:5c8c325890d3919ed2eed607f18c85f3e56b6154ac535eea8d528ecf1aa3659a + sourceBlobDigest: sha256:3c0dd7e3f51c6365c9ffa10da4a68ede10dcbfbd51e7ada202b9638734972dc8 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6a01fa8140088735ccb9c5e5e79272410e4a8d64f9caa9756592c1d540feb4da - sourceBlobDigest: sha256:44dc586b67df101e5b115b16c8d6a2991c4488257eef039c3e1491f4af69437f + sourceRevisionDigest: sha256:5c8c325890d3919ed2eed607f18c85f3e56b6154ac535eea8d528ecf1aa3659a + sourceBlobDigest: sha256:3c0dd7e3f51c6365c9ffa10da4a68ede10dcbfbd51e7ada202b9638734972dc8 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:14b00aec0efae7dcf67569be815b3772c0021a1e1eda7d404503d5de832ec122 + codeSamplesRevisionDigest: sha256:72171bfe146165df7f67ee76759bf1da037f20509276ff314ffe0f6e9b29d01e workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index dc787af0..d0760bc5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3429,4 +3429,14 @@ Based on: ### Generated - [python v1.3.66] . ### Releases -- [PyPI v1.3.66] https://pypi.org/project/openrouter/1.3.66 - . \ No newline at end of file +- [PyPI v1.3.66] https://pypi.org/project/openrouter/1.3.66 - . + +## 2026-10-19 17:03:15 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.67] . +### Releases +- [PyPI v1.3.67] https://pypi.org/project/openrouter/1.3.67 - . \ No newline at end of file diff --git a/docs/components/intern.mdx b/docs/components/intern.mdx index d7a6f76e..f5462adf 100644 --- a/docs/components/intern.mdx +++ b/docs/components/intern.mdx @@ -7,19 +7,21 @@ Public lifecycle state and settings for one intern. ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `attached_vault_id` | *Nullable[str]* | ✅ | Vault the intern borrows from another intern, or null when it borrows none. | -| `created_at` | *str* | ✅ | ISO 8601 creation time. | -| `description` | *Nullable[str]* | ✅ | Free-form description. | -| `hostname` | *Nullable[str]* | ✅ | Public hostname the intern is reachable at, or null until provisioning has assigned one. | -| `id` | *str* | ✅ | Intern id. | -| `instructions` | *Nullable[str]* | ✅ | Standing instructions the intern boots with. | -| `last_failure_message` | *Nullable[str]* | ✅ | Why the last provisioning attempt failed, when status is failed. | -| `model` | *Nullable[str]* | ✅ | OpenRouter model slug the intern runs, or null for the workspace default. | -| `name` | *str* | ✅ | Intern name, unique per creator within a workspace. | -| `progress` | [Nullable[components.Progress]](../components/progress.mdx) | ✅ | Active provisioning step, or null once provisioning has settled. | -| `status` | [components.InternStatus](../components/internstatus.mdx) | ✅ | Lifecycle status. | -| `updated_at` | *str* | ✅ | ISO 8601 last update time. | -| `vault_id` | *Nullable[str]* | ✅ | Vault the intern owns, or null before it has been created. | -| `workspace_id` | *str* | ✅ | Workspace that owns the intern and scopes its secrets. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `attached_vault_id` | *Nullable[str]* | ✅ | Vault the intern borrows from another intern, or null when it borrows none. | +| `created_at` | *str* | ✅ | ISO 8601 creation time. | +| `created_by_you` | *Optional[bool]* | ➖ | Whether the user behind the key created the intern. Present on list and retrieve; absent for organization keys, which act for no user. | +| `description` | *Nullable[str]* | ✅ | Free-form description. | +| `hostname` | *Nullable[str]* | ✅ | Public hostname the intern is reachable at, or null until provisioning has assigned one. | +| `icon_sha256` | *OptionalNullable[str]* | ➖ | SHA-256 of the intern icon, or null when it has none. Present on list and retrieve; fetch the bytes from `GET /api/v1/interns/{intern_id}/icon`. | +| `id` | *str* | ✅ | Intern id. | +| `instructions` | *Nullable[str]* | ✅ | Standing instructions the intern boots with. | +| `last_failure_message` | *Nullable[str]* | ✅ | Why the last provisioning attempt failed, when status is failed. | +| `model` | *Nullable[str]* | ✅ | OpenRouter model slug the intern runs, or null for the workspace default. | +| `name` | *str* | ✅ | Intern name, unique per creator within a workspace. | +| `progress` | [Nullable[components.Progress]](../components/progress.mdx) | ✅ | Active provisioning step, or null once provisioning has settled. | +| `status` | [components.InternStatus](../components/internstatus.mdx) | ✅ | Lifecycle status. | +| `updated_at` | *str* | ✅ | ISO 8601 last update time. | +| `vault_id` | *Nullable[str]* | ✅ | Vault the intern owns, or null before it has been created. | +| `workspace_id` | *str* | ✅ | Workspace that owns the intern and scopes its secrets. | \ No newline at end of file diff --git a/docs/operations/getinterniconglobals.mdx b/docs/operations/getinterniconglobals.mdx new file mode 100644 index 00000000..8dcdd830 --- /dev/null +++ b/docs/operations/getinterniconglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetInternIconGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getinterniconrequest.mdx b/docs/operations/getinterniconrequest.mdx new file mode 100644 index 00000000..0ea24cbe --- /dev/null +++ b/docs/operations/getinterniconrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetInternIconRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `intern_id` | *str* | ✅ | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `v` | *Optional[str]* | ➖ | The `icon_sha256` the caller expects. | | \ No newline at end of file diff --git a/docs/operations/getinterniconresponse.mdx b/docs/operations/getinterniconresponse.mdx new file mode 100644 index 00000000..24a2ce72 --- /dev/null +++ b/docs/operations/getinterniconresponse.mdx @@ -0,0 +1,18 @@ +--- +title: "GetInternIconResponse" +--- + +## Supported Types + +### `httpx.Response` + +```python +value: httpx.Response = /* values here */ +``` + +### `httpx.Response` + +```python +value: httpx.Response = /* values here */ +``` + diff --git a/docs/sdks/interns/README.mdx b/docs/sdks/interns/README.mdx index c2bf0c73..46d5db0c 100644 --- a/docs/sdks/interns/README.mdx +++ b/docs/sdks/interns/README.mdx @@ -18,6 +18,7 @@ Create, inspect, update, provision, suspend and delete OpenRouter interns throug * [~~get_intern_daemon_access~~](#get_intern_daemon_access) - Get an intern's daemon access (deprecated alias) ⚠️ **Deprecated** * [~~sign_intern_daemon_access_request~~](#sign_intern_daemon_access_request) - Sign a daemon request with the caller's identity (deprecated alias) ⚠️ **Deprecated** * [sign_intern_daemon_request](#sign_intern_daemon_request) - Sign a daemon request with the caller's identity +* [get_intern_icon](#get_intern_icon) - Get an intern's icon * [provision_intern](#provision_intern) - Provision an intern * [suspend_intern](#suspend_intern) - Suspend an intern * [chat](#chat) - Stream a chat completion with an intern @@ -470,6 +471,54 @@ with OpenRouter( | errors.InternLifecycleError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | +## get_intern_icon + +Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. + +### Example Usage + +```python +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_icon(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | ✅ | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `v` | *Optional[str]* | ➖ | The `icon_sha256` the caller expects. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.GetInternIconResponse](../../operations/getinterniconresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 401, 403, 404, 408 | application/json | +| errors.InternLifecycleError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + ## provision_intern Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required. diff --git a/pyproject.toml b/pyproject.toml index 8f7be67f..c91f84b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.66" +version = "1.3.67" 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 a003753c..da4c9b94 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.66" +__version__: str = "1.3.67" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.66 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.67 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/intern.py b/src/openrouter/components/intern.py index 1dd62abe..0597b6a6 100644 --- a/src/openrouter/components/intern.py +++ b/src/openrouter/components/intern.py @@ -1,10 +1,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from pydantic import model_serializer -from typing import Literal, Union -from typing_extensions import TypedDict +from typing import Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict class ProgressTypedDict(TypedDict): @@ -78,6 +85,10 @@ class InternTypedDict(TypedDict): r"""Vault the intern owns, or null before it has been created.""" workspace_id: str r"""Workspace that owns the intern and scopes its secrets.""" + created_by_you: NotRequired[bool] + r"""Whether the user behind the key created the intern. Present on list and retrieve; absent for organization keys, which act for no user.""" + icon_sha256: NotRequired[Nullable[str]] + r"""SHA-256 of the intern icon, or null when it has none. Present on list and retrieve; fetch the bytes from `GET /api/v1/interns/{intern_id}/icon`.""" class Intern(BaseModel): @@ -125,16 +136,45 @@ class Intern(BaseModel): workspace_id: str r"""Workspace that owns the intern and scopes its secrets.""" + created_by_you: Optional[bool] = None + r"""Whether the user behind the key created the intern. Present on list and retrieve; absent for organization keys, which act for no user.""" + + icon_sha256: OptionalNullable[str] = UNSET + r"""SHA-256 of the intern icon, or null when it has none. Present on list and retrieve; fetch the bytes from `GET /api/v1/interns/{intern_id}/icon`.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): + optional_fields = set(["created_by_you", "icon_sha256"]) + nullable_fields = set( + [ + "attached_vault_id", + "description", + "hostname", + "icon_sha256", + "instructions", + "last_failure_message", + "model", + "progress", + "vault_id", + ] + ) 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/interns.py b/src/openrouter/interns.py index 56198d2f..19f2e8da 100644 --- a/src/openrouter/interns.py +++ b/src/openrouter/interns.py @@ -11,6 +11,11 @@ from typing_extensions import deprecated +class GetInternIconAcceptEnum(str, Enum): + IMAGE_JPEG = "image/jpeg" + IMAGE_PNG = "image/png" + + class ChatAcceptEnum(str, Enum): APPLICATION_JSON = "application/json" TEXT_EVENT_STREAM = "text/event-stream" @@ -2593,6 +2598,292 @@ async def sign_intern_daemon_request_async( raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + def get_intern_icon( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + v: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + accept_header_override: Optional[GetInternIconAcceptEnum] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetInternIconResponse: + r"""Get an intern's icon + + Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. 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 v: The `icon_sha256` the caller expects. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + 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.GetInternIconRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + v=v, + ) + + req = self._build_request( + method="GET", + path="/interns/{internId}/icon", + 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=accept_header_override.value + if accept_header_override is not None + else "image/jpeg;q=1, image/png;q=0", + http_headers=http_headers, + _globals=operations.GetInternIconGlobals( + 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="getInternIcon", + 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), + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "image/jpeg"): + return http_res + if utils.match_response(http_res, "200", "image/png"): + return http_res + if utils.match_response( + http_res, ["401", "403", "404", "408"], "application/json" + ): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res, http_res_text + ) + raise errors.InternLifecycleError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res, http_res_text + ) + raise errors.InternLifecycleError(response_data, http_res, http_res_text) + 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 + ) + + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) + + async def get_intern_icon_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + v: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + accept_header_override: Optional[GetInternIconAcceptEnum] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetInternIconResponse: + r"""Get an intern's icon + + Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. 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 v: The `icon_sha256` the caller expects. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param accept_header_override: Override the default accept header for this method + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + 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.GetInternIconRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + v=v, + ) + + req = self._build_request_async( + method="GET", + path="/interns/{internId}/icon", + 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=accept_header_override.value + if accept_header_override is not None + else "image/jpeg;q=1, image/png;q=0", + http_headers=http_headers, + _globals=operations.GetInternIconGlobals( + 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="getInternIcon", + 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), + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "image/jpeg"): + return http_res + if utils.match_response(http_res, "200", "image/png"): + return http_res + if utils.match_response( + http_res, ["401", "403", "404", "408"], "application/json" + ): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res, http_res_text + ) + raise errors.InternLifecycleError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res, http_res_text + ) + raise errors.InternLifecycleError(response_data, http_res, http_res_text) + 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 + ) + + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) + def provision_intern( self, *, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 3f4ec274..265b76bd 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -548,6 +548,14 @@ GetInternDaemonAccessRequest, GetInternDaemonAccessRequestTypedDict, ) + from .getinternicon import ( + GetInternIconGlobals, + GetInternIconGlobalsTypedDict, + GetInternIconRequest, + GetInternIconRequestTypedDict, + GetInternIconResponse, + GetInternIconResponseTypedDict, + ) from .getkey import ( GetKeyData, GetKeyDataTypedDict, @@ -1574,6 +1582,12 @@ "GetInternDaemonRequestTypedDict", "GetInternGlobals", "GetInternGlobalsTypedDict", + "GetInternIconGlobals", + "GetInternIconGlobalsTypedDict", + "GetInternIconRequest", + "GetInternIconRequestTypedDict", + "GetInternIconResponse", + "GetInternIconResponseTypedDict", "GetInternRequest", "GetInternRequestTypedDict", "GetKeyData", @@ -2481,6 +2495,12 @@ "GetInternDaemonAccessGlobalsTypedDict": ".getinterndaemonaccess", "GetInternDaemonAccessRequest": ".getinterndaemonaccess", "GetInternDaemonAccessRequestTypedDict": ".getinterndaemonaccess", + "GetInternIconGlobals": ".getinternicon", + "GetInternIconGlobalsTypedDict": ".getinternicon", + "GetInternIconRequest": ".getinternicon", + "GetInternIconRequestTypedDict": ".getinternicon", + "GetInternIconResponse": ".getinternicon", + "GetInternIconResponseTypedDict": ".getinternicon", "GetKeyData": ".getkey", "GetKeyDataTypedDict": ".getkey", "GetKeyGlobals": ".getkey", diff --git a/src/openrouter/operations/getinternicon.py b/src/openrouter/operations/getinternicon.py new file mode 100644 index 00000000..77a97912 --- /dev/null +++ b/src/openrouter/operations/getinternicon.py @@ -0,0 +1,170 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import httpx +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class GetInternIconGlobalsTypedDict(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 GetInternIconGlobals(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 GetInternIconRequestTypedDict(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. + + """ + v: NotRequired[str] + r"""The `icon_sha256` the caller expects.""" + + +class GetInternIconRequest(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. + + """ + + v: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""The `icon_sha256` the caller expects.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories", "v"] + ) + 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 + + +GetInternIconResponseTypedDict = TypeAliasType( + "GetInternIconResponseTypedDict", Union[httpx.Response, httpx.Response] +) + + +GetInternIconResponse = TypeAliasType( + "GetInternIconResponse", Union[httpx.Response, httpx.Response] +) diff --git a/uv.lock b/uv.lock index 9cdf2fd7..7cd2188e 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.66" +version = "1.3.67" source = { editable = "." } dependencies = [ { name = "httpcore" },