@openrouter/sdk 0.13.45 → 0.13.47
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/imagegenerationproviderpreferences.d.ts +811 -0
- package/esm/models/imagegenerationproviderpreferences.js +208 -0
- package/esm/models/imagegenerationrequest.d.ts +4 -753
- package/esm/models/imagegenerationrequest.js +2 -162
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/pricingoverride.d.ts +44 -0
- package/esm/models/pricingoverride.js +30 -0
- package/esm/models/providerpreferences.d.ts +16 -16
- package/esm/models/providerpreferences.js +12 -19
- package/esm/models/publicendpoint.d.ts +5 -0
- package/esm/models/publicendpoint.js +2 -0
- package/esm/models/publicpricing.d.ts +5 -0
- package/esm/models/publicpricing.js +2 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
8
|
import { ContentPartImage$outboundSchema, } from "./contentpartimage.js";
|
|
9
|
+
import { ImageGenerationProviderPreferences$outboundSchema, } from "./imagegenerationproviderpreferences.js";
|
|
9
10
|
/**
|
|
10
11
|
* Normalized aspect ratio of the generated image. Providers clamp to their supported subset.
|
|
11
12
|
*/
|
|
@@ -75,166 +76,6 @@ export const ImageGenerationRequestBackground$outboundSchema = openEnums.outboun
|
|
|
75
76
|
/** @internal */
|
|
76
77
|
export const ImageGenerationRequestOutputFormat$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestOutputFormat);
|
|
77
78
|
/** @internal */
|
|
78
|
-
export const ImageGenerationRequestOptions$outboundSchema = z.object({
|
|
79
|
-
oneai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
80
|
-
ai21: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
81
|
-
aionLabs: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
82
|
-
akashml: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
83
|
-
alibaba: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
84
|
-
amazonBedrock: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
85
|
-
amazonNova: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
86
|
-
ambient: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
87
|
-
anthropic: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
88
|
-
anyscale: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
89
|
-
arceeAi: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
90
|
-
atlasCloud: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
91
|
-
atoma: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
92
|
-
avian: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
93
|
-
azure: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
94
|
-
baidu: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
95
|
-
baseten: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
96
|
-
blackForestLabs: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
97
|
-
byteplus: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
98
|
-
centml: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
99
|
-
cerebras: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
100
|
-
chutes: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
101
|
-
cirrascale: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
102
|
-
clarifai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
103
|
-
cloudflare: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
104
|
-
cohere: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
105
|
-
crofai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
106
|
-
crucible: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
107
|
-
crusoe: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
108
|
-
darkbloom: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
109
|
-
decart: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
110
|
-
deepgram: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
111
|
-
deepinfra: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
112
|
-
deepseek: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
113
|
-
dekallm: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
114
|
-
digitalocean: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
115
|
-
enfer: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
116
|
-
fakeProvider: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
117
|
-
featherless: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
118
|
-
fireworks: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
119
|
-
friendli: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
120
|
-
gmicloud: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
121
|
-
googleAiStudio: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
122
|
-
googleVertex: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
123
|
-
gopomelo: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
124
|
-
groq: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
125
|
-
heygen: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
126
|
-
huggingface: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
127
|
-
hyperbolic: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
128
|
-
hyperbolicQuantized: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
129
|
-
inception: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
130
|
-
inceptron: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
131
|
-
inferactVllm: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
132
|
-
inferenceNet: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
133
|
-
infermatic: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
134
|
-
inflection: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
135
|
-
inocloud: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
136
|
-
ioNet: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
137
|
-
ionstream: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
138
|
-
klusterai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
139
|
-
lambda: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
140
|
-
lepton: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
141
|
-
liquid: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
142
|
-
lynn: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
143
|
-
lynnPrivate: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
144
|
-
mancer: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
145
|
-
mancerOld: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
146
|
-
mara: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
147
|
-
meta: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
148
|
-
minimax: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
149
|
-
mistral: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
150
|
-
modal: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
151
|
-
modelrun: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
152
|
-
modular: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
153
|
-
moonshotai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
154
|
-
morph: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
155
|
-
ncompass: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
156
|
-
nebius: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
157
|
-
nexAgi: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
158
|
-
nextbit: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
159
|
-
nineteen: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
160
|
-
novita: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
161
|
-
nvidia: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
162
|
-
octoai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
163
|
-
openInference: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
164
|
-
openai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
165
|
-
parasail: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
166
|
-
perceptron: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
167
|
-
perplexity: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
168
|
-
phala: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
169
|
-
poolside: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
170
|
-
quiver: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
171
|
-
recraft: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
172
|
-
recursal: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
173
|
-
reflection: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
174
|
-
reka: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
175
|
-
relace: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
176
|
-
replicate: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
177
|
-
sakana: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
178
|
-
sambanova: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
179
|
-
sambanovaCloaked: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
180
|
-
seed: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
181
|
-
sfCompute: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
182
|
-
siliconflow: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
183
|
-
sourceful: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
184
|
-
stealth: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
185
|
-
stepfun: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
186
|
-
streamlake: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
187
|
-
switchpoint: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
188
|
-
targon: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
189
|
-
tenstorrent: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
190
|
-
together: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
191
|
-
togetherLite: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
192
|
-
ubicloud: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
193
|
-
upstage: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
194
|
-
venice: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
195
|
-
wafer: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
196
|
-
wandb: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
197
|
-
xai: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
198
|
-
xiaomi: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
199
|
-
zAi: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
200
|
-
}).transform((v) => {
|
|
201
|
-
return remap$(v, {
|
|
202
|
-
oneai: "01ai",
|
|
203
|
-
aionLabs: "aion-labs",
|
|
204
|
-
amazonBedrock: "amazon-bedrock",
|
|
205
|
-
amazonNova: "amazon-nova",
|
|
206
|
-
arceeAi: "arcee-ai",
|
|
207
|
-
atlasCloud: "atlas-cloud",
|
|
208
|
-
blackForestLabs: "black-forest-labs",
|
|
209
|
-
fakeProvider: "fake-provider",
|
|
210
|
-
googleAiStudio: "google-ai-studio",
|
|
211
|
-
googleVertex: "google-vertex",
|
|
212
|
-
hyperbolicQuantized: "hyperbolic-quantized",
|
|
213
|
-
inferactVllm: "inferact-vllm",
|
|
214
|
-
inferenceNet: "inference-net",
|
|
215
|
-
ioNet: "io-net",
|
|
216
|
-
lynnPrivate: "lynn-private",
|
|
217
|
-
mancerOld: "mancer-old",
|
|
218
|
-
nexAgi: "nex-agi",
|
|
219
|
-
openInference: "open-inference",
|
|
220
|
-
sambanovaCloaked: "sambanova-cloaked",
|
|
221
|
-
sfCompute: "sf-compute",
|
|
222
|
-
togetherLite: "together-lite",
|
|
223
|
-
zAi: "z-ai",
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
export function imageGenerationRequestOptionsToJSON(imageGenerationRequestOptions) {
|
|
227
|
-
return JSON.stringify(ImageGenerationRequestOptions$outboundSchema.parse(imageGenerationRequestOptions));
|
|
228
|
-
}
|
|
229
|
-
/** @internal */
|
|
230
|
-
export const ImageGenerationRequestProvider$outboundSchema = z.object({
|
|
231
|
-
options: z.lazy(() => ImageGenerationRequestOptions$outboundSchema)
|
|
232
|
-
.optional(),
|
|
233
|
-
});
|
|
234
|
-
export function imageGenerationRequestProviderToJSON(imageGenerationRequestProvider) {
|
|
235
|
-
return JSON.stringify(ImageGenerationRequestProvider$outboundSchema.parse(imageGenerationRequestProvider));
|
|
236
|
-
}
|
|
237
|
-
/** @internal */
|
|
238
79
|
export const ImageGenerationRequestQuality$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestQuality);
|
|
239
80
|
/** @internal */
|
|
240
81
|
export const ImageGenerationRequestResolution$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestResolution);
|
|
@@ -248,8 +89,7 @@ export const ImageGenerationRequest$outboundSchema = z.object({
|
|
|
248
89
|
outputCompression: z.int().optional(),
|
|
249
90
|
outputFormat: ImageGenerationRequestOutputFormat$outboundSchema.optional(),
|
|
250
91
|
prompt: z.string(),
|
|
251
|
-
provider:
|
|
252
|
-
.optional(),
|
|
92
|
+
provider: ImageGenerationProviderPreferences$outboundSchema.optional(),
|
|
253
93
|
quality: ImageGenerationRequestQuality$outboundSchema.optional(),
|
|
254
94
|
resolution: ImageGenerationRequestResolution$outboundSchema.optional(),
|
|
255
95
|
seed: z.int().optional(),
|
package/esm/models/index.d.ts
CHANGED
|
@@ -235,6 +235,7 @@ export * from "./imagegencallgeneratingevent.js";
|
|
|
235
235
|
export * from "./imagegencallinprogressevent.js";
|
|
236
236
|
export * from "./imagegencallpartialimageevent.js";
|
|
237
237
|
export * from "./imagegencompletedevent.js";
|
|
238
|
+
export * from "./imagegenerationproviderpreferences.js";
|
|
238
239
|
export * from "./imagegenerationrequest.js";
|
|
239
240
|
export * from "./imagegenerationresponse.js";
|
|
240
241
|
export * from "./imagegenerationservertool.js";
|
|
@@ -401,6 +402,7 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
401
402
|
export * from "./preview20250311websearchservertool.js";
|
|
402
403
|
export * from "./previewwebsearchservertool.js";
|
|
403
404
|
export * from "./previewwebsearchuserlocation.js";
|
|
405
|
+
export * from "./pricingoverride.js";
|
|
404
406
|
export * from "./promptcachebreakpoint.js";
|
|
405
407
|
export * from "./promptcacheoptions.js";
|
|
406
408
|
export * from "./promptinjectionscanscope.js";
|
package/esm/models/index.js
CHANGED
|
@@ -239,6 +239,7 @@ export * from "./imagegencallgeneratingevent.js";
|
|
|
239
239
|
export * from "./imagegencallinprogressevent.js";
|
|
240
240
|
export * from "./imagegencallpartialimageevent.js";
|
|
241
241
|
export * from "./imagegencompletedevent.js";
|
|
242
|
+
export * from "./imagegenerationproviderpreferences.js";
|
|
242
243
|
export * from "./imagegenerationrequest.js";
|
|
243
244
|
export * from "./imagegenerationresponse.js";
|
|
244
245
|
export * from "./imagegenerationservertool.js";
|
|
@@ -405,6 +406,7 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
405
406
|
export * from "./preview20250311websearchservertool.js";
|
|
406
407
|
export * from "./previewwebsearchservertool.js";
|
|
407
408
|
export * from "./previewwebsearchuserlocation.js";
|
|
409
|
+
export * from "./pricingoverride.js";
|
|
408
410
|
export * from "./promptcachebreakpoint.js";
|
|
409
411
|
export * from "./promptcacheoptions.js";
|
|
410
412
|
export * from "./promptinjectionscanscope.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
* A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.
|
|
6
|
+
*/
|
|
7
|
+
export type PricingOverride = {
|
|
8
|
+
/**
|
|
9
|
+
* Overridden price in USD per audio input token
|
|
10
|
+
*/
|
|
11
|
+
audio?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Overridden price in USD per token for completion (output) generation
|
|
14
|
+
*/
|
|
15
|
+
completion?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Overridden price in USD per cached audio input token
|
|
18
|
+
*/
|
|
19
|
+
inputAudioCache?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Overridden price in USD per cached input token (read)
|
|
22
|
+
*/
|
|
23
|
+
inputCacheRead?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Overridden price in USD per cache-write token
|
|
26
|
+
*/
|
|
27
|
+
inputCacheWrite?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Overridden price in USD per 1-hour cache-write token
|
|
30
|
+
*/
|
|
31
|
+
inputCacheWrite1h?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold
|
|
34
|
+
*/
|
|
35
|
+
minPromptTokens?: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Overridden price in USD per token for prompt (input) processing
|
|
38
|
+
*/
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const PricingOverride$inboundSchema: z.ZodType<PricingOverride, unknown>;
|
|
43
|
+
export declare function pricingOverrideFromJSON(jsonString: string): SafeParseResult<PricingOverride, SDKValidationError>;
|
|
44
|
+
//# sourceMappingURL=pricingoverride.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b1116f9327ef
|
|
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 PricingOverride$inboundSchema = z.object({
|
|
10
|
+
audio: z.string().optional(),
|
|
11
|
+
completion: z.string().optional(),
|
|
12
|
+
input_audio_cache: z.string().optional(),
|
|
13
|
+
input_cache_read: z.string().optional(),
|
|
14
|
+
input_cache_write: z.string().optional(),
|
|
15
|
+
input_cache_write_1h: z.string().optional(),
|
|
16
|
+
min_prompt_tokens: z.number().optional(),
|
|
17
|
+
prompt: z.string().optional(),
|
|
18
|
+
}).transform((v) => {
|
|
19
|
+
return remap$(v, {
|
|
20
|
+
"input_audio_cache": "inputAudioCache",
|
|
21
|
+
"input_cache_read": "inputCacheRead",
|
|
22
|
+
"input_cache_write": "inputCacheWrite",
|
|
23
|
+
"input_cache_write_1h": "inputCacheWrite1h",
|
|
24
|
+
"min_prompt_tokens": "minPromptTokens",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export function pricingOverrideFromJSON(jsonString) {
|
|
28
|
+
return safeParse(jsonString, (x) => PricingOverride$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PricingOverride' from JSON`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=pricingoverride.js.map
|
|
@@ -27,7 +27,7 @@ export declare const DataCollection: {
|
|
|
27
27
|
* - deny: use only providers which do not collect user data.
|
|
28
28
|
*/
|
|
29
29
|
export type DataCollection = OpenEnum<typeof DataCollection>;
|
|
30
|
-
export type
|
|
30
|
+
export type ProviderPreferencesIgnore = ProviderName | string;
|
|
31
31
|
/**
|
|
32
32
|
* The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
|
33
33
|
*/
|
|
@@ -53,12 +53,12 @@ export type MaxPrice = {
|
|
|
53
53
|
*/
|
|
54
54
|
request?: string | undefined;
|
|
55
55
|
};
|
|
56
|
-
export type
|
|
57
|
-
export type
|
|
56
|
+
export type ProviderPreferencesOnly = ProviderName | string;
|
|
57
|
+
export type ProviderPreferencesOrder = ProviderName | string;
|
|
58
58
|
/**
|
|
59
59
|
* The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
|
60
60
|
*/
|
|
61
|
-
export type
|
|
61
|
+
export type ProviderPreferencesSort = ProviderSort | ProviderSortConfig | any;
|
|
62
62
|
/**
|
|
63
63
|
* When multiple model providers are available, optionally indicate your routing preference.
|
|
64
64
|
*/
|
|
@@ -128,10 +128,10 @@ export type ProviderPreferences = {
|
|
|
128
128
|
/** @internal */
|
|
129
129
|
export declare const DataCollection$outboundSchema: z.ZodType<string, DataCollection>;
|
|
130
130
|
/** @internal */
|
|
131
|
-
export type
|
|
131
|
+
export type ProviderPreferencesIgnore$Outbound = string | string;
|
|
132
132
|
/** @internal */
|
|
133
|
-
export declare const
|
|
134
|
-
export declare function
|
|
133
|
+
export declare const ProviderPreferencesIgnore$outboundSchema: z.ZodType<ProviderPreferencesIgnore$Outbound, ProviderPreferencesIgnore>;
|
|
134
|
+
export declare function providerPreferencesIgnoreToJSON(providerPreferencesIgnore: ProviderPreferencesIgnore): string;
|
|
135
135
|
/** @internal */
|
|
136
136
|
export type MaxPrice$Outbound = {
|
|
137
137
|
audio?: string | undefined;
|
|
@@ -144,20 +144,20 @@ export type MaxPrice$Outbound = {
|
|
|
144
144
|
export declare const MaxPrice$outboundSchema: z.ZodType<MaxPrice$Outbound, MaxPrice>;
|
|
145
145
|
export declare function maxPriceToJSON(maxPrice: MaxPrice): string;
|
|
146
146
|
/** @internal */
|
|
147
|
-
export type
|
|
147
|
+
export type ProviderPreferencesOnly$Outbound = string | string;
|
|
148
148
|
/** @internal */
|
|
149
|
-
export declare const
|
|
150
|
-
export declare function
|
|
149
|
+
export declare const ProviderPreferencesOnly$outboundSchema: z.ZodType<ProviderPreferencesOnly$Outbound, ProviderPreferencesOnly>;
|
|
150
|
+
export declare function providerPreferencesOnlyToJSON(providerPreferencesOnly: ProviderPreferencesOnly): string;
|
|
151
151
|
/** @internal */
|
|
152
|
-
export type
|
|
152
|
+
export type ProviderPreferencesOrder$Outbound = string | string;
|
|
153
153
|
/** @internal */
|
|
154
|
-
export declare const
|
|
155
|
-
export declare function
|
|
154
|
+
export declare const ProviderPreferencesOrder$outboundSchema: z.ZodType<ProviderPreferencesOrder$Outbound, ProviderPreferencesOrder>;
|
|
155
|
+
export declare function providerPreferencesOrderToJSON(providerPreferencesOrder: ProviderPreferencesOrder): string;
|
|
156
156
|
/** @internal */
|
|
157
|
-
export type
|
|
157
|
+
export type ProviderPreferencesSort$Outbound = string | ProviderSortConfig$Outbound | any;
|
|
158
158
|
/** @internal */
|
|
159
|
-
export declare const
|
|
160
|
-
export declare function
|
|
159
|
+
export declare const ProviderPreferencesSort$outboundSchema: z.ZodType<ProviderPreferencesSort$Outbound, ProviderPreferencesSort>;
|
|
160
|
+
export declare function providerPreferencesSortToJSON(providerPreferencesSort: ProviderPreferencesSort): string;
|
|
161
161
|
/** @internal */
|
|
162
162
|
export type ProviderPreferences$Outbound = {
|
|
163
163
|
allow_fallbacks?: boolean | null | undefined;
|
|
@@ -26,10 +26,9 @@ export const DataCollection = {
|
|
|
26
26
|
/** @internal */
|
|
27
27
|
export const DataCollection$outboundSchema = openEnums.outboundSchema(DataCollection);
|
|
28
28
|
/** @internal */
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return JSON.stringify(Ignore$outboundSchema.parse(ignore));
|
|
29
|
+
export const ProviderPreferencesIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
30
|
+
export function providerPreferencesIgnoreToJSON(providerPreferencesIgnore) {
|
|
31
|
+
return JSON.stringify(ProviderPreferencesIgnore$outboundSchema.parse(providerPreferencesIgnore));
|
|
33
32
|
}
|
|
34
33
|
/** @internal */
|
|
35
34
|
export const MaxPrice$outboundSchema = z
|
|
@@ -44,29 +43,23 @@ export function maxPriceToJSON(maxPrice) {
|
|
|
44
43
|
return JSON.stringify(MaxPrice$outboundSchema.parse(maxPrice));
|
|
45
44
|
}
|
|
46
45
|
/** @internal */
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]);
|
|
51
|
-
export function onlyToJSON(only) {
|
|
52
|
-
return JSON.stringify(Only$outboundSchema.parse(only));
|
|
46
|
+
export const ProviderPreferencesOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
47
|
+
export function providerPreferencesOnlyToJSON(providerPreferencesOnly) {
|
|
48
|
+
return JSON.stringify(ProviderPreferencesOnly$outboundSchema.parse(providerPreferencesOnly));
|
|
53
49
|
}
|
|
54
50
|
/** @internal */
|
|
55
|
-
export const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
]);
|
|
59
|
-
export function orderToJSON(order) {
|
|
60
|
-
return JSON.stringify(Order$outboundSchema.parse(order));
|
|
51
|
+
export const ProviderPreferencesOrder$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
52
|
+
export function providerPreferencesOrderToJSON(providerPreferencesOrder) {
|
|
53
|
+
return JSON.stringify(ProviderPreferencesOrder$outboundSchema.parse(providerPreferencesOrder));
|
|
61
54
|
}
|
|
62
55
|
/** @internal */
|
|
63
|
-
export const
|
|
56
|
+
export const ProviderPreferencesSort$outboundSchema = z.union([
|
|
64
57
|
ProviderSort$outboundSchema,
|
|
65
58
|
ProviderSortConfig$outboundSchema,
|
|
66
59
|
z.any(),
|
|
67
60
|
]);
|
|
68
|
-
export function
|
|
69
|
-
return JSON.stringify(
|
|
61
|
+
export function providerPreferencesSortToJSON(providerPreferencesSort) {
|
|
62
|
+
return JSON.stringify(ProviderPreferencesSort$outboundSchema.parse(providerPreferencesSort));
|
|
70
63
|
}
|
|
71
64
|
/** @internal */
|
|
72
65
|
export const ProviderPreferences$outboundSchema = z.object({
|
|
@@ -5,6 +5,7 @@ import { EndpointStatus } from "./endpointstatus.js";
|
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
6
|
import { Parameter } from "./parameter.js";
|
|
7
7
|
import { PercentileStats } from "./percentilestats.js";
|
|
8
|
+
import { PricingOverride } from "./pricingoverride.js";
|
|
8
9
|
import { ProviderName } from "./providername.js";
|
|
9
10
|
export type Pricing = {
|
|
10
11
|
/**
|
|
@@ -55,6 +56,10 @@ export type Pricing = {
|
|
|
55
56
|
* Price in USD per internal reasoning token
|
|
56
57
|
*/
|
|
57
58
|
internalReasoning?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.
|
|
61
|
+
*/
|
|
62
|
+
overrides?: Array<PricingOverride> | undefined;
|
|
58
63
|
/**
|
|
59
64
|
* Price in USD per token for prompt (input) processing
|
|
60
65
|
*/
|
|
@@ -9,6 +9,7 @@ import * as openEnums from "../types/enums.js";
|
|
|
9
9
|
import { EndpointStatus$inboundSchema, } from "./endpointstatus.js";
|
|
10
10
|
import { Parameter$inboundSchema } from "./parameter.js";
|
|
11
11
|
import { PercentileStats$inboundSchema, } from "./percentilestats.js";
|
|
12
|
+
import { PricingOverride$inboundSchema, } from "./pricingoverride.js";
|
|
12
13
|
import { ProviderName$inboundSchema } from "./providername.js";
|
|
13
14
|
export const PublicEndpointQuantization = {
|
|
14
15
|
Int4: "int4",
|
|
@@ -35,6 +36,7 @@ export const Pricing$inboundSchema = z.object({
|
|
|
35
36
|
input_cache_write: z.string().optional(),
|
|
36
37
|
input_cache_write_1h: z.string().optional(),
|
|
37
38
|
internal_reasoning: z.string().optional(),
|
|
39
|
+
overrides: z.array(PricingOverride$inboundSchema).optional(),
|
|
38
40
|
prompt: z.string(),
|
|
39
41
|
request: z.string().optional(),
|
|
40
42
|
web_search: z.string().optional(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
import { PricingOverride } from "./pricingoverride.js";
|
|
4
5
|
/**
|
|
5
6
|
* Pricing information for the model
|
|
6
7
|
*/
|
|
@@ -53,6 +54,10 @@ export type PublicPricing = {
|
|
|
53
54
|
* Price in USD per internal reasoning token
|
|
54
55
|
*/
|
|
55
56
|
internalReasoning?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.
|
|
59
|
+
*/
|
|
60
|
+
overrides?: Array<PricingOverride> | undefined;
|
|
56
61
|
/**
|
|
57
62
|
* Price in USD per token for prompt (input) processing
|
|
58
63
|
*/
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { PricingOverride$inboundSchema, } from "./pricingoverride.js";
|
|
8
9
|
/** @internal */
|
|
9
10
|
export const PublicPricing$inboundSchema = z
|
|
10
11
|
.object({
|
|
@@ -20,6 +21,7 @@ export const PublicPricing$inboundSchema = z
|
|
|
20
21
|
input_cache_write: z.string().optional(),
|
|
21
22
|
input_cache_write_1h: z.string().optional(),
|
|
22
23
|
internal_reasoning: z.string().optional(),
|
|
24
|
+
overrides: z.array(PricingOverride$inboundSchema).optional(),
|
|
23
25
|
prompt: z.string(),
|
|
24
26
|
request: z.string().optional(),
|
|
25
27
|
web_search: z.string().optional(),
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.47",
|
|
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": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test:transit": "exit 0",
|
|
77
|
-
"typecheck": "tsc --noEmit",
|
|
78
76
|
"compile": "tsc",
|
|
79
|
-
"prepare": "npm run build",
|
|
80
|
-
"test:watch": "vitest --watch --project unit",
|
|
81
|
-
"typecheck:transit": "exit 0",
|
|
82
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"prepare": "npm run build",
|
|
83
79
|
"test": "vitest --run --project unit",
|
|
84
|
-
"test:e2e": "vitest --run --project e2e"
|
|
80
|
+
"test:e2e": "vitest --run --project e2e",
|
|
81
|
+
"test:transit": "exit 0",
|
|
82
|
+
"test:watch": "vitest --watch --project unit",
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|