@openrouter/sdk 0.3.11 → 0.3.14
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/index.d.ts +1 -0
- package/esm/index.js +2 -0
- package/esm/lib/anthropic-compat.test.js +3 -0
- package/esm/lib/chat-compat.test.js +3 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/model-result.d.ts +8 -3
- package/esm/lib/model-result.js +57 -35
- package/esm/lib/tool-event-broadcaster.d.ts +44 -0
- package/esm/lib/tool-event-broadcaster.js +146 -0
- package/esm/lib/tool-executor.d.ts +21 -6
- package/esm/lib/tool-executor.js +57 -8
- package/esm/lib/tool-types.d.ts +18 -18
- package/esm/lib/tool.d.ts +16 -16
- package/esm/models/chatgenerationparams.d.ts +93 -12
- package/esm/models/chatgenerationparams.js +75 -6
- package/esm/models/chatgenerationtokenusage.d.ts +1 -0
- package/esm/models/chatgenerationtokenusage.js +2 -0
- package/esm/models/chatmessagetokenlogprob.d.ts +4 -4
- package/esm/models/chatmessagetokenlogprob.js +4 -5
- package/esm/models/index.d.ts +7 -0
- package/esm/models/index.js +7 -0
- package/esm/models/openairesponsesinputunion.d.ts +15 -5
- package/esm/models/openairesponsesinputunion.js +5 -5
- package/esm/models/openresponseseasyinputmessage.d.ts +41 -16
- package/esm/models/openresponseseasyinputmessage.js +38 -13
- package/esm/models/openresponsesinputmessageitem.d.ts +37 -12
- package/esm/models/openresponsesinputmessageitem.js +33 -9
- package/esm/models/openresponsesnonstreamingresponse.d.ts +5 -2
- package/esm/models/openresponsesnonstreamingresponse.js +8 -2
- package/esm/models/openresponsesreasoning.d.ts +1 -0
- package/esm/models/openresponsesreasoning.js +1 -0
- package/esm/models/openresponsesrequest.d.ts +61 -24
- package/esm/models/openresponsesrequest.js +39 -6
- package/esm/models/operations/getgeneration.d.ts +4 -0
- package/esm/models/operations/getgeneration.js +1 -0
- package/esm/models/percentilelatencycutoffs.d.ts +33 -0
- package/esm/models/percentilelatencycutoffs.js +16 -0
- package/esm/models/percentilestats.d.ts +28 -0
- package/esm/models/percentilestats.js +17 -0
- package/esm/models/percentilethroughputcutoffs.d.ts +33 -0
- package/esm/models/percentilethroughputcutoffs.js +16 -0
- package/esm/models/preferredmaxlatency.d.ts +12 -0
- package/esm/models/preferredmaxlatency.js +12 -0
- package/esm/models/preferredminthroughput.d.ts +12 -0
- package/esm/models/preferredminthroughput.js +12 -0
- package/esm/models/providername.d.ts +3 -2
- package/esm/models/providername.js +3 -2
- package/esm/models/providerpreferences.d.ts +8 -20
- package/esm/models/providerpreferences.js +6 -6
- package/esm/models/publicendpoint.d.ts +6 -0
- package/esm/models/publicendpoint.js +5 -0
- package/esm/models/responseinputimage.d.ts +11 -3
- package/esm/models/responseinputimage.js +9 -2
- package/esm/models/responseinputvideo.d.ts +20 -0
- package/esm/models/responseinputvideo.js +19 -0
- package/esm/models/responseoutputtext.d.ts +38 -0
- package/esm/models/responseoutputtext.js +50 -0
- package/esm/models/responsesoutputitemreasoning.d.ts +30 -1
- package/esm/models/responsesoutputitemreasoning.js +22 -0
- package/esm/models/responsesoutputmodality.d.ts +10 -0
- package/esm/models/responsesoutputmodality.js +12 -0
- package/esm/models/schema0.d.ts +3 -2
- package/esm/models/schema0.js +3 -2
- package/esm/models/schema3.d.ts +1 -0
- package/esm/models/schema3.js +1 -0
- package/jsr.json +1 -1
- package/package.json +6 -7
- package/vitest.config.ts +25 -16
- package/.zed/settings.json +0 -10
|
@@ -4,6 +4,7 @@ import { Result as SafeParseResult } from "../types/fp.js";
|
|
|
4
4
|
import { EndpointStatus } from "./endpointstatus.js";
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
6
|
import { Parameter } from "./parameter.js";
|
|
7
|
+
import { PercentileStats } from "./percentilestats.js";
|
|
7
8
|
import { ProviderName } from "./providername.js";
|
|
8
9
|
export type Pricing = {
|
|
9
10
|
/**
|
|
@@ -85,6 +86,11 @@ export type PublicEndpoint = {
|
|
|
85
86
|
status?: EndpointStatus | undefined;
|
|
86
87
|
uptimeLast30m: number | null;
|
|
87
88
|
supportsImplicitCaching: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
|
|
91
|
+
*/
|
|
92
|
+
latencyLast30m: PercentileStats | null;
|
|
93
|
+
throughputLast30m: PercentileStats | null;
|
|
88
94
|
};
|
|
89
95
|
/** @internal */
|
|
90
96
|
export declare const Pricing$inboundSchema: z.ZodType<Pricing, unknown>;
|
|
@@ -8,6 +8,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
8
8
|
import * as openEnums from "../types/enums.js";
|
|
9
9
|
import { EndpointStatus$inboundSchema, } from "./endpointstatus.js";
|
|
10
10
|
import { Parameter$inboundSchema } from "./parameter.js";
|
|
11
|
+
import { PercentileStats$inboundSchema, } from "./percentilestats.js";
|
|
11
12
|
import { ProviderName$inboundSchema } from "./providername.js";
|
|
12
13
|
export const PublicEndpointQuantization = {
|
|
13
14
|
Int4: "int4",
|
|
@@ -66,6 +67,8 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
66
67
|
status: EndpointStatus$inboundSchema.optional(),
|
|
67
68
|
uptime_last_30m: z.nullable(z.number()),
|
|
68
69
|
supports_implicit_caching: z.boolean(),
|
|
70
|
+
latency_last_30m: z.nullable(PercentileStats$inboundSchema),
|
|
71
|
+
throughput_last_30m: z.nullable(PercentileStats$inboundSchema),
|
|
69
72
|
}).transform((v) => {
|
|
70
73
|
return remap$(v, {
|
|
71
74
|
"model_name": "modelName",
|
|
@@ -76,6 +79,8 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
76
79
|
"supported_parameters": "supportedParameters",
|
|
77
80
|
"uptime_last_30m": "uptimeLast30m",
|
|
78
81
|
"supports_implicit_caching": "supportsImplicitCaching",
|
|
82
|
+
"latency_last_30m": "latencyLast30m",
|
|
83
|
+
"throughput_last_30m": "throughputLast30m",
|
|
79
84
|
});
|
|
80
85
|
});
|
|
81
86
|
export function publicEndpointFromJSON(jsonString) {
|
|
@@ -1,7 +1,11 @@
|
|
|
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 { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const ResponseInputImageType: {
|
|
6
|
+
readonly InputImage: "input_image";
|
|
7
|
+
};
|
|
8
|
+
export type ResponseInputImageType = ClosedEnum<typeof ResponseInputImageType>;
|
|
5
9
|
export declare const ResponseInputImageDetail: {
|
|
6
10
|
readonly Auto: "auto";
|
|
7
11
|
readonly High: "high";
|
|
@@ -12,11 +16,15 @@ export type ResponseInputImageDetail = OpenEnum<typeof ResponseInputImageDetail>
|
|
|
12
16
|
* Image input content item
|
|
13
17
|
*/
|
|
14
18
|
export type ResponseInputImage = {
|
|
15
|
-
type:
|
|
19
|
+
type: ResponseInputImageType;
|
|
16
20
|
detail: ResponseInputImageDetail;
|
|
17
21
|
imageUrl?: string | null | undefined;
|
|
18
22
|
};
|
|
19
23
|
/** @internal */
|
|
24
|
+
export declare const ResponseInputImageType$inboundSchema: z.ZodEnum<typeof ResponseInputImageType>;
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const ResponseInputImageType$outboundSchema: z.ZodEnum<typeof ResponseInputImageType>;
|
|
27
|
+
/** @internal */
|
|
20
28
|
export declare const ResponseInputImageDetail$inboundSchema: z.ZodType<ResponseInputImageDetail, unknown>;
|
|
21
29
|
/** @internal */
|
|
22
30
|
export declare const ResponseInputImageDetail$outboundSchema: z.ZodType<string, ResponseInputImageDetail>;
|
|
@@ -24,7 +32,7 @@ export declare const ResponseInputImageDetail$outboundSchema: z.ZodType<string,
|
|
|
24
32
|
export declare const ResponseInputImage$inboundSchema: z.ZodType<ResponseInputImage, unknown>;
|
|
25
33
|
/** @internal */
|
|
26
34
|
export type ResponseInputImage$Outbound = {
|
|
27
|
-
type:
|
|
35
|
+
type: string;
|
|
28
36
|
detail: string;
|
|
29
37
|
image_url?: string | null | undefined;
|
|
30
38
|
};
|
|
@@ -6,18 +6,25 @@ 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
8
|
import * as openEnums from "../types/enums.js";
|
|
9
|
+
export const ResponseInputImageType = {
|
|
10
|
+
InputImage: "input_image",
|
|
11
|
+
};
|
|
9
12
|
export const ResponseInputImageDetail = {
|
|
10
13
|
Auto: "auto",
|
|
11
14
|
High: "high",
|
|
12
15
|
Low: "low",
|
|
13
16
|
};
|
|
14
17
|
/** @internal */
|
|
18
|
+
export const ResponseInputImageType$inboundSchema = z.enum(ResponseInputImageType);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ResponseInputImageType$outboundSchema = ResponseInputImageType$inboundSchema;
|
|
21
|
+
/** @internal */
|
|
15
22
|
export const ResponseInputImageDetail$inboundSchema = openEnums.inboundSchema(ResponseInputImageDetail);
|
|
16
23
|
/** @internal */
|
|
17
24
|
export const ResponseInputImageDetail$outboundSchema = openEnums.outboundSchema(ResponseInputImageDetail);
|
|
18
25
|
/** @internal */
|
|
19
26
|
export const ResponseInputImage$inboundSchema = z.object({
|
|
20
|
-
type:
|
|
27
|
+
type: ResponseInputImageType$inboundSchema,
|
|
21
28
|
detail: ResponseInputImageDetail$inboundSchema,
|
|
22
29
|
image_url: z.nullable(z.string()).optional(),
|
|
23
30
|
}).transform((v) => {
|
|
@@ -27,7 +34,7 @@ export const ResponseInputImage$inboundSchema = z.object({
|
|
|
27
34
|
});
|
|
28
35
|
/** @internal */
|
|
29
36
|
export const ResponseInputImage$outboundSchema = z.object({
|
|
30
|
-
type:
|
|
37
|
+
type: ResponseInputImageType$outboundSchema,
|
|
31
38
|
detail: ResponseInputImageDetail$outboundSchema,
|
|
32
39
|
imageUrl: z.nullable(z.string()).optional(),
|
|
33
40
|
}).transform((v) => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* Video input content item
|
|
4
|
+
*/
|
|
5
|
+
export type ResponseInputVideo = {
|
|
6
|
+
type: "input_video";
|
|
7
|
+
/**
|
|
8
|
+
* A base64 data URL or remote URL that resolves to a video file
|
|
9
|
+
*/
|
|
10
|
+
videoUrl: string;
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type ResponseInputVideo$Outbound = {
|
|
14
|
+
type: "input_video";
|
|
15
|
+
video_url: string;
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const ResponseInputVideo$outboundSchema: z.ZodType<ResponseInputVideo$Outbound, ResponseInputVideo>;
|
|
19
|
+
export declare function responseInputVideoToJSON(responseInputVideo: ResponseInputVideo): string;
|
|
20
|
+
//# sourceMappingURL=responseinputvideo.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 79bef840e448
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ResponseInputVideo$outboundSchema = z.object({
|
|
9
|
+
type: z.literal("input_video"),
|
|
10
|
+
videoUrl: z.string(),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return remap$(v, {
|
|
13
|
+
videoUrl: "video_url",
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export function responseInputVideoToJSON(responseInputVideo) {
|
|
17
|
+
return JSON.stringify(ResponseInputVideo$outboundSchema.parse(responseInputVideo));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=responseinputvideo.js.map
|
|
@@ -2,18 +2,56 @@ 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
4
|
import { OpenAIResponsesAnnotation, OpenAIResponsesAnnotation$Outbound } from "./openairesponsesannotation.js";
|
|
5
|
+
export type ResponseOutputTextTopLogprob = {
|
|
6
|
+
token: string;
|
|
7
|
+
bytes: Array<number>;
|
|
8
|
+
logprob: number;
|
|
9
|
+
};
|
|
10
|
+
export type Logprob = {
|
|
11
|
+
token: string;
|
|
12
|
+
bytes: Array<number>;
|
|
13
|
+
logprob: number;
|
|
14
|
+
topLogprobs: Array<ResponseOutputTextTopLogprob>;
|
|
15
|
+
};
|
|
5
16
|
export type ResponseOutputText = {
|
|
6
17
|
type: "output_text";
|
|
7
18
|
text: string;
|
|
8
19
|
annotations?: Array<OpenAIResponsesAnnotation> | undefined;
|
|
20
|
+
logprobs?: Array<Logprob> | undefined;
|
|
21
|
+
};
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const ResponseOutputTextTopLogprob$inboundSchema: z.ZodType<ResponseOutputTextTopLogprob, unknown>;
|
|
24
|
+
/** @internal */
|
|
25
|
+
export type ResponseOutputTextTopLogprob$Outbound = {
|
|
26
|
+
token: string;
|
|
27
|
+
bytes: Array<number>;
|
|
28
|
+
logprob: number;
|
|
9
29
|
};
|
|
10
30
|
/** @internal */
|
|
31
|
+
export declare const ResponseOutputTextTopLogprob$outboundSchema: z.ZodType<ResponseOutputTextTopLogprob$Outbound, ResponseOutputTextTopLogprob>;
|
|
32
|
+
export declare function responseOutputTextTopLogprobToJSON(responseOutputTextTopLogprob: ResponseOutputTextTopLogprob): string;
|
|
33
|
+
export declare function responseOutputTextTopLogprobFromJSON(jsonString: string): SafeParseResult<ResponseOutputTextTopLogprob, SDKValidationError>;
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const Logprob$inboundSchema: z.ZodType<Logprob, unknown>;
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type Logprob$Outbound = {
|
|
38
|
+
token: string;
|
|
39
|
+
bytes: Array<number>;
|
|
40
|
+
logprob: number;
|
|
41
|
+
top_logprobs: Array<ResponseOutputTextTopLogprob$Outbound>;
|
|
42
|
+
};
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const Logprob$outboundSchema: z.ZodType<Logprob$Outbound, Logprob>;
|
|
45
|
+
export declare function logprobToJSON(logprob: Logprob): string;
|
|
46
|
+
export declare function logprobFromJSON(jsonString: string): SafeParseResult<Logprob, SDKValidationError>;
|
|
47
|
+
/** @internal */
|
|
11
48
|
export declare const ResponseOutputText$inboundSchema: z.ZodType<ResponseOutputText, unknown>;
|
|
12
49
|
/** @internal */
|
|
13
50
|
export type ResponseOutputText$Outbound = {
|
|
14
51
|
type: "output_text";
|
|
15
52
|
text: string;
|
|
16
53
|
annotations?: Array<OpenAIResponsesAnnotation$Outbound> | undefined;
|
|
54
|
+
logprobs?: Array<Logprob$Outbound> | undefined;
|
|
17
55
|
};
|
|
18
56
|
/** @internal */
|
|
19
57
|
export declare const ResponseOutputText$outboundSchema: z.ZodType<ResponseOutputText$Outbound, ResponseOutputText>;
|
|
@@ -3,19 +3,69 @@
|
|
|
3
3
|
* @generated-id: 2d5e61e53c46
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
7
|
import { safeParse } from "../lib/schemas.js";
|
|
7
8
|
import { OpenAIResponsesAnnotation$inboundSchema, OpenAIResponsesAnnotation$outboundSchema, } from "./openairesponsesannotation.js";
|
|
8
9
|
/** @internal */
|
|
10
|
+
export const ResponseOutputTextTopLogprob$inboundSchema = z.object({
|
|
11
|
+
token: z.string(),
|
|
12
|
+
bytes: z.array(z.number()),
|
|
13
|
+
logprob: z.number(),
|
|
14
|
+
});
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ResponseOutputTextTopLogprob$outboundSchema = z.object({
|
|
17
|
+
token: z.string(),
|
|
18
|
+
bytes: z.array(z.number()),
|
|
19
|
+
logprob: z.number(),
|
|
20
|
+
});
|
|
21
|
+
export function responseOutputTextTopLogprobToJSON(responseOutputTextTopLogprob) {
|
|
22
|
+
return JSON.stringify(ResponseOutputTextTopLogprob$outboundSchema.parse(responseOutputTextTopLogprob));
|
|
23
|
+
}
|
|
24
|
+
export function responseOutputTextTopLogprobFromJSON(jsonString) {
|
|
25
|
+
return safeParse(jsonString, (x) => ResponseOutputTextTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseOutputTextTopLogprob' from JSON`);
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const Logprob$inboundSchema = z.object({
|
|
29
|
+
token: z.string(),
|
|
30
|
+
bytes: z.array(z.number()),
|
|
31
|
+
logprob: z.number(),
|
|
32
|
+
top_logprobs: z.array(z.lazy(() => ResponseOutputTextTopLogprob$inboundSchema)),
|
|
33
|
+
}).transform((v) => {
|
|
34
|
+
return remap$(v, {
|
|
35
|
+
"top_logprobs": "topLogprobs",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const Logprob$outboundSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
token: z.string(),
|
|
42
|
+
bytes: z.array(z.number()),
|
|
43
|
+
logprob: z.number(),
|
|
44
|
+
topLogprobs: z.array(z.lazy(() => ResponseOutputTextTopLogprob$outboundSchema)),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
topLogprobs: "top_logprobs",
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export function logprobToJSON(logprob) {
|
|
51
|
+
return JSON.stringify(Logprob$outboundSchema.parse(logprob));
|
|
52
|
+
}
|
|
53
|
+
export function logprobFromJSON(jsonString) {
|
|
54
|
+
return safeParse(jsonString, (x) => Logprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Logprob' from JSON`);
|
|
55
|
+
}
|
|
56
|
+
/** @internal */
|
|
9
57
|
export const ResponseOutputText$inboundSchema = z.object({
|
|
10
58
|
type: z.literal("output_text"),
|
|
11
59
|
text: z.string(),
|
|
12
60
|
annotations: z.array(OpenAIResponsesAnnotation$inboundSchema).optional(),
|
|
61
|
+
logprobs: z.array(z.lazy(() => Logprob$inboundSchema)).optional(),
|
|
13
62
|
});
|
|
14
63
|
/** @internal */
|
|
15
64
|
export const ResponseOutputText$outboundSchema = z.object({
|
|
16
65
|
type: z.literal("output_text"),
|
|
17
66
|
text: z.string(),
|
|
18
67
|
annotations: z.array(OpenAIResponsesAnnotation$outboundSchema).optional(),
|
|
68
|
+
logprobs: z.array(z.lazy(() => Logprob$outboundSchema)).optional(),
|
|
19
69
|
});
|
|
20
70
|
export function responseOutputTextToJSON(responseOutputText) {
|
|
21
71
|
return JSON.stringify(ResponseOutputText$outboundSchema.parse(responseOutputText));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { ClosedEnum } from "../types/enums.js";
|
|
2
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
5
|
import { ReasoningSummaryText, ReasoningSummaryText$Outbound } from "./reasoningsummarytext.js";
|
|
@@ -21,6 +21,21 @@ export declare const ResponsesOutputItemReasoningStatusCompleted: {
|
|
|
21
21
|
};
|
|
22
22
|
export type ResponsesOutputItemReasoningStatusCompleted = ClosedEnum<typeof ResponsesOutputItemReasoningStatusCompleted>;
|
|
23
23
|
export type ResponsesOutputItemReasoningStatusUnion = ResponsesOutputItemReasoningStatusCompleted | ResponsesOutputItemReasoningStatusIncomplete | ResponsesOutputItemReasoningStatusInProgress;
|
|
24
|
+
/**
|
|
25
|
+
* The format of the reasoning content
|
|
26
|
+
*/
|
|
27
|
+
export declare const ResponsesOutputItemReasoningFormat: {
|
|
28
|
+
readonly Unknown: "unknown";
|
|
29
|
+
readonly OpenaiResponsesV1: "openai-responses-v1";
|
|
30
|
+
readonly AzureOpenaiResponsesV1: "azure-openai-responses-v1";
|
|
31
|
+
readonly XaiResponsesV1: "xai-responses-v1";
|
|
32
|
+
readonly AnthropicClaudeV1: "anthropic-claude-v1";
|
|
33
|
+
readonly GoogleGeminiV1: "google-gemini-v1";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The format of the reasoning content
|
|
37
|
+
*/
|
|
38
|
+
export type ResponsesOutputItemReasoningFormat = OpenEnum<typeof ResponsesOutputItemReasoningFormat>;
|
|
24
39
|
/**
|
|
25
40
|
* An output item containing reasoning
|
|
26
41
|
*/
|
|
@@ -31,6 +46,14 @@ export type ResponsesOutputItemReasoning = {
|
|
|
31
46
|
summary: Array<ReasoningSummaryText>;
|
|
32
47
|
encryptedContent?: string | null | undefined;
|
|
33
48
|
status?: ResponsesOutputItemReasoningStatusCompleted | ResponsesOutputItemReasoningStatusIncomplete | ResponsesOutputItemReasoningStatusInProgress | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* A signature for the reasoning content, used for verification
|
|
51
|
+
*/
|
|
52
|
+
signature?: string | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The format of the reasoning content
|
|
55
|
+
*/
|
|
56
|
+
format?: ResponsesOutputItemReasoningFormat | null | undefined;
|
|
34
57
|
};
|
|
35
58
|
/** @internal */
|
|
36
59
|
export declare const ResponsesOutputItemReasoningType$inboundSchema: z.ZodEnum<typeof ResponsesOutputItemReasoningType>;
|
|
@@ -57,6 +80,10 @@ export declare const ResponsesOutputItemReasoningStatusUnion$outboundSchema: z.Z
|
|
|
57
80
|
export declare function responsesOutputItemReasoningStatusUnionToJSON(responsesOutputItemReasoningStatusUnion: ResponsesOutputItemReasoningStatusUnion): string;
|
|
58
81
|
export declare function responsesOutputItemReasoningStatusUnionFromJSON(jsonString: string): SafeParseResult<ResponsesOutputItemReasoningStatusUnion, SDKValidationError>;
|
|
59
82
|
/** @internal */
|
|
83
|
+
export declare const ResponsesOutputItemReasoningFormat$inboundSchema: z.ZodType<ResponsesOutputItemReasoningFormat, unknown>;
|
|
84
|
+
/** @internal */
|
|
85
|
+
export declare const ResponsesOutputItemReasoningFormat$outboundSchema: z.ZodType<string, ResponsesOutputItemReasoningFormat>;
|
|
86
|
+
/** @internal */
|
|
60
87
|
export declare const ResponsesOutputItemReasoning$inboundSchema: z.ZodType<ResponsesOutputItemReasoning, unknown>;
|
|
61
88
|
/** @internal */
|
|
62
89
|
export type ResponsesOutputItemReasoning$Outbound = {
|
|
@@ -66,6 +93,8 @@ export type ResponsesOutputItemReasoning$Outbound = {
|
|
|
66
93
|
summary: Array<ReasoningSummaryText$Outbound>;
|
|
67
94
|
encrypted_content?: string | null | undefined;
|
|
68
95
|
status?: string | string | string | undefined;
|
|
96
|
+
signature?: string | null | undefined;
|
|
97
|
+
format?: string | null | undefined;
|
|
69
98
|
};
|
|
70
99
|
/** @internal */
|
|
71
100
|
export declare const ResponsesOutputItemReasoning$outboundSchema: z.ZodType<ResponsesOutputItemReasoning$Outbound, ResponsesOutputItemReasoning>;
|
|
@@ -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 * as openEnums from "../types/enums.js";
|
|
8
9
|
import { ReasoningSummaryText$inboundSchema, ReasoningSummaryText$outboundSchema, } from "./reasoningsummarytext.js";
|
|
9
10
|
import { ReasoningTextContent$inboundSchema, ReasoningTextContent$outboundSchema, } from "./reasoningtextcontent.js";
|
|
10
11
|
export const ResponsesOutputItemReasoningType = {
|
|
@@ -19,6 +20,17 @@ export const ResponsesOutputItemReasoningStatusIncomplete = {
|
|
|
19
20
|
export const ResponsesOutputItemReasoningStatusCompleted = {
|
|
20
21
|
Completed: "completed",
|
|
21
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The format of the reasoning content
|
|
25
|
+
*/
|
|
26
|
+
export const ResponsesOutputItemReasoningFormat = {
|
|
27
|
+
Unknown: "unknown",
|
|
28
|
+
OpenaiResponsesV1: "openai-responses-v1",
|
|
29
|
+
AzureOpenaiResponsesV1: "azure-openai-responses-v1",
|
|
30
|
+
XaiResponsesV1: "xai-responses-v1",
|
|
31
|
+
AnthropicClaudeV1: "anthropic-claude-v1",
|
|
32
|
+
GoogleGeminiV1: "google-gemini-v1",
|
|
33
|
+
};
|
|
22
34
|
/** @internal */
|
|
23
35
|
export const ResponsesOutputItemReasoningType$inboundSchema = z.enum(ResponsesOutputItemReasoningType);
|
|
24
36
|
/** @internal */
|
|
@@ -54,6 +66,10 @@ export function responsesOutputItemReasoningStatusUnionFromJSON(jsonString) {
|
|
|
54
66
|
return safeParse(jsonString, (x) => ResponsesOutputItemReasoningStatusUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponsesOutputItemReasoningStatusUnion' from JSON`);
|
|
55
67
|
}
|
|
56
68
|
/** @internal */
|
|
69
|
+
export const ResponsesOutputItemReasoningFormat$inboundSchema = openEnums.inboundSchema(ResponsesOutputItemReasoningFormat);
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const ResponsesOutputItemReasoningFormat$outboundSchema = openEnums.outboundSchema(ResponsesOutputItemReasoningFormat);
|
|
72
|
+
/** @internal */
|
|
57
73
|
export const ResponsesOutputItemReasoning$inboundSchema = z.object({
|
|
58
74
|
type: ResponsesOutputItemReasoningType$inboundSchema,
|
|
59
75
|
id: z.string(),
|
|
@@ -65,6 +81,9 @@ export const ResponsesOutputItemReasoning$inboundSchema = z.object({
|
|
|
65
81
|
ResponsesOutputItemReasoningStatusIncomplete$inboundSchema,
|
|
66
82
|
ResponsesOutputItemReasoningStatusInProgress$inboundSchema,
|
|
67
83
|
]).optional(),
|
|
84
|
+
signature: z.nullable(z.string()).optional(),
|
|
85
|
+
format: z.nullable(ResponsesOutputItemReasoningFormat$inboundSchema)
|
|
86
|
+
.optional(),
|
|
68
87
|
}).transform((v) => {
|
|
69
88
|
return remap$(v, {
|
|
70
89
|
"encrypted_content": "encryptedContent",
|
|
@@ -82,6 +101,9 @@ export const ResponsesOutputItemReasoning$outboundSchema = z.object({
|
|
|
82
101
|
ResponsesOutputItemReasoningStatusIncomplete$outboundSchema,
|
|
83
102
|
ResponsesOutputItemReasoningStatusInProgress$outboundSchema,
|
|
84
103
|
]).optional(),
|
|
104
|
+
signature: z.nullable(z.string()).optional(),
|
|
105
|
+
format: z.nullable(ResponsesOutputItemReasoningFormat$outboundSchema)
|
|
106
|
+
.optional(),
|
|
85
107
|
}).transform((v) => {
|
|
86
108
|
return remap$(v, {
|
|
87
109
|
encryptedContent: "encrypted_content",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const ResponsesOutputModality: {
|
|
4
|
+
readonly Text: "text";
|
|
5
|
+
readonly Image: "image";
|
|
6
|
+
};
|
|
7
|
+
export type ResponsesOutputModality = OpenEnum<typeof ResponsesOutputModality>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const ResponsesOutputModality$outboundSchema: z.ZodType<string, ResponsesOutputModality>;
|
|
10
|
+
//# sourceMappingURL=responsesoutputmodality.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c42840bf36d8
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
export const ResponsesOutputModality = {
|
|
7
|
+
Text: "text",
|
|
8
|
+
Image: "image",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const ResponsesOutputModality$outboundSchema = openEnums.outboundSchema(ResponsesOutputModality);
|
|
12
|
+
//# sourceMappingURL=responsesoutputmodality.js.map
|
package/esm/models/schema0.d.ts
CHANGED
|
@@ -27,12 +27,12 @@ export declare const Schema0Enum: {
|
|
|
27
27
|
readonly Fireworks: "Fireworks";
|
|
28
28
|
readonly Friendli: "Friendli";
|
|
29
29
|
readonly GMICloud: "GMICloud";
|
|
30
|
-
readonly GoPomelo: "GoPomelo";
|
|
31
30
|
readonly Google: "Google";
|
|
32
31
|
readonly GoogleAIStudio: "Google AI Studio";
|
|
33
32
|
readonly Groq: "Groq";
|
|
34
33
|
readonly Hyperbolic: "Hyperbolic";
|
|
35
34
|
readonly Inception: "Inception";
|
|
35
|
+
readonly Inceptron: "Inceptron";
|
|
36
36
|
readonly InferenceNet: "InferenceNet";
|
|
37
37
|
readonly Infermatic: "Infermatic";
|
|
38
38
|
readonly Inflection: "Inflection";
|
|
@@ -57,13 +57,14 @@ export declare const Schema0Enum: {
|
|
|
57
57
|
readonly Phala: "Phala";
|
|
58
58
|
readonly Relace: "Relace";
|
|
59
59
|
readonly SambaNova: "SambaNova";
|
|
60
|
+
readonly Seed: "Seed";
|
|
60
61
|
readonly SiliconFlow: "SiliconFlow";
|
|
61
62
|
readonly Sourceful: "Sourceful";
|
|
62
63
|
readonly Stealth: "Stealth";
|
|
63
64
|
readonly StreamLake: "StreamLake";
|
|
64
65
|
readonly Switchpoint: "Switchpoint";
|
|
65
|
-
readonly Targon: "Targon";
|
|
66
66
|
readonly Together: "Together";
|
|
67
|
+
readonly Upstage: "Upstage";
|
|
67
68
|
readonly Venice: "Venice";
|
|
68
69
|
readonly WandB: "WandB";
|
|
69
70
|
readonly Xiaomi: "Xiaomi";
|
package/esm/models/schema0.js
CHANGED
|
@@ -31,12 +31,12 @@ export const Schema0Enum = {
|
|
|
31
31
|
Fireworks: "Fireworks",
|
|
32
32
|
Friendli: "Friendli",
|
|
33
33
|
GMICloud: "GMICloud",
|
|
34
|
-
GoPomelo: "GoPomelo",
|
|
35
34
|
Google: "Google",
|
|
36
35
|
GoogleAIStudio: "Google AI Studio",
|
|
37
36
|
Groq: "Groq",
|
|
38
37
|
Hyperbolic: "Hyperbolic",
|
|
39
38
|
Inception: "Inception",
|
|
39
|
+
Inceptron: "Inceptron",
|
|
40
40
|
InferenceNet: "InferenceNet",
|
|
41
41
|
Infermatic: "Infermatic",
|
|
42
42
|
Inflection: "Inflection",
|
|
@@ -61,13 +61,14 @@ export const Schema0Enum = {
|
|
|
61
61
|
Phala: "Phala",
|
|
62
62
|
Relace: "Relace",
|
|
63
63
|
SambaNova: "SambaNova",
|
|
64
|
+
Seed: "Seed",
|
|
64
65
|
SiliconFlow: "SiliconFlow",
|
|
65
66
|
Sourceful: "Sourceful",
|
|
66
67
|
Stealth: "Stealth",
|
|
67
68
|
StreamLake: "StreamLake",
|
|
68
69
|
Switchpoint: "Switchpoint",
|
|
69
|
-
Targon: "Targon",
|
|
70
70
|
Together: "Together",
|
|
71
|
+
Upstage: "Upstage",
|
|
71
72
|
Venice: "Venice",
|
|
72
73
|
WandB: "WandB",
|
|
73
74
|
Xiaomi: "Xiaomi",
|
package/esm/models/schema3.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
5
5
|
export declare const Schema5: {
|
|
6
6
|
readonly Unknown: "unknown";
|
|
7
7
|
readonly OpenaiResponsesV1: "openai-responses-v1";
|
|
8
|
+
readonly AzureOpenaiResponsesV1: "azure-openai-responses-v1";
|
|
8
9
|
readonly XaiResponsesV1: "xai-responses-v1";
|
|
9
10
|
readonly AnthropicClaudeV1: "anthropic-claude-v1";
|
|
10
11
|
readonly GoogleGeminiV1: "google-gemini-v1";
|
package/esm/models/schema3.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as openEnums from "../types/enums.js";
|
|
|
8
8
|
export const Schema5 = {
|
|
9
9
|
Unknown: "unknown",
|
|
10
10
|
OpenaiResponsesV1: "openai-responses-v1",
|
|
11
|
+
AzureOpenaiResponsesV1: "azure-openai-responses-v1",
|
|
11
12
|
XaiResponsesV1: "xai-responses-v1",
|
|
12
13
|
AnthropicClaudeV1: "anthropic-claude-v1",
|
|
13
14
|
GoogleGeminiV1: "google-gemini-v1",
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,11 +69,9 @@
|
|
|
69
69
|
"build": "tsc",
|
|
70
70
|
"typecheck": "tsc --noEmit",
|
|
71
71
|
"prepublishOnly": "npm run build",
|
|
72
|
-
"test": "vitest --run",
|
|
73
|
-
"test:
|
|
74
|
-
|
|
75
|
-
"peerDependencies": {
|
|
76
|
-
|
|
72
|
+
"test": "vitest --run --project unit",
|
|
73
|
+
"test:e2e": "vitest --run --project e2e",
|
|
74
|
+
"test:watch": "vitest --watch --project unit"
|
|
77
75
|
},
|
|
78
76
|
"devDependencies": {
|
|
79
77
|
"@eslint/js": "^9.19.0",
|
|
@@ -87,5 +85,6 @@
|
|
|
87
85
|
},
|
|
88
86
|
"dependencies": {
|
|
89
87
|
"zod": "^3.25.0 || ^4.0.0"
|
|
90
|
-
}
|
|
88
|
+
},
|
|
89
|
+
"packageManager": "pnpm@10.22.0"
|
|
91
90
|
}
|
package/vitest.config.ts
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
import { dirname, join } from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
1
|
import { config } from 'dotenv';
|
|
4
2
|
import { defineConfig } from 'vitest/config';
|
|
5
3
|
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
|
|
9
4
|
// Load environment variables from .env file if it exists
|
|
10
5
|
// This will not override existing environment variables
|
|
11
6
|
config({
|
|
12
|
-
path:
|
|
7
|
+
path: new URL('.env', import.meta.url),
|
|
13
8
|
});
|
|
14
9
|
|
|
15
10
|
export default defineConfig({
|
|
16
11
|
test: {
|
|
17
12
|
globals: true,
|
|
18
13
|
environment: 'node',
|
|
19
|
-
// Don't override env vars - just let them pass through from the system
|
|
20
|
-
// The env object here will be merged with process.env
|
|
21
14
|
env: {
|
|
22
15
|
OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
|
|
23
16
|
},
|
|
24
|
-
include: [
|
|
25
|
-
'tests/**/*.test.ts',
|
|
26
|
-
],
|
|
27
|
-
hookTimeout: 30000,
|
|
28
|
-
testTimeout: 30000,
|
|
29
17
|
typecheck: {
|
|
30
18
|
enabled: true,
|
|
31
|
-
include: [
|
|
32
|
-
'tests/**/*.test.ts',
|
|
33
|
-
],
|
|
34
19
|
},
|
|
20
|
+
projects: [
|
|
21
|
+
{
|
|
22
|
+
extends: true,
|
|
23
|
+
test: {
|
|
24
|
+
name: 'unit',
|
|
25
|
+
include: [
|
|
26
|
+
'tests/unit/**/*.test.ts',
|
|
27
|
+
'tests/funcs/**/*.test.ts',
|
|
28
|
+
'tests/sdk/**/*.test.ts'
|
|
29
|
+
],
|
|
30
|
+
testTimeout: 10000,
|
|
31
|
+
hookTimeout: 10000,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
extends: true,
|
|
36
|
+
test: {
|
|
37
|
+
name: 'e2e',
|
|
38
|
+
include: ['tests/e2e/**/*.test.ts'],
|
|
39
|
+
testTimeout: 30000,
|
|
40
|
+
hookTimeout: 30000,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
35
44
|
},
|
|
36
45
|
});
|