@openrouter/sdk 0.12.19 → 0.12.21
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/chatwebsearchshorthand.d.ts +1 -1
- package/esm/models/createworkspacerequest.d.ts +10 -0
- package/esm/models/createworkspacerequest.js +4 -0
- package/esm/models/generationresponse.d.ts +4 -0
- package/esm/models/generationresponse.js +2 -0
- package/esm/models/inputsunion.d.ts +18 -4
- package/esm/models/inputsunion.js +42 -0
- package/esm/models/outputapplypatchservertoolitem.d.ts +21 -1
- package/esm/models/outputapplypatchservertoolitem.js +20 -2
- package/esm/models/outputbashservertoolitem.d.ts +23 -1
- package/esm/models/outputbashservertoolitem.js +22 -2
- package/esm/models/outputbrowseruseservertoolitem.d.ts +21 -1
- package/esm/models/outputbrowseruseservertoolitem.js +20 -2
- package/esm/models/outputcodeinterpretercallitem.d.ts +43 -1
- package/esm/models/outputcodeinterpretercallitem.js +52 -2
- package/esm/models/outputcodeinterpreterservertoolitem.d.ts +24 -1
- package/esm/models/outputcodeinterpreterservertoolitem.js +23 -2
- package/esm/models/outputcomputercallitem.d.ts +33 -2
- package/esm/models/outputcomputercallitem.js +36 -1
- package/esm/models/outputfilesearchservertoolitem.d.ts +20 -1
- package/esm/models/outputfilesearchservertoolitem.js +19 -2
- package/esm/models/outputimagegenerationservertoolitem.d.ts +23 -1
- package/esm/models/outputimagegenerationservertoolitem.js +22 -2
- package/esm/models/outputitems.d.ts +31 -3
- package/esm/models/outputitems.js +19 -14
- package/esm/models/outputmcpservertoolitem.d.ts +21 -1
- package/esm/models/outputmcpservertoolitem.js +20 -2
- package/esm/models/outputmemoryservertoolitem.d.ts +24 -2
- package/esm/models/outputmemoryservertoolitem.js +23 -2
- package/esm/models/outputmodality.d.ts +1 -1
- package/esm/models/outputmodality.js +1 -1
- package/esm/models/outputsearchmodelsservertoolitem.d.ts +21 -1
- package/esm/models/outputsearchmodelsservertoolitem.js +20 -2
- package/esm/models/outputtexteditorservertoolitem.d.ts +23 -2
- package/esm/models/outputtexteditorservertoolitem.js +23 -2
- package/esm/models/outputtoolsearchservertoolitem.d.ts +20 -1
- package/esm/models/outputtoolsearchservertoolitem.js +19 -2
- package/esm/models/outputwebfetchservertoolitem.d.ts +22 -1
- package/esm/models/outputwebfetchservertoolitem.js +21 -2
- package/esm/models/providername.d.ts +2 -0
- package/esm/models/providername.js +2 -0
- package/esm/models/providerresponse.d.ts +2 -0
- package/esm/models/providerresponse.js +2 -0
- package/esm/models/searchqualitylevel.d.ts +2 -2
- package/esm/models/searchqualitylevel.js +1 -1
- package/esm/models/speechrequest.d.ts +12 -0
- package/esm/models/speechrequest.js +3 -0
- package/esm/models/updateworkspacerequest.d.ts +10 -0
- package/esm/models/updateworkspacerequest.js +4 -0
- package/esm/models/videogenerationrequest.d.ts +17 -0
- package/esm/models/videogenerationrequest.js +5 -0
- package/esm/models/websearchconfig.d.ts +1 -1
- package/esm/models/websearchplugin.d.ts +35 -0
- package/esm/models/websearchplugin.js +21 -0
- package/esm/models/websearchuserlocationservertool.d.ts +8 -8
- package/esm/models/websearchuserlocationservertool.js +4 -4
- package/esm/models/workspace.d.ts +8 -0
- package/esm/models/workspace.js +4 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
|
@@ -235,6 +235,9 @@ export type VideoGenerationRequestOptions = {
|
|
|
235
235
|
nebius?: {
|
|
236
236
|
[k: string]: any | null;
|
|
237
237
|
} | undefined;
|
|
238
|
+
nexAgi?: {
|
|
239
|
+
[k: string]: any | null;
|
|
240
|
+
} | undefined;
|
|
238
241
|
nextbit?: {
|
|
239
242
|
[k: string]: any | null;
|
|
240
243
|
} | undefined;
|
|
@@ -265,6 +268,9 @@ export type VideoGenerationRequestOptions = {
|
|
|
265
268
|
phala?: {
|
|
266
269
|
[k: string]: any | null;
|
|
267
270
|
} | undefined;
|
|
271
|
+
poolside?: {
|
|
272
|
+
[k: string]: any | null;
|
|
273
|
+
} | undefined;
|
|
268
274
|
recraft?: {
|
|
269
275
|
[k: string]: any | null;
|
|
270
276
|
} | undefined;
|
|
@@ -373,6 +379,10 @@ export type VideoGenerationRequest = {
|
|
|
373
379
|
* Aspect ratio of the generated video
|
|
374
380
|
*/
|
|
375
381
|
aspectRatio?: AspectRatio | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS.
|
|
384
|
+
*/
|
|
385
|
+
callbackUrl?: string | undefined;
|
|
376
386
|
/**
|
|
377
387
|
* Duration of the generated video in seconds
|
|
378
388
|
*/
|
|
@@ -625,6 +635,9 @@ export type VideoGenerationRequestOptions$Outbound = {
|
|
|
625
635
|
nebius?: {
|
|
626
636
|
[k: string]: any | null;
|
|
627
637
|
} | undefined;
|
|
638
|
+
"nex-agi"?: {
|
|
639
|
+
[k: string]: any | null;
|
|
640
|
+
} | undefined;
|
|
628
641
|
nextbit?: {
|
|
629
642
|
[k: string]: any | null;
|
|
630
643
|
} | undefined;
|
|
@@ -655,6 +668,9 @@ export type VideoGenerationRequestOptions$Outbound = {
|
|
|
655
668
|
phala?: {
|
|
656
669
|
[k: string]: any | null;
|
|
657
670
|
} | undefined;
|
|
671
|
+
poolside?: {
|
|
672
|
+
[k: string]: any | null;
|
|
673
|
+
} | undefined;
|
|
658
674
|
recraft?: {
|
|
659
675
|
[k: string]: any | null;
|
|
660
676
|
} | undefined;
|
|
@@ -749,6 +765,7 @@ export declare const Resolution$outboundSchema: z.ZodType<string, Resolution>;
|
|
|
749
765
|
/** @internal */
|
|
750
766
|
export type VideoGenerationRequest$Outbound = {
|
|
751
767
|
aspect_ratio?: string | undefined;
|
|
768
|
+
callback_url?: string | undefined;
|
|
752
769
|
duration?: number | undefined;
|
|
753
770
|
frame_images?: Array<FrameImage$Outbound> | undefined;
|
|
754
771
|
generate_audio?: boolean | undefined;
|
|
@@ -105,6 +105,7 @@ export const VideoGenerationRequestOptions$outboundSchema = z.object({
|
|
|
105
105
|
morph: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
106
106
|
ncompass: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
107
107
|
nebius: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
108
|
+
nexAgi: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
108
109
|
nextbit: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
109
110
|
nineteen: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
110
111
|
novita: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
@@ -115,6 +116,7 @@ export const VideoGenerationRequestOptions$outboundSchema = z.object({
|
|
|
115
116
|
parasail: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
116
117
|
perplexity: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
117
118
|
phala: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
119
|
+
poolside: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
118
120
|
recraft: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
119
121
|
recursal: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
120
122
|
reflection: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
@@ -158,6 +160,7 @@ export const VideoGenerationRequestOptions$outboundSchema = z.object({
|
|
|
158
160
|
ioNet: "io-net",
|
|
159
161
|
lynnPrivate: "lynn-private",
|
|
160
162
|
mancerOld: "mancer-old",
|
|
163
|
+
nexAgi: "nex-agi",
|
|
161
164
|
openInference: "open-inference",
|
|
162
165
|
sambanovaCloaked: "sambanova-cloaked",
|
|
163
166
|
sfCompute: "sf-compute",
|
|
@@ -181,6 +184,7 @@ export const Resolution$outboundSchema = openEnums.outboundSchema(Resolution);
|
|
|
181
184
|
/** @internal */
|
|
182
185
|
export const VideoGenerationRequest$outboundSchema = z.object({
|
|
183
186
|
aspectRatio: AspectRatio$outboundSchema.optional(),
|
|
187
|
+
callbackUrl: z.string().optional(),
|
|
184
188
|
duration: z.int().optional(),
|
|
185
189
|
frameImages: z.array(FrameImage$outboundSchema).optional(),
|
|
186
190
|
generateAudio: z.boolean().optional(),
|
|
@@ -195,6 +199,7 @@ export const VideoGenerationRequest$outboundSchema = z.object({
|
|
|
195
199
|
}).transform((v) => {
|
|
196
200
|
return remap$(v, {
|
|
197
201
|
aspectRatio: "aspect_ratio",
|
|
202
|
+
callbackUrl: "callback_url",
|
|
198
203
|
frameImages: "frame_images",
|
|
199
204
|
generateAudio: "generate_audio",
|
|
200
205
|
inputReferences: "input_references",
|
|
@@ -24,7 +24,7 @@ export type WebSearchConfig = {
|
|
|
24
24
|
*/
|
|
25
25
|
maxTotalResults?: number | undefined;
|
|
26
26
|
/**
|
|
27
|
-
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
27
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars). Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl.
|
|
28
28
|
*/
|
|
29
29
|
searchContextSize?: SearchQualityLevel | undefined;
|
|
30
30
|
/**
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
2
3
|
import { WebSearchEngine } from "./websearchengine.js";
|
|
4
|
+
export declare const WebSearchPluginType: {
|
|
5
|
+
readonly Approximate: "approximate";
|
|
6
|
+
};
|
|
7
|
+
export type WebSearchPluginType = ClosedEnum<typeof WebSearchPluginType>;
|
|
8
|
+
/**
|
|
9
|
+
* Approximate user location for location-biased search results. Passed through to native providers that support it (e.g. Anthropic).
|
|
10
|
+
*/
|
|
11
|
+
export type UserLocation = {
|
|
12
|
+
city?: string | null | undefined;
|
|
13
|
+
country?: string | null | undefined;
|
|
14
|
+
region?: string | null | undefined;
|
|
15
|
+
timezone?: string | null | undefined;
|
|
16
|
+
type: WebSearchPluginType;
|
|
17
|
+
};
|
|
3
18
|
export type WebSearchPlugin = {
|
|
4
19
|
/**
|
|
5
20
|
* Set to false to disable the web-search plugin for this request. Defaults to true.
|
|
@@ -19,9 +34,27 @@ export type WebSearchPlugin = {
|
|
|
19
34
|
*/
|
|
20
35
|
includeDomains?: Array<string> | undefined;
|
|
21
36
|
maxResults?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Maximum number of times the model can invoke web search in a single turn. Passed through to native providers that support it (e.g. Anthropic).
|
|
39
|
+
*/
|
|
40
|
+
maxUses?: number | undefined;
|
|
22
41
|
searchPrompt?: string | undefined;
|
|
42
|
+
userLocation?: UserLocation | null | undefined;
|
|
23
43
|
};
|
|
24
44
|
/** @internal */
|
|
45
|
+
export declare const WebSearchPluginType$outboundSchema: z.ZodEnum<typeof WebSearchPluginType>;
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type UserLocation$Outbound = {
|
|
48
|
+
city?: string | null | undefined;
|
|
49
|
+
country?: string | null | undefined;
|
|
50
|
+
region?: string | null | undefined;
|
|
51
|
+
timezone?: string | null | undefined;
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
/** @internal */
|
|
55
|
+
export declare const UserLocation$outboundSchema: z.ZodType<UserLocation$Outbound, UserLocation>;
|
|
56
|
+
export declare function userLocationToJSON(userLocation: UserLocation): string;
|
|
57
|
+
/** @internal */
|
|
25
58
|
export type WebSearchPlugin$Outbound = {
|
|
26
59
|
enabled?: boolean | undefined;
|
|
27
60
|
engine?: string | undefined;
|
|
@@ -29,7 +62,9 @@ export type WebSearchPlugin$Outbound = {
|
|
|
29
62
|
id: "web";
|
|
30
63
|
include_domains?: Array<string> | undefined;
|
|
31
64
|
max_results?: number | undefined;
|
|
65
|
+
max_uses?: number | undefined;
|
|
32
66
|
search_prompt?: string | undefined;
|
|
67
|
+
user_location?: UserLocation$Outbound | null | undefined;
|
|
33
68
|
};
|
|
34
69
|
/** @internal */
|
|
35
70
|
export declare const WebSearchPlugin$outboundSchema: z.ZodType<WebSearchPlugin$Outbound, WebSearchPlugin>;
|
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { WebSearchEngine$outboundSchema, } from "./websearchengine.js";
|
|
8
|
+
export const WebSearchPluginType = {
|
|
9
|
+
Approximate: "approximate",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const WebSearchPluginType$outboundSchema = z.enum(WebSearchPluginType);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const UserLocation$outboundSchema = z.object({
|
|
15
|
+
city: z.nullable(z.string()).optional(),
|
|
16
|
+
country: z.nullable(z.string()).optional(),
|
|
17
|
+
region: z.nullable(z.string()).optional(),
|
|
18
|
+
timezone: z.nullable(z.string()).optional(),
|
|
19
|
+
type: WebSearchPluginType$outboundSchema,
|
|
20
|
+
});
|
|
21
|
+
export function userLocationToJSON(userLocation) {
|
|
22
|
+
return JSON.stringify(UserLocation$outboundSchema.parse(userLocation));
|
|
23
|
+
}
|
|
8
24
|
/** @internal */
|
|
9
25
|
export const WebSearchPlugin$outboundSchema = z.object({
|
|
10
26
|
enabled: z.boolean().optional(),
|
|
@@ -13,13 +29,18 @@ export const WebSearchPlugin$outboundSchema = z.object({
|
|
|
13
29
|
id: z.literal("web"),
|
|
14
30
|
includeDomains: z.array(z.string()).optional(),
|
|
15
31
|
maxResults: z.int().optional(),
|
|
32
|
+
maxUses: z.int().optional(),
|
|
16
33
|
searchPrompt: z.string().optional(),
|
|
34
|
+
userLocation: z.nullable(z.lazy(() => UserLocation$outboundSchema))
|
|
35
|
+
.optional(),
|
|
17
36
|
}).transform((v) => {
|
|
18
37
|
return remap$(v, {
|
|
19
38
|
excludeDomains: "exclude_domains",
|
|
20
39
|
includeDomains: "include_domains",
|
|
21
40
|
maxResults: "max_results",
|
|
41
|
+
maxUses: "max_uses",
|
|
22
42
|
searchPrompt: "search_prompt",
|
|
43
|
+
userLocation: "user_location",
|
|
23
44
|
});
|
|
24
45
|
});
|
|
25
46
|
export function webSearchPluginToJSON(webSearchPlugin) {
|
|
@@ -8,20 +8,20 @@ export type WebSearchUserLocationServerToolType = ClosedEnum<typeof WebSearchUse
|
|
|
8
8
|
* Approximate user location for location-biased results.
|
|
9
9
|
*/
|
|
10
10
|
export type WebSearchUserLocationServerTool = {
|
|
11
|
-
city?: string | undefined;
|
|
12
|
-
country?: string | undefined;
|
|
13
|
-
region?: string | undefined;
|
|
14
|
-
timezone?: string | undefined;
|
|
11
|
+
city?: string | null | undefined;
|
|
12
|
+
country?: string | null | undefined;
|
|
13
|
+
region?: string | null | undefined;
|
|
14
|
+
timezone?: string | null | undefined;
|
|
15
15
|
type?: WebSearchUserLocationServerToolType | undefined;
|
|
16
16
|
};
|
|
17
17
|
/** @internal */
|
|
18
18
|
export declare const WebSearchUserLocationServerToolType$outboundSchema: z.ZodEnum<typeof WebSearchUserLocationServerToolType>;
|
|
19
19
|
/** @internal */
|
|
20
20
|
export type WebSearchUserLocationServerTool$Outbound = {
|
|
21
|
-
city?: string | undefined;
|
|
22
|
-
country?: string | undefined;
|
|
23
|
-
region?: string | undefined;
|
|
24
|
-
timezone?: string | undefined;
|
|
21
|
+
city?: string | null | undefined;
|
|
22
|
+
country?: string | null | undefined;
|
|
23
|
+
region?: string | null | undefined;
|
|
24
|
+
timezone?: string | null | undefined;
|
|
25
25
|
type?: string | undefined;
|
|
26
26
|
};
|
|
27
27
|
/** @internal */
|
|
@@ -10,10 +10,10 @@ export const WebSearchUserLocationServerToolType = {
|
|
|
10
10
|
export const WebSearchUserLocationServerToolType$outboundSchema = z.enum(WebSearchUserLocationServerToolType);
|
|
11
11
|
/** @internal */
|
|
12
12
|
export const WebSearchUserLocationServerTool$outboundSchema = z.object({
|
|
13
|
-
city: z.string().optional(),
|
|
14
|
-
country: z.string().optional(),
|
|
15
|
-
region: z.string().optional(),
|
|
16
|
-
timezone: z.string().optional(),
|
|
13
|
+
city: z.nullable(z.string()).optional(),
|
|
14
|
+
country: z.nullable(z.string()).optional(),
|
|
15
|
+
region: z.nullable(z.string()).optional(),
|
|
16
|
+
timezone: z.nullable(z.string()).optional(),
|
|
17
17
|
type: WebSearchUserLocationServerToolType$outboundSchema.optional(),
|
|
18
18
|
});
|
|
19
19
|
export function webSearchUserLocationServerToolToJSON(webSearchUserLocationServerTool) {
|
|
@@ -30,6 +30,14 @@ export type Workspace = {
|
|
|
30
30
|
* Unique identifier for the workspace
|
|
31
31
|
*/
|
|
32
32
|
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional array of API key IDs to filter I/O logging. Null means all keys are logged.
|
|
35
|
+
*/
|
|
36
|
+
ioLoggingApiKeyIds: Array<number> | null;
|
|
37
|
+
/**
|
|
38
|
+
* Sampling rate for I/O logging (0.0001-1). 1 means 100% of requests are logged.
|
|
39
|
+
*/
|
|
40
|
+
ioLoggingSamplingRate: number;
|
|
33
41
|
/**
|
|
34
42
|
* Whether data discount logging is enabled for this workspace
|
|
35
43
|
*/
|
package/esm/models/workspace.js
CHANGED
|
@@ -14,6 +14,8 @@ export const Workspace$inboundSchema = z.object({
|
|
|
14
14
|
default_text_model: z.nullable(z.string()),
|
|
15
15
|
description: z.nullable(z.string()),
|
|
16
16
|
id: z.string(),
|
|
17
|
+
io_logging_api_key_ids: z.nullable(z.array(z.int())),
|
|
18
|
+
io_logging_sampling_rate: z.number(),
|
|
17
19
|
is_data_discount_logging_enabled: z.boolean(),
|
|
18
20
|
is_observability_broadcast_enabled: z.boolean(),
|
|
19
21
|
is_observability_io_logging_enabled: z.boolean(),
|
|
@@ -27,6 +29,8 @@ export const Workspace$inboundSchema = z.object({
|
|
|
27
29
|
"default_image_model": "defaultImageModel",
|
|
28
30
|
"default_provider_sort": "defaultProviderSort",
|
|
29
31
|
"default_text_model": "defaultTextModel",
|
|
32
|
+
"io_logging_api_key_ids": "ioLoggingApiKeyIds",
|
|
33
|
+
"io_logging_sampling_rate": "ioLoggingSamplingRate",
|
|
30
34
|
"is_data_discount_logging_enabled": "isDataDiscountLoggingEnabled",
|
|
31
35
|
"is_observability_broadcast_enabled": "isObservabilityBroadcastEnabled",
|
|
32
36
|
"is_observability_io_logging_enabled": "isObservabilityIoLoggingEnabled",
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.21",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"prepublishOnly": "npm run build",
|
|
72
72
|
"compile": "tsc",
|
|
73
73
|
"postinstall": "node scripts/check-types.js || true",
|
|
74
|
+
"test:e2e": "vitest --run --project e2e",
|
|
75
|
+
"test:watch": "vitest --watch --project unit",
|
|
76
|
+
"typecheck": "tsc --noEmit",
|
|
74
77
|
"prepare": "npm run build",
|
|
75
78
|
"test": "vitest --run --project unit",
|
|
76
79
|
"test:transit": "exit 0",
|
|
77
|
-
"test:watch": "vitest --watch --project unit",
|
|
78
|
-
"typecheck": "tsc --noEmit",
|
|
79
|
-
"test:e2e": "vitest --run --project e2e",
|
|
80
80
|
"typecheck:transit": "exit 0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|