diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 3077e7a5..3b0d16cb 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: 2f3c2d6332d03987fdded9c1782bd4b3 + docChecksum: 434b72129cda1f59f72dae47227c00ba docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.64 - configChecksum: 93623c4550edd6d6c410e7601a3a4ab5 + releaseVersion: 1.3.65 + configChecksum: 3dfa94babff61f2a72b47112402a6ce3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: d11a47cc-2faa-444b-b752-69db10b8d9b4 - pristine_commit_hash: a5c05f68a37e017629b4ac48673f3d9e8ac1491e - pristine_tree_hash: 11a418f2ab39b15eafd49d69aa932fb1cc6feaa5 + generation_id: 3dcb622d-01b9-48e2-9a6f-5186f23b90de + pristine_commit_hash: 03713aa9c715022aabafbaa3903e62b137404f37 + pristine_tree_hash: f65dc457eb12aa360c8c42bc3c3c534cf6d7c601 features: python: acceptHeaders: 3.0.0 @@ -9522,6 +9522,22 @@ trackedFiles: id: e829f52a26d3 last_write_checksum: sha1:cb8b441a4e0138861a6cf660367f674093844590 pristine_git_object: 590e46d83ce8a470b44499464e1343584fc66805 + docs/operations/listinternconnectionsdata.mdx: + id: 31deb378afb2 + last_write_checksum: sha1:ad10402d046065fc6490df94af8b28179c40b89e + pristine_git_object: 1ff44a5fd3975e7fe0f7416d4b1e1bf2d0bae390 + docs/operations/listinternconnectionsglobals.mdx: + id: 14fd5bacd264 + last_write_checksum: sha1:74d121d505f5392ca2f4d4289a83e83f8b227f61 + pristine_git_object: da7cc8bbbfee192d80c568378b608b56e45f326b + docs/operations/listinternconnectionsrequest.mdx: + id: 678cb5bb93fc + last_write_checksum: sha1:786111a8a5669edf82c93305d45764d6bbbc3f96 + pristine_git_object: 66e1c18195bd5d69ddc44007e6d2c8d15035a589 + docs/operations/listinternconnectionsresponse.mdx: + id: 1deb48e2a7ae + last_write_checksum: sha1:37678374b9eeee5a57a9077ba6ec047964ccd095 + pristine_git_object: 1caca8d9b10694296a7bb352e81f333400750868 docs/operations/listinterneffectivevaultsecretsglobals.mdx: id: 3c05df20a610 last_write_checksum: sha1:62ac9fadca5e196f129ff6f110b6b00aaba03021 @@ -10308,8 +10324,8 @@ trackedFiles: pristine_git_object: a8923ec2c634bf0d4e80f553c29d4cc6586afd9a docs/sdks/vault/README.mdx: id: 3738c6722acd - last_write_checksum: sha1:b608fe6954d2fc05d3982c4d071d8818ce68c1d8 - pristine_git_object: 03052b483039f45f63018432feaa54d255506749 + last_write_checksum: sha1:b6c1ea0075474d4e8cdb506019ac2dab22113641 + pristine_git_object: 3d165a13acd9f0223159d8800a3b32745f41f525 docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 last_write_checksum: sha1:936739fa3beecf2583d22e02baf5186917e466b4 @@ -10324,8 +10340,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:2d91c61a0c444376c90f8b6608c4dade6d98c621 - pristine_git_object: c9e6bbb93276862ce8253e03467ada10705db3ec + last_write_checksum: sha1:d9010c2b804870c3af08efc720a7a3a135591d08 + pristine_git_object: a6cf6662925f231ffe607ae14cdb7ed2d53bdae7 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10352,8 +10368,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:e930798d37bc425ae1c9cfbc56cc80de636847a3 - pristine_git_object: bc97c1931639824175f2506696a962fdbced468a + last_write_checksum: sha1:1ef3801c7751ad5b0de9b961109aadac386517df + pristine_git_object: 65d80334569ef2a43d3e4217f9cf6e5dcdc5e2b5 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -14064,8 +14080,8 @@ trackedFiles: pristine_git_object: f01a5ab1865b16939c092d854fe8a7145c327058 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:e17ae08243c8381872fb8fd0ded781096749f43e - pristine_git_object: 1370bf741d8ad3debebf00e4983f388362fb31a1 + last_write_checksum: sha1:4a40155b5857c17e8c8aaf072175bc2227f7769f + pristine_git_object: 3f4ec274171a7e3f68a07190b66f48b055a5985c src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -14478,6 +14494,10 @@ trackedFiles: id: ad2131e4aa6c last_write_checksum: sha1:b5bbcbd02ce54cdc8bb1a2a3a424ca93c73f90bc pristine_git_object: 01655ae02036acf433ec5f54fd1d9323a55f0684 + src/openrouter/operations/listinternconnections.py: + id: e688b4ac24ea + last_write_checksum: sha1:222f8c1853feb397c3efff81f0a22c88dbb83051 + pristine_git_object: c97a6289aae0f7176f135f37ba1f5fa0b5bb3e11 src/openrouter/operations/listinterneffectivevaultsecrets.py: id: 32772b285bb4 last_write_checksum: sha1:d2e172f972cc8ed89dfe1541e2c4bf5314ab7490 @@ -14812,8 +14832,8 @@ trackedFiles: pristine_git_object: dae01a44384ac3bc13ae07453a053bf6c898ebe3 src/openrouter/vault.py: id: 0645fe426ac1 - last_write_checksum: sha1:04d687c1ccb0980e4bab049b684e545d88343a7d - pristine_git_object: fbe218be3bd8fec06925de712f3a7fd13babf41d + last_write_checksum: sha1:b4c84a7664f80157745bd6025456d3f74e577e7c + pristine_git_object: d8830a439a43b10948dbff0d0994cf942114ef06 src/openrouter/video_generation.py: id: d0a90c1b8efe last_write_checksum: sha1:e5fc6c816742687bad4a0ae9a9d9232945f04815 @@ -18835,7 +18855,133 @@ examples: application/json: {"error": {"code": 404, "message": "Intern not found"}} "500": application/json: {"error": {"code": 404, "message": "Intern not found"}} + listInternConnections: + speakeasy-default-list-intern-connections: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "200": + application/json: {"data": [{"key": ""}]} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "408": + application/json: {"error": {"code": 408, "message": "Operation timed out. Please try again later."}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "504": + application/json: {"error": {"code": 504, "message": "The operation was aborted due to timeout"}} + invalid-vault-request: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "400": + application/json: {"error": {"code": 400, "message": "Invalid vault request"}} + invalid-or-missing-api-key: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "401": + application/json: {"error": {"code": 401, "message": "Invalid or missing API key"}} + regional-hostname: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "403": + application/json: {"error": {"code": 403, "message": "The Intern API does not support regional data residency yet. Please use the global endpoint at openrouter.ai."}} + workspace-scope-unavailable: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "403": + application/json: {"error": {"code": 403, "message": "Vault scope is unavailable"}} + not-found: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "404": + application/json: {"error": {"code": 404, "message": "Not found"}} + body-timed-out: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "408": + application/json: {"error": {"code": 408, "message": "Request body timed out"}} + route-deadline: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "408": + application/json: {"error": {"code": 408, "message": "Vault request timed out"}} + rate-limited: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "429": + application/json: {"error": {"code": 429, "message": "Too many vault requests"}} + internal-error: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + invalid-vault-response: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "502": + application/json: {"error": {"code": 502, "message": "Invalid vault response"}} + vault-request-failed: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "502": + application/json: {"error": {"code": 502, "message": "Vault request failed"}} + vault-unavailable: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "503": + application/json: {"error": {"code": 503, "message": "Vault service is unavailable"}} + writes-disabled: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "503": + application/json: {"error": {"code": 503, "message": "Vault writes are not enabled"}} + vault-timed-out: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "504": + application/json: {"error": {"code": 504, "message": "Vault request timed out"}} examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.batch.create_batches()`: `request.callback_url` **Added** + * `open_router.vault.list_intern_connections()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 867054e7..7c72c36a 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.64 + version: 1.3.65 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 64931b43..fc05cc12 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -52196,6 +52196,206 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /vault/interns/{internId}/connections: + get: + description: 'Lists the connections in scope for the intern, by the key of their card on the dashboard''s Connections tab: `github`, `slack`, `google`, a catalog MCP server such as `linear` or `notion`, or `mcp:` for a custom MCP server. A connection is listed when it is stored, enabled, and not turned off or hidden for this intern, as the Connections tab lists it; whether its last test passed is not part of the rule. `ori features add` checks a feature''s `ori.requires.connections` against this list. Keys only, never credentials. Returns 404 for an intern the key cannot see. The scope is selected by the API key: workspace routes act on the key''s active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern''s own API key is confined to that intern: it can always read the intern''s secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' + operationId: 'listInternConnections' + parameters: + - description: 'UUID of an intern in the workspace selected by the API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'UUID of an intern in the workspace selected by the API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + example: + data: + - key: 'github' + - key: 'linear' + schema: + properties: + data: + items: + properties: + key: + type: 'string' + required: + - 'key' + type: 'object' + type: 'array' + required: + - 'data' + type: 'object' + description: 'The connections the intern can use.' + '400': + content: + application/json: + examples: + invalid-vault-request: + summary: 'Invalid vault request' + value: + error: + code: 400 + message: 'Invalid vault request' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - The secret name, path, query or JSON body failed validation. The vault returns 400 for a malformed request as well.' + '401': + content: + application/json: + examples: + invalid-or-missing-api-key: + summary: 'Invalid or missing API key' + value: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Missing or unknown API key. Provisioning keys cannot call vault routes.' + '403': + content: + application/json: + examples: + regional-hostname: + summary: 'Regional hostname' + value: + error: + code: 403 + message: 'The Intern API does not support regional data residency yet. Please use the global endpoint at openrouter.ai.' + workspace-scope-unavailable: + summary: 'Workspace scope unavailable' + value: + error: + code: 403 + message: 'Vault scope is unavailable' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - The key has no usable workspace scope, or the request arrived on a regional hostname.' + '404': + content: + application/json: + examples: + not-found: + summary: 'Not found' + value: + error: + code: 404 + message: 'Not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - The intern is not in the selected workspace or is not visible to the key (a member key without an admin role sees only interns its member created or interns in workspaces they administer), the secret does not exist in the selected scope, or the caller is outside the intern programme.' + '408': + content: + application/json: + examples: + body-timed-out: + summary: 'Body timed out' + value: + error: + code: 408 + message: 'Request body timed out' + route-deadline: + summary: 'Route deadline' + value: + error: + code: 408 + message: 'Vault request timed out' + schema: + $ref: '#/components/schemas/RequestTimeoutResponse' + description: 'Request Timeout - The route deadline passed before the request completed, or the request body stopped arriving.' + '429': + content: + application/json: + examples: + rate-limited: + summary: 'Rate limited' + value: + error: + code: 429 + message: 'Too many vault requests' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - The vault rate limit was reached.' + '500': + content: + application/json: + examples: + internal-error: + summary: 'Internal error' + value: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Scope lookup failed.' + '502': + content: + application/json: + examples: + invalid-vault-response: + summary: 'Invalid vault response' + value: + error: + code: 502 + message: 'Invalid vault response' + vault-request-failed: + summary: 'Vault request failed' + value: + error: + code: 502 + message: 'Vault request failed' + schema: + $ref: '#/components/schemas/BadGatewayResponse' + description: 'Bad Gateway - The vault could not be reached or returned an unexpected response.' + '503': + content: + application/json: + examples: + vault-unavailable: + summary: 'Vault unavailable' + value: + error: + code: 503 + message: 'Vault service is unavailable' + writes-disabled: + summary: 'Writes disabled' + value: + error: + code: 503 + message: 'Vault writes are not enabled' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Vault writes are disabled for the caller, or the vault is not configured.' + '504': + content: + application/json: + examples: + vault-timed-out: + summary: 'Vault timed out' + value: + error: + code: 504 + message: 'Vault request timed out' + schema: + $ref: '#/components/schemas/GatewayTimeoutResponse' + description: 'Gateway Timeout - The vault did not answer in time.' + security: + - apiKey: [] + summary: 'List the connections an intern can use' + tags: + - 'Vault' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /vault/interns/{internId}/effective-secrets: get: description: 'Lists, one entry per name, the secret the intern''s outbound requests receive: its own secrets, secrets from an attached vault, and workspace secrets, including ones stored before workspace-scoped storage. Where several vaults hold a name, the entry is the one that wins, in the order intern, attached, workspace. The same resolution decides what outbound requests receive, so this list and the intern''s requests agree. `scope` says which vault the entry comes from. Responses carry metadata only, never values. Results are ordered by name and paginated with `limit` and `offset`. Returns 404 when the intern''s attached vault is no longer available, since the intern then receives no secrets. The scope is selected by the API key: workspace routes act on the key''s active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern''s own API key is confined to that intern: it can always read the intern''s secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index af5437b8..8fc4b0cb 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:fa064d6165a0f7e1d77909689f328e6d5226b7728c1729a64888da89e301c5a3 - sourceBlobDigest: sha256:7c2b45cff7db069caa60641482cb12fd6c6324fcc52fd151ebfe6d0611d88991 + sourceRevisionDigest: sha256:f4e39833826b4d8ecd08b96f825f301cadad81fdd5e6204b8b965cef04164b96 + sourceBlobDigest: sha256:50f36dd6ae42eee1e62fbb3a8963869260d5e271267089645576b1b4b16e385f tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fa064d6165a0f7e1d77909689f328e6d5226b7728c1729a64888da89e301c5a3 - sourceBlobDigest: sha256:7c2b45cff7db069caa60641482cb12fd6c6324fcc52fd151ebfe6d0611d88991 + sourceRevisionDigest: sha256:f4e39833826b4d8ecd08b96f825f301cadad81fdd5e6204b8b965cef04164b96 + sourceBlobDigest: sha256:50f36dd6ae42eee1e62fbb3a8963869260d5e271267089645576b1b4b16e385f codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:c69acbacacf0daa4ecb22221d69e72688b629675c8360a9c4ca2353a75b71710 + codeSamplesRevisionDigest: sha256:0d63545d7f55ad59e205de8824045c5232a9efd8cb66da46c991b3aa64d68586 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index e8c22b37..32b3b92a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3409,4 +3409,14 @@ Based on: ### Generated - [python v1.3.64] . ### Releases -- [PyPI v1.3.64] https://pypi.org/project/openrouter/1.3.64 - . \ No newline at end of file +- [PyPI v1.3.64] https://pypi.org/project/openrouter/1.3.64 - . + +## 2026-10-18 02:43:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.65] . +### Releases +- [PyPI v1.3.65] https://pypi.org/project/openrouter/1.3.65 - . \ No newline at end of file diff --git a/docs/operations/listinternconnectionsdata.mdx b/docs/operations/listinternconnectionsdata.mdx new file mode 100644 index 00000000..ba6ec2df --- /dev/null +++ b/docs/operations/listinternconnectionsdata.mdx @@ -0,0 +1,9 @@ +--- +title: "ListInternConnectionsData" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `key` | *str* | ✅ | N/A | \ No newline at end of file diff --git a/docs/operations/listinternconnectionsglobals.mdx b/docs/operations/listinternconnectionsglobals.mdx new file mode 100644 index 00000000..0f042b9a --- /dev/null +++ b/docs/operations/listinternconnectionsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListInternConnectionsGlobals" +--- + +## 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/listinternconnectionsrequest.mdx b/docs/operations/listinternconnectionsrequest.mdx new file mode 100644 index 00000000..c85fb730 --- /dev/null +++ b/docs/operations/listinternconnectionsrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "ListInternConnectionsRequest" +--- + +## 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* | ✅ | UUID of an intern in the workspace selected by the API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/operations/listinternconnectionsresponse.mdx b/docs/operations/listinternconnectionsresponse.mdx new file mode 100644 index 00000000..d6c8c3b9 --- /dev/null +++ b/docs/operations/listinternconnectionsresponse.mdx @@ -0,0 +1,12 @@ +--- +title: "ListInternConnectionsResponse" +--- + +The connections the intern can use. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `data` | List[[operations.ListInternConnectionsData](../operations/listinternconnectionsdata.mdx)] | ✅ | N/A | \ No newline at end of file diff --git a/docs/sdks/vault/README.mdx b/docs/sdks/vault/README.mdx index 9043a2b6..a0ac0864 100644 --- a/docs/sdks/vault/README.mdx +++ b/docs/sdks/vault/README.mdx @@ -9,6 +9,7 @@ Store host-bound secrets for a workspace or for one intern. Scope is selected by ### Available Operations +* [list_intern_connections](#list_intern_connections) - List the connections an intern can use * [list_intern_effective_vault_secrets](#list_intern_effective_vault_secrets) - List the secrets an intern receives * [list_intern_vault_secrets](#list_intern_vault_secrets) - List intern secrets * [delete_intern_vault_secret](#delete_intern_vault_secret) - Delete an intern secret @@ -18,6 +19,61 @@ Store host-bound secrets for a workspace or for one intern. Scope is selected by * [delete_vault_secret](#delete_vault_secret) - Delete a workspace secret * [store_vault_secret](#store_vault_secret) - Store a workspace secret +## list_intern_connections + +Lists the connections in scope for the intern, by the key of their card on the dashboard's Connections tab: `github`, `slack`, `google`, a catalog MCP server such as `linear` or `notion`, or `mcp:` for a custom MCP server. A connection is listed when it is stored, enabled, and not turned off or hidden for this intern, as the Connections tab lists it; whether its last test passed is not part of the rule. `ori features add` checks a feature's `ori.requires.connections` against this list. Keys only, never credentials. Returns 404 for an intern the key cannot see. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern's own API key is confined to that intern: it can always read the intern's secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. 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.vault.list_intern_connections(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | ✅ | UUID of an intern in the workspace selected by the 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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListInternConnectionsResponse](../../operations/listinternconnectionsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.RequestTimeoutResponseError | 408 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.GatewayTimeoutResponseError | 504 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + ## list_intern_effective_vault_secrets Lists, one entry per name, the secret the intern's outbound requests receive: its own secrets, secrets from an attached vault, and workspace secrets, including ones stored before workspace-scoped storage. Where several vaults hold a name, the entry is the one that wins, in the order intern, attached, workspace. The same resolution decides what outbound requests receive, so this list and the intern's requests agree. `scope` says which vault the entry comes from. Responses carry metadata only, never values. Results are ordered by name and paginated with `limit` and `offset`. Returns 404 when the intern's attached vault is no longer available, since the intern then receives no secrets. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern's own API key is confined to that intern: it can always read the intern's secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. 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 c9e6bbb9..a6cf6662 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.64" +version = "1.3.65" 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 bc97c193..65d80334 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.64" +__version__: str = "1.3.65" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.64 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.65 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 1370bf74..3f4ec274 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -807,6 +807,16 @@ ListImageModelsRequest, ListImageModelsRequestTypedDict, ) + from .listinternconnections import ( + ListInternConnectionsData, + ListInternConnectionsDataTypedDict, + ListInternConnectionsGlobals, + ListInternConnectionsGlobalsTypedDict, + ListInternConnectionsRequest, + ListInternConnectionsRequestTypedDict, + ListInternConnectionsResponse, + ListInternConnectionsResponseTypedDict, + ) from .listinterneffectivevaultsecrets import ( ListInternEffectiveVaultSecretsGlobals, ListInternEffectiveVaultSecretsGlobalsTypedDict, @@ -1756,6 +1766,14 @@ "ListImageModelsGlobalsTypedDict", "ListImageModelsRequest", "ListImageModelsRequestTypedDict", + "ListInternConnectionsData", + "ListInternConnectionsDataTypedDict", + "ListInternConnectionsGlobals", + "ListInternConnectionsGlobalsTypedDict", + "ListInternConnectionsRequest", + "ListInternConnectionsRequestTypedDict", + "ListInternConnectionsResponse", + "ListInternConnectionsResponseTypedDict", "ListInternEffectiveVaultSecretsGlobals", "ListInternEffectiveVaultSecretsGlobalsTypedDict", "ListInternEffectiveVaultSecretsRequest", @@ -2654,6 +2672,14 @@ "ListImageModelsGlobalsTypedDict": ".listimagemodels", "ListImageModelsRequest": ".listimagemodels", "ListImageModelsRequestTypedDict": ".listimagemodels", + "ListInternConnectionsData": ".listinternconnections", + "ListInternConnectionsDataTypedDict": ".listinternconnections", + "ListInternConnectionsGlobals": ".listinternconnections", + "ListInternConnectionsGlobalsTypedDict": ".listinternconnections", + "ListInternConnectionsRequest": ".listinternconnections", + "ListInternConnectionsRequestTypedDict": ".listinternconnections", + "ListInternConnectionsResponse": ".listinternconnections", + "ListInternConnectionsResponseTypedDict": ".listinternconnections", "ListInternEffectiveVaultSecretsGlobals": ".listinterneffectivevaultsecrets", "ListInternEffectiveVaultSecretsGlobalsTypedDict": ".listinterneffectivevaultsecrets", "ListInternEffectiveVaultSecretsRequest": ".listinterneffectivevaultsecrets", diff --git a/src/openrouter/operations/listinternconnections.py b/src/openrouter/operations/listinternconnections.py new file mode 100644 index 00000000..c97a6289 --- /dev/null +++ b/src/openrouter/operations/listinternconnections.py @@ -0,0 +1,166 @@ +"""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 List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListInternConnectionsGlobalsTypedDict(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 ListInternConnectionsGlobals(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 ListInternConnectionsRequestTypedDict(TypedDict): + intern_id: str + r"""UUID of an intern in the workspace selected by the 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 ListInternConnectionsRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""UUID of an intern in the workspace selected by the 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 + + +class ListInternConnectionsDataTypedDict(TypedDict): + key: str + + +class ListInternConnectionsData(BaseModel): + key: str + + +class ListInternConnectionsResponseTypedDict(TypedDict): + r"""The connections the intern can use.""" + + data: List[ListInternConnectionsDataTypedDict] + + +class ListInternConnectionsResponse(BaseModel): + r"""The connections the intern can use.""" + + data: List[ListInternConnectionsData] diff --git a/src/openrouter/vault.py b/src/openrouter/vault.py index fbe218be..d8830a43 100644 --- a/src/openrouter/vault.py +++ b/src/openrouter/vault.py @@ -12,6 +12,342 @@ class Vault(BaseSDK): r"""Store host-bound secrets for a workspace or for one intern. Scope is selected by the API key. Responses return metadata only, never secret values. See https://openrouter.ai/docs/guides/ori/vault.""" + def list_intern_connections( + 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, + ) -> operations.ListInternConnectionsResponse: + r"""List the connections an intern can use + + Lists the connections in scope for the intern, by the key of their card on the dashboard's Connections tab: `github`, `slack`, `google`, a catalog MCP server such as `linear` or `notion`, or `mcp:` for a custom MCP server. A connection is listed when it is stored, enabled, and not turned off or hidden for this intern, as the Connections tab lists it; whether its last test passed is not part of the rule. `ori features add` checks a feature's `ori.requires.connections` against this list. Keys only, never credentials. Returns 404 for an intern the key cannot see. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern's own API key is confined to that intern: it can always read the intern's secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. 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: UUID of an intern in the workspace selected by the 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.ListInternConnectionsRequest( + 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="/vault/interns/{internId}/connections", + 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.ListInternConnectionsGlobals( + 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="listInternConnections", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Vault"], + 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( + operations.ListInternConnectionsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "408", "application/json"): + response_data = unmarshal_json_response( + errors.RequestTimeoutResponseErrorData, http_res + ) + raise errors.RequestTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "504", "application/json"): + response_data = unmarshal_json_response( + errors.GatewayTimeoutResponseErrorData, http_res + ) + raise errors.GatewayTimeoutResponseError(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 list_intern_connections_async( + 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, + ) -> operations.ListInternConnectionsResponse: + r"""List the connections an intern can use + + Lists the connections in scope for the intern, by the key of their card on the dashboard's Connections tab: `github`, `slack`, `google`, a catalog MCP server such as `linear` or `notion`, or `mcp:` for a custom MCP server. A connection is listed when it is stored, enabled, and not turned off or hidden for this intern, as the Connections tab lists it; whether its last test passed is not part of the rule. `ori features add` checks a feature's `ori.requires.connections` against this list. Keys only, never credentials. Returns 404 for an intern the key cannot see. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern's own API key is confined to that intern: it can always read the intern's secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. 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: UUID of an intern in the workspace selected by the 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.ListInternConnectionsRequest( + 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="/vault/interns/{internId}/connections", + 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.ListInternConnectionsGlobals( + 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="listInternConnections", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Vault"], + 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( + operations.ListInternConnectionsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "408", "application/json"): + response_data = unmarshal_json_response( + errors.RequestTimeoutResponseErrorData, http_res + ) + raise errors.RequestTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "504", "application/json"): + response_data = unmarshal_json_response( + errors.GatewayTimeoutResponseErrorData, http_res + ) + raise errors.GatewayTimeoutResponseError(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) + def list_intern_effective_vault_secrets( self, *, diff --git a/uv.lock b/uv.lock index 348e82d9..b60de313 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.64" +version = "1.3.65" source = { editable = "." } dependencies = [ { name = "httpcore" },