@openrouter/sdk 1.2.128 → 1.2.130
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 +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/getcurrentkey.d.ts +13 -0
- package/esm/models/operations/getcurrentkey.js +10 -0
- package/esm/models/outputbashservertoolitem.d.ts +7 -2
- package/esm/models/outputbashservertoolitem.js +5 -3
- package/esm/models/outputshellcalloutputitem.d.ts +5 -1
- package/esm/models/outputshellcalloutputitem.js +1 -0
- package/esm/models/outputshellservertoolitem.d.ts +7 -2
- package/esm/models/outputshellservertoolitem.js +5 -3
- package/esm/models/shellcalloutputitem.d.ts +5 -0
- package/esm/models/shellcalloutputitem.js +1 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.2.
|
|
53
|
+
readonly sdkVersion: "1.2.130";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.130 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.2.
|
|
32
|
+
sdkVersion: "1.2.130",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.130 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
2
3
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
4
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
5
|
import * as models from "../index.js";
|
|
@@ -44,6 +45,12 @@ export type GetCurrentKeyRequest = {
|
|
|
44
45
|
*/
|
|
45
46
|
appCategories?: string | undefined;
|
|
46
47
|
};
|
|
48
|
+
export declare const AllowedDataRegion: {
|
|
49
|
+
readonly Global: "global";
|
|
50
|
+
readonly Europe: "europe";
|
|
51
|
+
readonly Us: "us";
|
|
52
|
+
};
|
|
53
|
+
export type AllowedDataRegion = OpenEnum<typeof AllowedDataRegion>;
|
|
47
54
|
/**
|
|
48
55
|
* Legacy rate limit information about a key. Will always return -1.
|
|
49
56
|
*
|
|
@@ -67,6 +74,10 @@ export type RateLimit = {
|
|
|
67
74
|
* Current API key information
|
|
68
75
|
*/
|
|
69
76
|
export type GetCurrentKeyData = {
|
|
77
|
+
/**
|
|
78
|
+
* Data regions permitted for this API key by the guardrail policies on the key and the account regional-routing entitlement. Empty when no region is permitted. Reflects region policy only: other key restrictions, such as management keys being blocked from inference, still apply.
|
|
79
|
+
*/
|
|
80
|
+
allowedDataRegions: Array<AllowedDataRegion>;
|
|
70
81
|
/**
|
|
71
82
|
* Total external BYOK usage (in USD) for the API key
|
|
72
83
|
*/
|
|
@@ -171,6 +182,8 @@ export type GetCurrentKeyRequest$Outbound = {
|
|
|
171
182
|
export declare const GetCurrentKeyRequest$outboundSchema: z.ZodType<GetCurrentKeyRequest$Outbound, GetCurrentKeyRequest>;
|
|
172
183
|
export declare function getCurrentKeyRequestToJSON(getCurrentKeyRequest: GetCurrentKeyRequest): string;
|
|
173
184
|
/** @internal */
|
|
185
|
+
export declare const AllowedDataRegion$inboundSchema: z.ZodType<AllowedDataRegion, unknown>;
|
|
186
|
+
/** @internal */
|
|
174
187
|
export declare const RateLimit$inboundSchema: z.ZodType<RateLimit, unknown>;
|
|
175
188
|
export declare function rateLimitFromJSON(jsonString: string): SafeParseResult<RateLimit, SDKValidationError>;
|
|
176
189
|
/** @internal */
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
8
9
|
import * as models from "../index.js";
|
|
10
|
+
export const AllowedDataRegion = {
|
|
11
|
+
Global: "global",
|
|
12
|
+
Europe: "europe",
|
|
13
|
+
Us: "us",
|
|
14
|
+
};
|
|
9
15
|
/** @internal */
|
|
10
16
|
export const GetCurrentKeyRequest$outboundSchema = z.object({
|
|
11
17
|
httpReferer: z.string().optional(),
|
|
@@ -20,6 +26,8 @@ export function getCurrentKeyRequestToJSON(getCurrentKeyRequest) {
|
|
|
20
26
|
return JSON.stringify(GetCurrentKeyRequest$outboundSchema.parse(getCurrentKeyRequest));
|
|
21
27
|
}
|
|
22
28
|
/** @internal */
|
|
29
|
+
export const AllowedDataRegion$inboundSchema = openEnums.inboundSchema(AllowedDataRegion);
|
|
30
|
+
/** @internal */
|
|
23
31
|
export const RateLimit$inboundSchema = z.object({
|
|
24
32
|
interval: z.string(),
|
|
25
33
|
note: z.string(),
|
|
@@ -30,6 +38,7 @@ export function rateLimitFromJSON(jsonString) {
|
|
|
30
38
|
}
|
|
31
39
|
/** @internal */
|
|
32
40
|
export const GetCurrentKeyData$inboundSchema = z.object({
|
|
41
|
+
allowed_data_regions: z.array(AllowedDataRegion$inboundSchema),
|
|
33
42
|
byok_usage: z.number(),
|
|
34
43
|
byok_usage_daily: z.number(),
|
|
35
44
|
byok_usage_monthly: z.number(),
|
|
@@ -52,6 +61,7 @@ export const GetCurrentKeyData$inboundSchema = z.object({
|
|
|
52
61
|
usage_weekly: z.number(),
|
|
53
62
|
}).transform((v) => {
|
|
54
63
|
return remap$(v, {
|
|
64
|
+
"allowed_data_regions": "allowedDataRegions",
|
|
55
65
|
"byok_usage": "byokUsage",
|
|
56
66
|
"byok_usage_daily": "byokUsageDaily",
|
|
57
67
|
"byok_usage_monthly": "byokUsageMonthly",
|
|
@@ -2,7 +2,7 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
import {
|
|
5
|
+
import { FailableToolCallStatus } from "./failabletoolcallstatus.js";
|
|
6
6
|
export declare const OutputBashServerToolItemTypeContainerFileCitation: {
|
|
7
7
|
readonly ContainerFileCitation: "container_file_citation";
|
|
8
8
|
};
|
|
@@ -36,13 +36,17 @@ export type OutputBashServerToolItem = {
|
|
|
36
36
|
* The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed.
|
|
37
37
|
*/
|
|
38
38
|
containerId?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. A non-zero `exitCode` is a command failure, not a tool failure.
|
|
41
|
+
*/
|
|
42
|
+
error?: string | undefined;
|
|
39
43
|
exitCode?: number | undefined;
|
|
40
44
|
/**
|
|
41
45
|
* Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API.
|
|
42
46
|
*/
|
|
43
47
|
files?: Array<OutputBashServerToolItemFile> | undefined;
|
|
44
48
|
id?: string | undefined;
|
|
45
|
-
status:
|
|
49
|
+
status: FailableToolCallStatus;
|
|
46
50
|
stderr?: string | undefined;
|
|
47
51
|
stdout?: string | undefined;
|
|
48
52
|
type: OutputBashServerToolItemTypeOpenrouterBash;
|
|
@@ -78,6 +82,7 @@ export type OutputBashServerToolItem$Outbound = {
|
|
|
78
82
|
call_id?: string | null | undefined;
|
|
79
83
|
command?: string | undefined;
|
|
80
84
|
container_id?: string | undefined;
|
|
85
|
+
error?: string | undefined;
|
|
81
86
|
exitCode?: number | undefined;
|
|
82
87
|
files?: Array<OutputBashServerToolItemFile$Outbound> | undefined;
|
|
83
88
|
id?: string | undefined;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
-
import {
|
|
8
|
+
import { FailableToolCallStatus$inboundSchema, FailableToolCallStatus$outboundSchema, } from "./failabletoolcallstatus.js";
|
|
9
9
|
export const OutputBashServerToolItemTypeContainerFileCitation = {
|
|
10
10
|
ContainerFileCitation: "container_file_citation",
|
|
11
11
|
};
|
|
@@ -64,11 +64,12 @@ export const OutputBashServerToolItem$inboundSchema = z.object({
|
|
|
64
64
|
call_id: z.nullable(z.string()).optional(),
|
|
65
65
|
command: z.string().optional(),
|
|
66
66
|
container_id: z.string().optional(),
|
|
67
|
+
error: z.string().optional(),
|
|
67
68
|
exitCode: z.int().optional(),
|
|
68
69
|
files: z.array(z.lazy(() => OutputBashServerToolItemFile$inboundSchema))
|
|
69
70
|
.optional(),
|
|
70
71
|
id: z.string().optional(),
|
|
71
|
-
status:
|
|
72
|
+
status: FailableToolCallStatus$inboundSchema,
|
|
72
73
|
stderr: z.string().optional(),
|
|
73
74
|
stdout: z.string().optional(),
|
|
74
75
|
type: OutputBashServerToolItemTypeOpenrouterBash$inboundSchema,
|
|
@@ -84,11 +85,12 @@ export const OutputBashServerToolItem$outboundSchema = z.object({
|
|
|
84
85
|
callId: z.nullable(z.string()).optional(),
|
|
85
86
|
command: z.string().optional(),
|
|
86
87
|
containerId: z.string().optional(),
|
|
88
|
+
error: z.string().optional(),
|
|
87
89
|
exitCode: z.int().optional(),
|
|
88
90
|
files: z.array(z.lazy(() => OutputBashServerToolItemFile$outboundSchema))
|
|
89
91
|
.optional(),
|
|
90
92
|
id: z.string().optional(),
|
|
91
|
-
status:
|
|
93
|
+
status: FailableToolCallStatus$outboundSchema,
|
|
92
94
|
stderr: z.string().optional(),
|
|
93
95
|
stdout: z.string().optional(),
|
|
94
96
|
type: OutputBashServerToolItemTypeOpenrouterBash$outboundSchema,
|
|
@@ -17,7 +17,7 @@ export type OutputShellCallOutputItemFile = {
|
|
|
17
17
|
type: OutputShellCallOutputItemTypeContainerFileCitation;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* A native `shell_call_output` item matching OpenAI's Responses API shape. Carries per-command stdout, stderr, and the exit/timeout outcome.
|
|
20
|
+
* A native `shell_call_output` item matching OpenAI's Responses API shape. Carries per-command stdout, stderr, and the exit/timeout outcome. A sandbox failure terminates the item as `incomplete` with `error` set.
|
|
21
21
|
*/
|
|
22
22
|
export type OutputShellCallOutputItem = {
|
|
23
23
|
callId: string;
|
|
@@ -25,6 +25,10 @@ export type OutputShellCallOutputItem = {
|
|
|
25
25
|
* The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed.
|
|
26
26
|
*/
|
|
27
27
|
containerId?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'incomplete'` and an empty `output`; absent on a successful call.
|
|
30
|
+
*/
|
|
31
|
+
error?: string | undefined;
|
|
28
32
|
/**
|
|
29
33
|
* Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API.
|
|
30
34
|
*/
|
|
@@ -35,6 +35,7 @@ export function outputShellCallOutputItemFileFromJSON(jsonString) {
|
|
|
35
35
|
export const OutputShellCallOutputItem$inboundSchema = z.object({
|
|
36
36
|
call_id: z.string(),
|
|
37
37
|
container_id: z.string().optional(),
|
|
38
|
+
error: z.string().optional(),
|
|
38
39
|
files: z.array(z.lazy(() => OutputShellCallOutputItemFile$inboundSchema))
|
|
39
40
|
.optional(),
|
|
40
41
|
id: z.string(),
|
|
@@ -2,8 +2,8 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { FailableToolCallStatus } from "./failabletoolcallstatus.js";
|
|
5
6
|
import { ShellCallOutputContent, ShellCallOutputContent$Outbound } from "./shellcalloutputcontent.js";
|
|
6
|
-
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
7
7
|
export type OutputShellServerToolItemAction = {
|
|
8
8
|
commands: Array<string>;
|
|
9
9
|
maxOutputLength?: number | null | undefined;
|
|
@@ -42,13 +42,17 @@ export type OutputShellServerToolItem = {
|
|
|
42
42
|
* The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed.
|
|
43
43
|
*/
|
|
44
44
|
containerId?: string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. `output` is omitted when `error` is set.
|
|
47
|
+
*/
|
|
48
|
+
error?: string | undefined;
|
|
45
49
|
/**
|
|
46
50
|
* Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API.
|
|
47
51
|
*/
|
|
48
52
|
files?: Array<OutputShellServerToolItemFile> | undefined;
|
|
49
53
|
id?: string | undefined;
|
|
50
54
|
output?: Array<ShellCallOutputContent> | undefined;
|
|
51
|
-
status:
|
|
55
|
+
status: FailableToolCallStatus;
|
|
52
56
|
type: OutputShellServerToolItemTypeOpenrouterShell;
|
|
53
57
|
};
|
|
54
58
|
/** @internal */
|
|
@@ -94,6 +98,7 @@ export type OutputShellServerToolItem$Outbound = {
|
|
|
94
98
|
arguments?: string | null | undefined;
|
|
95
99
|
call_id?: string | null | undefined;
|
|
96
100
|
container_id?: string | undefined;
|
|
101
|
+
error?: string | undefined;
|
|
97
102
|
files?: Array<OutputShellServerToolItemFile$Outbound> | undefined;
|
|
98
103
|
id?: string | undefined;
|
|
99
104
|
output?: Array<ShellCallOutputContent$Outbound> | undefined;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { FailableToolCallStatus$inboundSchema, FailableToolCallStatus$outboundSchema, } from "./failabletoolcallstatus.js";
|
|
8
9
|
import { ShellCallOutputContent$inboundSchema, ShellCallOutputContent$outboundSchema, } from "./shellcalloutputcontent.js";
|
|
9
|
-
import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
|
|
10
10
|
export const OutputShellServerToolItemTypeContainerFileCitation = {
|
|
11
11
|
ContainerFileCitation: "container_file_citation",
|
|
12
12
|
};
|
|
@@ -94,11 +94,12 @@ export const OutputShellServerToolItem$inboundSchema = z.object({
|
|
|
94
94
|
arguments: z.nullable(z.string()).optional(),
|
|
95
95
|
call_id: z.nullable(z.string()).optional(),
|
|
96
96
|
container_id: z.string().optional(),
|
|
97
|
+
error: z.string().optional(),
|
|
97
98
|
files: z.array(z.lazy(() => OutputShellServerToolItemFile$inboundSchema))
|
|
98
99
|
.optional(),
|
|
99
100
|
id: z.string().optional(),
|
|
100
101
|
output: z.array(ShellCallOutputContent$inboundSchema).optional(),
|
|
101
|
-
status:
|
|
102
|
+
status: FailableToolCallStatus$inboundSchema,
|
|
102
103
|
type: OutputShellServerToolItemTypeOpenrouterShell$inboundSchema,
|
|
103
104
|
}).transform((v) => {
|
|
104
105
|
return remap$(v, {
|
|
@@ -113,11 +114,12 @@ export const OutputShellServerToolItem$outboundSchema = z.object({
|
|
|
113
114
|
arguments: z.nullable(z.string()).optional(),
|
|
114
115
|
callId: z.nullable(z.string()).optional(),
|
|
115
116
|
containerId: z.string().optional(),
|
|
117
|
+
error: z.string().optional(),
|
|
116
118
|
files: z.array(z.lazy(() => OutputShellServerToolItemFile$outboundSchema))
|
|
117
119
|
.optional(),
|
|
118
120
|
id: z.string().optional(),
|
|
119
121
|
output: z.array(ShellCallOutputContent$outboundSchema).optional(),
|
|
120
|
-
status:
|
|
122
|
+
status: FailableToolCallStatus$outboundSchema,
|
|
121
123
|
type: OutputShellServerToolItemTypeOpenrouterShell$outboundSchema,
|
|
122
124
|
}).transform((v) => {
|
|
123
125
|
return remap$(v, {
|
|
@@ -27,6 +27,10 @@ export type ShellCallOutputItem = {
|
|
|
27
27
|
* The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed.
|
|
28
28
|
*/
|
|
29
29
|
containerId?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The error message when the sandbox call failed before producing a result, as echoed from a failed `shell_call_output` emission.
|
|
32
|
+
*/
|
|
33
|
+
error?: string | undefined;
|
|
30
34
|
/**
|
|
31
35
|
* Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API.
|
|
32
36
|
*/
|
|
@@ -57,6 +61,7 @@ export declare const ShellCallOutputItemTypeShellCallOutput$outboundSchema: z.Zo
|
|
|
57
61
|
export type ShellCallOutputItem$Outbound = {
|
|
58
62
|
call_id: string;
|
|
59
63
|
container_id?: string | undefined;
|
|
64
|
+
error?: string | undefined;
|
|
60
65
|
files?: Array<ShellCallOutputItemFile$Outbound> | undefined;
|
|
61
66
|
id?: string | null | undefined;
|
|
62
67
|
max_output_length?: number | null | undefined;
|
|
@@ -39,6 +39,7 @@ export const ShellCallOutputItemTypeShellCallOutput$outboundSchema = z.enum(Shel
|
|
|
39
39
|
export const ShellCallOutputItem$outboundSchema = z.object({
|
|
40
40
|
callId: z.string(),
|
|
41
41
|
containerId: z.string().optional(),
|
|
42
|
+
error: z.string().optional(),
|
|
42
43
|
files: z.array(z.lazy(() => ShellCallOutputItemFile$outboundSchema))
|
|
43
44
|
.optional(),
|
|
44
45
|
id: z.nullable(z.string()).optional(),
|
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.130",
|
|
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",
|
|
76
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
77
78
|
"prepare": "npm run build",
|
|
78
|
-
"test:e2e": "vitest --run --project e2e",
|
|
79
79
|
"test:transit": "exit 0",
|
|
80
80
|
"test:watch": "vitest --watch --project unit",
|
|
81
81
|
"typecheck": "tsc --noEmit",
|
|
82
82
|
"typecheck:transit": "exit 0",
|
|
83
|
-
"
|
|
84
|
-
"test": "vitest --run --project
|
|
83
|
+
"test": "vitest --run --project unit",
|
|
84
|
+
"test:e2e": "vitest --run --project e2e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|