@openrouter/sdk 1.2.42 → 1.2.43
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/esm/lib/config.d.ts +4 -3
- package/esm/lib/config.js +7 -4
- package/esm/lib/env.d.ts +5 -0
- package/esm/lib/env.js +1 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
package/esm/lib/config.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export type SDKOptions = {
|
|
|
31
31
|
*/
|
|
32
32
|
server?: keyof typeof ServerList | undefined;
|
|
33
33
|
/**
|
|
34
|
-
* Allows overriding the default server URL used by the SDK
|
|
34
|
+
* Allows overriding the default server URL used by the SDK. When omitted, the
|
|
35
|
+
* `OPENROUTER_BASE_URL` environment variable is used, if set.
|
|
35
36
|
*/
|
|
36
37
|
serverURL?: string | undefined;
|
|
37
38
|
/**
|
|
@@ -49,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
50
|
export declare const SDK_METADATA: {
|
|
50
51
|
readonly language: "typescript";
|
|
51
52
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.2.
|
|
53
|
+
readonly sdkVersion: "1.2.43";
|
|
53
54
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.43 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
* @generated-id: 320761608fb3
|
|
4
4
|
*/
|
|
5
|
+
import { env } from "./env.js";
|
|
5
6
|
import { pathToFunc } from "./url.js";
|
|
6
7
|
/**
|
|
7
8
|
* Production server
|
|
@@ -17,8 +18,10 @@ export function serverURLFromOptions(options) {
|
|
|
17
18
|
let serverURL = options.serverURL;
|
|
18
19
|
const params = {};
|
|
19
20
|
if (!serverURL) {
|
|
20
|
-
const server = options.server
|
|
21
|
-
serverURL =
|
|
21
|
+
const server = options.server;
|
|
22
|
+
serverURL =
|
|
23
|
+
(server ? ServerList[server] : env().OPENROUTER_BASE_URL) ||
|
|
24
|
+
ServerList[ServerProduction];
|
|
22
25
|
}
|
|
23
26
|
const u = pathToFunc(serverURL)(params);
|
|
24
27
|
return new URL(u);
|
|
@@ -26,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
29
|
export const SDK_METADATA = {
|
|
27
30
|
language: "typescript",
|
|
28
31
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.2.
|
|
32
|
+
sdkVersion: "1.2.43",
|
|
30
33
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.43 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
35
|
};
|
|
33
36
|
//# sourceMappingURL=config.js.map
|
package/esm/lib/env.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface Env {
|
|
|
15
15
|
*/
|
|
16
16
|
OPENROUTER_APP_CATEGORIES?: string | undefined;
|
|
17
17
|
OPENROUTER_DEBUG?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the default server URL used by the SDK. Must include the API version
|
|
20
|
+
* path, for example `https://openrouter.ai/api/v1`.
|
|
21
|
+
*/
|
|
22
|
+
OPENROUTER_BASE_URL?: string | undefined;
|
|
18
23
|
}
|
|
19
24
|
export declare const envSchema: z.ZodType<Env, unknown>;
|
|
20
25
|
/**
|
package/esm/lib/env.js
CHANGED
|
@@ -9,6 +9,7 @@ export const envSchema = z.object({
|
|
|
9
9
|
OPENROUTER_APP_TITLE: z.string().optional(),
|
|
10
10
|
OPENROUTER_APP_CATEGORIES: z.string().optional(),
|
|
11
11
|
OPENROUTER_DEBUG: z.coerce.boolean().optional(),
|
|
12
|
+
OPENROUTER_BASE_URL: z.string().url().optional(),
|
|
12
13
|
});
|
|
13
14
|
/**
|
|
14
15
|
* Checks for the existence of the Deno global object to determine the environment.
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.43",
|
|
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": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"compile": "tsc",
|
|
77
76
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
-
"test": "vitest --run --project unit",
|
|
79
|
-
"test:e2e": "vitest --run --project e2e",
|
|
80
|
-
"test:transit": "exit 0",
|
|
81
|
-
"typecheck:transit": "exit 0",
|
|
82
77
|
"prepare": "npm run build",
|
|
78
|
+
"test:transit": "exit 0",
|
|
83
79
|
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"typecheck": "tsc --noEmit"
|
|
80
|
+
"typecheck": "tsc --noEmit",
|
|
81
|
+
"compile": "tsc",
|
|
82
|
+
"test": "vitest --run --project unit",
|
|
83
|
+
"test:e2e": "vitest --run --project e2e",
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|