@openrouter/sdk 0.13.31 → 0.13.33
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/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/esm/models/providerresponse.d.ts +17 -0
- package/esm/models/providerresponse.js +11 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
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.33";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.33 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.33",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.33 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -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";
|
|
@@ -131,6 +131,17 @@ export declare const ProviderResponseProviderName: {
|
|
|
131
131
|
* Name of the provider
|
|
132
132
|
*/
|
|
133
133
|
export type ProviderResponseProviderName = OpenEnum<typeof ProviderResponseProviderName>;
|
|
134
|
+
/**
|
|
135
|
+
* The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.
|
|
136
|
+
*/
|
|
137
|
+
export declare const RoutedServiceTier: {
|
|
138
|
+
readonly Flex: "flex";
|
|
139
|
+
readonly Priority: "priority";
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.
|
|
143
|
+
*/
|
|
144
|
+
export type RoutedServiceTier = OpenEnum<typeof RoutedServiceTier>;
|
|
134
145
|
/**
|
|
135
146
|
* Details of a provider response for a generation attempt
|
|
136
147
|
*/
|
|
@@ -159,6 +170,10 @@ export type ProviderResponse = {
|
|
|
159
170
|
* Name of the provider
|
|
160
171
|
*/
|
|
161
172
|
providerName?: ProviderResponseProviderName | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.
|
|
175
|
+
*/
|
|
176
|
+
routedServiceTier?: RoutedServiceTier | undefined;
|
|
162
177
|
/**
|
|
163
178
|
* HTTP status code from the provider
|
|
164
179
|
*/
|
|
@@ -167,6 +182,8 @@ export type ProviderResponse = {
|
|
|
167
182
|
/** @internal */
|
|
168
183
|
export declare const ProviderResponseProviderName$inboundSchema: z.ZodType<ProviderResponseProviderName, unknown>;
|
|
169
184
|
/** @internal */
|
|
185
|
+
export declare const RoutedServiceTier$inboundSchema: z.ZodType<RoutedServiceTier, unknown>;
|
|
186
|
+
/** @internal */
|
|
170
187
|
export declare const ProviderResponse$inboundSchema: z.ZodType<ProviderResponse, unknown>;
|
|
171
188
|
export declare function providerResponseFromJSON(jsonString: string): SafeParseResult<ProviderResponse, SDKValidationError>;
|
|
172
189
|
//# sourceMappingURL=providerresponse.d.ts.map
|
|
@@ -131,9 +131,18 @@ export const ProviderResponseProviderName = {
|
|
|
131
131
|
ZAi: "Z.AI",
|
|
132
132
|
FakeProvider: "FakeProvider",
|
|
133
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.
|
|
136
|
+
*/
|
|
137
|
+
export const RoutedServiceTier = {
|
|
138
|
+
Flex: "flex",
|
|
139
|
+
Priority: "priority",
|
|
140
|
+
};
|
|
134
141
|
/** @internal */
|
|
135
142
|
export const ProviderResponseProviderName$inboundSchema = openEnums.inboundSchema(ProviderResponseProviderName);
|
|
136
143
|
/** @internal */
|
|
144
|
+
export const RoutedServiceTier$inboundSchema = openEnums.inboundSchema(RoutedServiceTier);
|
|
145
|
+
/** @internal */
|
|
137
146
|
export const ProviderResponse$inboundSchema = z.object({
|
|
138
147
|
endpoint_id: z.string().optional(),
|
|
139
148
|
id: z.string().optional(),
|
|
@@ -141,6 +150,7 @@ export const ProviderResponse$inboundSchema = z.object({
|
|
|
141
150
|
latency: z.number().optional(),
|
|
142
151
|
model_permaslug: z.string().optional(),
|
|
143
152
|
provider_name: ProviderResponseProviderName$inboundSchema.optional(),
|
|
153
|
+
routed_service_tier: RoutedServiceTier$inboundSchema.optional(),
|
|
144
154
|
status: z.nullable(z.int()),
|
|
145
155
|
}).transform((v) => {
|
|
146
156
|
return remap$(v, {
|
|
@@ -148,6 +158,7 @@ export const ProviderResponse$inboundSchema = z.object({
|
|
|
148
158
|
"is_byok": "isByok",
|
|
149
159
|
"model_permaslug": "modelPermaslug",
|
|
150
160
|
"provider_name": "providerName",
|
|
161
|
+
"routed_service_tier": "routedServiceTier",
|
|
151
162
|
});
|
|
152
163
|
});
|
|
153
164
|
export function providerResponseFromJSON(jsonString) {
|
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.33",
|
|
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": [
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"compile": "tsc",
|
|
77
|
-
"test": "vitest --run --project unit",
|
|
78
|
-
"test:e2e": "vitest --run --project e2e",
|
|
79
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"test": "vitest --run --project unit",
|
|
79
|
+
"test:watch": "vitest --watch --project unit",
|
|
80
80
|
"prepare": "npm run build",
|
|
81
|
+
"test:e2e": "vitest --run --project e2e",
|
|
81
82
|
"test:transit": "exit 0",
|
|
82
|
-
"test:watch": "vitest --watch --project unit",
|
|
83
83
|
"typecheck": "tsc --noEmit",
|
|
84
84
|
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|