@openrouter/sdk 1.2.1 → 1.2.3
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/chatrequest.d.ts +4 -3
- package/esm/models/chatrequest.js +2 -1
- package/esm/models/inputsunion.d.ts +5 -5
- package/esm/models/inputsunion.js +3 -3
- package/esm/models/responseserrorfield.d.ts +1 -0
- package/esm/models/responseserrorfield.js +1 -0
- package/esm/models/responsesrequest.d.ts +10 -0
- package/esm/models/responsesrequest.js +4 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.2.
|
|
52
|
+
readonly sdkVersion: "1.2.3";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.3 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.2.
|
|
29
|
+
sdkVersion: "1.2.3",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.2.3 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -82,17 +82,18 @@ export type ChatRequestReasoningEffort = OpenEnum<typeof ChatRequestReasoningEff
|
|
|
82
82
|
*/
|
|
83
83
|
export type ResponseFormat = ChatFormatGrammarConfig | ChatFormatJsonObjectConfig | ChatFormatJsonSchemaConfig | ChatFormatPythonConfig | ChatFormatTextConfig;
|
|
84
84
|
/**
|
|
85
|
-
* The service tier to use for processing this request.
|
|
85
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
86
86
|
*/
|
|
87
87
|
export declare const ChatRequestServiceTier: {
|
|
88
88
|
readonly Auto: "auto";
|
|
89
89
|
readonly Default: "default";
|
|
90
|
+
readonly Fast: "fast";
|
|
90
91
|
readonly Flex: "flex";
|
|
91
92
|
readonly Priority: "priority";
|
|
92
93
|
readonly Scale: "scale";
|
|
93
94
|
};
|
|
94
95
|
/**
|
|
95
|
-
* The service tier to use for processing this request.
|
|
96
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
96
97
|
*/
|
|
97
98
|
export type ChatRequestServiceTier = OpenEnum<typeof ChatRequestServiceTier>;
|
|
98
99
|
/**
|
|
@@ -211,7 +212,7 @@ export type ChatRequest = {
|
|
|
211
212
|
*/
|
|
212
213
|
seed?: number | null | undefined;
|
|
213
214
|
/**
|
|
214
|
-
* The service tier to use for processing this request.
|
|
215
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
215
216
|
*/
|
|
216
217
|
serviceTier?: ChatRequestServiceTier | null | undefined;
|
|
217
218
|
/**
|
|
@@ -63,11 +63,12 @@ export const ChatRequestReasoningEffort = {
|
|
|
63
63
|
None: "none",
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
* The service tier to use for processing this request.
|
|
66
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
67
67
|
*/
|
|
68
68
|
export const ChatRequestServiceTier = {
|
|
69
69
|
Auto: "auto",
|
|
70
70
|
Default: "default",
|
|
71
|
+
Fast: "fast",
|
|
71
72
|
Flex: "flex",
|
|
72
73
|
Priority: "priority",
|
|
73
74
|
Scale: "scale",
|
|
@@ -132,13 +132,13 @@ export type InputsMessage = {
|
|
|
132
132
|
phase?: InputsPhaseCommentary | InputsPhaseFinalAnswer | null | undefined;
|
|
133
133
|
role: InputsRole;
|
|
134
134
|
status?: InputsStatusCompleted1 | InputsStatusIncomplete1 | InputsStatusInProgress1 | undefined;
|
|
135
|
-
type
|
|
135
|
+
type?: InputsTypeMessage | undefined;
|
|
136
136
|
};
|
|
137
|
-
export type InputsUnion1 = OutputCodeInterpreterCallItem | FunctionCallItem | LocalShellCallItem | McpApprovalRequestItem | McpCallItem | ApplyPatchCallItem |
|
|
137
|
+
export type InputsUnion1 = OutputCodeInterpreterCallItem | FunctionCallItem | LocalShellCallItem | McpApprovalRequestItem | McpCallItem | ApplyPatchCallItem | OutputFunctionCallItem | OutputCustomToolCallItem | OutputFileSearchCallItem | OutputComputerCallItem | OutputDatetimeItem | McpListToolsItem | CustomToolCallItem | AgentMessageItem | ReasoningItem | FunctionCallOutputItem | ApplyPatchCallOutputItem | InputsMessage | InputsReasoning | OutputWebSearchCallItem | OutputImageGenerationCallItem | LocalShellCallOutputItem | ShellCallItem | ShellCallOutputItem | McpApprovalResponseItem | CustomToolCallOutputItem | AdditionalToolsItem | OutputWebSearchServerToolItem | OutputCodeInterpreterServerToolItem | OutputFileSearchServerToolItem | OutputImageGenerationServerToolItem | OutputBrowserUseServerToolItem | OutputBashServerToolItem | OutputTextEditorServerToolItem | OutputApplyPatchServerToolItem | OutputWebFetchServerToolItem | OutputToolSearchServerToolItem | OutputMemoryServerToolItem | OutputMcpServerToolItem | OutputSearchModelsServerToolItem | OutputFusionServerToolItem | OutputAdvisorServerToolItem | OutputSubagentServerToolItem | OutputFilesServerToolItem | CompactionItem | ItemReferenceItem | EasyInputMessage | InputMessageItem | ContextCompactionItem;
|
|
138
138
|
/**
|
|
139
139
|
* Input for a response request - can be a string or array of items
|
|
140
140
|
*/
|
|
141
|
-
export type InputsUnion = string | Array<OutputCodeInterpreterCallItem | FunctionCallItem | LocalShellCallItem | McpApprovalRequestItem | McpCallItem | ApplyPatchCallItem |
|
|
141
|
+
export type InputsUnion = string | Array<OutputCodeInterpreterCallItem | FunctionCallItem | LocalShellCallItem | McpApprovalRequestItem | McpCallItem | ApplyPatchCallItem | OutputFunctionCallItem | OutputCustomToolCallItem | OutputFileSearchCallItem | OutputComputerCallItem | OutputDatetimeItem | McpListToolsItem | CustomToolCallItem | AgentMessageItem | ReasoningItem | FunctionCallOutputItem | ApplyPatchCallOutputItem | InputsMessage | InputsReasoning | OutputWebSearchCallItem | OutputImageGenerationCallItem | LocalShellCallOutputItem | ShellCallItem | ShellCallOutputItem | McpApprovalResponseItem | CustomToolCallOutputItem | AdditionalToolsItem | OutputWebSearchServerToolItem | OutputCodeInterpreterServerToolItem | OutputFileSearchServerToolItem | OutputImageGenerationServerToolItem | OutputBrowserUseServerToolItem | OutputBashServerToolItem | OutputTextEditorServerToolItem | OutputApplyPatchServerToolItem | OutputWebFetchServerToolItem | OutputToolSearchServerToolItem | OutputMemoryServerToolItem | OutputMcpServerToolItem | OutputSearchModelsServerToolItem | OutputFusionServerToolItem | OutputAdvisorServerToolItem | OutputSubagentServerToolItem | OutputFilesServerToolItem | CompactionItem | ItemReferenceItem | EasyInputMessage | InputMessageItem | ContextCompactionItem>;
|
|
142
142
|
/** @internal */
|
|
143
143
|
export declare const InputsStatusInProgress2$outboundSchema: z.ZodEnum<typeof InputsStatusInProgress2>;
|
|
144
144
|
/** @internal */
|
|
@@ -213,12 +213,12 @@ export type InputsMessage$Outbound = {
|
|
|
213
213
|
export declare const InputsMessage$outboundSchema: z.ZodType<InputsMessage$Outbound, InputsMessage>;
|
|
214
214
|
export declare function inputsMessageToJSON(inputsMessage: InputsMessage): string;
|
|
215
215
|
/** @internal */
|
|
216
|
-
export type InputsUnion1$Outbound = OutputCodeInterpreterCallItem$Outbound | FunctionCallItem$Outbound | LocalShellCallItem$Outbound | McpApprovalRequestItem$Outbound | McpCallItem$Outbound | ApplyPatchCallItem$Outbound |
|
|
216
|
+
export type InputsUnion1$Outbound = OutputCodeInterpreterCallItem$Outbound | FunctionCallItem$Outbound | LocalShellCallItem$Outbound | McpApprovalRequestItem$Outbound | McpCallItem$Outbound | ApplyPatchCallItem$Outbound | OutputFunctionCallItem$Outbound | OutputCustomToolCallItem$Outbound | OutputFileSearchCallItem$Outbound | OutputComputerCallItem$Outbound | OutputDatetimeItem$Outbound | McpListToolsItem$Outbound | CustomToolCallItem$Outbound | AgentMessageItem$Outbound | ReasoningItem$Outbound | FunctionCallOutputItem$Outbound | ApplyPatchCallOutputItem$Outbound | InputsMessage$Outbound | InputsReasoning$Outbound | OutputWebSearchCallItem$Outbound | OutputImageGenerationCallItem$Outbound | LocalShellCallOutputItem$Outbound | ShellCallItem$Outbound | ShellCallOutputItem$Outbound | McpApprovalResponseItem$Outbound | CustomToolCallOutputItem$Outbound | AdditionalToolsItem$Outbound | OutputWebSearchServerToolItem$Outbound | OutputCodeInterpreterServerToolItem$Outbound | OutputFileSearchServerToolItem$Outbound | OutputImageGenerationServerToolItem$Outbound | OutputBrowserUseServerToolItem$Outbound | OutputBashServerToolItem$Outbound | OutputTextEditorServerToolItem$Outbound | OutputApplyPatchServerToolItem$Outbound | OutputWebFetchServerToolItem$Outbound | OutputToolSearchServerToolItem$Outbound | OutputMemoryServerToolItem$Outbound | OutputMcpServerToolItem$Outbound | OutputSearchModelsServerToolItem$Outbound | OutputFusionServerToolItem$Outbound | OutputAdvisorServerToolItem$Outbound | OutputSubagentServerToolItem$Outbound | OutputFilesServerToolItem$Outbound | CompactionItem$Outbound | ItemReferenceItem$Outbound | EasyInputMessage$Outbound | InputMessageItem$Outbound | ContextCompactionItem$Outbound;
|
|
217
217
|
/** @internal */
|
|
218
218
|
export declare const InputsUnion1$outboundSchema: z.ZodType<InputsUnion1$Outbound, InputsUnion1>;
|
|
219
219
|
export declare function inputsUnion1ToJSON(inputsUnion1: InputsUnion1): string;
|
|
220
220
|
/** @internal */
|
|
221
|
-
export type InputsUnion$Outbound = string | Array<OutputCodeInterpreterCallItem$Outbound | FunctionCallItem$Outbound | LocalShellCallItem$Outbound | McpApprovalRequestItem$Outbound | McpCallItem$Outbound | ApplyPatchCallItem$Outbound |
|
|
221
|
+
export type InputsUnion$Outbound = string | Array<OutputCodeInterpreterCallItem$Outbound | FunctionCallItem$Outbound | LocalShellCallItem$Outbound | McpApprovalRequestItem$Outbound | McpCallItem$Outbound | ApplyPatchCallItem$Outbound | OutputFunctionCallItem$Outbound | OutputCustomToolCallItem$Outbound | OutputFileSearchCallItem$Outbound | OutputComputerCallItem$Outbound | OutputDatetimeItem$Outbound | McpListToolsItem$Outbound | CustomToolCallItem$Outbound | AgentMessageItem$Outbound | ReasoningItem$Outbound | FunctionCallOutputItem$Outbound | ApplyPatchCallOutputItem$Outbound | InputsMessage$Outbound | InputsReasoning$Outbound | OutputWebSearchCallItem$Outbound | OutputImageGenerationCallItem$Outbound | LocalShellCallOutputItem$Outbound | ShellCallItem$Outbound | ShellCallOutputItem$Outbound | McpApprovalResponseItem$Outbound | CustomToolCallOutputItem$Outbound | AdditionalToolsItem$Outbound | OutputWebSearchServerToolItem$Outbound | OutputCodeInterpreterServerToolItem$Outbound | OutputFileSearchServerToolItem$Outbound | OutputImageGenerationServerToolItem$Outbound | OutputBrowserUseServerToolItem$Outbound | OutputBashServerToolItem$Outbound | OutputTextEditorServerToolItem$Outbound | OutputApplyPatchServerToolItem$Outbound | OutputWebFetchServerToolItem$Outbound | OutputToolSearchServerToolItem$Outbound | OutputMemoryServerToolItem$Outbound | OutputMcpServerToolItem$Outbound | OutputSearchModelsServerToolItem$Outbound | OutputFusionServerToolItem$Outbound | OutputAdvisorServerToolItem$Outbound | OutputSubagentServerToolItem$Outbound | OutputFilesServerToolItem$Outbound | CompactionItem$Outbound | ItemReferenceItem$Outbound | EasyInputMessage$Outbound | InputMessageItem$Outbound | ContextCompactionItem$Outbound>;
|
|
222
222
|
/** @internal */
|
|
223
223
|
export declare const InputsUnion$outboundSchema: z.ZodType<InputsUnion$Outbound, InputsUnion>;
|
|
224
224
|
export declare function inputsUnionToJSON(inputsUnion: InputsUnion): string;
|
|
@@ -198,7 +198,7 @@ export const InputsMessage$outboundSchema = z.object({
|
|
|
198
198
|
InputsStatusIncomplete1$outboundSchema,
|
|
199
199
|
InputsStatusInProgress1$outboundSchema,
|
|
200
200
|
]).optional(),
|
|
201
|
-
type: InputsTypeMessage$outboundSchema,
|
|
201
|
+
type: InputsTypeMessage$outboundSchema.default("message"),
|
|
202
202
|
});
|
|
203
203
|
export function inputsMessageToJSON(inputsMessage) {
|
|
204
204
|
return JSON.stringify(InputsMessage$outboundSchema.parse(inputsMessage));
|
|
@@ -211,7 +211,6 @@ export const InputsUnion1$outboundSchema = z.union([
|
|
|
211
211
|
McpApprovalRequestItem$outboundSchema,
|
|
212
212
|
McpCallItem$outboundSchema,
|
|
213
213
|
ApplyPatchCallItem$outboundSchema,
|
|
214
|
-
z.lazy(() => InputsMessage$outboundSchema),
|
|
215
214
|
OutputFunctionCallItem$outboundSchema,
|
|
216
215
|
OutputCustomToolCallItem$outboundSchema,
|
|
217
216
|
OutputFileSearchCallItem$outboundSchema,
|
|
@@ -223,6 +222,7 @@ export const InputsUnion1$outboundSchema = z.union([
|
|
|
223
222
|
ReasoningItem$outboundSchema,
|
|
224
223
|
FunctionCallOutputItem$outboundSchema,
|
|
225
224
|
ApplyPatchCallOutputItem$outboundSchema,
|
|
225
|
+
z.lazy(() => InputsMessage$outboundSchema),
|
|
226
226
|
z.lazy(() => InputsReasoning$outboundSchema),
|
|
227
227
|
OutputWebSearchCallItem$outboundSchema,
|
|
228
228
|
OutputImageGenerationCallItem$outboundSchema,
|
|
@@ -268,7 +268,6 @@ export const InputsUnion$outboundSchema = z.union([
|
|
|
268
268
|
McpApprovalRequestItem$outboundSchema,
|
|
269
269
|
McpCallItem$outboundSchema,
|
|
270
270
|
ApplyPatchCallItem$outboundSchema,
|
|
271
|
-
z.lazy(() => InputsMessage$outboundSchema),
|
|
272
271
|
OutputFunctionCallItem$outboundSchema,
|
|
273
272
|
OutputCustomToolCallItem$outboundSchema,
|
|
274
273
|
OutputFileSearchCallItem$outboundSchema,
|
|
@@ -280,6 +279,7 @@ export const InputsUnion$outboundSchema = z.union([
|
|
|
280
279
|
ReasoningItem$outboundSchema,
|
|
281
280
|
FunctionCallOutputItem$outboundSchema,
|
|
282
281
|
ApplyPatchCallOutputItem$outboundSchema,
|
|
282
|
+
z.lazy(() => InputsMessage$outboundSchema),
|
|
283
283
|
z.lazy(() => InputsReasoning$outboundSchema),
|
|
284
284
|
OutputWebSearchCallItem$outboundSchema,
|
|
285
285
|
OutputImageGenerationCallItem$outboundSchema,
|
|
@@ -22,6 +22,7 @@ export declare const Code: {
|
|
|
22
22
|
readonly FailedToDownloadImage: "failed_to_download_image";
|
|
23
23
|
readonly ImageFileNotFound: "image_file_not_found";
|
|
24
24
|
readonly BioPolicy: "bio_policy";
|
|
25
|
+
readonly DataResidencyMismatch: "data_residency_mismatch";
|
|
25
26
|
};
|
|
26
27
|
export type Code = OpenEnum<typeof Code>;
|
|
27
28
|
/**
|
|
@@ -25,6 +25,7 @@ export const Code = {
|
|
|
25
25
|
FailedToDownloadImage: "failed_to_download_image",
|
|
26
26
|
ImageFileNotFound: "image_file_not_found",
|
|
27
27
|
BioPolicy: "bio_policy",
|
|
28
|
+
DataResidencyMismatch: "data_residency_mismatch",
|
|
28
29
|
};
|
|
29
30
|
/** @internal */
|
|
30
31
|
export const Code$inboundSchema = openEnums
|
|
@@ -69,13 +69,20 @@ export type ReasoningConfig = {
|
|
|
69
69
|
enabled?: boolean | null | undefined;
|
|
70
70
|
maxTokens?: number | null | undefined;
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
74
|
+
*/
|
|
72
75
|
export declare const ResponsesRequestServiceTier: {
|
|
73
76
|
readonly Auto: "auto";
|
|
74
77
|
readonly Default: "default";
|
|
78
|
+
readonly Fast: "fast";
|
|
75
79
|
readonly Flex: "flex";
|
|
76
80
|
readonly Priority: "priority";
|
|
77
81
|
readonly Scale: "scale";
|
|
78
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
85
|
+
*/
|
|
79
86
|
export type ResponsesRequestServiceTier = OpenEnum<typeof ResponsesRequestServiceTier>;
|
|
80
87
|
/**
|
|
81
88
|
* Function tool definition
|
|
@@ -213,6 +220,9 @@ export type ResponsesRequest = {
|
|
|
213
220
|
* Recommended per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.
|
|
214
221
|
*/
|
|
215
222
|
safetyIdentifier?: string | null | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
225
|
+
*/
|
|
216
226
|
serviceTier?: ResponsesRequestServiceTier | null | undefined;
|
|
217
227
|
/**
|
|
218
228
|
* A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
|
|
@@ -59,9 +59,13 @@ import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
|
|
|
59
59
|
import { WebSearchPlugin$outboundSchema, } from "./websearchplugin.js";
|
|
60
60
|
import { WebSearchServerTool$outboundSchema, } from "./websearchservertool.js";
|
|
61
61
|
import { WebSearchServerToolOpenRouter$outboundSchema, } from "./websearchservertoolopenrouter.js";
|
|
62
|
+
/**
|
|
63
|
+
* The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
|
|
64
|
+
*/
|
|
62
65
|
export const ResponsesRequestServiceTier = {
|
|
63
66
|
Auto: "auto",
|
|
64
67
|
Default: "default",
|
|
68
|
+
Fast: "fast",
|
|
65
69
|
Flex: "flex",
|
|
66
70
|
Priority: "priority",
|
|
67
71
|
Scale: "scale",
|
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.3",
|
|
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": [
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"compile": "tsc",
|
|
77
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
-
"prepare": "npm run build",
|
|
79
77
|
"test": "vitest --run --project unit",
|
|
80
78
|
"test:transit": "exit 0",
|
|
81
|
-
"test:watch": "vitest --watch --project unit",
|
|
82
79
|
"typecheck:transit": "exit 0",
|
|
80
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
81
|
+
"prepare": "npm run build",
|
|
83
82
|
"test:e2e": "vitest --run --project e2e",
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
84
|
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|