@openrouter/sdk 1.4.5 → 1.4.7
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/funcs/toolsGetTool.d.ts +18 -0
- package/esm/funcs/toolsGetTool.js +110 -0
- package/esm/funcs/toolsListTools.d.ts +19 -0
- package/esm/funcs/toolsListTools.js +107 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chatrequest.d.ts +4 -3
- package/esm/models/chatrequest.js +2 -1
- package/esm/models/generationresponse.d.ts +4 -4
- package/esm/models/generationresponse.js +3 -3
- package/esm/models/gettoolresponse.d.ts +11 -0
- package/esm/models/gettoolresponse.js +15 -0
- package/esm/models/index.d.ts +11 -0
- package/esm/models/index.js +11 -0
- package/esm/models/listtoolsresponse.d.ts +25 -0
- package/esm/models/listtoolsresponse.js +29 -0
- package/esm/models/modelslistresponse.d.ts +4 -4
- package/esm/models/modelslistresponse.js +4 -4
- package/esm/models/operations/gettool.d.ts +80 -0
- package/esm/models/operations/gettool.js +43 -0
- package/esm/models/operations/index.d.ts +2 -0
- package/esm/models/operations/index.js +2 -0
- package/esm/models/operations/listtools.d.ts +93 -0
- package/esm/models/operations/listtools.js +43 -0
- package/esm/models/providerresponse.d.ts +1 -0
- package/esm/models/providerresponse.js +1 -0
- package/esm/models/responsesrequest.d.ts +4 -3
- package/esm/models/responsesrequest.js +2 -1
- package/esm/models/servertool.d.ts +79 -0
- package/esm/models/servertool.js +59 -0
- package/esm/models/servertooldetails.d.ts +90 -0
- package/esm/models/servertooldetails.js +73 -0
- package/esm/models/servertoolengine.d.ts +82 -0
- package/esm/models/servertoolengine.js +63 -0
- package/esm/models/servertoolexecutedby.d.ts +17 -0
- package/esm/models/servertoolexecutedby.js +16 -0
- package/esm/models/servertoolinputname.d.ts +28 -0
- package/esm/models/servertoolinputname.js +31 -0
- package/esm/models/servertoolnativemodel.d.ts +11 -0
- package/esm/models/servertoolnativemodel.js +15 -0
- package/esm/models/servertoolnativesupport.d.ts +14 -0
- package/esm/models/servertoolnativesupport.js +21 -0
- package/esm/models/servertooloutputname.d.ts +27 -0
- package/esm/models/servertooloutputname.js +29 -0
- package/esm/models/servertoolprice.d.ts +19 -0
- package/esm/models/servertoolprice.js +22 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/tools.d.ts +20 -0
- package/esm/sdk/tools.js +29 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { ServerToolExecutedBy } from "./servertoolexecutedby.js";
|
|
6
|
+
import { ServerToolPrice } from "./servertoolprice.js";
|
|
7
|
+
/**
|
|
8
|
+
* Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`
|
|
9
|
+
*/
|
|
10
|
+
export declare const BYOK: {
|
|
11
|
+
readonly Required: "required";
|
|
12
|
+
readonly Optional: "optional";
|
|
13
|
+
readonly None: "none";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`
|
|
17
|
+
*/
|
|
18
|
+
export type BYOK = OpenEnum<typeof BYOK>;
|
|
19
|
+
export declare const ServerToolEngineDataRegion: {
|
|
20
|
+
readonly Global: "global";
|
|
21
|
+
readonly Europe: "europe";
|
|
22
|
+
readonly Us: "us";
|
|
23
|
+
};
|
|
24
|
+
export type ServerToolEngineDataRegion = OpenEnum<typeof ServerToolEngineDataRegion>;
|
|
25
|
+
/**
|
|
26
|
+
* Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)
|
|
27
|
+
*/
|
|
28
|
+
export declare const PricingSource: {
|
|
29
|
+
readonly Openrouter: "openrouter";
|
|
30
|
+
readonly Provider: "provider";
|
|
31
|
+
readonly BYOK: "byok";
|
|
32
|
+
readonly None: "none";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)
|
|
36
|
+
*/
|
|
37
|
+
export type PricingSource = OpenEnum<typeof PricingSource>;
|
|
38
|
+
export type ServerToolEngine = {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`
|
|
41
|
+
*/
|
|
42
|
+
byok: BYOK;
|
|
43
|
+
/**
|
|
44
|
+
* The data regions whose requests this engine serves without leaving the region. A request pinned to a region can only use engines that list it; `global` is always listed.
|
|
45
|
+
*/
|
|
46
|
+
dataRegions: Array<ServerToolEngineDataRegion>;
|
|
47
|
+
/**
|
|
48
|
+
* The `parameters.mode` a request without one runs and bills as; null for engines without modes. The `pricing[]` row with this `mode` is what an unmoded request bills
|
|
49
|
+
*/
|
|
50
|
+
defaultMode: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).
|
|
53
|
+
*/
|
|
54
|
+
executedBy: ServerToolExecutedBy;
|
|
55
|
+
/**
|
|
56
|
+
* The `parameters.engine` value that selects this engine; null for the single engine of a tool without an engine parameter
|
|
57
|
+
*/
|
|
58
|
+
id: string | null;
|
|
59
|
+
name: string;
|
|
60
|
+
/**
|
|
61
|
+
* The rows OpenRouter bills; non-empty exactly when `pricing_source` is `openrouter`
|
|
62
|
+
*/
|
|
63
|
+
pricing: Array<ServerToolPrice>;
|
|
64
|
+
/**
|
|
65
|
+
* Where the rates are documented when `pricing_source` is `provider` or `byok`; null otherwise
|
|
66
|
+
*/
|
|
67
|
+
pricingDocUrl: string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)
|
|
70
|
+
*/
|
|
71
|
+
pricingSource: PricingSource;
|
|
72
|
+
};
|
|
73
|
+
/** @internal */
|
|
74
|
+
export declare const BYOK$inboundSchema: z.ZodType<BYOK, unknown>;
|
|
75
|
+
/** @internal */
|
|
76
|
+
export declare const ServerToolEngineDataRegion$inboundSchema: z.ZodType<ServerToolEngineDataRegion, unknown>;
|
|
77
|
+
/** @internal */
|
|
78
|
+
export declare const PricingSource$inboundSchema: z.ZodType<PricingSource, unknown>;
|
|
79
|
+
/** @internal */
|
|
80
|
+
export declare const ServerToolEngine$inboundSchema: z.ZodType<ServerToolEngine, unknown>;
|
|
81
|
+
export declare function serverToolEngineFromJSON(jsonString: string): SafeParseResult<ServerToolEngine, SDKValidationError>;
|
|
82
|
+
//# sourceMappingURL=servertoolengine.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 0ee547bdca50
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
import { ServerToolExecutedBy$inboundSchema, } from "./servertoolexecutedby.js";
|
|
10
|
+
import { ServerToolPrice$inboundSchema, } from "./servertoolprice.js";
|
|
11
|
+
/**
|
|
12
|
+
* Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`
|
|
13
|
+
*/
|
|
14
|
+
export const BYOK = {
|
|
15
|
+
Required: "required",
|
|
16
|
+
Optional: "optional",
|
|
17
|
+
None: "none",
|
|
18
|
+
};
|
|
19
|
+
export const ServerToolEngineDataRegion = {
|
|
20
|
+
Global: "global",
|
|
21
|
+
Europe: "europe",
|
|
22
|
+
Us: "us",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)
|
|
26
|
+
*/
|
|
27
|
+
export const PricingSource = {
|
|
28
|
+
Openrouter: "openrouter",
|
|
29
|
+
Provider: "provider",
|
|
30
|
+
BYOK: "byok",
|
|
31
|
+
None: "none",
|
|
32
|
+
};
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const BYOK$inboundSchema = openEnums
|
|
35
|
+
.inboundSchema(BYOK);
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const ServerToolEngineDataRegion$inboundSchema = openEnums.inboundSchema(ServerToolEngineDataRegion);
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const PricingSource$inboundSchema = openEnums.inboundSchema(PricingSource);
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const ServerToolEngine$inboundSchema = z.object({
|
|
42
|
+
byok: BYOK$inboundSchema,
|
|
43
|
+
data_regions: z.array(ServerToolEngineDataRegion$inboundSchema),
|
|
44
|
+
default_mode: z.nullable(z.string()),
|
|
45
|
+
executed_by: ServerToolExecutedBy$inboundSchema,
|
|
46
|
+
id: z.nullable(z.string()),
|
|
47
|
+
name: z.string(),
|
|
48
|
+
pricing: z.array(ServerToolPrice$inboundSchema),
|
|
49
|
+
pricing_doc_url: z.nullable(z.string()),
|
|
50
|
+
pricing_source: PricingSource$inboundSchema,
|
|
51
|
+
}).transform((v) => {
|
|
52
|
+
return remap$(v, {
|
|
53
|
+
"data_regions": "dataRegions",
|
|
54
|
+
"default_mode": "defaultMode",
|
|
55
|
+
"executed_by": "executedBy",
|
|
56
|
+
"pricing_doc_url": "pricingDocUrl",
|
|
57
|
+
"pricing_source": "pricingSource",
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
export function serverToolEngineFromJSON(jsonString) {
|
|
61
|
+
return safeParse(jsonString, (x) => ServerToolEngine$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolEngine' from JSON`);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=servertoolengine.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ServerToolExecutedBy: {
|
|
7
|
+
readonly Provider: "provider";
|
|
8
|
+
readonly Openrouter: "openrouter";
|
|
9
|
+
readonly Client: "client";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).
|
|
13
|
+
*/
|
|
14
|
+
export type ServerToolExecutedBy = OpenEnum<typeof ServerToolExecutedBy>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const ServerToolExecutedBy$inboundSchema: z.ZodType<ServerToolExecutedBy, unknown>;
|
|
17
|
+
//# sourceMappingURL=servertoolexecutedby.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: cfa354bfe40d
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).
|
|
8
|
+
*/
|
|
9
|
+
export const ServerToolExecutedBy = {
|
|
10
|
+
Provider: "provider",
|
|
11
|
+
Openrouter: "openrouter",
|
|
12
|
+
Client: "client",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ServerToolExecutedBy$inboundSchema = openEnums.inboundSchema(ServerToolExecutedBy);
|
|
16
|
+
//# sourceMappingURL=servertoolexecutedby.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { ServerToolOutputName } from "./servertooloutputname.js";
|
|
6
|
+
export declare const ServerToolInputNameApiFormat: {
|
|
7
|
+
readonly Responses: "responses";
|
|
8
|
+
readonly ChatCompletions: "chat-completions";
|
|
9
|
+
readonly AnthropicMessages: "anthropic-messages";
|
|
10
|
+
};
|
|
11
|
+
export type ServerToolInputNameApiFormat = OpenEnum<typeof ServerToolInputNameApiFormat>;
|
|
12
|
+
export type ServerToolInputName = {
|
|
13
|
+
/**
|
|
14
|
+
* API formats that accept this spelling in `tools[].type`
|
|
15
|
+
*/
|
|
16
|
+
apiFormats: Array<ServerToolInputNameApiFormat>;
|
|
17
|
+
/**
|
|
18
|
+
* What the call surfaces as on each accepting API format when requested under this spelling; a format is absent when the call is not visible to the caller
|
|
19
|
+
*/
|
|
20
|
+
outputNames: Array<ServerToolOutputName>;
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare const ServerToolInputNameApiFormat$inboundSchema: z.ZodType<ServerToolInputNameApiFormat, unknown>;
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const ServerToolInputName$inboundSchema: z.ZodType<ServerToolInputName, unknown>;
|
|
27
|
+
export declare function serverToolInputNameFromJSON(jsonString: string): SafeParseResult<ServerToolInputName, SDKValidationError>;
|
|
28
|
+
//# sourceMappingURL=servertoolinputname.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: deeca5c74395
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
import { ServerToolOutputName$inboundSchema, } from "./servertooloutputname.js";
|
|
10
|
+
export const ServerToolInputNameApiFormat = {
|
|
11
|
+
Responses: "responses",
|
|
12
|
+
ChatCompletions: "chat-completions",
|
|
13
|
+
AnthropicMessages: "anthropic-messages",
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ServerToolInputNameApiFormat$inboundSchema = openEnums.inboundSchema(ServerToolInputNameApiFormat);
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const ServerToolInputName$inboundSchema = z.object({
|
|
19
|
+
api_formats: z.array(ServerToolInputNameApiFormat$inboundSchema),
|
|
20
|
+
output_names: z.array(ServerToolOutputName$inboundSchema),
|
|
21
|
+
type: z.string(),
|
|
22
|
+
}).transform((v) => {
|
|
23
|
+
return remap$(v, {
|
|
24
|
+
"api_formats": "apiFormats",
|
|
25
|
+
"output_names": "outputNames",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export function serverToolInputNameFromJSON(jsonString) {
|
|
29
|
+
return safeParse(jsonString, (x) => ServerToolInputName$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolInputName' from JSON`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=servertoolinputname.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type ServerToolNativeModel = {
|
|
5
|
+
providers: Array<string>;
|
|
6
|
+
slug: string;
|
|
7
|
+
};
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const ServerToolNativeModel$inboundSchema: z.ZodType<ServerToolNativeModel, unknown>;
|
|
10
|
+
export declare function serverToolNativeModelFromJSON(jsonString: string): SafeParseResult<ServerToolNativeModel, SDKValidationError>;
|
|
11
|
+
//# sourceMappingURL=servertoolnativemodel.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 80f9cb866c58
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ServerToolNativeModel$inboundSchema = z.object({
|
|
9
|
+
providers: z.array(z.string()),
|
|
10
|
+
slug: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export function serverToolNativeModelFromJSON(jsonString) {
|
|
13
|
+
return safeParse(jsonString, (x) => ServerToolNativeModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolNativeModel' from JSON`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=servertoolnativemodel.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.
|
|
6
|
+
*/
|
|
7
|
+
export type ServerToolNativeSupport = {
|
|
8
|
+
endpointCount: number;
|
|
9
|
+
modelCount: number;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const ServerToolNativeSupport$inboundSchema: z.ZodType<ServerToolNativeSupport, unknown>;
|
|
13
|
+
export declare function serverToolNativeSupportFromJSON(jsonString: string): SafeParseResult<ServerToolNativeSupport, SDKValidationError>;
|
|
14
|
+
//# sourceMappingURL=servertoolnativesupport.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 3a84d88babcc
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ServerToolNativeSupport$inboundSchema = z.object({
|
|
10
|
+
endpoint_count: z.int(),
|
|
11
|
+
model_count: z.int(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
"endpoint_count": "endpointCount",
|
|
15
|
+
"model_count": "modelCount",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export function serverToolNativeSupportFromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => ServerToolNativeSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolNativeSupport' from JSON`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=servertoolnativesupport.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const ServerToolOutputNameApiFormat: {
|
|
6
|
+
readonly Responses: "responses";
|
|
7
|
+
readonly ChatCompletions: "chat-completions";
|
|
8
|
+
readonly AnthropicMessages: "anthropic-messages";
|
|
9
|
+
};
|
|
10
|
+
export type ServerToolOutputNameApiFormat = OpenEnum<typeof ServerToolOutputNameApiFormat>;
|
|
11
|
+
export type ServerToolOutputName = {
|
|
12
|
+
apiFormat: ServerToolOutputNameApiFormat;
|
|
13
|
+
/**
|
|
14
|
+
* Anthropic Messages `server_tool_use` block `name`, when the call surfaces as one
|
|
15
|
+
*/
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Output item `type` on Responses, content block `type` on Anthropic Messages, `reasoning_details[].type` on Chat Completions
|
|
19
|
+
*/
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const ServerToolOutputNameApiFormat$inboundSchema: z.ZodType<ServerToolOutputNameApiFormat, unknown>;
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const ServerToolOutputName$inboundSchema: z.ZodType<ServerToolOutputName, unknown>;
|
|
26
|
+
export declare function serverToolOutputNameFromJSON(jsonString: string): SafeParseResult<ServerToolOutputName, SDKValidationError>;
|
|
27
|
+
//# sourceMappingURL=servertooloutputname.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 1dd915c55b83
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
export const ServerToolOutputNameApiFormat = {
|
|
10
|
+
Responses: "responses",
|
|
11
|
+
ChatCompletions: "chat-completions",
|
|
12
|
+
AnthropicMessages: "anthropic-messages",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ServerToolOutputNameApiFormat$inboundSchema = openEnums.inboundSchema(ServerToolOutputNameApiFormat);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ServerToolOutputName$inboundSchema = z.object({
|
|
18
|
+
api_format: ServerToolOutputNameApiFormat$inboundSchema,
|
|
19
|
+
name: z.string().optional(),
|
|
20
|
+
type: z.string(),
|
|
21
|
+
}).transform((v) => {
|
|
22
|
+
return remap$(v, {
|
|
23
|
+
"api_format": "apiFormat",
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export function serverToolOutputNameFromJSON(jsonString) {
|
|
27
|
+
return safeParse(jsonString, (x) => ServerToolOutputName$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolOutputName' from JSON`);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=servertooloutputname.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type ServerToolPrice = {
|
|
5
|
+
maxUnitsPerCall: number;
|
|
6
|
+
/**
|
|
7
|
+
* The `parameters.mode` this price applies to; null for prices that do not depend on the mode. A request bills exactly one `request` row
|
|
8
|
+
*/
|
|
9
|
+
mode: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* USD per unit, as a decimal string
|
|
12
|
+
*/
|
|
13
|
+
price: string;
|
|
14
|
+
unit: string;
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const ServerToolPrice$inboundSchema: z.ZodType<ServerToolPrice, unknown>;
|
|
18
|
+
export declare function serverToolPriceFromJSON(jsonString: string): SafeParseResult<ServerToolPrice, SDKValidationError>;
|
|
19
|
+
//# sourceMappingURL=servertoolprice.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d12fcc3fb6f8
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ServerToolPrice$inboundSchema = z.object({
|
|
10
|
+
max_units_per_call: z.int(),
|
|
11
|
+
mode: z.nullable(z.string()),
|
|
12
|
+
price: z.string(),
|
|
13
|
+
unit: z.string(),
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
"max_units_per_call": "maxUnitsPerCall",
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export function serverToolPriceFromJSON(jsonString) {
|
|
20
|
+
return safeParse(jsonString, (x) => ServerToolPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolPrice' from JSON`);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=servertoolprice.js.map
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { Responses } from "./responses.js";
|
|
|
30
30
|
import { Scim } from "./scim.js";
|
|
31
31
|
import { STT } from "./stt.js";
|
|
32
32
|
import { SystemOne } from "./systemone.js";
|
|
33
|
+
import { Tools } from "./tools.js";
|
|
33
34
|
import { TTS } from "./tts.js";
|
|
34
35
|
import { Vault } from "./vault.js";
|
|
35
36
|
import { VideoGeneration } from "./videogeneration.js";
|
|
@@ -105,6 +106,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
105
106
|
get scim(): Scim;
|
|
106
107
|
private _systemOne?;
|
|
107
108
|
get systemOne(): SystemOne;
|
|
109
|
+
private _tools?;
|
|
110
|
+
get tools(): Tools;
|
|
108
111
|
private _vault?;
|
|
109
112
|
get vault(): Vault;
|
|
110
113
|
private _videoGeneration?;
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -34,6 +34,7 @@ import { Responses } from "./responses.js";
|
|
|
34
34
|
import { Scim } from "./scim.js";
|
|
35
35
|
import { STT } from "./stt.js";
|
|
36
36
|
import { SystemOne } from "./systemone.js";
|
|
37
|
+
import { Tools } from "./tools.js";
|
|
37
38
|
import { TTS } from "./tts.js";
|
|
38
39
|
import { Vault } from "./vault.js";
|
|
39
40
|
import { VideoGeneration } from "./videogeneration.js";
|
|
@@ -139,6 +140,9 @@ export class OpenRouter extends ClientSDK {
|
|
|
139
140
|
get systemOne() {
|
|
140
141
|
return (this._systemOne ?? (this._systemOne = new SystemOne(this._options)));
|
|
141
142
|
}
|
|
143
|
+
get tools() {
|
|
144
|
+
return (this._tools ?? (this._tools = new Tools(this._options)));
|
|
145
|
+
}
|
|
142
146
|
get vault() {
|
|
143
147
|
return (this._vault ?? (this._vault = new Vault(this._options)));
|
|
144
148
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
3
|
+
import * as operations from "../models/operations/index.js";
|
|
4
|
+
export declare class Tools extends ClientSDK {
|
|
5
|
+
/**
|
|
6
|
+
* List server tools
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively.
|
|
10
|
+
*/
|
|
11
|
+
listTools(security: operations.ListToolsSecurity, request?: operations.ListToolsRequest | undefined, options?: RequestOptions): Promise<models.ListToolsResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Get a server tool
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* One server tool by canonical name or any accepted alias, with the models that run it natively.
|
|
17
|
+
*/
|
|
18
|
+
getTool(security: operations.GetToolSecurity, request: operations.GetToolRequest, options?: RequestOptions): Promise<operations.GetToolResponse | undefined>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=tools.d.ts.map
|
package/esm/sdk/tools.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f997ccdd9dd9
|
|
4
|
+
*/
|
|
5
|
+
import { toolsGetTool } from "../funcs/toolsGetTool.js";
|
|
6
|
+
import { toolsListTools } from "../funcs/toolsListTools.js";
|
|
7
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
export class Tools extends ClientSDK {
|
|
10
|
+
/**
|
|
11
|
+
* List server tools
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively.
|
|
15
|
+
*/
|
|
16
|
+
async listTools(security, request, options) {
|
|
17
|
+
return unwrapAsync(toolsListTools(this, security, request, options));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a server tool
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* One server tool by canonical name or any accepted alias, with the models that run it natively.
|
|
24
|
+
*/
|
|
25
|
+
async getTool(security, request, options) {
|
|
26
|
+
return unwrapAsync(toolsGetTool(this, security, request, options));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=tools.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
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": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"packageManager": "pnpm@10.22.0",
|
|
23
23
|
"publishConfig": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "./esm/index.js",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
77
76
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
77
|
"prepare": "npm run build",
|
|
79
78
|
"test": "vitest --run --project unit",
|
|
80
|
-
"test:transit": "exit 0",
|
|
81
|
-
"test:watch": "vitest --watch --project unit",
|
|
82
79
|
"test:e2e": "vitest --run --project e2e",
|
|
80
|
+
"test:transit": "exit 0",
|
|
83
81
|
"typecheck": "tsc --noEmit",
|
|
84
|
-
"typecheck:transit": "exit 0"
|
|
82
|
+
"typecheck:transit": "exit 0",
|
|
83
|
+
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
84
|
+
"test:watch": "vitest --watch --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|