@openrouter/sdk 0.13.66 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  ![hero illustration](./assets/banner.png)
2
2
 
3
- # OpenRouter SDK
3
+ # OpenRouter TypeScript SDK
4
4
 
5
- The [OpenRouter SDK](https://openrouter.ai/docs/sdks/typescript) is a TypeScript toolkit designed to help you build AI-powered features and solutions in any JS or TS based runtime. Giving you easy access to 400+ models across providers in an easy and type-safe way.
5
+ The [OpenRouter TypeScript SDK](https://openrouter.ai/docs/sdks/typescript) is the official type-safe toolkit designed to build AI-powered features and solutions in any JS or TS runtime. It provides seamless access to 400+ leading AI models across providers combined with first-class TypeScript support.
6
6
 
7
7
  To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/typescript/reference) and [Documentation](https://openrouter.ai/docs/sdks/typescript).
8
8
 
@@ -190,7 +190,7 @@ run();
190
190
 
191
191
  You can setup your SDK to emit debug logs for SDK requests and responses.
192
192
 
193
- You can pass a logger that matches `console`'s interface as an SDK option.
193
+ You can pass a logger that matches the standard `console` interface (specifically matching the `Logger` interface containing `.log`, `.info`, `.warn`, `.error`, etc.) as an SDK option.
194
194
 
195
195
  > [!WARNING]
196
196
  > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
package/RUNTIMES.md CHANGED
@@ -14,7 +14,7 @@ Runtime environments that are explicitly supported are:
14
14
 
15
15
  - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
16
  - Node.js active and maintenance LTS releases
17
- - Currently, this is v18 and v20
17
+ - Currently, this is v18, v20, and v22
18
18
  - Bun v1 and above
19
19
  - Deno v1.39
20
20
  - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
@@ -11,5 +11,5 @@ import { Result } from "../types/fp.js";
11
11
  /**
12
12
  * List all endpoints for a model
13
13
  */
14
- export declare function endpointsList(client: OpenRouterCore, request: operations.ListEndpointsRequest, options?: RequestOptions): APIPromise<Result<operations.ListEndpointsResponse, errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
14
+ export declare function endpointsList(client: OpenRouterCore, request: operations.ListEndpointsRequest, options?: RequestOptions): APIPromise<Result<operations.ListEndpointsResponse, errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
15
15
  //# sourceMappingURL=endpointsList.d.ts.map
@@ -94,7 +94,7 @@ async function $do(client, request, options) {
94
94
  const responseFields = {
95
95
  HttpMeta: { Response: response, Request: req },
96
96
  };
97
- const [result] = await M.match(M.json(200, operations.ListEndpointsResponse$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
97
+ const [result] = await M.match(M.json(200, operations.ListEndpointsResponse$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
98
98
  if (!result.ok) {
99
99
  return [result, { status: "complete", request: req, response }];
100
100
  }
@@ -11,5 +11,5 @@ import { Result } from "../types/fp.js";
11
11
  /**
12
12
  * Preview the impact of ZDR on the available endpoints
13
13
  */
14
- export declare function endpointsListZdrEndpoints(client: OpenRouterCore, request?: operations.ListEndpointsZdrRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListEndpointsZdrResponse, errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
14
+ export declare function endpointsListZdrEndpoints(client: OpenRouterCore, request?: operations.ListEndpointsZdrRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListEndpointsZdrResponse, errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
15
15
  //# sourceMappingURL=endpointsListZdrEndpoints.d.ts.map
@@ -84,7 +84,7 @@ async function $do(client, request, options) {
84
84
  const responseFields = {
85
85
  HttpMeta: { Response: response, Request: req },
86
86
  };
87
- const [result] = await M.match(M.json(200, operations.ListEndpointsZdrResponse$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
87
+ const [result] = await M.match(M.json(200, operations.ListEndpointsZdrResponse$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
88
88
  if (!result.ok) {
89
89
  return [result, { status: "complete", request: req, response }];
90
90
  }
@@ -12,5 +12,5 @@ import { Result } from "../types/fp.js";
12
12
  /**
13
13
  * Get total count of available models
14
14
  */
15
- export declare function modelsCount(client: OpenRouterCore, request?: operations.ListModelsCountRequest | undefined, options?: RequestOptions): APIPromise<Result<models.ModelsCountResponse, errors.BadRequestResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
15
+ export declare function modelsCount(client: OpenRouterCore, request?: operations.ListModelsCountRequest | undefined, options?: RequestOptions): APIPromise<Result<models.ModelsCountResponse, errors.BadRequestResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
16
16
  //# sourceMappingURL=modelsCount.d.ts.map
@@ -89,7 +89,7 @@ async function $do(client, request, options) {
89
89
  const responseFields = {
90
90
  HttpMeta: { Response: response, Request: req },
91
91
  };
92
- const [result] = await M.match(M.json(200, models.ModelsCountResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
92
+ const [result] = await M.match(M.json(200, models.ModelsCountResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
93
93
  if (!result.ok) {
94
94
  return [result, { status: "complete", request: req, response }];
95
95
  }
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
15
15
  * @remarks
16
16
  * Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
17
17
  */
18
- export declare function modelsGet(client: OpenRouterCore, request: operations.GetModelRequest, options?: RequestOptions): APIPromise<Result<models.ModelResponse, errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ export declare function modelsGet(client: OpenRouterCore, request: operations.GetModelRequest, options?: RequestOptions): APIPromise<Result<models.ModelResponse, errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=modelsGet.d.ts.map
@@ -98,7 +98,7 @@ async function $do(client, request, options) {
98
98
  const responseFields = {
99
99
  HttpMeta: { Response: response, Request: req },
100
100
  };
101
- const [result] = await M.match(M.json(200, models.ModelResponse$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
101
+ const [result] = await M.match(M.json(200, models.ModelResponse$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
102
102
  if (!result.ok) {
103
103
  return [result, { status: "complete", request: req, response }];
104
104
  }
@@ -12,7 +12,7 @@ import { PageIterator } from "../types/operations.js";
12
12
  /**
13
13
  * List all models and their properties
14
14
  */
15
- export declare function modelsList(client: OpenRouterCore, request?: operations.GetModelsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.GetModelsResponse, errors.BadRequestResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
15
+ export declare function modelsList(client: OpenRouterCore, request?: operations.GetModelsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.GetModelsResponse, errors.BadRequestResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
16
16
  offset: number;
17
17
  }>>;
18
18
  //# sourceMappingURL=modelsList.d.ts.map
@@ -117,7 +117,7 @@ async function $do(client, request, options) {
117
117
  const responseFields = {
118
118
  HttpMeta: { Response: response, Request: req },
119
119
  };
120
- const [result, raw] = await M.match(M.json(200, operations.GetModelsResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
120
+ const [result, raw] = await M.match(M.json(200, operations.GetModelsResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
121
121
  if (!result.ok) {
122
122
  return [haltIterator(result), {
123
123
  status: "complete",
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
15
15
  * @remarks
16
16
  * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing).
17
17
  */
18
- export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListModelsUserResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
18
+ export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListModelsUserResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
19
19
  offset: number;
20
20
  }>>;
21
21
  //# sourceMappingURL=modelsListForUser.d.ts.map
@@ -99,7 +99,7 @@ async function $do(client, security, request, options) {
99
99
  };
100
100
  const [result, raw] = await M.match(M.json(200, operations.ListModelsUserResponse$inboundSchema, {
101
101
  key: "Result",
102
- }), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
102
+ }), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
103
103
  if (!result.ok) {
104
104
  return [haltIterator(result), {
105
105
  status: "complete",
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "0.13.66";
52
+ readonly sdkVersion: "1.0.0";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.66 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.0.0 2.914.0 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.13.66",
29
+ sdkVersion: "1.0.0",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 0.13.66 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.0.0 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.66",
5
+ "version": "1.0.0",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.66",
3
+ "version": "1.0.0",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -74,14 +74,14 @@
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
76
  "compile": "tsc",
77
- "prepare": "npm run build",
78
- "test:e2e": "vitest --run --project e2e",
79
- "typecheck": "tsc --noEmit",
80
- "typecheck:transit": "exit 0",
81
77
  "postinstall": "node scripts/check-types.js || true",
78
+ "prepare": "npm run build",
82
79
  "test": "vitest --run --project unit",
83
80
  "test:transit": "exit 0",
84
- "test:watch": "vitest --watch --project unit"
81
+ "test:e2e": "vitest --run --project e2e",
82
+ "test:watch": "vitest --watch --project unit",
83
+ "typecheck": "tsc --noEmit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {