diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 282e41fa0..82c17265c 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: "" id: "" management: - docChecksum: 0398b8e6329ef1de43f607a43c3279a7 + docChecksum: 7bce7d8a2da7e11efd1293f527f1e472 docVersion: 1.0.0 speakeasyVersion: 1.808.1 generationVersion: 2.960.8 - releaseVersion: 1.5.180 - configChecksum: 155fe12ade558f31fea82c0c6b0bcf90 + releaseVersion: 1.5.181 + configChecksum: 576437db3437ab6890073cfd00a5e763 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true @@ -8098,6 +8098,8 @@ trackedFiles: docs/models/operations/createkeysresponse.mdx: id: 5135de195ccb pristine_git_object: 228bc9504bea0ebaffe589f50b4697ff55d0b140 + docs/models/operations/createkeystagrequest.mdx: {} + docs/models/operations/createkeystagresponse.mdx: {} docs/models/operations/createmodelavailabilitypolicyglobals.mdx: id: 8b4d0b9ee305 pristine_git_object: 0c673b33073a7a893469dee4b75173d0936c8fa8 @@ -8863,6 +8865,7 @@ trackedFiles: docs/models/operations/getkeyresponse.mdx: id: 30188f9f0a06 pristine_git_object: 122004d771bbd8cb95a4500afb910dfb5cfdbad2 + docs/models/operations/getkeytag.mdx: {} docs/models/operations/getmemberpolicyassignmentglobals.mdx: id: 3bd0e9042ae6 pristine_git_object: a520de3b043cbead52b86e4154688b30290f697c @@ -9622,6 +9625,7 @@ trackedFiles: docs/models/operations/listscimorganizationrolemappingsrequest.mdx: {} docs/models/operations/listspeechmodelsglobals.mdx: {} docs/models/operations/listspeechmodelsrequest.mdx: {} + docs/models/operations/listtag.mdx: {} docs/models/operations/listtoolsglobals.mdx: id: 0514ca3a4bc5 pristine_git_object: 4e12d844e4b851e0549f31ad2d18e03a28f51436 @@ -10021,6 +10025,8 @@ trackedFiles: docs/models/operations/updatekeysresponse.mdx: id: 3d4ab9b1b401 pristine_git_object: bcd94fb4a94f6330c9e26d613bbf3ba7cc8ffbbb + docs/models/operations/updatekeystagrequest.mdx: {} + docs/models/operations/updatekeystagresponse.mdx: {} docs/models/operations/updatemodelavailabilitypolicyglobals.mdx: id: d9364237ec19 pristine_git_object: 169bbc74239e037d834b80ee9781b3dbcb3f5919 @@ -19069,7 +19075,7 @@ examples: speakeasy-default-list: responses: "200": - application/json: {"data": [{"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "last_used_at": "2026-09-15T15:45:00Z", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}]} + application/json: {"data": [{"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "last_used_at": "2026-09-15T15:45:00Z", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "tags": [{"key": "team", "value": "billing"}, {"key": "beta", "value": null}], "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}]} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "429": @@ -19088,7 +19094,7 @@ examples: application/json: {"name": "My New API Key"} responses: "201": - application/json: {"data": {"byok_usage": 0, "byok_usage_daily": 0, "byok_usage_monthly": 0, "byok_usage_weekly": 0, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "My New API Key", "last_used_at": null, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "name": "My New API Key", "updated_at": null, "usage": 0, "usage_daily": 0, "usage_monthly": 0, "usage_weekly": 0, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}, "key": "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"} + application/json: {"data": {"byok_usage": 0, "byok_usage_daily": 0, "byok_usage_monthly": 0, "byok_usage_weekly": 0, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "My New API Key", "last_used_at": null, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "name": "My New API Key", "tags": [{"key": "team", "value": "billing"}, {"key": "beta", "value": null}], "updated_at": null, "usage": 0, "usage_daily": 0, "usage_monthly": 0, "usage_weekly": 0, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}, "key": "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"} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -19108,7 +19114,7 @@ examples: application/json: {} responses: "200": - application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "Updated API Key Name", "last_used_at": "2026-09-15T15:45:00Z", "limit": 75, "limit_remaining": 32.12, "limit_reset": "daily", "name": "Updated API Key Name", "updated_at": "2025-08-24T16:00:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} + application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "Updated API Key Name", "last_used_at": "2026-09-15T15:45:00Z", "limit": 75, "limit_remaining": 32.12, "limit_reset": "daily", "name": "Updated API Key Name", "tags": [{"key": "team", "value": "billing"}, {"key": "beta", "value": null}], "updated_at": "2025-08-24T16:00:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -19166,7 +19172,7 @@ examples: hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943" responses: "200": - application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "last_used_at": "2026-09-15T15:45:00Z", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} + application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "external_user": null, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "last_used_at": "2026-09-15T15:45:00Z", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "tags": [{"key": "team", "value": "billing"}, {"key": "beta", "value": null}], "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -24220,4 +24226,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Typescript SDK Changes:\n* `openrouter.tts.createSpeech()`: \n * `request.speechRequest.separateTracks` **Added**\n* `openrouter.tts.listModels()`: `response.data[].endpoints[].outputModalities[].supportedParameters.separateTracks` **Added**\n* `openrouter.tts.getModel()`: `response.endpoints[].outputModalities[].supportedParameters.separateTracks` **Added**\n* `openrouter.images.listModels()`: `response.data[].supportedParameters.Map.union(range)` **Changed**\n* `openrouter.images.listModelEndpoints()`: `response.endpoints[].supportedParameters.Map.union(range)` **Changed**\n" +releaseNotes: "## Typescript SDK Changes:\n* `openrouter.analytics.queryAnalytics()`: \n * `request.requestBody.apiKeyTagKey` **Added**\n* `openrouter.apiKeys.list()`: \n * `request.tag` **Added**\n * `response.data[].tags` **Added**\n* `openrouter.apiKeys.create()`: \n * `request.requestBody.tags` **Added**\n * `response.data.tags` **Added**\n* `openrouter.apiKeys.get()`: `response.data.tags` **Added**\n* `openrouter.apiKeys.update()`: \n * `request.requestBody.tags` **Added**\n * `response.data.tags` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 531309b4a..41a3af004 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -38,7 +38,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 1.5.180 + version: 1.5.181 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 016a6f197..af9d0222a 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -43704,6 +43704,12 @@ paths: start: '2025-01-01T00:00:00Z' schema: properties: + api_key_tag_key: + description: 'Tag key to group by when `dimensions` includes `api_key_tag`, e.g. `team`. Each API key has at most one value per tag key, so groups do not overlap: keys with the tag group under its value, and keys with the tag but no value under the key name. Keys without the tag are left out of the results. Without this field, each `key:value` tag is its own group and a key with several tags counts toward each.' + example: 'team' + maxLength: 32 + minLength: 1 + type: 'string' classifier_dimensions: description: 'Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.' properties: @@ -56184,6 +56190,14 @@ paths: example: '0df9e665-d932-5740-b2c7-b52af166bc11' format: 'uuid' type: 'string' + - description: 'Only return API keys with this tag: `team` matches the tag key with any value, `team:billing` that exact value (case-insensitive).' + in: 'query' + name: 'tag' + required: false + schema: + description: 'Only return API keys with this tag: `team` matches the tag key with any value, `team:billing` that exact value (case-insensitive).' + example: 'team:billing' + type: 'string' - description: 'Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators.' in: 'query' name: 'creator_user_id' @@ -56367,6 +56381,30 @@ paths: description: 'Name of the API key' example: 'My Production Key' type: 'string' + tags: + description: 'Custom key-value tags attached to this API key.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + value: null + items: + properties: + key: + description: 'Tag key, as it was entered.' + example: 'team' + type: 'string' + value: + description: 'Tag value, as it was entered, or null when the tag is just a key.' + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + - 'value' + type: 'object' + type: 'array' updated_at: description: 'ISO 8601 timestamp of when the API key was last updated' example: '2025-08-24T15:45:00Z' @@ -56420,6 +56458,7 @@ paths: - 'external_user' - 'creator_user_id' - 'workspace_id' + - 'tags' type: 'object' type: 'array' required: @@ -56581,6 +56620,27 @@ paths: maxLength: 256 minLength: 1 type: 'string' + tags: + description: 'Custom key-value tags for the API key (at most 5, each tag key at most once). Keys are 1-32 characters of letters, numbers, spaces and - _ . /; the optional value is 1-64 characters and may also contain '':''. Matching is case-insensitive. Your plan limits how many distinct tag keys your account uses and how many distinct values each key has.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + items: + properties: + key: + example: 'team' + type: 'string' + value: + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + type: 'object' + maxItems: 5 + type: 'array' workspace_id: description: 'The workspace to create the API key in. Defaults to the default workspace for an organization-scoped management key, or to the management key''s own workspace for a workspace-scoped one, which cannot create keys elsewhere.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' @@ -56765,6 +56825,30 @@ paths: description: 'Name of the API key' example: 'My Production Key' type: 'string' + tags: + description: 'Custom key-value tags attached to this API key.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + value: null + items: + properties: + key: + description: 'Tag key, as it was entered.' + example: 'team' + type: 'string' + value: + description: 'Tag value, as it was entered, or null when the tag is just a key.' + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + - 'value' + type: 'object' + type: 'array' updated_at: description: 'ISO 8601 timestamp of when the API key was last updated' example: '2025-08-24T15:45:00Z' @@ -56818,6 +56902,7 @@ paths: - 'external_user' - 'creator_user_id' - 'workspace_id' + - 'tags' type: 'object' key: description: 'The actual API key string (only shown once)' @@ -57156,6 +57241,30 @@ paths: description: 'Name of the API key' example: 'My Production Key' type: 'string' + tags: + description: 'Custom key-value tags attached to this API key.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + value: null + items: + properties: + key: + description: 'Tag key, as it was entered.' + example: 'team' + type: 'string' + value: + description: 'Tag value, as it was entered, or null when the tag is just a key.' + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + - 'value' + type: 'object' + type: 'array' updated_at: description: 'ISO 8601 timestamp of when the API key was last updated' example: '2025-08-24T15:45:00Z' @@ -57209,6 +57318,7 @@ paths: - 'external_user' - 'creator_user_id' - 'workspace_id' + - 'tags' type: 'object' required: - 'data' @@ -57332,6 +57442,27 @@ paths: maxLength: 256 minLength: 1 type: 'string' + tags: + description: 'Replace the API key''s tags with this set (at most 5). Send an empty array to remove all tags.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + items: + properties: + key: + example: 'team' + type: 'string' + value: + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + type: 'object' + maxItems: 5 + type: 'array' workspace_id: description: 'Move the API key to this workspace. The key keeps its value; guardrail selections move with it, except direct guardrail assignments owned by the key''s current workspace, which are removed along with the selections derived from them, while other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. Sending the key''s current workspace is a no-op.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' @@ -57511,6 +57642,30 @@ paths: description: 'Name of the API key' example: 'My Production Key' type: 'string' + tags: + description: 'Custom key-value tags attached to this API key.' + example: + - key: 'team' + value: 'billing' + - key: 'beta' + value: null + items: + properties: + key: + description: 'Tag key, as it was entered.' + example: 'team' + type: 'string' + value: + description: 'Tag value, as it was entered, or null when the tag is just a key.' + example: 'billing' + type: + - 'string' + - 'null' + required: + - 'key' + - 'value' + type: 'object' + type: 'array' updated_at: description: 'ISO 8601 timestamp of when the API key was last updated' example: '2025-08-24T15:45:00Z' @@ -57564,6 +57719,7 @@ paths: - 'external_user' - 'creator_user_id' - 'workspace_id' + - 'tags' type: 'object' required: - 'data' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3e5813362..19b902e7c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.808.1 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b34aa7b3ed4727e486f2f069451426a3d52bd90eab1ed8a5b2f1fc832e64921c - sourceBlobDigest: sha256:90e0429cda1e8ba99e8887f147cc6ca7b48e9e9e2243482c9eb8e265cad95136 + sourceRevisionDigest: sha256:10ae45dd713cea3f5ff56891f96a0071766d800f5e0d85b8dc9cdb94c50dc3fa + sourceBlobDigest: sha256:f4e4ac3bb373a2d416683b73c65388dc78fe64d3af97cd050e0292ca7a753ddd tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b34aa7b3ed4727e486f2f069451426a3d52bd90eab1ed8a5b2f1fc832e64921c - sourceBlobDigest: sha256:90e0429cda1e8ba99e8887f147cc6ca7b48e9e9e2243482c9eb8e265cad95136 + sourceRevisionDigest: sha256:10ae45dd713cea3f5ff56891f96a0071766d800f5e0d85b8dc9cdb94c50dc3fa + sourceBlobDigest: sha256:f4e4ac3bb373a2d416683b73c65388dc78fe64d3af97cd050e0292ca7a753ddd codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:4a2eda86744137ce867f6f7b53a38c89b180c64f479031675bf85e86be01c8b7 + codeSamplesRevisionDigest: sha256:e11c8af35b5057eb9dad25899596ef704dc8a7ee0e2e292b421c2c467d113c9b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.808.1 diff --git a/RELEASES.md b/RELEASES.md index fe3aaa347..2bb4a8188 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -6176,4 +6176,14 @@ Based on: ### Generated - [typescript v1.5.180] . ### Releases -- [NPM v1.5.180] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.180 - . \ No newline at end of file +- [NPM v1.5.180] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.180 - . + +## 2026-12-04 23:49:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.808.1 (2.960.8) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.5.181] . +### Releases +- [NPM v1.5.181] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.181 - . \ No newline at end of file diff --git a/docs/models/operations/createkeysdata.mdx b/docs/models/operations/createkeysdata.mdx index 474401510..fcdf0f846 100644 --- a/docs/models/operations/createkeysdata.mdx +++ b/docs/models/operations/createkeysdata.mdx @@ -26,6 +26,16 @@ let value: CreateKeysData = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, @@ -56,6 +66,7 @@ let value: CreateKeysData = { | `limitRemaining` | *number* | ✔️ | Remaining spending limit in USD. Credit usage always counts toward `limit`; BYOK usage counts only when `include_byok_in_limit` is true. | 74.5 | | `limitReset` | *string* | ✔️ | Type of limit reset for the API key | monthly | | `name` | *string* | ✔️ | Name of the API key | My Production Key | +| `tags` | [operations.CreateKeysTagResponse](../../models/operations/createkeystagresponse.mdx)[] | ✔️ | Custom key-value tags attached to this API key. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta",
"value": null
}
] | | `updatedAt` | *string* | ✔️ | ISO 8601 timestamp of when the API key was last updated | 2025-08-24T15:45:00Z | | `usage` | *number* | ✔️ | Total OpenRouter credit usage (in USD) for the API key: the spend allocated to this key, including requests funded from a credit pool. It is not a debit total for the account balance. It excludes external BYOK inference cost, which is reported separately in `byok_usage`, but a BYOK platform fee, where charged, is credit spend and is included here. | 25.5 | | `usageDaily` | *number* | ✔️ | OpenRouter credit usage (in USD) for the current UTC day. Excludes external BYOK inference cost. | 25.5 | diff --git a/docs/models/operations/createkeysrequestbody.mdx b/docs/models/operations/createkeysrequestbody.mdx index c995465c3..1a76c45d6 100644 --- a/docs/models/operations/createkeysrequestbody.mdx +++ b/docs/models/operations/createkeysrequestbody.mdx @@ -14,13 +14,14 @@ let value: CreateKeysRequestBody = { ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `creatorUserId` | *string* | ➖ | Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key. A workspace-scoped management key may only name a member of its own workspace. | user_2dHFtVWx2n56w6HkM0000000000 | -| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | ➖ | Optional ISO 8601 UTC expiration timestamp. Must include seconds (YYYY-MM-DDTHH:MM:SSZ; fractional seconds allowed); minute-precision timestamps are rejected. | 2027-12-31T23:59:59Z | -| `external` | [operations.External](../../models/operations/external.mdx) | ➖ | Optional partner-defined identity associated with the created API key. | | -| `includeByokInLimit` | *boolean* | ➖ | Whether external BYOK usage counts toward this key's limit. When false, only credit usage is checked against `limit`. | true | -| `limit` | *number* | ➖ | Optional spending limit for the API key in USD | 50 | -| `limitReset` | [operations.CreateKeysLimitReset](../../models/operations/createkeyslimitreset.mdx) | ➖ | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | -| `name` | *string* | ✔️ | Name for the new API key | My New API Key | -| `workspaceId` | *string* | ➖ | The workspace to create the API key in. Defaults to the default workspace for an organization-scoped management key, or to the management key's own workspace for a workspace-scoped one, which cannot create keys elsewhere. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `creatorUserId` | *string* | ➖ | Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key. A workspace-scoped management key may only name a member of its own workspace. | user_2dHFtVWx2n56w6HkM0000000000 | +| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | ➖ | Optional ISO 8601 UTC expiration timestamp. Must include seconds (YYYY-MM-DDTHH:MM:SSZ; fractional seconds allowed); minute-precision timestamps are rejected. | 2027-12-31T23:59:59Z | +| `external` | [operations.External](../../models/operations/external.mdx) | ➖ | Optional partner-defined identity associated with the created API key. | | +| `includeByokInLimit` | *boolean* | ➖ | Whether external BYOK usage counts toward this key's limit. When false, only credit usage is checked against `limit`. | true | +| `limit` | *number* | ➖ | Optional spending limit for the API key in USD | 50 | +| `limitReset` | [operations.CreateKeysLimitReset](../../models/operations/createkeyslimitreset.mdx) | ➖ | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | +| `name` | *string* | ✔️ | Name for the new API key | My New API Key | +| `tags` | [operations.CreateKeysTagRequest](../../models/operations/createkeystagrequest.mdx)[] | ➖ | Custom key-value tags for the API key (at most 5, each tag key at most once). Keys are 1-32 characters of letters, numbers, spaces and - _ . /; the optional value is 1-64 characters and may also contain ':'. Matching is case-insensitive. Your plan limits how many distinct tag keys your account uses and how many distinct values each key has. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta"
}
] | +| `workspaceId` | *string* | ➖ | The workspace to create the API key in. Defaults to the default workspace for an organization-scoped management key, or to the management key's own workspace for a workspace-scoped one, which cannot create keys elsewhere. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/models/operations/createkeysresponse.mdx b/docs/models/operations/createkeysresponse.mdx index 228bc9504..b217ab63d 100644 --- a/docs/models/operations/createkeysresponse.mdx +++ b/docs/models/operations/createkeysresponse.mdx @@ -27,6 +27,16 @@ let value: CreateKeysResponse = { limitRemaining: 50, limitReset: "monthly", name: "My New API Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: null, usage: 0, usageDaily: 0, diff --git a/docs/models/operations/createkeystagrequest.mdx b/docs/models/operations/createkeystagrequest.mdx new file mode 100644 index 000000000..1a6afb417 --- /dev/null +++ b/docs/models/operations/createkeystagrequest.mdx @@ -0,0 +1,20 @@ +--- +title: "CreateKeysTagRequest" +--- + +## Example Usage + +```typescript +import { CreateKeysTagRequest } from "@openrouter/sdk/models/operations"; + +let value: CreateKeysTagRequest = { + key: "team", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `key` | *string* | ✔️ | N/A | team | +| `value` | *string* | ➖ | N/A | billing | \ No newline at end of file diff --git a/docs/models/operations/createkeystagresponse.mdx b/docs/models/operations/createkeystagresponse.mdx new file mode 100644 index 000000000..72843cf08 --- /dev/null +++ b/docs/models/operations/createkeystagresponse.mdx @@ -0,0 +1,21 @@ +--- +title: "CreateKeysTagResponse" +--- + +## Example Usage + +```typescript +import { CreateKeysTagResponse } from "@openrouter/sdk/models/operations"; + +let value: CreateKeysTagResponse = { + key: "team", + value: "billing", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `key` | *string* | ✔️ | Tag key, as it was entered. | team | +| `value` | *string* | ✔️ | Tag value, as it was entered, or null when the tag is just a key. | billing | \ No newline at end of file diff --git a/docs/models/operations/getkeydata.mdx b/docs/models/operations/getkeydata.mdx index e318acca2..b5360626e 100644 --- a/docs/models/operations/getkeydata.mdx +++ b/docs/models/operations/getkeydata.mdx @@ -26,6 +26,16 @@ let value: GetKeyData = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, @@ -56,6 +66,7 @@ let value: GetKeyData = { | `limitRemaining` | *number* | ✔️ | Remaining spending limit in USD. Credit usage always counts toward `limit`; BYOK usage counts only when `include_byok_in_limit` is true. | 74.5 | | `limitReset` | *string* | ✔️ | Type of limit reset for the API key | monthly | | `name` | *string* | ✔️ | Name of the API key | My Production Key | +| `tags` | [operations.GetKeyTag](../../models/operations/getkeytag.mdx)[] | ✔️ | Custom key-value tags attached to this API key. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta",
"value": null
}
] | | `updatedAt` | *string* | ✔️ | ISO 8601 timestamp of when the API key was last updated | 2025-08-24T15:45:00Z | | `usage` | *number* | ✔️ | Total OpenRouter credit usage (in USD) for the API key: the spend allocated to this key, including requests funded from a credit pool. It is not a debit total for the account balance. It excludes external BYOK inference cost, which is reported separately in `byok_usage`, but a BYOK platform fee, where charged, is credit spend and is included here. | 25.5 | | `usageDaily` | *number* | ✔️ | OpenRouter credit usage (in USD) for the current UTC day. Excludes external BYOK inference cost. | 25.5 | diff --git a/docs/models/operations/getkeyresponse.mdx b/docs/models/operations/getkeyresponse.mdx index 122004d77..973e1d9dc 100644 --- a/docs/models/operations/getkeyresponse.mdx +++ b/docs/models/operations/getkeyresponse.mdx @@ -27,6 +27,16 @@ let value: GetKeyResponse = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, diff --git a/docs/models/operations/getkeytag.mdx b/docs/models/operations/getkeytag.mdx new file mode 100644 index 000000000..2a4b42d5d --- /dev/null +++ b/docs/models/operations/getkeytag.mdx @@ -0,0 +1,21 @@ +--- +title: "GetKeyTag" +--- + +## Example Usage + +```typescript +import { GetKeyTag } from "@openrouter/sdk/models/operations"; + +let value: GetKeyTag = { + key: "team", + value: "billing", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `key` | *string* | ✔️ | Tag key, as it was entered. | team | +| `value` | *string* | ✔️ | Tag value, as it was entered, or null when the tag is just a key. | billing | \ No newline at end of file diff --git a/docs/models/operations/listdata.mdx b/docs/models/operations/listdata.mdx index 0d8cd32fc..da330f86a 100644 --- a/docs/models/operations/listdata.mdx +++ b/docs/models/operations/listdata.mdx @@ -24,6 +24,16 @@ let value: ListData = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, @@ -54,6 +64,7 @@ let value: ListData = { | `limitRemaining` | *number* | ✔️ | Remaining spending limit in USD. Credit usage always counts toward `limit`; BYOK usage counts only when `include_byok_in_limit` is true. | 74.5 | | `limitReset` | *string* | ✔️ | Type of limit reset for the API key | monthly | | `name` | *string* | ✔️ | Name of the API key | My Production Key | +| `tags` | [operations.ListTag](../../models/operations/listtag.mdx)[] | ✔️ | Custom key-value tags attached to this API key. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta",
"value": null
}
] | | `updatedAt` | *string* | ✔️ | ISO 8601 timestamp of when the API key was last updated | 2025-08-24T15:45:00Z | | `usage` | *number* | ✔️ | Total OpenRouter credit usage (in USD) for the API key: the spend allocated to this key, including requests funded from a credit pool. It is not a debit total for the account balance. It excludes external BYOK inference cost, which is reported separately in `byok_usage`, but a BYOK platform fee, where charged, is credit spend and is included here. | 25.5 | | `usageDaily` | *number* | ✔️ | OpenRouter credit usage (in USD) for the current UTC day. Excludes external BYOK inference cost. | 25.5 | diff --git a/docs/models/operations/listrequest.mdx b/docs/models/operations/listrequest.mdx index 4f26d3484..4c8b636e3 100644 --- a/docs/models/operations/listrequest.mdx +++ b/docs/models/operations/listrequest.mdx @@ -21,4 +21,5 @@ let value: ListRequest = {}; | `includeExpired` | *boolean* | ➖ | Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true. | false | | `offset` | *number* | ➖ | Number of API keys to skip for pagination | 0 | | `workspaceId` | *string* | ➖ | Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `tag` | *string* | ➖ | Only return API keys with this tag: `team` matches the tag key with any value, `team:billing` that exact value (case-insensitive). | team:billing | | `creatorUserId` | *string* | ➖ | Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators. | user_2dHFtVWx2n56w6HkM0000000000 | \ No newline at end of file diff --git a/docs/models/operations/listresponse.mdx b/docs/models/operations/listresponse.mdx index 273582504..d3d06276c 100644 --- a/docs/models/operations/listresponse.mdx +++ b/docs/models/operations/listresponse.mdx @@ -28,6 +28,16 @@ let value: ListResponse = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, diff --git a/docs/models/operations/listresponsebody.mdx b/docs/models/operations/listresponsebody.mdx index d9c951dcc..68a041085 100644 --- a/docs/models/operations/listresponsebody.mdx +++ b/docs/models/operations/listresponsebody.mdx @@ -28,6 +28,16 @@ let value: ListResponseBody = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, diff --git a/docs/models/operations/listtag.mdx b/docs/models/operations/listtag.mdx new file mode 100644 index 000000000..011d056e8 --- /dev/null +++ b/docs/models/operations/listtag.mdx @@ -0,0 +1,21 @@ +--- +title: "ListTag" +--- + +## Example Usage + +```typescript +import { ListTag } from "@openrouter/sdk/models/operations"; + +let value: ListTag = { + key: "team", + value: "billing", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `key` | *string* | ✔️ | Tag key, as it was entered. | team | +| `value` | *string* | ✔️ | Tag value, as it was entered, or null when the tag is just a key. | billing | \ No newline at end of file diff --git a/docs/models/operations/queryanalyticsrequestbody.mdx b/docs/models/operations/queryanalyticsrequestbody.mdx index 610af8d4d..5eff64de8 100644 --- a/docs/models/operations/queryanalyticsrequestbody.mdx +++ b/docs/models/operations/queryanalyticsrequestbody.mdx @@ -16,15 +16,16 @@ let value: QueryAnalyticsRequestBody = { ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `classifierDimensions` | [operations.ClassifierDimensions](../../models/operations/classifierdimensions.mdx) | ➖ | Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. | | -| `classifierFilters` | [operations.ClassifierFilters](../../models/operations/classifierfilters.mdx) | ➖ | Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. | | -| `dimensions` | *string*[] | ➖ | N/A | | -| `filters` | *models.Filter*[] | ➖ | N/A | | -| `granularity` | *string* | ➖ | Time granularity | day | -| `groupLimit` | *number* | ➖ | Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. | 100 | -| `limit` | *number* | ➖ | Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. | | -| `metrics` | *string*[] | ✔️ | N/A | | -| `orderBy` | [operations.OrderBy](../../models/operations/orderby.mdx) | ➖ | N/A | | -| `timeRange` | [operations.TimeRange](../../models/operations/timerange.mdx) | ➖ | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `apiKeyTagKey` | *string* | ➖ | Tag key to group by when `dimensions` includes `api_key_tag`, e.g. `team`. Each API key has at most one value per tag key, so groups do not overlap: keys with the tag group under its value, and keys with the tag but no value under the key name. Keys without the tag are left out of the results. Without this field, each `key:value` tag is its own group and a key with several tags counts toward each. | team | +| `classifierDimensions` | [operations.ClassifierDimensions](../../models/operations/classifierdimensions.mdx) | ➖ | Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. | | +| `classifierFilters` | [operations.ClassifierFilters](../../models/operations/classifierfilters.mdx) | ➖ | Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. | | +| `dimensions` | *string*[] | ➖ | N/A | | +| `filters` | *models.Filter*[] | ➖ | N/A | | +| `granularity` | *string* | ➖ | Time granularity | day | +| `groupLimit` | *number* | ➖ | Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. | 100 | +| `limit` | *number* | ➖ | Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. | | +| `metrics` | *string*[] | ✔️ | N/A | | +| `orderBy` | [operations.OrderBy](../../models/operations/orderby.mdx) | ➖ | N/A | | +| `timeRange` | [operations.TimeRange](../../models/operations/timerange.mdx) | ➖ | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatekeysdata.mdx b/docs/models/operations/updatekeysdata.mdx index 1b507193b..6b8eaf23a 100644 --- a/docs/models/operations/updatekeysdata.mdx +++ b/docs/models/operations/updatekeysdata.mdx @@ -26,6 +26,16 @@ let value: UpdateKeysData = { limitRemaining: 74.5, limitReset: "monthly", name: "My Production Key", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T15:45:00Z", usage: 25.5, usageDaily: 25.5, @@ -56,6 +66,7 @@ let value: UpdateKeysData = { | `limitRemaining` | *number* | ✔️ | Remaining spending limit in USD. Credit usage always counts toward `limit`; BYOK usage counts only when `include_byok_in_limit` is true. | 74.5 | | `limitReset` | *string* | ✔️ | Type of limit reset for the API key | monthly | | `name` | *string* | ✔️ | Name of the API key | My Production Key | +| `tags` | [operations.UpdateKeysTagResponse](../../models/operations/updatekeystagresponse.mdx)[] | ✔️ | Custom key-value tags attached to this API key. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta",
"value": null
}
] | | `updatedAt` | *string* | ✔️ | ISO 8601 timestamp of when the API key was last updated | 2025-08-24T15:45:00Z | | `usage` | *number* | ✔️ | Total OpenRouter credit usage (in USD) for the API key: the spend allocated to this key, including requests funded from a credit pool. It is not a debit total for the account balance. It excludes external BYOK inference cost, which is reported separately in `byok_usage`, but a BYOK platform fee, where charged, is credit spend and is included here. | 25.5 | | `usageDaily` | *number* | ✔️ | OpenRouter credit usage (in USD) for the current UTC day. Excludes external BYOK inference cost. | 25.5 | diff --git a/docs/models/operations/updatekeysrequestbody.mdx b/docs/models/operations/updatekeysrequestbody.mdx index 5412253ce..18365521d 100644 --- a/docs/models/operations/updatekeysrequestbody.mdx +++ b/docs/models/operations/updatekeysrequestbody.mdx @@ -19,4 +19,5 @@ let value: UpdateKeysRequestBody = {}; | `limit` | *number* | ➖ | New spending limit for the API key in USD | 75 | | `limitReset` | [operations.UpdateKeysLimitReset](../../models/operations/updatekeyslimitreset.mdx) | ➖ | New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | daily | | `name` | *string* | ➖ | New name for the API key | Updated API Key Name | +| `tags` | [operations.UpdateKeysTagRequest](../../models/operations/updatekeystagrequest.mdx)[] | ➖ | Replace the API key's tags with this set (at most 5). Send an empty array to remove all tags. | [
\{
"key": "team",
"value": "billing"
},
\{
"key": "beta"
}
] | | `workspaceId` | *string* | ➖ | Move the API key to this workspace. The key keeps its value; guardrail selections move with it, except direct guardrail assignments owned by the key's current workspace, which are removed along with the selections derived from them, while other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. Sending the key's current workspace is a no-op. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/models/operations/updatekeysresponse.mdx b/docs/models/operations/updatekeysresponse.mdx index c633955a9..81a3e378a 100644 --- a/docs/models/operations/updatekeysresponse.mdx +++ b/docs/models/operations/updatekeysresponse.mdx @@ -27,6 +27,16 @@ let value: UpdateKeysResponse = { limitRemaining: 32.12, limitReset: "daily", name: "Updated API Key Name", + tags: [ + { + key: "team", + value: "billing", + }, + { + key: "beta", + value: null, + }, + ], updatedAt: "2025-08-24T16:00:00Z", usage: 25.5, usageDaily: 25.5, diff --git a/docs/models/operations/updatekeystagrequest.mdx b/docs/models/operations/updatekeystagrequest.mdx new file mode 100644 index 000000000..db2e577e5 --- /dev/null +++ b/docs/models/operations/updatekeystagrequest.mdx @@ -0,0 +1,20 @@ +--- +title: "UpdateKeysTagRequest" +--- + +## Example Usage + +```typescript +import { UpdateKeysTagRequest } from "@openrouter/sdk/models/operations"; + +let value: UpdateKeysTagRequest = { + key: "team", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `key` | *string* | ✔️ | N/A | team | +| `value` | *string* | ➖ | N/A | billing | \ No newline at end of file diff --git a/docs/models/operations/updatekeystagresponse.mdx b/docs/models/operations/updatekeystagresponse.mdx new file mode 100644 index 000000000..bad7a6184 --- /dev/null +++ b/docs/models/operations/updatekeystagresponse.mdx @@ -0,0 +1,21 @@ +--- +title: "UpdateKeysTagResponse" +--- + +## Example Usage + +```typescript +import { UpdateKeysTagResponse } from "@openrouter/sdk/models/operations"; + +let value: UpdateKeysTagResponse = { + key: "team", + value: "billing", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `key` | *string* | ✔️ | Tag key, as it was entered. | team | +| `value` | *string* | ✔️ | Tag value, as it was entered, or null when the tag is just a key. | billing | \ No newline at end of file diff --git a/jsr.json b/jsr.json index 695c88bc7..3c872d4cc 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "1.5.180", + "version": "1.5.181", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 65c2e84ae..749f961be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "1.5.180", + "version": "1.5.181", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.", "keywords": [ @@ -75,13 +75,13 @@ "prepublishOnly": "npm run build", "compile": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js", "postinstall": "node scripts/check-types.js || true", - "test:e2e": "vitest --run --project e2e", - "test:transit": "exit 0", - "test:watch": "vitest --watch --project unit", - "typecheck:transit": "exit 0", "prepare": "npm run build", + "test:watch": "vitest --watch --project unit", + "typecheck": "tsc --noEmit", "test": "vitest --run --project unit", - "typecheck": "tsc --noEmit" + "test:e2e": "vitest --run --project e2e", + "test:transit": "exit 0", + "typecheck:transit": "exit 0" }, "peerDependencies": { diff --git a/src/funcs/apiKeysList.ts b/src/funcs/apiKeysList.ts index f4d0f7e37..20d45c87b 100644 --- a/src/funcs/apiKeysList.ts +++ b/src/funcs/apiKeysList.ts @@ -118,6 +118,7 @@ async function $do( "include_disabled": payload?.include_disabled, "include_expired": payload?.include_expired, "offset": payload?.offset, + "tag": payload?.tag, "workspace_id": payload?.workspace_id, }); diff --git a/src/lib/config.ts b/src/lib/config.ts index 48a5abb78..45b6dfd76 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -74,7 +74,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "1.5.180", + sdkVersion: "1.5.181", genVersion: "2.960.8", - userAgent: "speakeasy-sdk/typescript 1.5.180 2.960.8 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 1.5.181 2.960.8 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/operations/createkeys.ts b/src/models/operations/createkeys.ts index 818be7367..66844c90f 100644 --- a/src/models/operations/createkeys.ts +++ b/src/models/operations/createkeys.ts @@ -59,6 +59,11 @@ export const CreateKeysLimitReset = { */ export type CreateKeysLimitReset = OpenEnum; +export type CreateKeysTagRequest = { + key: string; + value?: string | null | undefined; +}; + export type CreateKeysRequestBody = { /** * Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key. A workspace-scoped management key may only name a member of its own workspace. @@ -88,6 +93,10 @@ export type CreateKeysRequestBody = { * Name for the new API key */ name: string; + /** + * Custom key-value tags for the API key (at most 5, each tag key at most once). Keys are 1-32 characters of letters, numbers, spaces and - _ . /; the optional value is 1-64 characters and may also contain ':'. Matching is case-insensitive. Your plan limits how many distinct tag keys your account uses and how many distinct values each key has. + */ + tags?: Array | undefined; /** * The workspace to create the API key in. Defaults to the default workspace for an organization-scoped management key, or to the management key's own workspace for a workspace-scoped one, which cannot create keys elsewhere. */ @@ -117,6 +126,17 @@ export type CreateKeysRequest = { requestBody: CreateKeysRequestBody; }; +export type CreateKeysTagResponse = { + /** + * Tag key, as it was entered. + */ + key: string; + /** + * Tag value, as it was entered, or null when the tag is just a key. + */ + value: string | null; +}; + /** * The created API key information */ @@ -189,6 +209,10 @@ export type CreateKeysData = { * Name of the API key */ name: string; + /** + * Custom key-value tags attached to this API key. + */ + tags: Array; /** * ISO 8601 timestamp of when the API key was last updated */ @@ -256,6 +280,29 @@ export const CreateKeysLimitReset$outboundSchema: z.ZodType< CreateKeysLimitReset > = openEnums.outboundSchema(CreateKeysLimitReset); +/** @internal */ +export type CreateKeysTagRequest$Outbound = { + key: string; + value?: string | null | undefined; +}; + +/** @internal */ +export const CreateKeysTagRequest$outboundSchema: z.ZodType< + CreateKeysTagRequest$Outbound, + CreateKeysTagRequest +> = z.object({ + key: z.string(), + value: z.nullable(z.string()).optional(), +}); + +export function createKeysTagRequestToJSON( + createKeysTagRequest: CreateKeysTagRequest, +): string { + return JSON.stringify( + CreateKeysTagRequest$outboundSchema.parse(createKeysTagRequest), + ); +} + /** @internal */ export type CreateKeysRequestBody$Outbound = { creator_user_id?: string | null | undefined; @@ -265,6 +312,7 @@ export type CreateKeysRequestBody$Outbound = { limit?: number | null | undefined; limit_reset?: string | null | undefined; name: string; + tags?: Array | undefined; workspace_id?: string | undefined; }; @@ -280,6 +328,7 @@ export const CreateKeysRequestBody$outboundSchema: z.ZodType< limit: z.nullable(z.number()).optional(), limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(), name: z.string(), + tags: z.array(z.lazy(() => CreateKeysTagRequest$outboundSchema)).optional(), workspaceId: z.string().optional(), }).transform((v) => { return remap$(v, { @@ -331,6 +380,25 @@ export function createKeysRequestToJSON( ); } +/** @internal */ +export const CreateKeysTagResponse$inboundSchema: z.ZodType< + CreateKeysTagResponse, + unknown +> = z.object({ + key: z.string(), + value: z.nullable(z.string()), +}); + +export function createKeysTagResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateKeysTagResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateKeysTagResponse' from JSON`, + ); +} + /** @internal */ export const CreateKeysData$inboundSchema: z.ZodType = z.object({ @@ -355,6 +423,7 @@ export const CreateKeysData$inboundSchema: z.ZodType = limit_remaining: z.nullable(z.number()), limit_reset: z.nullable(z.string()), name: z.string(), + tags: z.array(z.lazy(() => CreateKeysTagResponse$inboundSchema)), updated_at: z.nullable(z.string()), usage: z.number(), usage_daily: z.number(), diff --git a/src/models/operations/getkey.ts b/src/models/operations/getkey.ts index 16ad9e150..64aded35c 100644 --- a/src/models/operations/getkey.ts +++ b/src/models/operations/getkey.ts @@ -56,6 +56,17 @@ export type GetKeyRequest = { hash: string; }; +export type GetKeyTag = { + /** + * Tag key, as it was entered. + */ + key: string; + /** + * Tag value, as it was entered, or null when the tag is just a key. + */ + value: string | null; +}; + /** * The API key information */ @@ -128,6 +139,10 @@ export type GetKeyData = { * Name of the API key */ name: string; + /** + * Custom key-value tags attached to this API key. + */ + tags: Array; /** * ISO 8601 timestamp of when the API key was last updated */ @@ -191,6 +206,22 @@ export function getKeyRequestToJSON(getKeyRequest: GetKeyRequest): string { return JSON.stringify(GetKeyRequest$outboundSchema.parse(getKeyRequest)); } +/** @internal */ +export const GetKeyTag$inboundSchema: z.ZodType = z.object({ + key: z.string(), + value: z.nullable(z.string()), +}); + +export function getKeyTagFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetKeyTag$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetKeyTag' from JSON`, + ); +} + /** @internal */ export const GetKeyData$inboundSchema: z.ZodType = z .object({ @@ -215,6 +246,7 @@ export const GetKeyData$inboundSchema: z.ZodType = z limit_remaining: z.nullable(z.number()), limit_reset: z.nullable(z.string()), name: z.string(), + tags: z.array(z.lazy(() => GetKeyTag$inboundSchema)), updated_at: z.nullable(z.string()), usage: z.number(), usage_daily: z.number(), diff --git a/src/models/operations/list.ts b/src/models/operations/list.ts index 71a259e08..5e93e4bb7 100644 --- a/src/models/operations/list.ts +++ b/src/models/operations/list.ts @@ -66,12 +66,27 @@ export type ListRequest = { * Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another. */ workspaceId?: string | undefined; + /** + * Only return API keys with this tag: `team` matches the tag key with any value, `team:billing` that exact value (case-insensitive). + */ + tag?: string | undefined; /** * Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators. */ creatorUserId?: string | undefined; }; +export type ListTag = { + /** + * Tag key, as it was entered. + */ + key: string; + /** + * Tag value, as it was entered, or null when the tag is just a key. + */ + value: string | null; +}; + export type ListData = { /** * Total external BYOK usage (in USD) for the API key. This is the inference cost OpenRouter records for requests served through your own provider keys, computed from token counts and configured prices, not the amount your provider invoices you. It is not included in the `usage*` fields. @@ -141,6 +156,10 @@ export type ListData = { * Name of the API key */ name: string; + /** + * Custom key-value tags attached to this API key. + */ + tags: Array; /** * ISO 8601 timestamp of when the API key was last updated */ @@ -190,6 +209,7 @@ export type ListRequest$Outbound = { include_expired?: boolean | undefined; offset?: number | null | undefined; workspace_id?: string | undefined; + tag?: string | undefined; creator_user_id?: string | undefined; }; @@ -205,6 +225,7 @@ export const ListRequest$outboundSchema: z.ZodType< includeExpired: z.boolean().optional(), offset: z.nullable(z.int()).optional(), workspaceId: z.string().optional(), + tag: z.string().optional(), creatorUserId: z.string().optional(), }).transform((v) => { return remap$(v, { @@ -220,6 +241,22 @@ export function listRequestToJSON(listRequest: ListRequest): string { return JSON.stringify(ListRequest$outboundSchema.parse(listRequest)); } +/** @internal */ +export const ListTag$inboundSchema: z.ZodType = z.object({ + key: z.string(), + value: z.nullable(z.string()), +}); + +export function listTagFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListTag$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListTag' from JSON`, + ); +} + /** @internal */ export const ListData$inboundSchema: z.ZodType = z.object({ byok_usage: z.number(), @@ -243,6 +280,7 @@ export const ListData$inboundSchema: z.ZodType = z.object({ limit_remaining: z.nullable(z.number()), limit_reset: z.nullable(z.string()), name: z.string(), + tags: z.array(z.lazy(() => ListTag$inboundSchema)), updated_at: z.nullable(z.string()), usage: z.number(), usage_daily: z.number(), diff --git a/src/models/operations/queryanalytics.ts b/src/models/operations/queryanalytics.ts index b736a323b..500200fc1 100644 --- a/src/models/operations/queryanalytics.ts +++ b/src/models/operations/queryanalytics.ts @@ -85,6 +85,10 @@ export type TimeRange = { }; export type QueryAnalyticsRequestBody = { + /** + * Tag key to group by when `dimensions` includes `api_key_tag`, e.g. `team`. Each API key has at most one value per tag key, so groups do not overlap: keys with the tag group under its value, and keys with the tag but no value under the key name. Keys without the tag are left out of the results. Without this field, each `key:value` tag is its own group and a key with several tags counts toward each. + */ + apiKeyTagKey?: string | undefined; /** * Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. */ @@ -263,6 +267,7 @@ export function timeRangeToJSON(timeRange: TimeRange): string { /** @internal */ export type QueryAnalyticsRequestBody$Outbound = { + api_key_tag_key?: string | undefined; classifier_dimensions?: ClassifierDimensions$Outbound | undefined; classifier_filters?: ClassifierFilters$Outbound | undefined; dimensions?: Array | undefined; @@ -280,6 +285,7 @@ export const QueryAnalyticsRequestBody$outboundSchema: z.ZodType< QueryAnalyticsRequestBody$Outbound, QueryAnalyticsRequestBody > = z.object({ + apiKeyTagKey: z.string().optional(), classifierDimensions: z.lazy(() => ClassifierDimensions$outboundSchema) .optional(), classifierFilters: z.lazy(() => ClassifierFilters$outboundSchema).optional(), @@ -293,6 +299,7 @@ export const QueryAnalyticsRequestBody$outboundSchema: z.ZodType< timeRange: z.lazy(() => TimeRange$outboundSchema).optional(), }).transform((v) => { return remap$(v, { + apiKeyTagKey: "api_key_tag_key", classifierDimensions: "classifier_dimensions", classifierFilters: "classifier_filters", groupLimit: "group_limit", diff --git a/src/models/operations/updatekeys.ts b/src/models/operations/updatekeys.ts index 16dd20e74..d5bf11491 100644 --- a/src/models/operations/updatekeys.ts +++ b/src/models/operations/updatekeys.ts @@ -45,6 +45,11 @@ export const UpdateKeysLimitReset = { */ export type UpdateKeysLimitReset = OpenEnum; +export type UpdateKeysTagRequest = { + key: string; + value?: string | null | undefined; +}; + export type UpdateKeysRequestBody = { /** * Whether to disable the API key @@ -66,6 +71,10 @@ export type UpdateKeysRequestBody = { * New name for the API key */ name?: string | undefined; + /** + * Replace the API key's tags with this set (at most 5). Send an empty array to remove all tags. + */ + tags?: Array | undefined; /** * Move the API key to this workspace. The key keeps its value; guardrail selections move with it, except direct guardrail assignments owned by the key's current workspace, which are removed along with the selections derived from them, while other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. Sending the key's current workspace is a no-op. */ @@ -99,6 +108,17 @@ export type UpdateKeysRequest = { requestBody: UpdateKeysRequestBody; }; +export type UpdateKeysTagResponse = { + /** + * Tag key, as it was entered. + */ + key: string; + /** + * Tag value, as it was entered, or null when the tag is just a key. + */ + value: string | null; +}; + /** * The updated API key information */ @@ -171,6 +191,10 @@ export type UpdateKeysData = { * Name of the API key */ name: string; + /** + * Custom key-value tags attached to this API key. + */ + tags: Array; /** * ISO 8601 timestamp of when the API key was last updated */ @@ -213,6 +237,29 @@ export const UpdateKeysLimitReset$outboundSchema: z.ZodType< UpdateKeysLimitReset > = openEnums.outboundSchema(UpdateKeysLimitReset); +/** @internal */ +export type UpdateKeysTagRequest$Outbound = { + key: string; + value?: string | null | undefined; +}; + +/** @internal */ +export const UpdateKeysTagRequest$outboundSchema: z.ZodType< + UpdateKeysTagRequest$Outbound, + UpdateKeysTagRequest +> = z.object({ + key: z.string(), + value: z.nullable(z.string()).optional(), +}); + +export function updateKeysTagRequestToJSON( + updateKeysTagRequest: UpdateKeysTagRequest, +): string { + return JSON.stringify( + UpdateKeysTagRequest$outboundSchema.parse(updateKeysTagRequest), + ); +} + /** @internal */ export type UpdateKeysRequestBody$Outbound = { disabled?: boolean | undefined; @@ -220,6 +267,7 @@ export type UpdateKeysRequestBody$Outbound = { limit?: number | null | undefined; limit_reset?: string | null | undefined; name?: string | undefined; + tags?: Array | undefined; workspace_id?: string | undefined; }; @@ -233,6 +281,7 @@ export const UpdateKeysRequestBody$outboundSchema: z.ZodType< limit: z.nullable(z.number()).optional(), limitReset: z.nullable(UpdateKeysLimitReset$outboundSchema).optional(), name: z.string().optional(), + tags: z.array(z.lazy(() => UpdateKeysTagRequest$outboundSchema)).optional(), workspaceId: z.string().optional(), }).transform((v) => { return remap$(v, { @@ -284,6 +333,25 @@ export function updateKeysRequestToJSON( ); } +/** @internal */ +export const UpdateKeysTagResponse$inboundSchema: z.ZodType< + UpdateKeysTagResponse, + unknown +> = z.object({ + key: z.string(), + value: z.nullable(z.string()), +}); + +export function updateKeysTagResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateKeysTagResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateKeysTagResponse' from JSON`, + ); +} + /** @internal */ export const UpdateKeysData$inboundSchema: z.ZodType = z.object({ @@ -308,6 +376,7 @@ export const UpdateKeysData$inboundSchema: z.ZodType = limit_remaining: z.nullable(z.number()), limit_reset: z.nullable(z.string()), name: z.string(), + tags: z.array(z.lazy(() => UpdateKeysTagResponse$inboundSchema)), updated_at: z.nullable(z.string()), usage: z.number(), usage_daily: z.number(),