@openrouter/sdk 0.13.60 → 0.13.62
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/autobetarouterplugin.d.ts +27 -0
- package/esm/models/autobetarouterplugin.js +22 -0
- package/esm/models/chatrequest.d.ts +5 -4
- package/esm/models/chatrequest.js +3 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/messagesrequest.d.ts +5 -4
- package/esm/models/messagesrequest.js +3 -0
- package/esm/models/openresponsesresult.d.ts +5 -0
- package/esm/models/openresponsesresult.js +3 -0
- package/esm/models/promptcacheoptions.d.ts +7 -0
- package/esm/models/promptcacheoptions.js +12 -1
- package/esm/models/responsesrequest.d.ts +5 -4
- package/esm/models/responsesrequest.js +3 -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.62";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.62 2.914.0 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.62",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.62 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type AutoBetaRouterPlugin = {
|
|
3
|
+
/**
|
|
4
|
+
* List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list.
|
|
5
|
+
*/
|
|
6
|
+
allowedModels?: Array<string> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 7.
|
|
9
|
+
*/
|
|
10
|
+
costQualityTradeoff?: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Set to false to disable the auto-beta-router plugin for this request. Defaults to true.
|
|
13
|
+
*/
|
|
14
|
+
enabled?: boolean | undefined;
|
|
15
|
+
id: "auto-beta-router";
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export type AutoBetaRouterPlugin$Outbound = {
|
|
19
|
+
allowed_models?: Array<string> | undefined;
|
|
20
|
+
cost_quality_tradeoff?: number | undefined;
|
|
21
|
+
enabled?: boolean | undefined;
|
|
22
|
+
id: "auto-beta-router";
|
|
23
|
+
};
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const AutoBetaRouterPlugin$outboundSchema: z.ZodType<AutoBetaRouterPlugin$Outbound, AutoBetaRouterPlugin>;
|
|
26
|
+
export declare function autoBetaRouterPluginToJSON(autoBetaRouterPlugin: AutoBetaRouterPlugin): string;
|
|
27
|
+
//# sourceMappingURL=autobetarouterplugin.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 80e04f632d5f
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const AutoBetaRouterPlugin$outboundSchema = z.object({
|
|
9
|
+
allowedModels: z.array(z.string()).optional(),
|
|
10
|
+
costQualityTradeoff: z.int().optional(),
|
|
11
|
+
enabled: z.boolean().optional(),
|
|
12
|
+
id: z.literal("auto-beta-router"),
|
|
13
|
+
}).transform((v) => {
|
|
14
|
+
return remap$(v, {
|
|
15
|
+
allowedModels: "allowed_models",
|
|
16
|
+
costQualityTradeoff: "cost_quality_tradeoff",
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export function autoBetaRouterPluginToJSON(autoBetaRouterPlugin) {
|
|
20
|
+
return JSON.stringify(AutoBetaRouterPlugin$outboundSchema.parse(autoBetaRouterPlugin));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=autobetarouterplugin.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
|
|
4
|
+
import { AutoBetaRouterPlugin, AutoBetaRouterPlugin$Outbound } from "./autobetarouterplugin.js";
|
|
4
5
|
import { AutoRouterPlugin, AutoRouterPlugin$Outbound } from "./autorouterplugin.js";
|
|
5
6
|
import { ChatDebugOptions, ChatDebugOptions$Outbound } from "./chatdebugoptions.js";
|
|
6
7
|
import { ChatFormatGrammarConfig, ChatFormatGrammarConfig$Outbound } from "./chatformatgrammarconfig.js";
|
|
@@ -33,7 +34,7 @@ export declare const Modality: {
|
|
|
33
34
|
readonly Audio: "audio";
|
|
34
35
|
};
|
|
35
36
|
export type Modality = OpenEnum<typeof Modality>;
|
|
36
|
-
export type ChatRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
37
|
+
export type ChatRequestPlugin = AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
37
38
|
/**
|
|
38
39
|
* Constrains effort on reasoning for reasoning models
|
|
39
40
|
*/
|
|
@@ -171,7 +172,7 @@ export type ChatRequest = {
|
|
|
171
172
|
/**
|
|
172
173
|
* Plugins you want to enable for this request, including their settings.
|
|
173
174
|
*/
|
|
174
|
-
plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
175
|
+
plugins?: Array<AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
175
176
|
/**
|
|
176
177
|
* Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
|
|
177
178
|
*/
|
|
@@ -273,7 +274,7 @@ export type ChatRequest = {
|
|
|
273
274
|
/** @internal */
|
|
274
275
|
export declare const Modality$outboundSchema: z.ZodType<string, Modality>;
|
|
275
276
|
/** @internal */
|
|
276
|
-
export type ChatRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
277
|
+
export type ChatRequestPlugin$Outbound = AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
277
278
|
/** @internal */
|
|
278
279
|
export declare const ChatRequestPlugin$outboundSchema: z.ZodType<ChatRequestPlugin$Outbound, ChatRequestPlugin>;
|
|
279
280
|
export declare function chatRequestPluginToJSON(chatRequestPlugin: ChatRequestPlugin): string;
|
|
@@ -324,7 +325,7 @@ export type ChatRequest$Outbound = {
|
|
|
324
325
|
model?: string | undefined;
|
|
325
326
|
models?: Array<string> | undefined;
|
|
326
327
|
parallel_tool_calls?: boolean | null | undefined;
|
|
327
|
-
plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
328
|
+
plugins?: Array<AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
328
329
|
prediction?: Prediction$Outbound | null | undefined;
|
|
329
330
|
presence_penalty?: number | null | undefined;
|
|
330
331
|
prompt_cache_key?: string | null | undefined;
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
8
|
import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
|
|
9
|
+
import { AutoBetaRouterPlugin$outboundSchema, } from "./autobetarouterplugin.js";
|
|
9
10
|
import { AutoRouterPlugin$outboundSchema, } from "./autorouterplugin.js";
|
|
10
11
|
import { ChatDebugOptions$outboundSchema, } from "./chatdebugoptions.js";
|
|
11
12
|
import { ChatFormatGrammarConfig$outboundSchema, } from "./chatformatgrammarconfig.js";
|
|
@@ -76,6 +77,7 @@ export const Modality$outboundSchema = openEnums
|
|
|
76
77
|
.outboundSchema(Modality);
|
|
77
78
|
/** @internal */
|
|
78
79
|
export const ChatRequestPlugin$outboundSchema = z.union([
|
|
80
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
79
81
|
AutoRouterPlugin$outboundSchema,
|
|
80
82
|
ContextCompressionPlugin$outboundSchema,
|
|
81
83
|
FileParserPlugin$outboundSchema,
|
|
@@ -141,6 +143,7 @@ export const ChatRequest$outboundSchema = z.object({
|
|
|
141
143
|
models: z.array(z.string()).optional(),
|
|
142
144
|
parallelToolCalls: z.nullable(z.boolean()).optional(),
|
|
143
145
|
plugins: z.array(z.union([
|
|
146
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
144
147
|
AutoRouterPlugin$outboundSchema,
|
|
145
148
|
ContextCompressionPlugin$outboundSchema,
|
|
146
149
|
FileParserPlugin$outboundSchema,
|
package/esm/models/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from "./applypatchservertoolopenrouter.js";
|
|
|
59
59
|
export * from "./applypatchupdatefileoperation.js";
|
|
60
60
|
export * from "./apprankingsitem.js";
|
|
61
61
|
export * from "./apprankingsresponse.js";
|
|
62
|
+
export * from "./autobetarouterplugin.js";
|
|
62
63
|
export * from "./autorouterplugin.js";
|
|
63
64
|
export * from "./badgatewayresponseerrordata.js";
|
|
64
65
|
export * from "./badrequestresponseerrordata.js";
|
package/esm/models/index.js
CHANGED
|
@@ -63,6 +63,7 @@ export * from "./applypatchservertoolopenrouter.js";
|
|
|
63
63
|
export * from "./applypatchupdatefileoperation.js";
|
|
64
64
|
export * from "./apprankingsitem.js";
|
|
65
65
|
export * from "./apprankingsresponse.js";
|
|
66
|
+
export * from "./autobetarouterplugin.js";
|
|
66
67
|
export * from "./autorouterplugin.js";
|
|
67
68
|
export * from "./badgatewayresponseerrordata.js";
|
|
68
69
|
export * from "./badrequestresponseerrordata.js";
|
|
@@ -10,6 +10,7 @@ import { AnthropicThinkingTurns, AnthropicThinkingTurns$Outbound } from "./anthr
|
|
|
10
10
|
import { AnthropicToolUsesKeep, AnthropicToolUsesKeep$Outbound } from "./anthropictooluseskeep.js";
|
|
11
11
|
import { AnthropicToolUsesTrigger, AnthropicToolUsesTrigger$Outbound } from "./anthropictoolusestrigger.js";
|
|
12
12
|
import { AnthropicWebSearchToolUserLocation, AnthropicWebSearchToolUserLocation$Outbound } from "./anthropicwebsearchtooluserlocation.js";
|
|
13
|
+
import { AutoBetaRouterPlugin, AutoBetaRouterPlugin$Outbound } from "./autobetarouterplugin.js";
|
|
13
14
|
import { AutoRouterPlugin, AutoRouterPlugin$Outbound } from "./autorouterplugin.js";
|
|
14
15
|
import { BashServerTool, BashServerTool$Outbound } from "./bashservertool.js";
|
|
15
16
|
import { ContextCompressionPlugin, ContextCompressionPlugin$Outbound } from "./contextcompressionplugin.js";
|
|
@@ -78,7 +79,7 @@ export type ContextManagement = {
|
|
|
78
79
|
export type MessagesRequestMetadata = {
|
|
79
80
|
userId?: string | null | undefined;
|
|
80
81
|
};
|
|
81
|
-
export type MessagesRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
82
|
+
export type MessagesRequestPlugin = AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
82
83
|
/**
|
|
83
84
|
* Controls output generation speed. When set to `fast`, uses a higher-speed inference configuration at premium pricing. Defaults to `standard` when omitted.
|
|
84
85
|
*/
|
|
@@ -269,7 +270,7 @@ export type MessagesRequest = {
|
|
|
269
270
|
/**
|
|
270
271
|
* Plugins you want to enable for this request, including their settings.
|
|
271
272
|
*/
|
|
272
|
-
plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
273
|
+
plugins?: Array<AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
273
274
|
/**
|
|
274
275
|
* When multiple model providers are available, optionally indicate your routing preference.
|
|
275
276
|
*/
|
|
@@ -388,7 +389,7 @@ export type MessagesRequestMetadata$Outbound = {
|
|
|
388
389
|
export declare const MessagesRequestMetadata$outboundSchema: z.ZodType<MessagesRequestMetadata$Outbound, MessagesRequestMetadata>;
|
|
389
390
|
export declare function messagesRequestMetadataToJSON(messagesRequestMetadata: MessagesRequestMetadata): string;
|
|
390
391
|
/** @internal */
|
|
391
|
-
export type MessagesRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
392
|
+
export type MessagesRequestPlugin$Outbound = AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
392
393
|
/** @internal */
|
|
393
394
|
export declare const MessagesRequestPlugin$outboundSchema: z.ZodType<MessagesRequestPlugin$Outbound, MessagesRequestPlugin>;
|
|
394
395
|
export declare function messagesRequestPluginToJSON(messagesRequestPlugin: MessagesRequestPlugin): string;
|
|
@@ -591,7 +592,7 @@ export type MessagesRequest$Outbound = {
|
|
|
591
592
|
model: string;
|
|
592
593
|
models?: Array<string> | undefined;
|
|
593
594
|
output_config?: MessagesOutputConfig$Outbound | undefined;
|
|
594
|
-
plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
595
|
+
plugins?: Array<AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
595
596
|
provider?: ProviderPreferences$Outbound | null | undefined;
|
|
596
597
|
service_tier?: string | undefined;
|
|
597
598
|
session_id?: string | undefined;
|
|
@@ -15,6 +15,7 @@ import { AnthropicThinkingTurns$outboundSchema, } from "./anthropicthinkingturns
|
|
|
15
15
|
import { AnthropicToolUsesKeep$outboundSchema, } from "./anthropictooluseskeep.js";
|
|
16
16
|
import { AnthropicToolUsesTrigger$outboundSchema, } from "./anthropictoolusestrigger.js";
|
|
17
17
|
import { AnthropicWebSearchToolUserLocation$outboundSchema, } from "./anthropicwebsearchtooluserlocation.js";
|
|
18
|
+
import { AutoBetaRouterPlugin$outboundSchema, } from "./autobetarouterplugin.js";
|
|
18
19
|
import { AutoRouterPlugin$outboundSchema, } from "./autorouterplugin.js";
|
|
19
20
|
import { BashServerTool$outboundSchema, } from "./bashservertool.js";
|
|
20
21
|
import { ContextCompressionPlugin$outboundSchema, } from "./contextcompressionplugin.js";
|
|
@@ -213,6 +214,7 @@ export function messagesRequestMetadataToJSON(messagesRequestMetadata) {
|
|
|
213
214
|
}
|
|
214
215
|
/** @internal */
|
|
215
216
|
export const MessagesRequestPlugin$outboundSchema = z.union([
|
|
217
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
216
218
|
AutoRouterPlugin$outboundSchema,
|
|
217
219
|
ContextCompressionPlugin$outboundSchema,
|
|
218
220
|
FileParserPlugin$outboundSchema,
|
|
@@ -526,6 +528,7 @@ export const MessagesRequest$outboundSchema = z.object({
|
|
|
526
528
|
models: z.array(z.string()).optional(),
|
|
527
529
|
outputConfig: MessagesOutputConfig$outboundSchema.optional(),
|
|
528
530
|
plugins: z.array(z.union([
|
|
531
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
529
532
|
AutoRouterPlugin$outboundSchema,
|
|
530
533
|
ContextCompressionPlugin$outboundSchema,
|
|
531
534
|
FileParserPlugin$outboundSchema,
|
|
@@ -23,6 +23,7 @@ import { OpenRouterMetadata } from "./openroutermetadata.js";
|
|
|
23
23
|
import { OutputItems } from "./outputitems.js";
|
|
24
24
|
import { Preview20250311WebSearchServerTool } from "./preview20250311websearchservertool.js";
|
|
25
25
|
import { PreviewWebSearchServerTool } from "./previewwebsearchservertool.js";
|
|
26
|
+
import { PromptCacheOptions } from "./promptcacheoptions.js";
|
|
26
27
|
import { ResponsesErrorField } from "./responseserrorfield.js";
|
|
27
28
|
import { ServerToolUseDetails } from "./servertoolusedetails.js";
|
|
28
29
|
import { ShellServerTool } from "./shellservertool.js";
|
|
@@ -139,6 +140,10 @@ export type OpenResponsesResult = {
|
|
|
139
140
|
previousResponseId?: string | null | undefined;
|
|
140
141
|
prompt?: StoredPromptTemplate | null | undefined;
|
|
141
142
|
promptCacheKey?: string | null | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* 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.
|
|
145
|
+
*/
|
|
146
|
+
promptCacheOptions?: PromptCacheOptions | null | undefined;
|
|
142
147
|
reasoning?: BaseReasoningConfig | null | undefined;
|
|
143
148
|
safetyIdentifier?: string | null | undefined;
|
|
144
149
|
serviceTier?: string | null | undefined;
|
|
@@ -26,6 +26,7 @@ import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
|
|
|
26
26
|
import { OutputItems$inboundSchema } from "./outputitems.js";
|
|
27
27
|
import { Preview20250311WebSearchServerTool$inboundSchema, } from "./preview20250311websearchservertool.js";
|
|
28
28
|
import { PreviewWebSearchServerTool$inboundSchema, } from "./previewwebsearchservertool.js";
|
|
29
|
+
import { PromptCacheOptions$inboundSchema, } from "./promptcacheoptions.js";
|
|
29
30
|
import { ResponsesErrorField$inboundSchema, } from "./responseserrorfield.js";
|
|
30
31
|
import { ServerToolUseDetails$inboundSchema, } from "./servertoolusedetails.js";
|
|
31
32
|
import { ShellServerTool$inboundSchema, } from "./shellservertool.js";
|
|
@@ -158,6 +159,7 @@ export const OpenResponsesResult$inboundSchema = z.object({
|
|
|
158
159
|
previous_response_id: z.nullable(z.string()).optional(),
|
|
159
160
|
prompt: z.nullable(StoredPromptTemplate$inboundSchema).optional(),
|
|
160
161
|
prompt_cache_key: z.nullable(z.string()).optional(),
|
|
162
|
+
prompt_cache_options: z.nullable(PromptCacheOptions$inboundSchema).optional(),
|
|
161
163
|
reasoning: z.nullable(BaseReasoningConfig$inboundSchema).optional(),
|
|
162
164
|
safety_identifier: z.nullable(z.string()).optional(),
|
|
163
165
|
service_tier: z.nullable(z.string()).optional(),
|
|
@@ -203,6 +205,7 @@ export const OpenResponsesResult$inboundSchema = z.object({
|
|
|
203
205
|
"presence_penalty": "presencePenalty",
|
|
204
206
|
"previous_response_id": "previousResponseId",
|
|
205
207
|
"prompt_cache_key": "promptCacheKey",
|
|
208
|
+
"prompt_cache_options": "promptCacheOptions",
|
|
206
209
|
"safety_identifier": "safetyIdentifier",
|
|
207
210
|
"service_tier": "serviceTier",
|
|
208
211
|
"tool_choice": "toolChoice",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
3
5
|
export declare const PromptCacheOptionsMode: {
|
|
4
6
|
readonly Explicit: "explicit";
|
|
5
7
|
};
|
|
@@ -12,8 +14,12 @@ export type PromptCacheOptions = {
|
|
|
12
14
|
ttl?: string | null | undefined;
|
|
13
15
|
};
|
|
14
16
|
/** @internal */
|
|
17
|
+
export declare const PromptCacheOptionsMode$inboundSchema: z.ZodEnum<typeof PromptCacheOptionsMode>;
|
|
18
|
+
/** @internal */
|
|
15
19
|
export declare const PromptCacheOptionsMode$outboundSchema: z.ZodEnum<typeof PromptCacheOptionsMode>;
|
|
16
20
|
/** @internal */
|
|
21
|
+
export declare const PromptCacheOptions$inboundSchema: z.ZodType<PromptCacheOptions, unknown>;
|
|
22
|
+
/** @internal */
|
|
17
23
|
export type PromptCacheOptions$Outbound = {
|
|
18
24
|
mode: string;
|
|
19
25
|
ttl?: string | null | undefined;
|
|
@@ -21,4 +27,5 @@ export type PromptCacheOptions$Outbound = {
|
|
|
21
27
|
/** @internal */
|
|
22
28
|
export declare const PromptCacheOptions$outboundSchema: z.ZodType<PromptCacheOptions$Outbound, PromptCacheOptions>;
|
|
23
29
|
export declare function promptCacheOptionsToJSON(promptCacheOptions: PromptCacheOptions): string;
|
|
30
|
+
export declare function promptCacheOptionsFromJSON(jsonString: string): SafeParseResult<PromptCacheOptions, SDKValidationError>;
|
|
24
31
|
//# sourceMappingURL=promptcacheoptions.d.ts.map
|
|
@@ -3,11 +3,19 @@
|
|
|
3
3
|
* @generated-id: beb41f51263a
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
7
|
export const PromptCacheOptionsMode = {
|
|
7
8
|
Explicit: "explicit",
|
|
8
9
|
};
|
|
9
10
|
/** @internal */
|
|
10
|
-
export const PromptCacheOptionsMode$
|
|
11
|
+
export const PromptCacheOptionsMode$inboundSchema = z.enum(PromptCacheOptionsMode);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const PromptCacheOptionsMode$outboundSchema = PromptCacheOptionsMode$inboundSchema;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const PromptCacheOptions$inboundSchema = z.object({
|
|
16
|
+
mode: PromptCacheOptionsMode$inboundSchema,
|
|
17
|
+
ttl: z.nullable(z.string()).optional(),
|
|
18
|
+
});
|
|
11
19
|
/** @internal */
|
|
12
20
|
export const PromptCacheOptions$outboundSchema = z.object({
|
|
13
21
|
mode: PromptCacheOptionsMode$outboundSchema,
|
|
@@ -16,4 +24,7 @@ export const PromptCacheOptions$outboundSchema = z.object({
|
|
|
16
24
|
export function promptCacheOptionsToJSON(promptCacheOptions) {
|
|
17
25
|
return JSON.stringify(PromptCacheOptions$outboundSchema.parse(promptCacheOptions));
|
|
18
26
|
}
|
|
27
|
+
export function promptCacheOptionsFromJSON(jsonString) {
|
|
28
|
+
return safeParse(jsonString, (x) => PromptCacheOptions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptCacheOptions' from JSON`);
|
|
29
|
+
}
|
|
19
30
|
//# sourceMappingURL=promptcacheoptions.js.map
|
|
@@ -4,6 +4,7 @@ import { AdvisorServerToolOpenRouter, AdvisorServerToolOpenRouter$Outbound } fro
|
|
|
4
4
|
import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
|
|
5
5
|
import { ApplyPatchServerTool, ApplyPatchServerTool$Outbound } from "./applypatchservertool.js";
|
|
6
6
|
import { ApplyPatchServerToolOpenRouter, ApplyPatchServerToolOpenRouter$Outbound } from "./applypatchservertoolopenrouter.js";
|
|
7
|
+
import { AutoBetaRouterPlugin, AutoBetaRouterPlugin$Outbound } from "./autobetarouterplugin.js";
|
|
7
8
|
import { AutoRouterPlugin, AutoRouterPlugin$Outbound } from "./autorouterplugin.js";
|
|
8
9
|
import { BashServerTool, BashServerTool$Outbound } from "./bashservertool.js";
|
|
9
10
|
import { ChatDebugOptions, ChatDebugOptions$Outbound } from "./chatdebugoptions.js";
|
|
@@ -53,7 +54,7 @@ import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchserve
|
|
|
53
54
|
import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
|
|
54
55
|
import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
|
|
55
56
|
import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
|
|
56
|
-
export type ResponsesRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
57
|
+
export type ResponsesRequestPlugin = AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin;
|
|
57
58
|
export type ReasoningConfig = {
|
|
58
59
|
/**
|
|
59
60
|
* 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.
|
|
@@ -185,7 +186,7 @@ export type ResponsesRequest = {
|
|
|
185
186
|
/**
|
|
186
187
|
* Plugins you want to enable for this request, including their settings.
|
|
187
188
|
*/
|
|
188
|
-
plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
189
|
+
plugins?: Array<AutoBetaRouterPlugin | AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
|
|
189
190
|
presencePenalty?: number | null | undefined;
|
|
190
191
|
/**
|
|
191
192
|
* Not supported. The Responses API is stateless: no responses are stored, so a previous response cannot be referenced. Requests with a non-null value are rejected with a 400 error. Send the full conversation history in `input` instead.
|
|
@@ -290,7 +291,7 @@ export type ResponsesRequest = {
|
|
|
290
291
|
user?: string | undefined;
|
|
291
292
|
};
|
|
292
293
|
/** @internal */
|
|
293
|
-
export type ResponsesRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
294
|
+
export type ResponsesRequestPlugin$Outbound = AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound;
|
|
294
295
|
/** @internal */
|
|
295
296
|
export declare const ResponsesRequestPlugin$outboundSchema: z.ZodType<ResponsesRequestPlugin$Outbound, ResponsesRequestPlugin>;
|
|
296
297
|
export declare function responsesRequestPluginToJSON(responsesRequestPlugin: ResponsesRequestPlugin): string;
|
|
@@ -399,7 +400,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
399
400
|
model?: string | undefined;
|
|
400
401
|
models?: Array<string> | undefined;
|
|
401
402
|
parallel_tool_calls?: boolean | null | undefined;
|
|
402
|
-
plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
403
|
+
plugins?: Array<AutoBetaRouterPlugin$Outbound | AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
|
|
403
404
|
presence_penalty?: number | null | undefined;
|
|
404
405
|
previous_response_id?: any | undefined;
|
|
405
406
|
prompt?: StoredPromptTemplate$Outbound | null | undefined;
|
|
@@ -9,6 +9,7 @@ import { AdvisorServerToolOpenRouter$outboundSchema, } from "./advisorservertool
|
|
|
9
9
|
import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
|
|
10
10
|
import { ApplyPatchServerTool$outboundSchema, } from "./applypatchservertool.js";
|
|
11
11
|
import { ApplyPatchServerToolOpenRouter$outboundSchema, } from "./applypatchservertoolopenrouter.js";
|
|
12
|
+
import { AutoBetaRouterPlugin$outboundSchema, } from "./autobetarouterplugin.js";
|
|
12
13
|
import { AutoRouterPlugin$outboundSchema, } from "./autorouterplugin.js";
|
|
13
14
|
import { BashServerTool$outboundSchema, } from "./bashservertool.js";
|
|
14
15
|
import { ChatDebugOptions$outboundSchema, } from "./chatdebugoptions.js";
|
|
@@ -67,6 +68,7 @@ export const ResponsesRequestServiceTier = {
|
|
|
67
68
|
};
|
|
68
69
|
/** @internal */
|
|
69
70
|
export const ResponsesRequestPlugin$outboundSchema = z.union([
|
|
71
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
70
72
|
AutoRouterPlugin$outboundSchema,
|
|
71
73
|
ContextCompressionPlugin$outboundSchema,
|
|
72
74
|
FileParserPlugin$outboundSchema,
|
|
@@ -160,6 +162,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
160
162
|
models: z.array(z.string()).optional(),
|
|
161
163
|
parallelToolCalls: z.nullable(z.boolean()).optional(),
|
|
162
164
|
plugins: z.array(z.union([
|
|
165
|
+
AutoBetaRouterPlugin$outboundSchema,
|
|
163
166
|
AutoRouterPlugin$outboundSchema,
|
|
164
167
|
ContextCompressionPlugin$outboundSchema,
|
|
165
168
|
FileParserPlugin$outboundSchema,
|
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.62",
|
|
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
76
|
"test": "vitest --run --project unit",
|
|
78
|
-
"test:transit": "exit 0",
|
|
79
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
80
|
-
"prepare": "npm run build",
|
|
81
77
|
"test:e2e": "vitest --run --project e2e",
|
|
82
|
-
"test:watch": "vitest --watch --project unit",
|
|
83
78
|
"typecheck": "tsc --noEmit",
|
|
84
|
-
"typecheck:transit": "exit 0"
|
|
79
|
+
"typecheck:transit": "exit 0",
|
|
80
|
+
"prepare": "npm run build",
|
|
81
|
+
"test:transit": "exit 0",
|
|
82
|
+
"test:watch": "vitest --watch --project unit",
|
|
83
|
+
"compile": "tsc",
|
|
84
|
+
"postinstall": "node scripts/check-types.js || true"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|