@openrouter/sdk 1.5.54 → 1.5.56
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
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.5.
|
|
53
|
+
readonly sdkVersion: "1.5.56";
|
|
54
54
|
readonly genVersion: "2.950.13";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.56 2.950.13 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.5.
|
|
32
|
+
sdkVersion: "1.5.56",
|
|
33
33
|
genVersion: "2.950.13",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.56 2.950.13 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { OpenEnum } from "../types/enums.js";
|
|
2
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { ContentPartImage, ContentPartImage$Outbound } from "./contentpartimage.js";
|
|
4
4
|
import { ImageGenerationProviderPreferences, ImageGenerationProviderPreferences$Outbound } from "./imagegenerationproviderpreferences.js";
|
|
5
5
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
@@ -50,17 +50,32 @@ export declare const ImageGenerationRequestBackground: {
|
|
|
50
50
|
* Background treatment. `transparent` requires an output_format that supports alpha (png or webp).
|
|
51
51
|
*/
|
|
52
52
|
export type ImageGenerationRequestBackground = OpenEnum<typeof ImageGenerationRequestBackground>;
|
|
53
|
+
export type ImageGenerationRequestImageUrl = {
|
|
54
|
+
url: string;
|
|
55
|
+
};
|
|
56
|
+
export declare const ImageGenerationRequestType: {
|
|
57
|
+
readonly ImageUrl: "image_url";
|
|
58
|
+
};
|
|
59
|
+
export type ImageGenerationRequestType = ClosedEnum<typeof ImageGenerationRequestType>;
|
|
60
|
+
/**
|
|
61
|
+
* A transparent PNG overlay (arrows, circles, annotations) with the same dimensions as the first reference image, as a base64 data URL or HTTP(S) URL, guiding where an edit applies. Image-to-image requests only; honored by models with markup-guided editing (OpenAI gpt-image-2.6) and ignored otherwise.
|
|
62
|
+
*/
|
|
63
|
+
export type Markup = {
|
|
64
|
+
imageUrl: ImageGenerationRequestImageUrl;
|
|
65
|
+
type: ImageGenerationRequestType;
|
|
66
|
+
};
|
|
53
67
|
/**
|
|
54
|
-
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
|
|
68
|
+
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. GIF produces an animation on models that support it (OpenAI gpt-image-2.6; see `frame_count`).
|
|
55
69
|
*/
|
|
56
70
|
export declare const ImageGenerationRequestOutputFormat: {
|
|
57
71
|
readonly Png: "png";
|
|
58
72
|
readonly Jpeg: "jpeg";
|
|
59
73
|
readonly Webp: "webp";
|
|
60
74
|
readonly Svg: "svg";
|
|
75
|
+
readonly Gif: "gif";
|
|
61
76
|
};
|
|
62
77
|
/**
|
|
63
|
-
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
|
|
78
|
+
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. GIF produces an animation on models that support it (OpenAI gpt-image-2.6; see `frame_count`).
|
|
64
79
|
*/
|
|
65
80
|
export type ImageGenerationRequestOutputFormat = OpenEnum<typeof ImageGenerationRequestOutputFormat>;
|
|
66
81
|
/**
|
|
@@ -105,10 +120,22 @@ export type ImageGenerationRequest = {
|
|
|
105
120
|
* Background treatment. `transparent` requires an output_format that supports alpha (png or webp).
|
|
106
121
|
*/
|
|
107
122
|
background?: ImageGenerationRequestBackground | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Number of animation frames (2-64) when `output_format` is `gif`. Only honored by models that produce animations (OpenAI gpt-image-2.6, generations only); ignored otherwise.
|
|
125
|
+
*/
|
|
126
|
+
frameCount?: number | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Display time of each animation frame in milliseconds (20-2000) when `output_format` is `gif`. Ignored by models that do not produce animations.
|
|
129
|
+
*/
|
|
130
|
+
frameDurationMs?: number | undefined;
|
|
108
131
|
/**
|
|
109
132
|
* Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs.
|
|
110
133
|
*/
|
|
111
134
|
inputReferences?: Array<ContentPartImage> | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* A transparent PNG overlay (arrows, circles, annotations) with the same dimensions as the first reference image, as a base64 data URL or HTTP(S) URL, guiding where an edit applies. Image-to-image requests only; honored by models with markup-guided editing (OpenAI gpt-image-2.6) and ignored otherwise.
|
|
137
|
+
*/
|
|
138
|
+
markup?: Markup | undefined;
|
|
112
139
|
/**
|
|
113
140
|
* The image generation model to use
|
|
114
141
|
*/
|
|
@@ -122,7 +149,7 @@ export type ImageGenerationRequest = {
|
|
|
122
149
|
*/
|
|
123
150
|
outputCompression?: number | undefined;
|
|
124
151
|
/**
|
|
125
|
-
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
|
|
152
|
+
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. GIF produces an animation on models that support it (OpenAI gpt-image-2.6; see `frame_count`).
|
|
126
153
|
*/
|
|
127
154
|
outputFormat?: ImageGenerationRequestOutputFormat | undefined;
|
|
128
155
|
/**
|
|
@@ -171,6 +198,23 @@ export declare const ImageGenerationRequestAspectRatio$outboundSchema: z.ZodType
|
|
|
171
198
|
/** @internal */
|
|
172
199
|
export declare const ImageGenerationRequestBackground$outboundSchema: z.ZodType<string, ImageGenerationRequestBackground>;
|
|
173
200
|
/** @internal */
|
|
201
|
+
export type ImageGenerationRequestImageUrl$Outbound = {
|
|
202
|
+
url: string;
|
|
203
|
+
};
|
|
204
|
+
/** @internal */
|
|
205
|
+
export declare const ImageGenerationRequestImageUrl$outboundSchema: z.ZodType<ImageGenerationRequestImageUrl$Outbound, ImageGenerationRequestImageUrl>;
|
|
206
|
+
export declare function imageGenerationRequestImageUrlToJSON(imageGenerationRequestImageUrl: ImageGenerationRequestImageUrl): string;
|
|
207
|
+
/** @internal */
|
|
208
|
+
export declare const ImageGenerationRequestType$outboundSchema: z.ZodEnum<typeof ImageGenerationRequestType>;
|
|
209
|
+
/** @internal */
|
|
210
|
+
export type Markup$Outbound = {
|
|
211
|
+
image_url: ImageGenerationRequestImageUrl$Outbound;
|
|
212
|
+
type: string;
|
|
213
|
+
};
|
|
214
|
+
/** @internal */
|
|
215
|
+
export declare const Markup$outboundSchema: z.ZodType<Markup$Outbound, Markup>;
|
|
216
|
+
export declare function markupToJSON(markup: Markup): string;
|
|
217
|
+
/** @internal */
|
|
174
218
|
export declare const ImageGenerationRequestOutputFormat$outboundSchema: z.ZodType<string, ImageGenerationRequestOutputFormat>;
|
|
175
219
|
/** @internal */
|
|
176
220
|
export declare const ImageGenerationRequestQuality$outboundSchema: z.ZodType<string, ImageGenerationRequestQuality>;
|
|
@@ -180,7 +224,10 @@ export declare const ImageGenerationRequestResolution$outboundSchema: z.ZodType<
|
|
|
180
224
|
export type ImageGenerationRequest$Outbound = {
|
|
181
225
|
aspect_ratio?: string | undefined;
|
|
182
226
|
background?: string | undefined;
|
|
227
|
+
frame_count?: number | undefined;
|
|
228
|
+
frame_duration_ms?: number | undefined;
|
|
183
229
|
input_references?: Array<ContentPartImage$Outbound> | undefined;
|
|
230
|
+
markup?: Markup$Outbound | undefined;
|
|
184
231
|
model: string;
|
|
185
232
|
n?: number | undefined;
|
|
186
233
|
output_compression?: number | undefined;
|
|
@@ -47,14 +47,18 @@ export const ImageGenerationRequestBackground = {
|
|
|
47
47
|
Transparent: "transparent",
|
|
48
48
|
Opaque: "opaque",
|
|
49
49
|
};
|
|
50
|
+
export const ImageGenerationRequestType = {
|
|
51
|
+
ImageUrl: "image_url",
|
|
52
|
+
};
|
|
50
53
|
/**
|
|
51
|
-
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.
|
|
54
|
+
* Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. GIF produces an animation on models that support it (OpenAI gpt-image-2.6; see `frame_count`).
|
|
52
55
|
*/
|
|
53
56
|
export const ImageGenerationRequestOutputFormat = {
|
|
54
57
|
Png: "png",
|
|
55
58
|
Jpeg: "jpeg",
|
|
56
59
|
Webp: "webp",
|
|
57
60
|
Svg: "svg",
|
|
61
|
+
Gif: "gif",
|
|
58
62
|
};
|
|
59
63
|
/**
|
|
60
64
|
* Rendering quality. Providers without a quality knob ignore this.
|
|
@@ -83,6 +87,28 @@ export const ImageGenerationRequestAspectRatio$outboundSchema = openEnums.outbou
|
|
|
83
87
|
/** @internal */
|
|
84
88
|
export const ImageGenerationRequestBackground$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestBackground);
|
|
85
89
|
/** @internal */
|
|
90
|
+
export const ImageGenerationRequestImageUrl$outboundSchema = z.object({
|
|
91
|
+
url: z.string(),
|
|
92
|
+
});
|
|
93
|
+
export function imageGenerationRequestImageUrlToJSON(imageGenerationRequestImageUrl) {
|
|
94
|
+
return JSON.stringify(ImageGenerationRequestImageUrl$outboundSchema.parse(imageGenerationRequestImageUrl));
|
|
95
|
+
}
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const ImageGenerationRequestType$outboundSchema = z.enum(ImageGenerationRequestType);
|
|
98
|
+
/** @internal */
|
|
99
|
+
export const Markup$outboundSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
imageUrl: z.lazy(() => ImageGenerationRequestImageUrl$outboundSchema),
|
|
102
|
+
type: ImageGenerationRequestType$outboundSchema,
|
|
103
|
+
}).transform((v) => {
|
|
104
|
+
return remap$(v, {
|
|
105
|
+
imageUrl: "image_url",
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
export function markupToJSON(markup) {
|
|
109
|
+
return JSON.stringify(Markup$outboundSchema.parse(markup));
|
|
110
|
+
}
|
|
111
|
+
/** @internal */
|
|
86
112
|
export const ImageGenerationRequestOutputFormat$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestOutputFormat);
|
|
87
113
|
/** @internal */
|
|
88
114
|
export const ImageGenerationRequestQuality$outboundSchema = openEnums.outboundSchema(ImageGenerationRequestQuality);
|
|
@@ -92,7 +118,10 @@ export const ImageGenerationRequestResolution$outboundSchema = openEnums.outboun
|
|
|
92
118
|
export const ImageGenerationRequest$outboundSchema = z.object({
|
|
93
119
|
aspectRatio: ImageGenerationRequestAspectRatio$outboundSchema.optional(),
|
|
94
120
|
background: ImageGenerationRequestBackground$outboundSchema.optional(),
|
|
121
|
+
frameCount: z.int().optional(),
|
|
122
|
+
frameDurationMs: z.int().optional(),
|
|
95
123
|
inputReferences: z.array(ContentPartImage$outboundSchema).optional(),
|
|
124
|
+
markup: z.lazy(() => Markup$outboundSchema).optional(),
|
|
96
125
|
model: z.string(),
|
|
97
126
|
n: z.int().optional(),
|
|
98
127
|
outputCompression: z.int().optional(),
|
|
@@ -110,6 +139,8 @@ export const ImageGenerationRequest$outboundSchema = z.object({
|
|
|
110
139
|
}).transform((v) => {
|
|
111
140
|
return remap$(v, {
|
|
112
141
|
aspectRatio: "aspect_ratio",
|
|
142
|
+
frameCount: "frame_count",
|
|
143
|
+
frameDurationMs: "frame_duration_ms",
|
|
113
144
|
inputReferences: "input_references",
|
|
114
145
|
outputCompression: "output_compression",
|
|
115
146
|
outputFormat: "output_format",
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.56",
|
|
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 && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
+
"test:transit": "exit 0",
|
|
77
|
+
"typecheck": "tsc --noEmit",
|
|
78
|
+
"typecheck:transit": "exit 0",
|
|
79
|
+
"test:e2e": "vitest --run --project e2e",
|
|
80
|
+
"test:watch": "vitest --watch --project unit",
|
|
76
81
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
77
82
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
83
|
"prepare": "npm run build",
|
|
79
|
-
"test
|
|
80
|
-
"test:watch": "vitest --watch --project unit",
|
|
81
|
-
"typecheck": "tsc --noEmit",
|
|
82
|
-
"test": "vitest --run --project unit",
|
|
83
|
-
"test:transit": "exit 0",
|
|
84
|
-
"typecheck:transit": "exit 0"
|
|
84
|
+
"test": "vitest --run --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|