@openrouter/sdk 0.13.45 → 0.13.46

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.
@@ -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: z.lazy(() => ImageGenerationRequestProvider$outboundSchema)
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(),
@@ -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";
@@ -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";
@@ -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 Ignore = ProviderName | string;
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 Only = ProviderName | string;
57
- export type Order = ProviderName | string;
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 Sort = ProviderSort | ProviderSortConfig | any;
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 Ignore$Outbound = string | string;
131
+ export type ProviderPreferencesIgnore$Outbound = string | string;
132
132
  /** @internal */
133
- export declare const Ignore$outboundSchema: z.ZodType<Ignore$Outbound, Ignore>;
134
- export declare function ignoreToJSON(ignore: Ignore): string;
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 Only$Outbound = string | string;
147
+ export type ProviderPreferencesOnly$Outbound = string | string;
148
148
  /** @internal */
149
- export declare const Only$outboundSchema: z.ZodType<Only$Outbound, Only>;
150
- export declare function onlyToJSON(only: Only): string;
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 Order$Outbound = string | string;
152
+ export type ProviderPreferencesOrder$Outbound = string | string;
153
153
  /** @internal */
154
- export declare const Order$outboundSchema: z.ZodType<Order$Outbound, Order>;
155
- export declare function orderToJSON(order: Order): string;
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 Sort$Outbound = string | ProviderSortConfig$Outbound | any;
157
+ export type ProviderPreferencesSort$Outbound = string | ProviderSortConfig$Outbound | any;
158
158
  /** @internal */
159
- export declare const Sort$outboundSchema: z.ZodType<Sort$Outbound, Sort>;
160
- export declare function sortToJSON(sort: Sort): string;
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 Ignore$outboundSchema = z
30
- .union([ProviderName$outboundSchema, z.string()]);
31
- export function ignoreToJSON(ignore) {
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 Only$outboundSchema = z.union([
48
- ProviderName$outboundSchema,
49
- z.string(),
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 Order$outboundSchema = z.union([
56
- ProviderName$outboundSchema,
57
- z.string(),
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 Sort$outboundSchema = z.union([
56
+ export const ProviderPreferencesSort$outboundSchema = z.union([
64
57
  ProviderSort$outboundSchema,
65
58
  ProviderSortConfig$outboundSchema,
66
59
  z.any(),
67
60
  ]);
68
- export function sortToJSON(sort) {
69
- return JSON.stringify(Sort$outboundSchema.parse(sort));
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({
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.45",
5
+ "version": "0.13.46",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.45",
3
+ "version": "0.13.46",
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
77
  "prepare": "npm run build",
80
- "test:watch": "vitest --watch --project unit",
78
+ "typecheck": "tsc --noEmit",
81
79
  "typecheck:transit": "exit 0",
82
80
  "postinstall": "node scripts/check-types.js || true",
83
81
  "test": "vitest --run --project unit",
84
- "test:e2e": "vitest --run --project e2e"
82
+ "test:e2e": "vitest --run --project e2e",
83
+ "test:transit": "exit 0",
84
+ "test:watch": "vitest --watch --project unit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {