@openrouter/sdk 0.12.2 → 0.12.4
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 +16 -16
- package/esm/models/chatrequest.js +8 -8
- package/esm/models/chatsearchmodelsservertool.d.ts +28 -0
- package/esm/models/chatsearchmodelsservertool.js +20 -0
- 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/index.d.ts +2 -0
- package/esm/models/index.js +2 -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 +23 -14
- package/esm/models/responsesrequest.js +10 -7
- package/esm/models/searchmodelsservertoolconfig.d.ts +18 -0
- package/esm/models/searchmodelsservertoolconfig.js +18 -0
- 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
|
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { ApplyPatchServerTool, ApplyPatchServerTool$Outbound } from "./applypatchservertool.js";
|
|
4
4
|
import { AutoRouterPlugin, AutoRouterPlugin$Outbound } from "./autorouterplugin.js";
|
|
5
|
+
import { ChatSearchModelsServerTool, ChatSearchModelsServerTool$Outbound } from "./chatsearchmodelsservertool.js";
|
|
5
6
|
import { CodeInterpreterServerTool, CodeInterpreterServerTool$Outbound } from "./codeinterpreterservertool.js";
|
|
6
7
|
import { CodexLocalShellTool, CodexLocalShellTool$Outbound } from "./codexlocalshelltool.js";
|
|
7
8
|
import { ComputerUseServerTool, ComputerUseServerTool$Outbound } from "./computeruseservertool.js";
|
|
@@ -55,13 +56,15 @@ export type ResponsesRequestToolFunction = {
|
|
|
55
56
|
};
|
|
56
57
|
export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
57
58
|
type: "openrouter:datetime";
|
|
59
|
+
}) | (ChatSearchModelsServerTool & {
|
|
60
|
+
type: "openrouter:experimental__search_models";
|
|
58
61
|
}) | WebSearchServerToolOpenRouter;
|
|
59
62
|
/**
|
|
60
63
|
* Request schema for Responses endpoint
|
|
61
64
|
*/
|
|
62
65
|
export type ResponsesRequest = {
|
|
63
66
|
background?: boolean | null | undefined;
|
|
64
|
-
frequencyPenalty?: number | undefined;
|
|
67
|
+
frequencyPenalty?: number | null | undefined;
|
|
65
68
|
/**
|
|
66
69
|
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
|
|
67
70
|
*/
|
|
@@ -74,8 +77,8 @@ export type ResponsesRequest = {
|
|
|
74
77
|
*/
|
|
75
78
|
input?: InputsUnion | undefined;
|
|
76
79
|
instructions?: string | null | undefined;
|
|
77
|
-
maxOutputTokens?: number | undefined;
|
|
78
|
-
maxToolCalls?: number | undefined;
|
|
80
|
+
maxOutputTokens?: number | null | undefined;
|
|
81
|
+
maxToolCalls?: number | null | undefined;
|
|
79
82
|
/**
|
|
80
83
|
* 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.
|
|
81
84
|
*/
|
|
@@ -93,7 +96,7 @@ export type ResponsesRequest = {
|
|
|
93
96
|
* Plugins you want to enable for this request, including their settings.
|
|
94
97
|
*/
|
|
95
98
|
plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | ModerationPlugin | ResponseHealingPlugin | WebSearchPlugin> | undefined;
|
|
96
|
-
presencePenalty?: number | undefined;
|
|
99
|
+
presencePenalty?: number | null | undefined;
|
|
97
100
|
previousResponseId?: string | null | undefined;
|
|
98
101
|
prompt?: StoredPromptTemplate | null | undefined;
|
|
99
102
|
promptCacheKey?: string | null | undefined;
|
|
@@ -113,7 +116,7 @@ export type ResponsesRequest = {
|
|
|
113
116
|
sessionId?: string | undefined;
|
|
114
117
|
store?: false | undefined;
|
|
115
118
|
stream?: boolean | undefined;
|
|
116
|
-
temperature?: number | undefined;
|
|
119
|
+
temperature?: number | null | undefined;
|
|
117
120
|
/**
|
|
118
121
|
* Text output configuration including format and verbosity
|
|
119
122
|
*/
|
|
@@ -121,10 +124,12 @@ export type ResponsesRequest = {
|
|
|
121
124
|
toolChoice?: OpenAIResponsesToolChoiceUnion | undefined;
|
|
122
125
|
tools?: Array<ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
123
126
|
type: "openrouter:datetime";
|
|
127
|
+
}) | (ChatSearchModelsServerTool & {
|
|
128
|
+
type: "openrouter:experimental__search_models";
|
|
124
129
|
}) | WebSearchServerToolOpenRouter> | undefined;
|
|
125
130
|
topK?: number | undefined;
|
|
126
|
-
topLogprobs?: number | undefined;
|
|
127
|
-
topP?: number | undefined;
|
|
131
|
+
topLogprobs?: number | null | undefined;
|
|
132
|
+
topP?: number | null | undefined;
|
|
128
133
|
/**
|
|
129
134
|
* 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.
|
|
130
135
|
*/
|
|
@@ -163,6 +168,8 @@ export declare function responsesRequestToolFunctionToJSON(responsesRequestToolF
|
|
|
163
168
|
/** @internal */
|
|
164
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 & {
|
|
165
170
|
type: "openrouter:datetime";
|
|
171
|
+
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
172
|
+
type: "openrouter:experimental__search_models";
|
|
166
173
|
}) | WebSearchServerToolOpenRouter$Outbound;
|
|
167
174
|
/** @internal */
|
|
168
175
|
export declare const ResponsesRequestToolUnion$outboundSchema: z.ZodType<ResponsesRequestToolUnion$Outbound, ResponsesRequestToolUnion>;
|
|
@@ -170,15 +177,15 @@ export declare function responsesRequestToolUnionToJSON(responsesRequestToolUnio
|
|
|
170
177
|
/** @internal */
|
|
171
178
|
export type ResponsesRequest$Outbound = {
|
|
172
179
|
background?: boolean | null | undefined;
|
|
173
|
-
frequency_penalty?: number | undefined;
|
|
180
|
+
frequency_penalty?: number | null | undefined;
|
|
174
181
|
image_config?: {
|
|
175
182
|
[k: string]: string | number;
|
|
176
183
|
} | undefined;
|
|
177
184
|
include?: Array<string> | null | undefined;
|
|
178
185
|
input?: InputsUnion$Outbound | undefined;
|
|
179
186
|
instructions?: string | null | undefined;
|
|
180
|
-
max_output_tokens?: number | undefined;
|
|
181
|
-
max_tool_calls?: number | undefined;
|
|
187
|
+
max_output_tokens?: number | null | undefined;
|
|
188
|
+
max_tool_calls?: number | null | undefined;
|
|
182
189
|
metadata?: {
|
|
183
190
|
[k: string]: string;
|
|
184
191
|
} | null | undefined;
|
|
@@ -187,7 +194,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
187
194
|
models?: Array<string> | undefined;
|
|
188
195
|
parallel_tool_calls?: boolean | null | undefined;
|
|
189
196
|
plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound> | undefined;
|
|
190
|
-
presence_penalty?: number | undefined;
|
|
197
|
+
presence_penalty?: number | null | undefined;
|
|
191
198
|
previous_response_id?: string | null | undefined;
|
|
192
199
|
prompt?: StoredPromptTemplate$Outbound | null | undefined;
|
|
193
200
|
prompt_cache_key?: string | null | undefined;
|
|
@@ -198,15 +205,17 @@ export type ResponsesRequest$Outbound = {
|
|
|
198
205
|
session_id?: string | undefined;
|
|
199
206
|
store: false;
|
|
200
207
|
stream: boolean;
|
|
201
|
-
temperature?: number | undefined;
|
|
208
|
+
temperature?: number | null | undefined;
|
|
202
209
|
text?: TextExtendedConfig$Outbound | undefined;
|
|
203
210
|
tool_choice?: OpenAIResponsesToolChoiceUnion$Outbound | undefined;
|
|
204
211
|
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 & {
|
|
205
212
|
type: "openrouter:datetime";
|
|
213
|
+
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
214
|
+
type: "openrouter:experimental__search_models";
|
|
206
215
|
}) | WebSearchServerToolOpenRouter$Outbound> | undefined;
|
|
207
216
|
top_k?: number | undefined;
|
|
208
|
-
top_logprobs?: number | undefined;
|
|
209
|
-
top_p?: number | undefined;
|
|
217
|
+
top_logprobs?: number | null | undefined;
|
|
218
|
+
top_p?: number | null | undefined;
|
|
210
219
|
trace?: TraceConfig$Outbound | undefined;
|
|
211
220
|
truncation?: string | null | undefined;
|
|
212
221
|
user?: string | undefined;
|
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
8
|
import { ApplyPatchServerTool$outboundSchema, } from "./applypatchservertool.js";
|
|
9
9
|
import { AutoRouterPlugin$outboundSchema, } from "./autorouterplugin.js";
|
|
10
|
+
import { ChatSearchModelsServerTool$outboundSchema, } from "./chatsearchmodelsservertool.js";
|
|
10
11
|
import { CodeInterpreterServerTool$outboundSchema, } from "./codeinterpreterservertool.js";
|
|
11
12
|
import { CodexLocalShellTool$outboundSchema, } from "./codexlocalshelltool.js";
|
|
12
13
|
import { ComputerUseServerTool$outboundSchema, } from "./computeruseservertool.js";
|
|
@@ -90,6 +91,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
|
|
|
90
91
|
ApplyPatchServerTool$outboundSchema,
|
|
91
92
|
CustomTool$outboundSchema,
|
|
92
93
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
94
|
+
ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
|
|
93
95
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
94
96
|
]);
|
|
95
97
|
export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
|
|
@@ -98,14 +100,14 @@ export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
|
|
|
98
100
|
/** @internal */
|
|
99
101
|
export const ResponsesRequest$outboundSchema = z.object({
|
|
100
102
|
background: z.nullable(z.boolean()).optional(),
|
|
101
|
-
frequencyPenalty: z.number().optional(),
|
|
103
|
+
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
102
104
|
imageConfig: z.record(z.string(), z.union([z.string(), z.number()]))
|
|
103
105
|
.optional(),
|
|
104
106
|
include: z.nullable(z.array(ResponseIncludesEnum$outboundSchema)).optional(),
|
|
105
107
|
input: InputsUnion$outboundSchema.optional(),
|
|
106
108
|
instructions: z.nullable(z.string()).optional(),
|
|
107
|
-
maxOutputTokens: z.int().optional(),
|
|
108
|
-
maxToolCalls: z.int().optional(),
|
|
109
|
+
maxOutputTokens: z.nullable(z.int()).optional(),
|
|
110
|
+
maxToolCalls: z.nullable(z.int()).optional(),
|
|
109
111
|
metadata: z.nullable(z.record(z.string(), z.string())).optional(),
|
|
110
112
|
modalities: z.array(OutputModalityEnum$outboundSchema).optional(),
|
|
111
113
|
model: z.string().optional(),
|
|
@@ -119,7 +121,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
119
121
|
ResponseHealingPlugin$outboundSchema,
|
|
120
122
|
WebSearchPlugin$outboundSchema,
|
|
121
123
|
])).optional(),
|
|
122
|
-
presencePenalty: z.number().optional(),
|
|
124
|
+
presencePenalty: z.nullable(z.number()).optional(),
|
|
123
125
|
previousResponseId: z.nullable(z.string()).optional(),
|
|
124
126
|
prompt: z.nullable(StoredPromptTemplate$outboundSchema).optional(),
|
|
125
127
|
promptCacheKey: z.nullable(z.string()).optional(),
|
|
@@ -130,7 +132,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
130
132
|
sessionId: z.string().optional(),
|
|
131
133
|
store: z.literal(false).default(false),
|
|
132
134
|
stream: z.boolean().default(false),
|
|
133
|
-
temperature: z.number().optional(),
|
|
135
|
+
temperature: z.nullable(z.number()).optional(),
|
|
134
136
|
text: TextExtendedConfig$outboundSchema.optional(),
|
|
135
137
|
toolChoice: OpenAIResponsesToolChoiceUnion$outboundSchema.optional(),
|
|
136
138
|
tools: z.array(z.union([
|
|
@@ -149,11 +151,12 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
149
151
|
ApplyPatchServerTool$outboundSchema,
|
|
150
152
|
CustomTool$outboundSchema,
|
|
151
153
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
154
|
+
ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
|
|
152
155
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
153
156
|
])).optional(),
|
|
154
157
|
topK: z.int().optional(),
|
|
155
|
-
topLogprobs: z.int().optional(),
|
|
156
|
-
topP: z.number().optional(),
|
|
158
|
+
topLogprobs: z.nullable(z.int()).optional(),
|
|
159
|
+
topP: z.nullable(z.number()).optional(),
|
|
157
160
|
trace: TraceConfig$outboundSchema.optional(),
|
|
158
161
|
truncation: z.nullable(OpenAIResponsesTruncation$outboundSchema).optional(),
|
|
159
162
|
user: z.string().optional(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the openrouter:experimental__search_models server tool
|
|
4
|
+
*/
|
|
5
|
+
export type SearchModelsServerToolConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* Maximum number of models to return. Defaults to 5, max 20.
|
|
8
|
+
*/
|
|
9
|
+
maxResults?: number | undefined;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export type SearchModelsServerToolConfig$Outbound = {
|
|
13
|
+
max_results?: number | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const SearchModelsServerToolConfig$outboundSchema: z.ZodType<SearchModelsServerToolConfig$Outbound, SearchModelsServerToolConfig>;
|
|
17
|
+
export declare function searchModelsServerToolConfigToJSON(searchModelsServerToolConfig: SearchModelsServerToolConfig): string;
|
|
18
|
+
//# sourceMappingURL=searchmodelsservertoolconfig.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f15358a543a6
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const SearchModelsServerToolConfig$outboundSchema = z.object({
|
|
9
|
+
maxResults: z.int().optional(),
|
|
10
|
+
}).transform((v) => {
|
|
11
|
+
return remap$(v, {
|
|
12
|
+
maxResults: "max_results",
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
export function searchModelsServerToolConfigToJSON(searchModelsServerToolConfig) {
|
|
16
|
+
return JSON.stringify(SearchModelsServerToolConfig$outboundSchema.parse(searchModelsServerToolConfig));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=searchmodelsservertoolconfig.js.map
|
|
@@ -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.4",
|
|
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
|
+
"prepare": "npm run build",
|
|
73
|
+
"typecheck": "tsc --noEmit",
|
|
72
74
|
"compile": "tsc",
|
|
75
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
73
76
|
"test": "vitest --run --project unit",
|
|
74
77
|
"test:e2e": "vitest --run --project e2e",
|
|
75
78
|
"test:transit": "exit 0",
|
|
76
|
-
"
|
|
77
|
-
"typecheck:transit": "exit 0"
|
|
78
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
79
|
-
"prepare": "npm run build",
|
|
80
|
-
"test:watch": "vitest --watch --project unit"
|
|
79
|
+
"test:watch": "vitest --watch --project unit",
|
|
80
|
+
"typecheck:transit": "exit 0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|