Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
lockVersion: ""
id: ""
management:
docChecksum: a9575ea2449f9486f69e57b06702b72c
docChecksum: c4ddd907c6e8e688476fc791fddce30d
docVersion: 1.0.0
speakeasyVersion: 1.787.0
generationVersion: 2.914.0
releaseVersion: 1.4.17
configChecksum: 62f7a5c003602a55ae84c2ae8ae2080b
releaseVersion: 1.4.18
configChecksum: a63a5c0344bab35c87ba20c6c5769aff
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
published: true
persistentEdits:
generation_id: c6dfa0d2-bd22-409c-b0d7-0b7b8fe8c3b7
pristine_commit_hash: 5d8ada8837c73d45a55f1e33c1b16f1956a7e72e
pristine_tree_hash: 4c2a0e93e78dd0e995a076610418ad01804a7459
generation_id: 4bd9d864-a9cd-4706-a283-13c542b9c149
pristine_commit_hash: 917f7ce2b7bf791698fa0077b23d68d682ef20bb
pristine_tree_hash: f84112239f39812abeda7d056c53c58c9e847ac0
features:
typescript:
acceptHeaders: 2.81.2
Expand Down Expand Up @@ -15072,8 +15072,8 @@ trackedFiles:
pristine_git_object: d83e642dfeee46102ccc469da7a644cc99efab42
docs/sdks/apikeys/README.mdx:
id: 27fcaae1c346
last_write_checksum: sha1:a1cb4fab7f31bcf8597520dad9290d3ede3be19a
pristine_git_object: 5003dfe082082b968b6d20a2e0020d8c6bae06fb
last_write_checksum: sha1:428eb6435f85eaf5a685da33b169beb9485735f5
pristine_git_object: 36cad6b72875be9c4ae1edadafea3c90cfecda62
docs/sdks/batch/README.mdx:
id: e367aa4f4295
last_write_checksum: sha1:6a7b49a4ad9ba8dc1600a20d20417e8ee45d69c9
Expand Down Expand Up @@ -15315,12 +15315,12 @@ trackedFiles:
pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a
jsr.json:
id: 7f6ab7767282
last_write_checksum: sha1:759f3c4362503dcf57b212fc2eb61c2ae8f8f866
pristine_git_object: 56bbb8f8d561d468f02cacb7f0d9d28a9a6710fe
last_write_checksum: sha1:45bedeb23c7fadf1252f091f81afb5799396900d
pristine_git_object: 4ea4c1e2e992f5ff6641c5c7ddeb02fa9be7d36b
package.json:
id: 7030d0b2f71b
last_write_checksum: sha1:f91d6cb3b662c030c4b69d9d328d5e54a8b55983
pristine_git_object: 1a78e5411ecaaa48189dcd6c9feded121dd2dc12
last_write_checksum: sha1:745d04123d32122b71f1810484cd2125892794d0
pristine_git_object: 431df562b6aeacec2435ea37ba07908a5ebfd01d
src/core.ts:
id: f431fdbcd144
last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131
Expand Down Expand Up @@ -15363,8 +15363,8 @@ trackedFiles:
pristine_git_object: fc3c9f8316d86d3128be6f71e168b5cfd8e2f32b
src/funcs/apiKeysUpdate.ts:
id: 05700884934b
last_write_checksum: sha1:6724255025710798b8169f2db96ea2ac23392875
pristine_git_object: b236ec536229e23a813c2c9683072417c3a9ea47
last_write_checksum: sha1:d4286a929ca48618e2b3441ea2751fed4d59c432
pristine_git_object: fca49cdeeaea702ca58d988351aebe7d5ec53075
src/funcs/batchCreateBatches.ts:
id: 8796df347125
last_write_checksum: sha1:bbf2369387e8922cdf18a33b28840c40e2b79c4e
Expand Down Expand Up @@ -15939,8 +15939,8 @@ trackedFiles:
pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e
src/lib/config.ts:
id: 320761608fb3
last_write_checksum: sha1:37e1d400a9d539c897846bdf94ba9c318df3e4ab
pristine_git_object: 726859d0bccf85a38714199b227468517e3ca657
last_write_checksum: sha1:0fe125981ae33a67aeb5c6e142c0e2e31d754a2e
pristine_git_object: 42199d9d95e8a44cef1b4ff5f822e244e102c9c1
src/lib/dlv.ts:
id: b1988214835a
last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711
Expand Down Expand Up @@ -20089,8 +20089,8 @@ trackedFiles:
pristine_git_object: 8a7efa79ead429ae16fd167d1969491766e11751
src/sdk/apikeys.ts:
id: 5dda931501e1
last_write_checksum: sha1:5703cc8f8b2aa6c33d491e2319eae43753bf5ba1
pristine_git_object: afff539f0e658b5ecf98eef83184aaae83def189
last_write_checksum: sha1:7e44ec7cd3247c94658a3be3063e53bf3d3137fc
pristine_git_object: 99315a8ad4fc70adead9752c56b4e582f29a8a80
src/sdk/batch.ts:
id: 254a218f7d6b
last_write_checksum: sha1:060fefc69e19501be3cabe381e44091a14f36c12
Expand Down Expand Up @@ -20626,6 +20626,24 @@ examples:
application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}}
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
invalid_parameters:
parameters:
path:
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
requestBody:
application/json: {}
responses:
"400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
no_update_fields:
parameters:
path:
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943"
requestBody:
application/json: {}
responses:
"400":
application/json: {"error": {"code": 400, "message": "No update fields provided"}}
deleteKeys:
speakeasy-default-delete-keys:
parameters:
Expand Down Expand Up @@ -24224,4 +24242,3 @@ examples:
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
examplesVersion: 1.0.2
releaseNotes: "## Typescript SDK Changes:\n* `openrouter.images.generate()`: \n * `request.imageGenerationRequest.resolution.enum(1.5K)` **Added**\n"
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
typescript:
version: 1.4.17
version: 1.4.18
acceptHeaderEnum: false
additionalDependencies:
dependencies:
Expand Down
20 changes: 15 additions & 5 deletions .speakeasy/out.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43978,7 +43978,7 @@ paths:
- 'API Keys'
x-speakeasy-name-override: 'get'
patch:
description: 'Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).'
description: "Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).\n\n<Warning>\nYou can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.\n</Warning>"
operationId: 'updateKeys'
parameters:
- description: 'The hash identifier of the API key to update'
Expand Down Expand Up @@ -44261,10 +44261,20 @@ paths:
'400':
content:
application/json:
example:
error:
code: 400
message: 'Invalid request parameters'
examples:
invalid_parameters:
summary: 'Invalid request parameters'
value:
error:
code: 400
message: 'Invalid request parameters'
no_update_fields:
description: 'Returned when the body contains none of the accepted fields, for example `{"workspace_id": "..."}`. `workspace_id` can''t be changed through the API.'
summary: 'No accepted fields in the request body'
value:
error:
code: 400
message: 'No update fields provided'
schema:
$ref: '#/components/schemas/BadRequestResponse'
description: 'Bad Request - Invalid request parameters or malformed input'
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ speakeasyVersion: 1.787.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:ef161a0447b36c13ffbbabef706e7a7bd95f212226b012cf8e36ed98f31f61c4
sourceBlobDigest: sha256:385590cede8164b419d3e461a38492edb251d18d6ba8de47ea1f050c85ba82bb
sourceRevisionDigest: sha256:b0f99062e8f93eb36c1f1a4e61d013095cac91fb66daca78fb5afec72dc87a3e
sourceBlobDigest: sha256:784594107f2a405803db5e58a5ad2f796adcb4b06a9555f7ecc9f8a5596493ab
tags:
- latest
- 1.0.0
targets:
openrouter:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:ef161a0447b36c13ffbbabef706e7a7bd95f212226b012cf8e36ed98f31f61c4
sourceBlobDigest: sha256:385590cede8164b419d3e461a38492edb251d18d6ba8de47ea1f050c85ba82bb
sourceRevisionDigest: sha256:b0f99062e8f93eb36c1f1a4e61d013095cac91fb66daca78fb5afec72dc87a3e
sourceBlobDigest: sha256:784594107f2a405803db5e58a5ad2f796adcb4b06a9555f7ecc9f8a5596493ab
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
codeSamplesRevisionDigest: sha256:f9469faf524f85636945af73958ae3bb9f01cf8761f171c76f65c05497338b48
codeSamplesRevisionDigest: sha256:86d43acc8b45584293c7de634ae4b028a2709d50f5ca215edde1a6e16cf5ae7d
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.787.0
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4306,4 +4306,14 @@ Based on:
### Generated
- [typescript v1.4.17] .
### Releases
- [NPM v1.4.17] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.17 - .
- [NPM v1.4.17] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.17 - .

