@openrouter/sdk 1.2.42 → 1.2.44
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/esm/models/advisorservertoolconfig.d.ts +1 -12
- package/esm/models/advisorservertoolconfig.js +0 -4
- package/esm/models/advisorservertoolopenrouter.d.ts +1 -1
- package/esm/models/index.d.ts +0 -1
- package/esm/models/index.js +0 -1
- package/jsr.json +1 -1
- package/package.json +6 -6
- package/esm/models/advisornestedtool.d.ts +0 -25
- package/esm/models/advisornestedtool.js +0 -23
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.44";
|
|
53
54
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.44 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.44",
|
|
30
33
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.44 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.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { AdvisorNestedTool, AdvisorNestedTool$Outbound } from "./advisornestedtool.js";
|
|
3
2
|
import { AdvisorReasoning, AdvisorReasoning$Outbound } from "./advisorreasoning.js";
|
|
4
3
|
/**
|
|
5
4
|
* Configuration for one openrouter:advisor server tool entry.
|
|
@@ -18,11 +17,7 @@ export type AdvisorServerToolConfig = {
|
|
|
18
17
|
*/
|
|
19
18
|
maxCompletionTokens?: number | undefined;
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
maxToolCalls?: number | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Slug of the advisor model to consult (any OpenRouter model). When omitted, the executor can choose it via the tool call's `model` argument; if neither is set, the model from the outer API request is used. The advisor tool itself cannot be the advisor model.
|
|
20
|
+
* Slug of the advisor model to consult (any OpenRouter model). When omitted, the executor can choose it via the tool call's `model` argument; if neither is set, the model from the outer API request is used.
|
|
26
21
|
*/
|
|
27
22
|
model?: string | undefined;
|
|
28
23
|
/**
|
|
@@ -41,23 +36,17 @@ export type AdvisorServerToolConfig = {
|
|
|
41
36
|
* Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.
|
|
42
37
|
*/
|
|
43
38
|
temperature?: number | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself.
|
|
46
|
-
*/
|
|
47
|
-
tools?: Array<AdvisorNestedTool> | undefined;
|
|
48
39
|
};
|
|
49
40
|
/** @internal */
|
|
50
41
|
export type AdvisorServerToolConfig$Outbound = {
|
|
51
42
|
forward_transcript?: boolean | undefined;
|
|
52
43
|
instructions?: string | undefined;
|
|
53
44
|
max_completion_tokens?: number | undefined;
|
|
54
|
-
max_tool_calls?: number | undefined;
|
|
55
45
|
model?: string | undefined;
|
|
56
46
|
name?: string | undefined;
|
|
57
47
|
reasoning?: AdvisorReasoning$Outbound | undefined;
|
|
58
48
|
stream?: boolean | undefined;
|
|
59
49
|
temperature?: number | undefined;
|
|
60
|
-
tools?: Array<AdvisorNestedTool$Outbound> | undefined;
|
|
61
50
|
};
|
|
62
51
|
/** @internal */
|
|
63
52
|
export declare const AdvisorServerToolConfig$outboundSchema: z.ZodType<AdvisorServerToolConfig$Outbound, AdvisorServerToolConfig>;
|
|
@@ -4,25 +4,21 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
-
import { AdvisorNestedTool$outboundSchema, } from "./advisornestedtool.js";
|
|
8
7
|
import { AdvisorReasoning$outboundSchema, } from "./advisorreasoning.js";
|
|
9
8
|
/** @internal */
|
|
10
9
|
export const AdvisorServerToolConfig$outboundSchema = z.object({
|
|
11
10
|
forwardTranscript: z.boolean().optional(),
|
|
12
11
|
instructions: z.string().optional(),
|
|
13
12
|
maxCompletionTokens: z.int().optional(),
|
|
14
|
-
maxToolCalls: z.int().optional(),
|
|
15
13
|
model: z.string().optional(),
|
|
16
14
|
name: z.string().optional(),
|
|
17
15
|
reasoning: AdvisorReasoning$outboundSchema.optional(),
|
|
18
16
|
stream: z.boolean().optional(),
|
|
19
17
|
temperature: z.number().optional(),
|
|
20
|
-
tools: z.array(AdvisorNestedTool$outboundSchema).optional(),
|
|
21
18
|
}).transform((v) => {
|
|
22
19
|
return remap$(v, {
|
|
23
20
|
forwardTranscript: "forward_transcript",
|
|
24
21
|
maxCompletionTokens: "max_completion_tokens",
|
|
25
|
-
maxToolCalls: "max_tool_calls",
|
|
26
22
|
});
|
|
27
23
|
});
|
|
28
24
|
export function advisorServerToolConfigToJSON(advisorServerToolConfig) {
|
|
@@ -6,7 +6,7 @@ export declare const AdvisorServerToolOpenRouterType: {
|
|
|
6
6
|
};
|
|
7
7
|
export type AdvisorServerToolOpenRouterType = ClosedEnum<typeof AdvisorServerToolOpenRouterType>;
|
|
8
8
|
/**
|
|
9
|
-
* OpenRouter built-in server tool: consults a higher-intelligence advisor model (any OpenRouter model) for guidance mid-generation and returns its response.
|
|
9
|
+
* OpenRouter built-in server tool: consults a higher-intelligence advisor model (any OpenRouter model) for guidance mid-generation and returns its response. Include multiple entries to offer several named advisors; at most one entry may omit `name` to act as the default advisor.
|
|
10
10
|
*/
|
|
11
11
|
export type AdvisorServerToolOpenRouter = {
|
|
12
12
|
/**
|
package/esm/models/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./aabenchmarkentry.js";
|
|
|
2
2
|
export * from "./activityitem.js";
|
|
3
3
|
export * from "./activityresponse.js";
|
|
4
4
|
export * from "./additionaltoolsitem.js";
|
|
5
|
-
export * from "./advisornestedtool.js";
|
|
6
5
|
export * from "./advisorreasoning.js";
|
|
7
6
|
export * from "./advisorservertoolconfig.js";
|
|
8
7
|
export * from "./advisorservertoolopenrouter.js";
|
package/esm/models/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export * from "./aabenchmarkentry.js";
|
|
|
6
6
|
export * from "./activityitem.js";
|
|
7
7
|
export * from "./activityresponse.js";
|
|
8
8
|
export * from "./additionaltoolsitem.js";
|
|
9
|
-
export * from "./advisornestedtool.js";
|
|
10
9
|
export * from "./advisorreasoning.js";
|
|
11
10
|
export * from "./advisorservertoolconfig.js";
|
|
12
11
|
export * from "./advisorservertoolopenrouter.js";
|
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.44",
|
|
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",
|
|
77
|
+
"prepare": "npm run build",
|
|
78
78
|
"test": "vitest --run --project unit",
|
|
79
|
-
"test:e2e": "vitest --run --project e2e",
|
|
80
79
|
"test:transit": "exit 0",
|
|
81
|
-
"typecheck:transit": "exit 0",
|
|
82
|
-
"prepare": "npm run build",
|
|
83
80
|
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"typecheck": "tsc --noEmit"
|
|
81
|
+
"typecheck": "tsc --noEmit",
|
|
82
|
+
"typecheck:transit": "exit 0",
|
|
83
|
+
"test:e2e": "vitest --run --project e2e",
|
|
84
|
+
"compile": "tsc"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
/**
|
|
3
|
-
* A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself.
|
|
4
|
-
*/
|
|
5
|
-
export type AdvisorNestedTool = {
|
|
6
|
-
parameters?: {
|
|
7
|
-
[k: string]: any;
|
|
8
|
-
} | undefined;
|
|
9
|
-
type: string;
|
|
10
|
-
additionalProperties?: {
|
|
11
|
-
[k: string]: any;
|
|
12
|
-
} | undefined;
|
|
13
|
-
};
|
|
14
|
-
/** @internal */
|
|
15
|
-
export type AdvisorNestedTool$Outbound = {
|
|
16
|
-
parameters?: {
|
|
17
|
-
[k: string]: any;
|
|
18
|
-
} | undefined;
|
|
19
|
-
type: string;
|
|
20
|
-
[additionalProperties: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
/** @internal */
|
|
23
|
-
export declare const AdvisorNestedTool$outboundSchema: z.ZodType<AdvisorNestedTool$Outbound, AdvisorNestedTool>;
|
|
24
|
-
export declare function advisorNestedToolToJSON(advisorNestedTool: AdvisorNestedTool): string;
|
|
25
|
-
//# sourceMappingURL=advisornestedtool.d.ts.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: 5dc7e04c01b7
|
|
4
|
-
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const AdvisorNestedTool$outboundSchema = z.object({
|
|
9
|
-
parameters: z.record(z.string(), z.any()).optional(),
|
|
10
|
-
type: z.string(),
|
|
11
|
-
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
12
|
-
}).transform((v) => {
|
|
13
|
-
return {
|
|
14
|
-
...v.additionalProperties,
|
|
15
|
-
...remap$(v, {
|
|
16
|
-
additionalProperties: null,
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
export function advisorNestedToolToJSON(advisorNestedTool) {
|
|
21
|
-
return JSON.stringify(AdvisorNestedTool$outboundSchema.parse(advisorNestedTool));
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=advisornestedtool.js.map
|