@openrouter/sdk 0.12.20 → 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/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/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 +1 -0
- package/esm/models/providername.js +1 -0
- package/esm/models/providerresponse.d.ts +1 -0
- package/esm/models/providerresponse.js +1 -0
- package/esm/models/speechrequest.d.ts +6 -0
- package/esm/models/speechrequest.js +1 -0
- package/esm/models/updateworkspacerequest.d.ts +10 -0
- package/esm/models/updateworkspacerequest.js +4 -0
- package/esm/models/videogenerationrequest.d.ts +11 -0
- package/esm/models/videogenerationrequest.js +3 -0
- 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 +6 -6
|
@@ -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": [
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
70
70
|
"build": "tsc",
|
|
71
71
|
"prepublishOnly": "npm run build",
|
|
72
|
-
"test:transit": "exit 0",
|
|
73
72
|
"compile": "tsc",
|
|
74
73
|
"postinstall": "node scripts/check-types.js || true",
|
|
75
|
-
"
|
|
76
|
-
"test": "vitest --run --project unit",
|
|
74
|
+
"test:e2e": "vitest --run --project e2e",
|
|
77
75
|
"test:watch": "vitest --watch --project unit",
|
|
78
76
|
"typecheck": "tsc --noEmit",
|
|
79
|
-
"
|
|
80
|
-
"test
|
|
77
|
+
"prepare": "npm run build",
|
|
78
|
+
"test": "vitest --run --project unit",
|
|
79
|
+
"test:transit": "exit 0",
|
|
80
|
+
"typecheck:transit": "exit 0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|