## 2026-10-01 21:31:52
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v1.4.18] .
### Releases
- [NPM v1.4.18] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.18 - .
78 changes: 63 additions & 15 deletions docs/sdks/apikeys/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ run();

Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).

### Example Usage
\<Warning>
You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
</Warning>

### Example Usage: invalid_parameters

```typescript
import { OpenRouter } from "@openrouter/sdk";
Expand All @@ -448,13 +452,7 @@ const openRouter = new OpenRouter({
async function run() {
const result = await openRouter.apiKeys.update({
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
requestBody: {
disabled: false,
includeByokInLimit: true,
limit: 75,
limitReset: "daily",
name: "Updated API Key Name",
},
requestBody: {},
});

console.log(result);
Expand Down Expand Up @@ -483,13 +481,63 @@ const openRouter = new OpenRouterCore({
async function run() {
const res = await apiKeysUpdate(openRouter, {
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
requestBody: {
disabled: false,
includeByokInLimit: true,
limit: 75,
limitReset: "daily",
name: "Updated API Key Name",
},
requestBody: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("apiKeysUpdate failed:", res.error);
}
}

run();
```
### Example Usage: no_update_fields

```typescript
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
httpReferer: "<value>",
appTitle: "<value>",
appCategories: "<value>",
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
const result = await openRouter.apiKeys.update({
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
requestBody: {},
});

console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { apiKeysUpdate } from "@openrouter/sdk/funcs/apiKeysUpdate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
httpReferer: "<value>",
appTitle: "<value>",
appCategories: "<value>",
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
const res = await apiKeysUpdate(openRouter, {
hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
requestBody: {},
});
if (res.ok) {
const { value: result } = res;
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@openrouter/sdk",
"version": "1.4.17",
"version": "1.4.18",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openrouter/sdk",
"version": "1.4.17",
"version": "1.4.18",
"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": [
Expand Down Expand Up @@ -73,15 +73,15 @@
"lint": "eslint --cache --max-warnings=0 src",
"build": "tsc && node scripts/unbarrel-imports.js",
"prepublishOnly": "npm run build",
"test:transit": "exit 0",
"typecheck": "tsc --noEmit",
"compile": "tsc && node scripts/unbarrel-imports.js",
"test:watch": "vitest --watch --project unit",
"typecheck:transit": "exit 0",
"postinstall": "node scripts/check-types.js || true",
"prepare": "npm run build",
"test": "vitest --run --project unit",
"test:e2e": "vitest --run --project e2e",
"typecheck": "tsc --noEmit",
"compile": "tsc && node scripts/unbarrel-imports.js",
"test": "vitest --run --project unit"
"test:transit": "exit 0"
},
"peerDependencies": {

Expand Down
4 changes: 4 additions & 0 deletions src/funcs/apiKeysUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import { Result } from "../types/fp.js";
*
* @remarks
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
*
* <Warning>
* You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
* </Warning>
*/
export function apiKeysUpdate(
client: OpenRouterCore,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0.0",
sdkVersion: "1.4.17",
sdkVersion: "1.4.18",
genVersion: "2.914.0",
userAgent: "speakeasy-sdk/typescript 1.4.17 2.914.0 1.0.0 @openrouter/sdk",
userAgent: "speakeasy-sdk/typescript 1.4.18 2.914.0 1.0.0 @openrouter/sdk",
} as const;
4 changes: 4 additions & 0 deletions src/sdk/apikeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class APIKeys extends ClientSDK {
*
* @remarks
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
*
* <Warning>
* You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
* </Warning>
*/
async update(
request: operations.UpdateKeysRequest,
Expand Down
Loading