@openrouter/sdk 0.12.3 → 0.12.5
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/chatfunctiontool.d.ts +3 -2
- package/esm/models/chatfunctiontool.js +2 -0
- package/esm/models/chatrequest.d.ts +19 -24
- package/esm/models/chatrequest.js +10 -14
- package/esm/models/chatusage.d.ts +4 -4
- package/esm/models/chatusage.js +4 -4
- package/esm/models/createguardrailrequest.d.ts +2 -2
- package/esm/models/createguardrailrequest.js +1 -1
- package/esm/models/guardrail.d.ts +1 -1
- package/esm/models/guardrail.js +1 -1
- package/esm/models/imageconfig.d.ts +8 -0
- package/esm/models/imageconfig.js +11 -0
- package/esm/models/imagegenerationservertoolconfig.d.ts +23 -0
- package/esm/models/imagegenerationservertoolconfig.js +23 -0
- package/esm/models/imagegenerationservertoolconfigunion.d.ts +8 -0
- package/esm/models/imagegenerationservertoolconfigunion.js +11 -0
- package/esm/models/imagegenerationservertoolopenrouter.d.ts +28 -0
- package/esm/models/imagegenerationservertoolopenrouter.js +20 -0
- package/esm/models/index.d.ts +4 -0
- package/esm/models/index.js +4 -0
- package/esm/models/model.d.ts +1 -1
- package/esm/models/model.js +1 -1
- package/esm/models/openresponsesresult.d.ts +5 -5
- package/esm/models/openresponsesresult.js +5 -5
- package/esm/models/operations/createkeys.d.ts +4 -4
- package/esm/models/operations/createkeys.js +3 -3
- package/esm/models/operations/getcurrentkey.d.ts +2 -2
- package/esm/models/operations/getcurrentkey.js +2 -2
- package/esm/models/operations/getgeneration.d.ts +17 -17
- package/esm/models/operations/getgeneration.js +17 -17
- package/esm/models/operations/getkey.d.ts +2 -2
- package/esm/models/operations/getkey.js +2 -2
- package/esm/models/operations/list.d.ts +4 -4
- package/esm/models/operations/list.js +3 -3
- package/esm/models/operations/listguardrailkeyassignments.d.ts +2 -2
- package/esm/models/operations/listguardrailkeyassignments.js +1 -1
- package/esm/models/operations/listguardrailmemberassignments.d.ts +2 -2
- package/esm/models/operations/listguardrailmemberassignments.js +1 -1
- package/esm/models/operations/listguardrails.d.ts +2 -2
- package/esm/models/operations/listguardrails.js +1 -1
- package/esm/models/operations/listkeyassignments.d.ts +2 -2
- package/esm/models/operations/listkeyassignments.js +1 -1
- package/esm/models/operations/listmemberassignments.d.ts +2 -2
- package/esm/models/operations/listmemberassignments.js +1 -1
- package/esm/models/operations/listorganizationmembers.d.ts +2 -2
- package/esm/models/operations/listorganizationmembers.js +1 -1
- package/esm/models/operations/updatekeys.d.ts +4 -4
- package/esm/models/operations/updatekeys.js +3 -3
- package/esm/models/percentilelatencycutoffs.d.ts +8 -8
- package/esm/models/percentilelatencycutoffs.js +4 -4
- package/esm/models/percentilethroughputcutoffs.d.ts +8 -8
- package/esm/models/percentilethroughputcutoffs.js +4 -4
- package/esm/models/publicendpoint.d.ts +5 -5
- package/esm/models/publicendpoint.js +5 -5
- package/esm/models/reasoningconfig.d.ts +2 -2
- package/esm/models/reasoningconfig.js +1 -1
- package/esm/models/responsesrequest.d.ts +27 -23
- package/esm/models/responsesrequest.js +12 -14
- package/esm/models/updateguardrailrequest.d.ts +2 -2
- package/esm/models/updateguardrailrequest.js +1 -1
- package/esm/models/usage.d.ts +2 -2
- package/esm/models/usage.js +2 -2
- package/esm/models/videogenerationusage.d.ts +1 -1
- package/esm/models/videogenerationusage.js +1 -1
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -6,26 +6,26 @@ export type PercentileThroughputCutoffs = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Minimum p50 throughput (tokens/sec)
|
|
8
8
|
*/
|
|
9
|
-
p50?: number | undefined;
|
|
9
|
+
p50?: number | null | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* Minimum p75 throughput (tokens/sec)
|
|
12
12
|
*/
|
|
13
|
-
p75?: number | undefined;
|
|
13
|
+
p75?: number | null | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Minimum p90 throughput (tokens/sec)
|
|
16
16
|
*/
|
|
17
|
-
p90?: number | undefined;
|
|
17
|
+
p90?: number | null | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* Minimum p99 throughput (tokens/sec)
|
|
20
20
|
*/
|
|
21
|
-
p99?: number | undefined;
|
|
21
|
+
p99?: number | null | undefined;
|
|
22
22
|
};
|
|
23
23
|
/** @internal */
|
|
24
24
|
export type PercentileThroughputCutoffs$Outbound = {
|
|
25
|
-
p50?: number | undefined;
|
|
26
|
-
p75?: number | undefined;
|
|
27
|
-
p90?: number | undefined;
|
|
28
|
-
p99?: number | undefined;
|
|
25
|
+
p50?: number | null | undefined;
|
|
26
|
+
p75?: number | null | undefined;
|
|
27
|
+
p90?: number | null | undefined;
|
|
28
|
+
p99?: number | null | undefined;
|
|
29
29
|
};
|
|
30
30
|
/** @internal */
|
|
31
31
|
export declare const PercentileThroughputCutoffs$outboundSchema: z.ZodType<PercentileThroughputCutoffs$Outbound, PercentileThroughputCutoffs>;
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const PercentileThroughputCutoffs$outboundSchema = z.object({
|
|
8
|
-
p50: z.number().optional(),
|
|
9
|
-
p75: z.number().optional(),
|
|
10
|
-
p90: z.number().optional(),
|
|
11
|
-
p99: z.number().optional(),
|
|
8
|
+
p50: z.nullable(z.number()).optional(),
|
|
9
|
+
p75: z.nullable(z.number()).optional(),
|
|
10
|
+
p90: z.nullable(z.number()).optional(),
|
|
11
|
+
p99: z.nullable(z.number()).optional(),
|
|
12
12
|
});
|
|
13
13
|
export function percentileThroughputCutoffsToJSON(percentileThroughputCutoffs) {
|
|
14
14
|
return JSON.stringify(PercentileThroughputCutoffs$outboundSchema.parse(percentileThroughputCutoffs));
|
|
@@ -43,8 +43,8 @@ export type PublicEndpoint = {
|
|
|
43
43
|
* Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
|
|
44
44
|
*/
|
|
45
45
|
latencyLast30m: PercentileStats | null;
|
|
46
|
-
maxCompletionTokens: number;
|
|
47
|
-
maxPromptTokens: number;
|
|
46
|
+
maxCompletionTokens: number | null;
|
|
47
|
+
maxPromptTokens: number | null;
|
|
48
48
|
/**
|
|
49
49
|
* The unique identifier for the model (permaslug)
|
|
50
50
|
*/
|
|
@@ -62,12 +62,12 @@ export type PublicEndpoint = {
|
|
|
62
62
|
/**
|
|
63
63
|
* Uptime percentage over the last 1 day, calculated as successful requests / (successful + error requests) * 100. Rate-limited requests are excluded. Returns null if insufficient data.
|
|
64
64
|
*/
|
|
65
|
-
uptimeLast1d: number;
|
|
66
|
-
uptimeLast30m: number;
|
|
65
|
+
uptimeLast1d: number | null;
|
|
66
|
+
uptimeLast30m: number | null;
|
|
67
67
|
/**
|
|
68
68
|
* Uptime percentage over the last 5 minutes, calculated as successful requests / (successful + error requests) * 100. Rate-limited requests are excluded. Returns null if insufficient data.
|
|
69
69
|
*/
|
|
70
|
-
uptimeLast5m: number;
|
|
70
|
+
uptimeLast5m: number | null;
|
|
71
71
|
};
|
|
72
72
|
/** @internal */
|
|
73
73
|
export declare const Pricing$inboundSchema: z.ZodType<Pricing, unknown>;
|
|
@@ -58,8 +58,8 @@ export const PublicEndpointQuantization$inboundSchema = openEnums.inboundSchema(
|
|
|
58
58
|
export const PublicEndpoint$inboundSchema = z.object({
|
|
59
59
|
context_length: z.int(),
|
|
60
60
|
latency_last_30m: z.nullable(PercentileStats$inboundSchema),
|
|
61
|
-
max_completion_tokens: z.int(),
|
|
62
|
-
max_prompt_tokens: z.int(),
|
|
61
|
+
max_completion_tokens: z.nullable(z.int()),
|
|
62
|
+
max_prompt_tokens: z.nullable(z.int()),
|
|
63
63
|
model_id: z.string(),
|
|
64
64
|
model_name: z.string(),
|
|
65
65
|
name: z.string(),
|
|
@@ -71,9 +71,9 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
71
71
|
supports_implicit_caching: z.boolean(),
|
|
72
72
|
tag: z.string(),
|
|
73
73
|
throughput_last_30m: z.nullable(PercentileStats$inboundSchema),
|
|
74
|
-
uptime_last_1d: z.number(),
|
|
75
|
-
uptime_last_30m: z.number(),
|
|
76
|
-
uptime_last_5m: z.number(),
|
|
74
|
+
uptime_last_1d: z.nullable(z.number()),
|
|
75
|
+
uptime_last_30m: z.nullable(z.number()),
|
|
76
|
+
uptime_last_5m: z.nullable(z.number()),
|
|
77
77
|
}).transform((v) => {
|
|
78
78
|
return remap$(v, {
|
|
79
79
|
"context_length": "contextLength",
|
|
@@ -8,14 +8,14 @@ export type ReasoningConfig = {
|
|
|
8
8
|
effort?: ReasoningEffort | null | undefined;
|
|
9
9
|
summary?: ReasoningSummaryVerbosity | null | undefined;
|
|
10
10
|
enabled?: boolean | null | undefined;
|
|
11
|
-
maxTokens?: number | undefined;
|
|
11
|
+
maxTokens?: number | null | undefined;
|
|
12
12
|
};
|
|
13
13
|
/** @internal */
|
|
14
14
|
export type ReasoningConfig$Outbound = {
|
|
15
15
|
effort?: string | null | undefined;
|
|
16
16
|
summary?: string | null | undefined;
|
|
17
17
|
enabled?: boolean | null | undefined;
|
|
18
|
-
max_tokens?: number | undefined;
|
|
18
|
+
max_tokens?: number | null | undefined;
|
|
19
19
|
};
|
|
20
20
|
/** @internal */
|
|
21
21
|
export declare const ReasoningConfig$outboundSchema: z.ZodType<ReasoningConfig$Outbound, ReasoningConfig>;
|
|
@@ -11,7 +11,7 @@ export const ReasoningConfig$outboundSchema = z.object({
|
|
|
11
11
|
effort: z.nullable(ReasoningEffort$outboundSchema).optional(),
|
|
12
12
|
summary: z.nullable(ReasoningSummaryVerbosity$outboundSchema).optional(),
|
|
13
13
|
enabled: z.nullable(z.boolean()).optional(),
|
|
14
|
-
maxTokens: z.int().optional(),
|
|
14
|
+
maxTokens: z.nullable(z.int()).optional(),
|
|
15
15
|
}).transform((v) => {
|
|
16
16
|
return remap$(v, {
|
|
17
17
|
maxTokens: "max_tokens",
|
|
@@ -11,7 +11,9 @@ import { CustomTool, CustomTool$Outbound } from "./customtool.js";
|
|
|
11
11
|
import { DatetimeServerTool, DatetimeServerTool$Outbound } from "./datetimeservertool.js";
|
|
12
12
|
import { FileParserPlugin, FileParserPlugin$Outbound } from "./fileparserplugin.js";
|
|
13
13
|
import { FileSearchServerTool, FileSearchServerTool$Outbound } from "./filesearchservertool.js";
|
|
14
|
+
import { ImageConfig, ImageConfig$Outbound } from "./imageconfig.js";
|
|
14
15
|
import { ImageGenerationServerTool, ImageGenerationServerTool$Outbound } from "./imagegenerationservertool.js";
|
|
16
|
+
import { ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter$Outbound } from "./imagegenerationservertoolopenrouter.js";
|
|
15
17
|
import { InputsUnion, InputsUnion$Outbound } from "./inputsunion.js";
|
|
16
18
|
import { LegacyWebSearchServerTool, LegacyWebSearchServerTool$Outbound } from "./legacywebsearchservertool.js";
|
|
17
19
|
import { McpServerTool, McpServerTool$Outbound } from "./mcpservertool.js";
|
|
@@ -32,7 +34,6 @@ import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
|
32
34
|
import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
|
|
33
35
|
import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
|
|
34
36
|
import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
|
|
35
|
-
export type ResponsesRequestImageConfig = string | number;
|
|
36
37
|
export type ResponsesRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | ModerationPlugin | ResponseHealingPlugin | WebSearchPlugin;
|
|
37
38
|
export declare const ResponsesRequestServiceTier: {
|
|
38
39
|
readonly Auto: "auto";
|
|
@@ -56,6 +57,8 @@ export type ResponsesRequestToolFunction = {
|
|
|
56
57
|
};
|
|
57
58
|
export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
58
59
|
type: "openrouter:datetime";
|
|
60
|
+
}) | (ImageGenerationServerToolOpenRouter & {
|
|
61
|
+
type: "openrouter:image_generation";
|
|
59
62
|
}) | (ChatSearchModelsServerTool & {
|
|
60
63
|
type: "openrouter:experimental__search_models";
|
|
61
64
|
}) | WebSearchServerToolOpenRouter;
|
|
@@ -64,12 +67,12 @@ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWe
|
|
|
64
67
|
*/
|
|
65
68
|
export type ResponsesRequest = {
|
|
66
69
|
background?: boolean | null | undefined;
|
|
67
|
-
frequencyPenalty?: number | undefined;
|
|
70
|
+
frequencyPenalty?: number | null | undefined;
|
|
68
71
|
/**
|
|
69
|
-
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/
|
|
72
|
+
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
|
|
70
73
|
*/
|
|
71
74
|
imageConfig?: {
|
|
72
|
-
[k: string]:
|
|
75
|
+
[k: string]: ImageConfig;
|
|
73
76
|
} | undefined;
|
|
74
77
|
include?: Array<ResponseIncludesEnum> | null | undefined;
|
|
75
78
|
/**
|
|
@@ -77,8 +80,8 @@ export type ResponsesRequest = {
|
|
|
77
80
|
*/
|
|
78
81
|
input?: InputsUnion | undefined;
|
|
79
82
|
instructions?: string | null | undefined;
|
|
80
|
-
maxOutputTokens?: number | undefined;
|
|
81
|
-
maxToolCalls?: number | undefined;
|
|
83
|
+
maxOutputTokens?: number | null | undefined;
|
|
84
|
+
maxToolCalls?: number | null | undefined;
|
|
82
85
|
/**
|
|
83
86
|
* Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
|
|
84
87
|
*/
|
|
@@ -96,7 +99,7 @@ export type ResponsesRequest = {
|
|
|
96
99
|
* Plugins you want to enable for this request, including their settings.
|
|
97
100
|
*/
|
|
98
101
|
plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | ModerationPlugin | ResponseHealingPlugin | WebSearchPlugin> | undefined;
|
|
99
|
-
presencePenalty?: number | undefined;
|
|
102
|
+
presencePenalty?: number | null | undefined;
|
|
100
103
|
previousResponseId?: string | null | undefined;
|
|
101
104
|
prompt?: StoredPromptTemplate | null | undefined;
|
|
102
105
|
promptCacheKey?: string | null | undefined;
|
|
@@ -116,7 +119,7 @@ export type ResponsesRequest = {
|
|
|
116
119
|
sessionId?: string | undefined;
|
|
117
120
|
store?: false | undefined;
|
|
118
121
|
stream?: boolean | undefined;
|
|
119
|
-
temperature?: number | undefined;
|
|
122
|
+
temperature?: number | null | undefined;
|
|
120
123
|
/**
|
|
121
124
|
* Text output configuration including format and verbosity
|
|
122
125
|
*/
|
|
@@ -124,12 +127,14 @@ export type ResponsesRequest = {
|
|
|
124
127
|
toolChoice?: OpenAIResponsesToolChoiceUnion | undefined;
|
|
125
128
|
tools?: Array<ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
126
129
|
type: "openrouter:datetime";
|
|
130
|
+
}) | (ImageGenerationServerToolOpenRouter & {
|
|
131
|
+
type: "openrouter:image_generation";
|
|
127
132
|
}) | (ChatSearchModelsServerTool & {
|
|
128
133
|
type: "openrouter:experimental__search_models";
|
|
129
134
|
}) | WebSearchServerToolOpenRouter> | undefined;
|
|
130
135
|
topK?: number | undefined;
|
|
131
|
-
topLogprobs?: number | undefined;
|
|
132
|
-
topP?: number | undefined;
|
|
136
|
+
topLogprobs?: number | null | undefined;
|
|
137
|
+
topP?: number | null | undefined;
|
|
133
138
|
/**
|
|
134
139
|
* Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
|
135
140
|
*/
|
|
@@ -141,11 +146,6 @@ export type ResponsesRequest = {
|
|
|
141
146
|
user?: string | undefined;
|
|
142
147
|
};
|
|
143
148
|
/** @internal */
|
|
144
|
-
export type ResponsesRequestImageConfig$Outbound = string | number;
|
|
145
|
-
/** @internal */
|
|
146
|
-
export declare const ResponsesRequestImageConfig$outboundSchema: z.ZodType<ResponsesRequestImageConfig$Outbound, ResponsesRequestImageConfig>;
|
|
147
|
-
export declare function responsesRequestImageConfigToJSON(responsesRequestImageConfig: ResponsesRequestImageConfig): string;
|
|
148
|
-
/** @internal */
|
|
149
149
|
export type ResponsesRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound;
|
|
150
150
|
/** @internal */
|
|
151
151
|
export declare const ResponsesRequestPlugin$outboundSchema: z.ZodType<ResponsesRequestPlugin$Outbound, ResponsesRequestPlugin>;
|
|
@@ -168,6 +168,8 @@ export declare function responsesRequestToolFunctionToJSON(responsesRequestToolF
|
|
|
168
168
|
/** @internal */
|
|
169
169
|
export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (DatetimeServerTool$Outbound & {
|
|
170
170
|
type: "openrouter:datetime";
|
|
171
|
+
}) | (ImageGenerationServerToolOpenRouter$Outbound & {
|
|
172
|
+
type: "openrouter:image_generation";
|
|
171
173
|
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
172
174
|
type: "openrouter:experimental__search_models";
|
|
173
175
|
}) | WebSearchServerToolOpenRouter$Outbound;
|
|
@@ -177,15 +179,15 @@ export declare function responsesRequestToolUnionToJSON(responsesRequestToolUnio
|
|
|
177
179
|
/** @internal */
|
|
178
180
|
export type ResponsesRequest$Outbound = {
|
|
179
181
|
background?: boolean | null | undefined;
|
|
180
|
-
frequency_penalty?: number | undefined;
|
|
182
|
+
frequency_penalty?: number | null | undefined;
|
|
181
183
|
image_config?: {
|
|
182
|
-
[k: string]:
|
|
184
|
+
[k: string]: ImageConfig$Outbound;
|
|
183
185
|
} | undefined;
|
|
184
186
|
include?: Array<string> | null | undefined;
|
|
185
187
|
input?: InputsUnion$Outbound | undefined;
|
|
186
188
|
instructions?: string | null | undefined;
|
|
187
|
-
max_output_tokens?: number | undefined;
|
|
188
|
-
max_tool_calls?: number | undefined;
|
|
189
|
+
max_output_tokens?: number | null | undefined;
|
|
190
|
+
max_tool_calls?: number | null | undefined;
|
|
189
191
|
metadata?: {
|
|
190
192
|
[k: string]: string;
|
|
191
193
|
} | null | undefined;
|
|
@@ -194,7 +196,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
194
196
|
models?: Array<string> | undefined;
|
|
195
197
|
parallel_tool_calls?: boolean | null | undefined;
|
|
196
198
|
plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound> | undefined;
|
|
197
|
-
presence_penalty?: number | undefined;
|
|
199
|
+
presence_penalty?: number | null | undefined;
|
|
198
200
|
previous_response_id?: string | null | undefined;
|
|
199
201
|
prompt?: StoredPromptTemplate$Outbound | null | undefined;
|
|
200
202
|
prompt_cache_key?: string | null | undefined;
|
|
@@ -205,17 +207,19 @@ export type ResponsesRequest$Outbound = {
|
|
|
205
207
|
session_id?: string | undefined;
|
|
206
208
|
store: false;
|
|
207
209
|
stream: boolean;
|
|
208
|
-
temperature?: number | undefined;
|
|
210
|
+
temperature?: number | null | undefined;
|
|
209
211
|
text?: TextExtendedConfig$Outbound | undefined;
|
|
210
212
|
tool_choice?: OpenAIResponsesToolChoiceUnion$Outbound | undefined;
|
|
211
213
|
tools?: Array<ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (DatetimeServerTool$Outbound & {
|
|
212
214
|
type: "openrouter:datetime";
|
|
215
|
+
}) | (ImageGenerationServerToolOpenRouter$Outbound & {
|
|
216
|
+
type: "openrouter:image_generation";
|
|
213
217
|
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
214
218
|
type: "openrouter:experimental__search_models";
|
|
215
219
|
}) | WebSearchServerToolOpenRouter$Outbound> | undefined;
|
|
216
220
|
top_k?: number | undefined;
|
|
217
|
-
top_logprobs?: number | undefined;
|
|
218
|
-
top_p?: number | undefined;
|
|
221
|
+
top_logprobs?: number | null | undefined;
|
|
222
|
+
top_p?: number | null | undefined;
|
|
219
223
|
trace?: TraceConfig$Outbound | undefined;
|
|
220
224
|
truncation?: string | null | undefined;
|
|
221
225
|
user?: string | undefined;
|
|
@@ -16,7 +16,9 @@ import { CustomTool$outboundSchema, } from "./customtool.js";
|
|
|
16
16
|
import { DatetimeServerTool$outboundSchema, } from "./datetimeservertool.js";
|
|
17
17
|
import { FileParserPlugin$outboundSchema, } from "./fileparserplugin.js";
|
|
18
18
|
import { FileSearchServerTool$outboundSchema, } from "./filesearchservertool.js";
|
|
19
|
+
import { ImageConfig$outboundSchema, } from "./imageconfig.js";
|
|
19
20
|
import { ImageGenerationServerTool$outboundSchema, } from "./imagegenerationservertool.js";
|
|
21
|
+
import { ImageGenerationServerToolOpenRouter$outboundSchema, } from "./imagegenerationservertoolopenrouter.js";
|
|
20
22
|
import { InputsUnion$outboundSchema, } from "./inputsunion.js";
|
|
21
23
|
import { LegacyWebSearchServerTool$outboundSchema, } from "./legacywebsearchservertool.js";
|
|
22
24
|
import { McpServerTool$outboundSchema, } from "./mcpservertool.js";
|
|
@@ -45,11 +47,6 @@ export const ResponsesRequestServiceTier = {
|
|
|
45
47
|
Scale: "scale",
|
|
46
48
|
};
|
|
47
49
|
/** @internal */
|
|
48
|
-
export const ResponsesRequestImageConfig$outboundSchema = z.union([z.string(), z.number()]);
|
|
49
|
-
export function responsesRequestImageConfigToJSON(responsesRequestImageConfig) {
|
|
50
|
-
return JSON.stringify(ResponsesRequestImageConfig$outboundSchema.parse(responsesRequestImageConfig));
|
|
51
|
-
}
|
|
52
|
-
/** @internal */
|
|
53
50
|
export const ResponsesRequestPlugin$outboundSchema = z.union([
|
|
54
51
|
AutoRouterPlugin$outboundSchema,
|
|
55
52
|
ContextCompressionPlugin$outboundSchema,
|
|
@@ -91,6 +88,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
|
|
|
91
88
|
ApplyPatchServerTool$outboundSchema,
|
|
92
89
|
CustomTool$outboundSchema,
|
|
93
90
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
91
|
+
ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
|
|
94
92
|
ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
|
|
95
93
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
96
94
|
]);
|
|
@@ -100,14 +98,13 @@ export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
|
|
|
100
98
|
/** @internal */
|
|
101
99
|
export const ResponsesRequest$outboundSchema = z.object({
|
|
102
100
|
background: z.nullable(z.boolean()).optional(),
|
|
103
|
-
frequencyPenalty: z.number().optional(),
|
|
104
|
-
imageConfig: z.record(z.string(),
|
|
105
|
-
.optional(),
|
|
101
|
+
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
102
|
+
imageConfig: z.record(z.string(), ImageConfig$outboundSchema).optional(),
|
|
106
103
|
include: z.nullable(z.array(ResponseIncludesEnum$outboundSchema)).optional(),
|
|
107
104
|
input: InputsUnion$outboundSchema.optional(),
|
|
108
105
|
instructions: z.nullable(z.string()).optional(),
|
|
109
|
-
maxOutputTokens: z.int().optional(),
|
|
110
|
-
maxToolCalls: z.int().optional(),
|
|
106
|
+
maxOutputTokens: z.nullable(z.int()).optional(),
|
|
107
|
+
maxToolCalls: z.nullable(z.int()).optional(),
|
|
111
108
|
metadata: z.nullable(z.record(z.string(), z.string())).optional(),
|
|
112
109
|
modalities: z.array(OutputModalityEnum$outboundSchema).optional(),
|
|
113
110
|
model: z.string().optional(),
|
|
@@ -121,7 +118,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
121
118
|
ResponseHealingPlugin$outboundSchema,
|
|
122
119
|
WebSearchPlugin$outboundSchema,
|
|
123
120
|
])).optional(),
|
|
124
|
-
presencePenalty: z.number().optional(),
|
|
121
|
+
presencePenalty: z.nullable(z.number()).optional(),
|
|
125
122
|
previousResponseId: z.nullable(z.string()).optional(),
|
|
126
123
|
prompt: z.nullable(StoredPromptTemplate$outboundSchema).optional(),
|
|
127
124
|
promptCacheKey: z.nullable(z.string()).optional(),
|
|
@@ -132,7 +129,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
132
129
|
sessionId: z.string().optional(),
|
|
133
130
|
store: z.literal(false).default(false),
|
|
134
131
|
stream: z.boolean().default(false),
|
|
135
|
-
temperature: z.number().optional(),
|
|
132
|
+
temperature: z.nullable(z.number()).optional(),
|
|
136
133
|
text: TextExtendedConfig$outboundSchema.optional(),
|
|
137
134
|
toolChoice: OpenAIResponsesToolChoiceUnion$outboundSchema.optional(),
|
|
138
135
|
tools: z.array(z.union([
|
|
@@ -151,12 +148,13 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
151
148
|
ApplyPatchServerTool$outboundSchema,
|
|
152
149
|
CustomTool$outboundSchema,
|
|
153
150
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
151
|
+
ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
|
|
154
152
|
ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
|
|
155
153
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
156
154
|
])).optional(),
|
|
157
155
|
topK: z.int().optional(),
|
|
158
|
-
topLogprobs: z.int().optional(),
|
|
159
|
-
topP: z.number().optional(),
|
|
156
|
+
topLogprobs: z.nullable(z.int()).optional(),
|
|
157
|
+
topP: z.nullable(z.number()).optional(),
|
|
160
158
|
trace: TraceConfig$outboundSchema.optional(),
|
|
161
159
|
truncation: z.nullable(OpenAIResponsesTruncation$outboundSchema).optional(),
|
|
162
160
|
user: z.string().optional(),
|
|
@@ -28,7 +28,7 @@ export type UpdateGuardrailRequest = {
|
|
|
28
28
|
/**
|
|
29
29
|
* New spending limit in USD
|
|
30
30
|
*/
|
|
31
|
-
limitUsd?: number | undefined;
|
|
31
|
+
limitUsd?: number | null | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* New name for the guardrail
|
|
34
34
|
*/
|
|
@@ -46,7 +46,7 @@ export type UpdateGuardrailRequest$Outbound = {
|
|
|
46
46
|
enforce_zdr?: boolean | null | undefined;
|
|
47
47
|
ignored_models?: Array<string> | null | undefined;
|
|
48
48
|
ignored_providers?: Array<string> | null | undefined;
|
|
49
|
-
limit_usd?: number | undefined;
|
|
49
|
+
limit_usd?: number | null | undefined;
|
|
50
50
|
name?: string | undefined;
|
|
51
51
|
reset_interval?: string | null | undefined;
|
|
52
52
|
};
|
|
@@ -13,7 +13,7 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
|
13
13
|
enforceZdr: z.nullable(z.boolean()).optional(),
|
|
14
14
|
ignoredModels: z.nullable(z.array(z.string())).optional(),
|
|
15
15
|
ignoredProviders: z.nullable(z.array(z.string())).optional(),
|
|
16
|
-
limitUsd: z.number().optional(),
|
|
16
|
+
limitUsd: z.nullable(z.number()).optional(),
|
|
17
17
|
name: z.string().optional(),
|
|
18
18
|
resetInterval: z.nullable(GuardrailInterval$outboundSchema).optional(),
|
|
19
19
|
}).transform((v) => {
|
package/esm/models/usage.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type OutputTokensDetails = {
|
|
|
8
8
|
reasoningTokens: number;
|
|
9
9
|
};
|
|
10
10
|
export type CostDetails = {
|
|
11
|
-
upstreamInferenceCost?: number | undefined;
|
|
11
|
+
upstreamInferenceCost?: number | null | undefined;
|
|
12
12
|
upstreamInferenceInputCost: number;
|
|
13
13
|
upstreamInferenceOutputCost: number;
|
|
14
14
|
};
|
|
@@ -24,7 +24,7 @@ export type Usage = {
|
|
|
24
24
|
/**
|
|
25
25
|
* Cost of the completion
|
|
26
26
|
*/
|
|
27
|
-
cost?: number | undefined;
|
|
27
|
+
cost?: number | null | undefined;
|
|
28
28
|
costDetails?: CostDetails | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Whether a request was made using a Bring Your Own Key configuration
|
package/esm/models/usage.js
CHANGED
|
@@ -30,7 +30,7 @@ export function outputTokensDetailsFromJSON(jsonString) {
|
|
|
30
30
|
/** @internal */
|
|
31
31
|
export const CostDetails$inboundSchema = z
|
|
32
32
|
.object({
|
|
33
|
-
upstream_inference_cost: z.number().optional(),
|
|
33
|
+
upstream_inference_cost: z.nullable(z.number()).optional(),
|
|
34
34
|
upstream_inference_input_cost: z.number(),
|
|
35
35
|
upstream_inference_output_cost: z.number(),
|
|
36
36
|
}).transform((v) => {
|
|
@@ -50,7 +50,7 @@ export const Usage$inboundSchema = z.object({
|
|
|
50
50
|
output_tokens: z.int(),
|
|
51
51
|
output_tokens_details: z.lazy(() => OutputTokensDetails$inboundSchema),
|
|
52
52
|
total_tokens: z.int(),
|
|
53
|
-
cost: z.number().optional(),
|
|
53
|
+
cost: z.nullable(z.number()).optional(),
|
|
54
54
|
cost_details: z.lazy(() => CostDetails$inboundSchema).optional(),
|
|
55
55
|
is_byok: z.boolean().optional(),
|
|
56
56
|
}).transform((v) => {
|
|
@@ -7,7 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
/** @internal */
|
|
9
9
|
export const VideoGenerationUsage$inboundSchema = z.object({
|
|
10
|
-
cost: z.number().optional(),
|
|
10
|
+
cost: z.nullable(z.number()).optional(),
|
|
11
11
|
is_byok: z.boolean().optional(),
|
|
12
12
|
}).transform((v) => {
|
|
13
13
|
return remap$(v, {
|
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.5",
|
|
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
|
-
"
|
|
72
|
+
"typecheck": "tsc --noEmit",
|
|
73
|
+
"compile": "tsc",
|
|
73
74
|
"test": "vitest --run --project unit",
|
|
74
75
|
"test:e2e": "vitest --run --project e2e",
|
|
75
76
|
"test:transit": "exit 0",
|
|
76
|
-
"typecheck:transit": "exit 0",
|
|
77
77
|
"test:watch": "vitest --watch --project unit",
|
|
78
|
-
"typecheck": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
78
|
+
"typecheck:transit": "exit 0",
|
|
79
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
80
|
+
"prepare": "npm run build"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|