@openrouter/sdk 0.13.30 → 0.13.32
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/imagegencompletedevent.d.ts +1 -1
- package/esm/models/imagegenerationresponse.d.ts +1 -1
- package/esm/models/imagegentextchunkevent.d.ts +39 -0
- package/esm/models/imagegentextchunkevent.js +27 -0
- package/esm/models/imagestreamingresponse.d.ts +3 -2
- package/esm/models/imagestreamingresponse.js +3 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/jsr.json +1 -1
- package/package.json +8 -8
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "0.13.
|
|
52
|
+
readonly sdkVersion: "0.13.32";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.32 2.884.4 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "0.13.
|
|
29
|
+
sdkVersion: "0.13.32",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.32 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -15,7 +15,7 @@ export type ImageGenCompletedEvent = {
|
|
|
15
15
|
*/
|
|
16
16
|
created: number;
|
|
17
17
|
/**
|
|
18
|
-
* Media type (MIME type) of the image.
|
|
18
|
+
* Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.
|
|
19
19
|
*/
|
|
20
20
|
mediaType?: string | undefined;
|
|
21
21
|
/**
|
|
@@ -8,7 +8,7 @@ export type ImageGenerationResponseData = {
|
|
|
8
8
|
*/
|
|
9
9
|
b64Json: string;
|
|
10
10
|
/**
|
|
11
|
-
* Media type (MIME type) of the image.
|
|
11
|
+
* Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.
|
|
12
12
|
*/
|
|
13
13
|
mediaType?: string | undefined;
|
|
14
14
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ImageGenTextChunkEventPhase: {
|
|
9
|
+
readonly Content: "content";
|
|
10
|
+
readonly Reasoning: "reasoning";
|
|
11
|
+
readonly Draft: "draft";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.
|
|
15
|
+
*/
|
|
16
|
+
export type ImageGenTextChunkEventPhase = OpenEnum<typeof ImageGenTextChunkEventPhase>;
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG)
|
|
19
|
+
*/
|
|
20
|
+
export type ImageGenTextChunkEvent = {
|
|
21
|
+
/**
|
|
22
|
+
* The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.
|
|
23
|
+
*/
|
|
24
|
+
phase: ImageGenTextChunkEventPhase;
|
|
25
|
+
/**
|
|
26
|
+
* A text fragment of the image being generated (e.g. partial SVG markup)
|
|
27
|
+
*/
|
|
28
|
+
text: string;
|
|
29
|
+
/**
|
|
30
|
+
* The event type
|
|
31
|
+
*/
|
|
32
|
+
type: "image_generation.text_chunk";
|
|
33
|
+
};
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const ImageGenTextChunkEventPhase$inboundSchema: z.ZodType<ImageGenTextChunkEventPhase, unknown>;
|
|
36
|
+
/** @internal */
|
|
37
|
+
export declare const ImageGenTextChunkEvent$inboundSchema: z.ZodType<ImageGenTextChunkEvent, unknown>;
|
|
38
|
+
export declare function imageGenTextChunkEventFromJSON(jsonString: string): SafeParseResult<ImageGenTextChunkEvent, SDKValidationError>;
|
|
39
|
+
//# sourceMappingURL=imagegentextchunkevent.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4de0c36d6255
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
/**
|
|
9
|
+
* The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.
|
|
10
|
+
*/
|
|
11
|
+
export const ImageGenTextChunkEventPhase = {
|
|
12
|
+
Content: "content",
|
|
13
|
+
Reasoning: "reasoning",
|
|
14
|
+
Draft: "draft",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ImageGenTextChunkEventPhase$inboundSchema = openEnums.inboundSchema(ImageGenTextChunkEventPhase);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ImageGenTextChunkEvent$inboundSchema = z.object({
|
|
20
|
+
phase: ImageGenTextChunkEventPhase$inboundSchema,
|
|
21
|
+
text: z.string(),
|
|
22
|
+
type: z.literal("image_generation.text_chunk"),
|
|
23
|
+
});
|
|
24
|
+
export function imageGenTextChunkEventFromJSON(jsonString) {
|
|
25
|
+
return safeParse(jsonString, (x) => ImageGenTextChunkEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ImageGenTextChunkEvent' from JSON`);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=imagegentextchunkevent.js.map
|
|
@@ -5,9 +5,10 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
5
5
|
import { ImageGenCompletedEvent } from "./imagegencompletedevent.js";
|
|
6
6
|
import { ImageGenPartialImageEvent } from "./imagegenpartialimageevent.js";
|
|
7
7
|
import { ImageGenStreamErrorEvent } from "./imagegenstreamerrorevent.js";
|
|
8
|
-
|
|
8
|
+
import { ImageGenTextChunkEvent } from "./imagegentextchunkevent.js";
|
|
9
|
+
export type ImageStreamingResponseData = ImageGenPartialImageEvent | ImageGenTextChunkEvent | ImageGenCompletedEvent | ImageGenStreamErrorEvent | discriminatedUnionTypes.Unknown<"type">;
|
|
9
10
|
export type ImageStreamingResponse = {
|
|
10
|
-
data: ImageGenPartialImageEvent | ImageGenCompletedEvent | ImageGenStreamErrorEvent | discriminatedUnionTypes.Unknown<"type">;
|
|
11
|
+
data: ImageGenPartialImageEvent | ImageGenTextChunkEvent | ImageGenCompletedEvent | ImageGenStreamErrorEvent | discriminatedUnionTypes.Unknown<"type">;
|
|
11
12
|
};
|
|
12
13
|
/** @internal */
|
|
13
14
|
export declare const ImageStreamingResponseData$inboundSchema: z.ZodType<ImageStreamingResponseData, unknown>;
|
|
@@ -8,9 +8,11 @@ import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
|
8
8
|
import { ImageGenCompletedEvent$inboundSchema, } from "./imagegencompletedevent.js";
|
|
9
9
|
import { ImageGenPartialImageEvent$inboundSchema, } from "./imagegenpartialimageevent.js";
|
|
10
10
|
import { ImageGenStreamErrorEvent$inboundSchema, } from "./imagegenstreamerrorevent.js";
|
|
11
|
+
import { ImageGenTextChunkEvent$inboundSchema, } from "./imagegentextchunkevent.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export const ImageStreamingResponseData$inboundSchema = discriminatedUnion("type", {
|
|
13
14
|
["image_generation.partial_image"]: ImageGenPartialImageEvent$inboundSchema,
|
|
15
|
+
["image_generation.text_chunk"]: ImageGenTextChunkEvent$inboundSchema,
|
|
14
16
|
["image_generation.completed"]: ImageGenCompletedEvent$inboundSchema,
|
|
15
17
|
error: ImageGenStreamErrorEvent$inboundSchema,
|
|
16
18
|
});
|
|
@@ -33,6 +35,7 @@ export const ImageStreamingResponse$inboundSchema = z.object({
|
|
|
33
35
|
}
|
|
34
36
|
}).pipe(discriminatedUnion("type", {
|
|
35
37
|
["image_generation.partial_image"]: ImageGenPartialImageEvent$inboundSchema,
|
|
38
|
+
["image_generation.text_chunk"]: ImageGenTextChunkEvent$inboundSchema,
|
|
36
39
|
["image_generation.completed"]: ImageGenCompletedEvent$inboundSchema,
|
|
37
40
|
error: ImageGenStreamErrorEvent$inboundSchema,
|
|
38
41
|
})),
|
package/esm/models/index.d.ts
CHANGED
|
@@ -241,6 +241,7 @@ export * from "./imagegenerationstatus.js";
|
|
|
241
241
|
export * from "./imagegenerationusage.js";
|
|
242
242
|
export * from "./imagegenpartialimageevent.js";
|
|
243
243
|
export * from "./imagegenstreamerrorevent.js";
|
|
244
|
+
export * from "./imagegentextchunkevent.js";
|
|
244
245
|
export * from "./imagemodelarchitecture.js";
|
|
245
246
|
export * from "./imagemodelendpointsresponse.js";
|
|
246
247
|
export * from "./imagemodellistitem.js";
|
package/esm/models/index.js
CHANGED
|
@@ -245,6 +245,7 @@ export * from "./imagegenerationstatus.js";
|
|
|
245
245
|
export * from "./imagegenerationusage.js";
|
|
246
246
|
export * from "./imagegenpartialimageevent.js";
|
|
247
247
|
export * from "./imagegenstreamerrorevent.js";
|
|
248
|
+
export * from "./imagegentextchunkevent.js";
|
|
248
249
|
export * from "./imagemodelarchitecture.js";
|
|
249
250
|
export * from "./imagemodelendpointsresponse.js";
|
|
250
251
|
export * from "./imagemodellistitem.js";
|
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.32",
|
|
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": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"packageManager": "pnpm@10.22.0",
|
|
23
23
|
"publishConfig": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"provenance": true,
|
|
25
|
+
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "./esm/index.js",
|
|
@@ -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:watch": "vitest --watch --project unit",
|
|
77
|
-
"typecheck:transit": "exit 0",
|
|
78
|
-
"typecheck": "tsc --noEmit",
|
|
79
76
|
"compile": "tsc",
|
|
80
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"test:e2e": "vitest --run --project e2e",
|
|
79
|
+
"typecheck": "tsc --noEmit",
|
|
80
|
+
"typecheck:transit": "exit 0",
|
|
81
81
|
"prepare": "npm run build",
|
|
82
82
|
"test": "vitest --run --project unit",
|
|
83
|
-
"test:
|
|
84
|
-
"test:
|
|
83
|
+
"test:transit": "exit 0",
|
|
84
|
+
"test:watch": "vitest --watch --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|