@openrouter/sdk 0.13.35 → 0.13.37
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/basereasoningconfig.d.ts +5 -0
- package/esm/models/basereasoningconfig.js +2 -0
- package/esm/models/imagegenerationservertool.d.ts +2 -22
- package/esm/models/imagegenerationservertool.js +4 -26
- package/esm/models/index.d.ts +3 -0
- package/esm/models/index.js +3 -0
- package/esm/models/inputtext.d.ts +6 -0
- package/esm/models/inputtext.js +14 -0
- package/esm/models/promptcachebreakpoint.d.ts +29 -0
- package/esm/models/promptcachebreakpoint.js +28 -0
- package/esm/models/promptcacheoptions.d.ts +24 -0
- package/esm/models/promptcacheoptions.js +19 -0
- package/esm/models/reasoningconfig.d.ts +6 -0
- package/esm/models/reasoningconfig.js +2 -0
- package/esm/models/reasoningcontext.d.ts +19 -0
- package/esm/models/reasoningcontext.js +18 -0
- package/esm/models/responseserrorfield.d.ts +1 -0
- package/esm/models/responseserrorfield.js +1 -0
- package/esm/models/responsesrequest.d.ts +6 -0
- package/esm/models/responsesrequest.js +3 -0
- package/esm/models/usage.d.ts +1 -0
- package/esm/models/usage.js +2 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
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.37";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.37 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.37",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.37 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
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
|
+
import { ReasoningContext } from "./reasoningcontext.js";
|
|
4
5
|
import { ReasoningEffort } from "./reasoningeffort.js";
|
|
5
6
|
import { ReasoningMode } from "./reasoningmode.js";
|
|
6
7
|
import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
|
|
7
8
|
export type BaseReasoningConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
|
|
11
|
+
*/
|
|
12
|
+
context?: ReasoningContext | null | undefined;
|
|
8
13
|
effort?: ReasoningEffort | null | undefined;
|
|
9
14
|
/**
|
|
10
15
|
* Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ReasoningContext$inboundSchema, } from "./reasoningcontext.js";
|
|
7
8
|
import { ReasoningEffort$inboundSchema, } from "./reasoningeffort.js";
|
|
8
9
|
import { ReasoningMode$inboundSchema } from "./reasoningmode.js";
|
|
9
10
|
import { ReasoningSummaryVerbosity$inboundSchema, } from "./reasoningsummaryverbosity.js";
|
|
10
11
|
/** @internal */
|
|
11
12
|
export const BaseReasoningConfig$inboundSchema = z.object({
|
|
13
|
+
context: z.nullable(ReasoningContext$inboundSchema).optional(),
|
|
12
14
|
effort: z.nullable(ReasoningEffort$inboundSchema).optional(),
|
|
13
15
|
mode: z.nullable(ReasoningMode$inboundSchema).optional(),
|
|
14
16
|
summary: z.nullable(ReasoningSummaryVerbosity$inboundSchema).optional(),
|
|
@@ -17,11 +17,6 @@ export type InputImageMask = {
|
|
|
17
17
|
fileId?: string | undefined;
|
|
18
18
|
imageUrl?: string | undefined;
|
|
19
19
|
};
|
|
20
|
-
export declare const ModelEnum: {
|
|
21
|
-
readonly GptImage1: "gpt-image-1";
|
|
22
|
-
readonly GptImage1Mini: "gpt-image-1-mini";
|
|
23
|
-
};
|
|
24
|
-
export type ModelEnum = OpenEnum<typeof ModelEnum>;
|
|
25
20
|
export declare const Moderation: {
|
|
26
21
|
readonly Auto: "auto";
|
|
27
22
|
readonly Low: "low";
|
|
@@ -40,13 +35,6 @@ export declare const ImageGenerationServerToolQuality: {
|
|
|
40
35
|
readonly Auto: "auto";
|
|
41
36
|
};
|
|
42
37
|
export type ImageGenerationServerToolQuality = OpenEnum<typeof ImageGenerationServerToolQuality>;
|
|
43
|
-
export declare const Size: {
|
|
44
|
-
readonly OneThousandAndTwentyFourx1024: "1024x1024";
|
|
45
|
-
readonly OneThousandAndTwentyFourx1536: "1024x1536";
|
|
46
|
-
readonly OneThousandFiveHundredAndThirtySixx1024: "1536x1024";
|
|
47
|
-
readonly Auto: "auto";
|
|
48
|
-
};
|
|
49
|
-
export type Size = OpenEnum<typeof Size>;
|
|
50
38
|
/**
|
|
51
39
|
* Image generation tool configuration
|
|
52
40
|
*/
|
|
@@ -54,13 +42,13 @@ export type ImageGenerationServerTool = {
|
|
|
54
42
|
background?: ImageGenerationServerToolBackground | undefined;
|
|
55
43
|
inputFidelity?: InputFidelity | null | undefined;
|
|
56
44
|
inputImageMask?: InputImageMask | undefined;
|
|
57
|
-
model?:
|
|
45
|
+
model?: string | undefined;
|
|
58
46
|
moderation?: Moderation | undefined;
|
|
59
47
|
outputCompression?: number | undefined;
|
|
60
48
|
outputFormat?: ImageGenerationServerToolOutputFormat | undefined;
|
|
61
49
|
partialImages?: number | undefined;
|
|
62
50
|
quality?: ImageGenerationServerToolQuality | undefined;
|
|
63
|
-
size?:
|
|
51
|
+
size?: string | undefined;
|
|
64
52
|
type: "image_generation";
|
|
65
53
|
};
|
|
66
54
|
/** @internal */
|
|
@@ -83,10 +71,6 @@ export declare const InputImageMask$outboundSchema: z.ZodType<InputImageMask$Out
|
|
|
83
71
|
export declare function inputImageMaskToJSON(inputImageMask: InputImageMask): string;
|
|
84
72
|
export declare function inputImageMaskFromJSON(jsonString: string): SafeParseResult<InputImageMask, SDKValidationError>;
|
|
85
73
|
/** @internal */
|
|
86
|
-
export declare const ModelEnum$inboundSchema: z.ZodType<ModelEnum, unknown>;
|
|
87
|
-
/** @internal */
|
|
88
|
-
export declare const ModelEnum$outboundSchema: z.ZodType<string, ModelEnum>;
|
|
89
|
-
/** @internal */
|
|
90
74
|
export declare const Moderation$inboundSchema: z.ZodType<Moderation, unknown>;
|
|
91
75
|
/** @internal */
|
|
92
76
|
export declare const Moderation$outboundSchema: z.ZodType<string, Moderation>;
|
|
@@ -99,10 +83,6 @@ export declare const ImageGenerationServerToolQuality$inboundSchema: z.ZodType<I
|
|
|
99
83
|
/** @internal */
|
|
100
84
|
export declare const ImageGenerationServerToolQuality$outboundSchema: z.ZodType<string, ImageGenerationServerToolQuality>;
|
|
101
85
|
/** @internal */
|
|
102
|
-
export declare const Size$inboundSchema: z.ZodType<Size, unknown>;
|
|
103
|
-
/** @internal */
|
|
104
|
-
export declare const Size$outboundSchema: z.ZodType<string, Size>;
|
|
105
|
-
/** @internal */
|
|
106
86
|
export declare const ImageGenerationServerTool$inboundSchema: z.ZodType<ImageGenerationServerTool, unknown>;
|
|
107
87
|
/** @internal */
|
|
108
88
|
export type ImageGenerationServerTool$Outbound = {
|
|
@@ -15,10 +15,6 @@ export const InputFidelity = {
|
|
|
15
15
|
High: "high",
|
|
16
16
|
Low: "low",
|
|
17
17
|
};
|
|
18
|
-
export const ModelEnum = {
|
|
19
|
-
GptImage1: "gpt-image-1",
|
|
20
|
-
GptImage1Mini: "gpt-image-1-mini",
|
|
21
|
-
};
|
|
22
18
|
export const Moderation = {
|
|
23
19
|
Auto: "auto",
|
|
24
20
|
Low: "low",
|
|
@@ -34,12 +30,6 @@ export const ImageGenerationServerToolQuality = {
|
|
|
34
30
|
High: "high",
|
|
35
31
|
Auto: "auto",
|
|
36
32
|
};
|
|
37
|
-
export const Size = {
|
|
38
|
-
OneThousandAndTwentyFourx1024: "1024x1024",
|
|
39
|
-
OneThousandAndTwentyFourx1536: "1024x1536",
|
|
40
|
-
OneThousandFiveHundredAndThirtySixx1024: "1536x1024",
|
|
41
|
-
Auto: "auto",
|
|
42
|
-
};
|
|
43
33
|
/** @internal */
|
|
44
34
|
export const ImageGenerationServerToolBackground$inboundSchema = openEnums.inboundSchema(ImageGenerationServerToolBackground);
|
|
45
35
|
/** @internal */
|
|
@@ -75,12 +65,6 @@ export function inputImageMaskFromJSON(jsonString) {
|
|
|
75
65
|
return safeParse(jsonString, (x) => InputImageMask$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InputImageMask' from JSON`);
|
|
76
66
|
}
|
|
77
67
|
/** @internal */
|
|
78
|
-
export const ModelEnum$inboundSchema = openEnums
|
|
79
|
-
.inboundSchema(ModelEnum);
|
|
80
|
-
/** @internal */
|
|
81
|
-
export const ModelEnum$outboundSchema = openEnums
|
|
82
|
-
.outboundSchema(ModelEnum);
|
|
83
|
-
/** @internal */
|
|
84
68
|
export const Moderation$inboundSchema = openEnums.inboundSchema(Moderation);
|
|
85
69
|
/** @internal */
|
|
86
70
|
export const Moderation$outboundSchema = openEnums.outboundSchema(Moderation);
|
|
@@ -93,23 +77,17 @@ export const ImageGenerationServerToolQuality$inboundSchema = openEnums.inboundS
|
|
|
93
77
|
/** @internal */
|
|
94
78
|
export const ImageGenerationServerToolQuality$outboundSchema = openEnums.outboundSchema(ImageGenerationServerToolQuality);
|
|
95
79
|
/** @internal */
|
|
96
|
-
export const Size$inboundSchema = openEnums
|
|
97
|
-
.inboundSchema(Size);
|
|
98
|
-
/** @internal */
|
|
99
|
-
export const Size$outboundSchema = openEnums
|
|
100
|
-
.outboundSchema(Size);
|
|
101
|
-
/** @internal */
|
|
102
80
|
export const ImageGenerationServerTool$inboundSchema = z.object({
|
|
103
81
|
background: ImageGenerationServerToolBackground$inboundSchema.optional(),
|
|
104
82
|
input_fidelity: z.nullable(InputFidelity$inboundSchema).optional(),
|
|
105
83
|
input_image_mask: z.lazy(() => InputImageMask$inboundSchema).optional(),
|
|
106
|
-
model:
|
|
84
|
+
model: z.string().optional(),
|
|
107
85
|
moderation: Moderation$inboundSchema.optional(),
|
|
108
86
|
output_compression: z.int().optional(),
|
|
109
87
|
output_format: ImageGenerationServerToolOutputFormat$inboundSchema.optional(),
|
|
110
88
|
partial_images: z.int().optional(),
|
|
111
89
|
quality: ImageGenerationServerToolQuality$inboundSchema.optional(),
|
|
112
|
-
size:
|
|
90
|
+
size: z.string().optional(),
|
|
113
91
|
type: z.literal("image_generation"),
|
|
114
92
|
}).transform((v) => {
|
|
115
93
|
return remap$(v, {
|
|
@@ -125,13 +103,13 @@ export const ImageGenerationServerTool$outboundSchema = z.object({
|
|
|
125
103
|
background: ImageGenerationServerToolBackground$outboundSchema.optional(),
|
|
126
104
|
inputFidelity: z.nullable(InputFidelity$outboundSchema).optional(),
|
|
127
105
|
inputImageMask: z.lazy(() => InputImageMask$outboundSchema).optional(),
|
|
128
|
-
model:
|
|
106
|
+
model: z.string().optional(),
|
|
129
107
|
moderation: Moderation$outboundSchema.optional(),
|
|
130
108
|
outputCompression: z.int().optional(),
|
|
131
109
|
outputFormat: ImageGenerationServerToolOutputFormat$outboundSchema.optional(),
|
|
132
110
|
partialImages: z.int().optional(),
|
|
133
111
|
quality: ImageGenerationServerToolQuality$outboundSchema.optional(),
|
|
134
|
-
size:
|
|
112
|
+
size: z.string().optional(),
|
|
135
113
|
type: z.literal("image_generation"),
|
|
136
114
|
}).transform((v) => {
|
|
137
115
|
return remap$(v, {
|
package/esm/models/index.d.ts
CHANGED
|
@@ -392,6 +392,8 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
392
392
|
export * from "./preview20250311websearchservertool.js";
|
|
393
393
|
export * from "./previewwebsearchservertool.js";
|
|
394
394
|
export * from "./previewwebsearchuserlocation.js";
|
|
395
|
+
export * from "./promptcachebreakpoint.js";
|
|
396
|
+
export * from "./promptcacheoptions.js";
|
|
395
397
|
export * from "./promptinjectionscanscope.js";
|
|
396
398
|
export * from "./providername.js";
|
|
397
399
|
export * from "./provideroptions.js";
|
|
@@ -408,6 +410,7 @@ export * from "./rankingsdailyitem.js";
|
|
|
408
410
|
export * from "./rankingsdailymeta.js";
|
|
409
411
|
export * from "./rankingsdailyresponse.js";
|
|
410
412
|
export * from "./reasoningconfig.js";
|
|
413
|
+
export * from "./reasoningcontext.js";
|
|
411
414
|
export * from "./reasoningdeltaevent.js";
|
|
412
415
|
export * from "./reasoningdetailencrypted.js";
|
|
413
416
|
export * from "./reasoningdetailservertoolcall.js";
|
package/esm/models/index.js
CHANGED
|
@@ -396,6 +396,8 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
396
396
|
export * from "./preview20250311websearchservertool.js";
|
|
397
397
|
export * from "./previewwebsearchservertool.js";
|
|
398
398
|
export * from "./previewwebsearchuserlocation.js";
|
|
399
|
+
export * from "./promptcachebreakpoint.js";
|
|
400
|
+
export * from "./promptcacheoptions.js";
|
|
399
401
|
export * from "./promptinjectionscanscope.js";
|
|
400
402
|
export * from "./providername.js";
|
|
401
403
|
export * from "./provideroptions.js";
|
|
@@ -412,6 +414,7 @@ export * from "./rankingsdailyitem.js";
|
|
|
412
414
|
export * from "./rankingsdailymeta.js";
|
|
413
415
|
export * from "./rankingsdailyresponse.js";
|
|
414
416
|
export * from "./reasoningconfig.js";
|
|
417
|
+
export * from "./reasoningcontext.js";
|
|
415
418
|
export * from "./reasoningdeltaevent.js";
|
|
416
419
|
export * from "./reasoningdetailencrypted.js";
|
|
417
420
|
export * from "./reasoningdetailservertoolcall.js";
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
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
|
+
import { PromptCacheBreakpoint, PromptCacheBreakpoint$Outbound } from "./promptcachebreakpoint.js";
|
|
4
5
|
/**
|
|
5
6
|
* Text input content item
|
|
6
7
|
*/
|
|
7
8
|
export type InputText = {
|
|
9
|
+
/**
|
|
10
|
+
* Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.
|
|
11
|
+
*/
|
|
12
|
+
promptCacheBreakpoint?: PromptCacheBreakpoint | null | undefined;
|
|
8
13
|
text: string;
|
|
9
14
|
type: "input_text";
|
|
10
15
|
};
|
|
@@ -12,6 +17,7 @@ export type InputText = {
|
|
|
12
17
|
export declare const InputText$inboundSchema: z.ZodType<InputText, unknown>;
|
|
13
18
|
/** @internal */
|
|
14
19
|
export type InputText$Outbound = {
|
|
20
|
+
prompt_cache_breakpoint?: PromptCacheBreakpoint$Outbound | null | undefined;
|
|
15
21
|
text: string;
|
|
16
22
|
type: "input_text";
|
|
17
23
|
};
|
package/esm/models/inputtext.js
CHANGED
|
@@ -3,16 +3,30 @@
|
|
|
3
3
|
* @generated-id: 8d6c10a240ae
|
|
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";
|
|
8
|
+
import { PromptCacheBreakpoint$inboundSchema, PromptCacheBreakpoint$outboundSchema, } from "./promptcachebreakpoint.js";
|
|
7
9
|
/** @internal */
|
|
8
10
|
export const InputText$inboundSchema = z.object({
|
|
11
|
+
prompt_cache_breakpoint: z.nullable(PromptCacheBreakpoint$inboundSchema)
|
|
12
|
+
.optional(),
|
|
9
13
|
text: z.string(),
|
|
10
14
|
type: z.literal("input_text"),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
"prompt_cache_breakpoint": "promptCacheBreakpoint",
|
|
18
|
+
});
|
|
11
19
|
});
|
|
12
20
|
/** @internal */
|
|
13
21
|
export const InputText$outboundSchema = z.object({
|
|
22
|
+
promptCacheBreakpoint: z.nullable(PromptCacheBreakpoint$outboundSchema)
|
|
23
|
+
.optional(),
|
|
14
24
|
text: z.string(),
|
|
15
25
|
type: z.literal("input_text"),
|
|
26
|
+
}).transform((v) => {
|
|
27
|
+
return remap$(v, {
|
|
28
|
+
promptCacheBreakpoint: "prompt_cache_breakpoint",
|
|
29
|
+
});
|
|
16
30
|
});
|
|
17
31
|
export function inputTextToJSON(inputText) {
|
|
18
32
|
return JSON.stringify(InputText$outboundSchema.parse(inputText));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const PromptCacheBreakpointMode: {
|
|
6
|
+
readonly Explicit: "explicit";
|
|
7
|
+
};
|
|
8
|
+
export type PromptCacheBreakpointMode = ClosedEnum<typeof PromptCacheBreakpointMode>;
|
|
9
|
+
/**
|
|
10
|
+
* Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.
|
|
11
|
+
*/
|
|
12
|
+
export type PromptCacheBreakpoint = {
|
|
13
|
+
mode: PromptCacheBreakpointMode;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const PromptCacheBreakpointMode$inboundSchema: z.ZodEnum<typeof PromptCacheBreakpointMode>;
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const PromptCacheBreakpointMode$outboundSchema: z.ZodEnum<typeof PromptCacheBreakpointMode>;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const PromptCacheBreakpoint$inboundSchema: z.ZodType<PromptCacheBreakpoint, unknown>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export type PromptCacheBreakpoint$Outbound = {
|
|
23
|
+
mode: string;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const PromptCacheBreakpoint$outboundSchema: z.ZodType<PromptCacheBreakpoint$Outbound, PromptCacheBreakpoint>;
|
|
27
|
+
export declare function promptCacheBreakpointToJSON(promptCacheBreakpoint: PromptCacheBreakpoint): string;
|
|
28
|
+
export declare function promptCacheBreakpointFromJSON(jsonString: string): SafeParseResult<PromptCacheBreakpoint, SDKValidationError>;
|
|
29
|
+
//# sourceMappingURL=promptcachebreakpoint.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f8222f76987b
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
export const PromptCacheBreakpointMode = {
|
|
8
|
+
Explicit: "explicit",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const PromptCacheBreakpointMode$inboundSchema = z.enum(PromptCacheBreakpointMode);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const PromptCacheBreakpointMode$outboundSchema = PromptCacheBreakpointMode$inboundSchema;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const PromptCacheBreakpoint$inboundSchema = z.object({
|
|
16
|
+
mode: PromptCacheBreakpointMode$inboundSchema,
|
|
17
|
+
});
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const PromptCacheBreakpoint$outboundSchema = z.object({
|
|
20
|
+
mode: PromptCacheBreakpointMode$outboundSchema,
|
|
21
|
+
});
|
|
22
|
+
export function promptCacheBreakpointToJSON(promptCacheBreakpoint) {
|
|
23
|
+
return JSON.stringify(PromptCacheBreakpoint$outboundSchema.parse(promptCacheBreakpoint));
|
|
24
|
+
}
|
|
25
|
+
export function promptCacheBreakpointFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => PromptCacheBreakpoint$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptCacheBreakpoint' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=promptcachebreakpoint.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
export declare const PromptCacheOptionsMode: {
|
|
4
|
+
readonly Explicit: "explicit";
|
|
5
|
+
};
|
|
6
|
+
export type PromptCacheOptionsMode = ClosedEnum<typeof PromptCacheOptionsMode>;
|
|
7
|
+
/**
|
|
8
|
+
* Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
|
|
9
|
+
*/
|
|
10
|
+
export type PromptCacheOptions = {
|
|
11
|
+
mode: PromptCacheOptionsMode;
|
|
12
|
+
ttl?: string | null | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const PromptCacheOptionsMode$outboundSchema: z.ZodEnum<typeof PromptCacheOptionsMode>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export type PromptCacheOptions$Outbound = {
|
|
18
|
+
mode: string;
|
|
19
|
+
ttl?: string | null | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const PromptCacheOptions$outboundSchema: z.ZodType<PromptCacheOptions$Outbound, PromptCacheOptions>;
|
|
23
|
+
export declare function promptCacheOptionsToJSON(promptCacheOptions: PromptCacheOptions): string;
|
|
24
|
+
//# sourceMappingURL=promptcacheoptions.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: beb41f51263a
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
export const PromptCacheOptionsMode = {
|
|
7
|
+
Explicit: "explicit",
|
|
8
|
+
};
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const PromptCacheOptionsMode$outboundSchema = z.enum(PromptCacheOptionsMode);
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const PromptCacheOptions$outboundSchema = z.object({
|
|
13
|
+
mode: PromptCacheOptionsMode$outboundSchema,
|
|
14
|
+
ttl: z.nullable(z.string()).optional(),
|
|
15
|
+
});
|
|
16
|
+
export function promptCacheOptionsToJSON(promptCacheOptions) {
|
|
17
|
+
return JSON.stringify(PromptCacheOptions$outboundSchema.parse(promptCacheOptions));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=promptcacheoptions.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { ReasoningContext } from "./reasoningcontext.js";
|
|
2
3
|
import { ReasoningEffort } from "./reasoningeffort.js";
|
|
3
4
|
import { ReasoningMode } from "./reasoningmode.js";
|
|
4
5
|
import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
|
|
@@ -6,6 +7,10 @@ import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
|
|
|
6
7
|
* Configuration for reasoning mode in the response
|
|
7
8
|
*/
|
|
8
9
|
export type ReasoningConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
|
|
12
|
+
*/
|
|
13
|
+
context?: ReasoningContext | null | undefined;
|
|
9
14
|
effort?: ReasoningEffort | null | undefined;
|
|
10
15
|
/**
|
|
11
16
|
* Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.
|
|
@@ -17,6 +22,7 @@ export type ReasoningConfig = {
|
|
|
17
22
|
};
|
|
18
23
|
/** @internal */
|
|
19
24
|
export type ReasoningConfig$Outbound = {
|
|
25
|
+
context?: string | null | undefined;
|
|
20
26
|
effort?: string | null | undefined;
|
|
21
27
|
mode?: string | null | undefined;
|
|
22
28
|
summary?: string | null | undefined;
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { ReasoningContext$outboundSchema, } from "./reasoningcontext.js";
|
|
7
8
|
import { ReasoningEffort$outboundSchema, } from "./reasoningeffort.js";
|
|
8
9
|
import { ReasoningMode$outboundSchema, } from "./reasoningmode.js";
|
|
9
10
|
import { ReasoningSummaryVerbosity$outboundSchema, } from "./reasoningsummaryverbosity.js";
|
|
10
11
|
/** @internal */
|
|
11
12
|
export const ReasoningConfig$outboundSchema = z.object({
|
|
13
|
+
context: z.nullable(ReasoningContext$outboundSchema).optional(),
|
|
12
14
|
effort: z.nullable(ReasoningEffort$outboundSchema).optional(),
|
|
13
15
|
mode: z.nullable(ReasoningMode$outboundSchema).optional(),
|
|
14
16
|
summary: z.nullable(ReasoningSummaryVerbosity$outboundSchema).optional(),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ReasoningContext: {
|
|
7
|
+
readonly Auto: "auto";
|
|
8
|
+
readonly AllTurns: "all_turns";
|
|
9
|
+
readonly CurrentTurn: "current_turn";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
|
|
13
|
+
*/
|
|
14
|
+
export type ReasoningContext = OpenEnum<typeof ReasoningContext>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const ReasoningContext$inboundSchema: z.ZodType<ReasoningContext, unknown>;
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const ReasoningContext$outboundSchema: z.ZodType<string, ReasoningContext>;
|
|
19
|
+
//# sourceMappingURL=reasoningcontext.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 999ae13f294f
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
|
|
8
|
+
*/
|
|
9
|
+
export const ReasoningContext = {
|
|
10
|
+
Auto: "auto",
|
|
11
|
+
AllTurns: "all_turns",
|
|
12
|
+
CurrentTurn: "current_turn",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ReasoningContext$inboundSchema = openEnums.inboundSchema(ReasoningContext);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ReasoningContext$outboundSchema = openEnums.outboundSchema(ReasoningContext);
|
|
18
|
+
//# sourceMappingURL=reasoningcontext.js.map
|
|
@@ -21,6 +21,7 @@ export declare const Code: {
|
|
|
21
21
|
readonly EmptyImageFile: "empty_image_file";
|
|
22
22
|
readonly FailedToDownloadImage: "failed_to_download_image";
|
|
23
23
|
readonly ImageFileNotFound: "image_file_not_found";
|
|
24
|
+
readonly BioPolicy: "bio_policy";
|
|
24
25
|
};
|
|
25
26
|
export type Code = OpenEnum<typeof Code>;
|
|
26
27
|
/**
|
|
@@ -32,6 +32,7 @@ import { OutputModalityEnum } from "./outputmodalityenum.js";
|
|
|
32
32
|
import { ParetoRouterPlugin, ParetoRouterPlugin$Outbound } from "./paretorouterplugin.js";
|
|
33
33
|
import { Preview20250311WebSearchServerTool, Preview20250311WebSearchServerTool$Outbound } from "./preview20250311websearchservertool.js";
|
|
34
34
|
import { PreviewWebSearchServerTool, PreviewWebSearchServerTool$Outbound } from "./previewwebsearchservertool.js";
|
|
35
|
+
import { PromptCacheOptions, PromptCacheOptions$Outbound } from "./promptcacheoptions.js";
|
|
35
36
|
import { ProviderPreferences, ProviderPreferences$Outbound } from "./providerpreferences.js";
|
|
36
37
|
import { ReasoningConfig, ReasoningConfig$Outbound } from "./reasoningconfig.js";
|
|
37
38
|
import { ResponseHealingPlugin, ResponseHealingPlugin$Outbound } from "./responsehealingplugin.js";
|
|
@@ -137,6 +138,10 @@ export type ResponsesRequest = {
|
|
|
137
138
|
previousResponseId?: string | null | undefined;
|
|
138
139
|
prompt?: StoredPromptTemplate | null | undefined;
|
|
139
140
|
promptCacheKey?: string | null | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
|
|
143
|
+
*/
|
|
144
|
+
promptCacheOptions?: PromptCacheOptions | null | undefined;
|
|
140
145
|
/**
|
|
141
146
|
* When multiple model providers are available, optionally indicate your routing preference.
|
|
142
147
|
*/
|
|
@@ -264,6 +269,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
264
269
|
previous_response_id?: string | null | undefined;
|
|
265
270
|
prompt?: StoredPromptTemplate$Outbound | null | undefined;
|
|
266
271
|
prompt_cache_key?: string | null | undefined;
|
|
272
|
+
prompt_cache_options?: PromptCacheOptions$Outbound | null | undefined;
|
|
267
273
|
provider?: ProviderPreferences$Outbound | null | undefined;
|
|
268
274
|
reasoning?: ReasoningConfig$Outbound | null | undefined;
|
|
269
275
|
safety_identifier?: string | null | undefined;
|
|
@@ -37,6 +37,7 @@ import { OutputModalityEnum$outboundSchema, } from "./outputmodalityenum.js";
|
|
|
37
37
|
import { ParetoRouterPlugin$outboundSchema, } from "./paretorouterplugin.js";
|
|
38
38
|
import { Preview20250311WebSearchServerTool$outboundSchema, } from "./preview20250311websearchservertool.js";
|
|
39
39
|
import { PreviewWebSearchServerTool$outboundSchema, } from "./previewwebsearchservertool.js";
|
|
40
|
+
import { PromptCacheOptions$outboundSchema, } from "./promptcacheoptions.js";
|
|
40
41
|
import { ProviderPreferences$outboundSchema, } from "./providerpreferences.js";
|
|
41
42
|
import { ReasoningConfig$outboundSchema, } from "./reasoningconfig.js";
|
|
42
43
|
import { ResponseHealingPlugin$outboundSchema, } from "./responsehealingplugin.js";
|
|
@@ -152,6 +153,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
152
153
|
previousResponseId: z.nullable(z.string()).optional(),
|
|
153
154
|
prompt: z.nullable(StoredPromptTemplate$outboundSchema).optional(),
|
|
154
155
|
promptCacheKey: z.nullable(z.string()).optional(),
|
|
156
|
+
promptCacheOptions: z.nullable(PromptCacheOptions$outboundSchema).optional(),
|
|
155
157
|
provider: z.nullable(ProviderPreferences$outboundSchema).optional(),
|
|
156
158
|
reasoning: z.nullable(ReasoningConfig$outboundSchema).optional(),
|
|
157
159
|
safetyIdentifier: z.nullable(z.string()).optional(),
|
|
@@ -209,6 +211,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
209
211
|
presencePenalty: "presence_penalty",
|
|
210
212
|
previousResponseId: "previous_response_id",
|
|
211
213
|
promptCacheKey: "prompt_cache_key",
|
|
214
|
+
promptCacheOptions: "prompt_cache_options",
|
|
212
215
|
safetyIdentifier: "safety_identifier",
|
|
213
216
|
serviceTier: "service_tier",
|
|
214
217
|
sessionId: "session_id",
|
package/esm/models/usage.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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
|
export type InputTokensDetails = {
|
|
5
|
+
cacheWriteTokens?: number | null | undefined;
|
|
5
6
|
cachedTokens: number;
|
|
6
7
|
};
|
|
7
8
|
export type OutputTokensDetails = {
|
package/esm/models/usage.js
CHANGED
|
@@ -7,9 +7,11 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
/** @internal */
|
|
9
9
|
export const InputTokensDetails$inboundSchema = z.object({
|
|
10
|
+
cache_write_tokens: z.nullable(z.int()).optional(),
|
|
10
11
|
cached_tokens: z.int(),
|
|
11
12
|
}).transform((v) => {
|
|
12
13
|
return remap$(v, {
|
|
14
|
+
"cache_write_tokens": "cacheWriteTokens",
|
|
13
15
|
"cached_tokens": "cachedTokens",
|
|
14
16
|
});
|
|
15
17
|
});
|
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.37",
|
|
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
|
-
"compile": "tsc",
|
|
77
|
-
"prepare": "npm run build",
|
|
78
|
-
"test": "vitest --run --project unit",
|
|
79
|
-
"typecheck": "tsc --noEmit",
|
|
80
|
-
"typecheck:transit": "exit 0",
|
|
81
76
|
"postinstall": "node scripts/check-types.js || true",
|
|
77
|
+
"test": "vitest --run --project unit",
|
|
82
78
|
"test:e2e": "vitest --run --project e2e",
|
|
83
79
|
"test:transit": "exit 0",
|
|
84
|
-
"test:watch": "vitest --watch --project unit"
|
|
80
|
+
"test:watch": "vitest --watch --project unit",
|
|
81
|
+
"compile": "tsc",
|
|
82
|
+
"prepare": "npm run build",
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|