@opencode/ai 2.0.3 → 2.0.4

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.
Files changed (77) hide show
  1. package/dist/cache-policy.js +10 -2
  2. package/dist/effort-updates.d.ts +12 -0
  3. package/dist/effort-updates.js +23 -0
  4. package/dist/protocols/alibaba-messages.d.ts +4 -1
  5. package/dist/protocols/alibaba-responses.d.ts +3 -1
  6. package/dist/protocols/anthropic-messages.d.ts +11 -2
  7. package/dist/protocols/anthropic-messages.js +48 -17
  8. package/dist/protocols/bedrock-converse.js +17 -12
  9. package/dist/protocols/meta-messages.d.ts +4 -1
  10. package/dist/protocols/meta-responses.d.ts +8 -4
  11. package/dist/protocols/mistral-chat.js +5 -33
  12. package/dist/protocols/open-responses-channel.js +4 -0
  13. package/dist/protocols/open-responses.d.ts +27 -9
  14. package/dist/protocols/open-responses.js +24 -8
  15. package/dist/protocols/openai-chat.d.ts +7 -7
  16. package/dist/protocols/openai-chat.js +10 -4
  17. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  18. package/dist/protocols/openai-compatible-responses.d.ts +4 -2
  19. package/dist/protocols/openai-responses.d.ts +74 -31
  20. package/dist/protocols/openai-responses.js +27 -6
  21. package/dist/protocols/utils/bedrock-media.d.ts +10 -8
  22. package/dist/protocols/utils/bedrock-media.js +29 -5
  23. package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
  24. package/dist/protocols/utils/mistral-tool-id.js +31 -0
  25. package/dist/protocols/utils/open-responses-options.d.ts +2 -4
  26. package/dist/protocols/utils/open-responses-options.js +2 -2
  27. package/dist/protocols/utils/responses-compaction.js +3 -1
  28. package/dist/protocols/xai-responses.d.ts +4 -2
  29. package/dist/protocols/zai-chat.d.ts +1 -1
  30. package/dist/protocols/zai-messages.d.ts +4 -1
  31. package/dist/provider-error.js +40 -4
  32. package/dist/providers/alibaba.d.ts +15 -10
  33. package/dist/providers/amazon-bedrock-mantle.d.ts +5 -3
  34. package/dist/providers/anthropic-compatible.d.ts +4 -1
  35. package/dist/providers/anthropic.d.ts +4 -1
  36. package/dist/providers/azure.d.ts +19 -5
  37. package/dist/providers/azure.js +1 -8
  38. package/dist/providers/baseten.d.ts +2 -2
  39. package/dist/providers/cerebras.d.ts +2 -2
  40. package/dist/providers/cerebras.js +1 -1
  41. package/dist/providers/cloudflare-ai-gateway.d.ts +1024 -13
  42. package/dist/providers/cloudflare-ai-gateway.js +64 -27
  43. package/dist/providers/cloudflare-workers-ai.d.ts +3 -3
  44. package/dist/providers/cloudflare-workers-ai.js +1 -1
  45. package/dist/providers/deepinfra.d.ts +2 -2
  46. package/dist/providers/deepinfra.js +1 -1
  47. package/dist/providers/deepseek.d.ts +2 -2
  48. package/dist/providers/fireworks.d.ts +2 -2
  49. package/dist/providers/fireworks.js +1 -1
  50. package/dist/providers/google-vertex-chat.d.ts +1 -1
  51. package/dist/providers/google-vertex-messages.d.ts +4 -1
  52. package/dist/providers/google-vertex-responses.d.ts +4 -2
  53. package/dist/providers/google-vertex.js +5 -1
  54. package/dist/providers/groq.d.ts +2 -2
  55. package/dist/providers/meta.d.ts +9 -4
  56. package/dist/providers/meta.js +1 -1
  57. package/dist/providers/minimax.d.ts +9 -4
  58. package/dist/providers/moonshot.d.ts +9 -4
  59. package/dist/providers/moonshot.js +1 -0
  60. package/dist/providers/openai-compatible-responses.d.ts +4 -2
  61. package/dist/providers/openai-compatible.d.ts +1 -1
  62. package/dist/providers/openai.d.ts +10 -3
  63. package/dist/providers/openai.js +4 -1
  64. package/dist/providers/openrouter.d.ts +4 -4
  65. package/dist/providers/openrouter.js +1 -1
  66. package/dist/providers/togetherai.d.ts +2 -2
  67. package/dist/providers/xai.d.ts +1 -1
  68. package/dist/providers/zai-coding-plan.d.ts +9 -4
  69. package/dist/providers/zai.d.ts +1 -1
  70. package/dist/route/client.d.ts +1 -0
  71. package/dist/route/client.js +3 -1
  72. package/dist/route/protocol.d.ts +2 -0
  73. package/dist/schema/messages.d.ts +22 -3
  74. package/dist/schema/messages.js +9 -1
  75. package/dist/schema/options.d.ts +6 -0
  76. package/dist/schema/options.js +7 -0
  77. package/package.json +3 -3
@@ -1,7 +1,6 @@
1
- import { OpenAIChat } from "../protocols/openai-chat.js";
1
+ import { Schema } from "effect";
2
+ import { AnthropicMessages, OpenAIChat, OpenAIResponses } from "../protocols/index.js";
2
3
  import { Auth } from "../route/auth.js";
3
- import { Route } from "../route/client.js";
4
- import { Endpoint } from "../route/endpoint.js";
5
4
  import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
6
5
  export const id = ProviderID.make("cloudflare-ai-gateway");
7
6
  export const authEnvVars = ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
@@ -13,53 +12,91 @@ export const baseURL = (input) => {
13
12
  provider: id,
14
13
  message: "CloudflareAIGateway.configure requires accountId unless baseURL is supplied",
15
14
  });
16
- return `https://gateway.ai.cloudflare.com/v1/${encodeURIComponent(input.accountId)}/${encodeURIComponent(input.gatewayId?.trim() || "default")}/compat`;
15
+ return `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(input.accountId)}/ai/v1`;
17
16
  };
17
+ export const responsesRoute = OpenAIResponses.route.with({
18
+ id: "cloudflare-ai-gateway-responses",
19
+ provider: id,
20
+ endpoint: { baseURL: undefined },
21
+ });
22
+ export const messagesRoute = AnthropicMessages.route.with({
23
+ id: "cloudflare-ai-gateway-messages",
24
+ provider: id,
25
+ endpoint: { baseURL: undefined },
26
+ });
27
+ export const route = OpenAIChat.route.with({
28
+ id: "cloudflare-ai-gateway-chat",
29
+ provider: id,
30
+ endpoint: { baseURL: undefined },
31
+ });
32
+ export const routes = [responsesRoute, messagesRoute, route];
18
33
  const auth = (input) => {
19
34
  if ("auth" in input && input.auth)
20
35
  return input.auth;
21
- const gateway = Auth.optional(input.gatewayApiKey, "gatewayApiKey")
36
+ return Auth.optional(input.gatewayApiKey ?? ("apiKey" in input ? input.apiKey : undefined), "apiKey")
22
37
  .orElse(Auth.config(authEnvVars[0]))
23
38
  .orElse(Auth.config(authEnvVars[1]))
24
- .pipe(Auth.bearerHeader("cf-aig-authorization"));
25
- if (!("apiKey" in input) || input.apiKey === undefined)
26
- return gateway;
27
- if (input.gatewayApiKey === undefined)
28
- return Auth.bearer(input.apiKey);
29
- return Auth.bearerHeader("cf-aig-authorization", input.gatewayApiKey).andThen(Auth.bearer(input.apiKey));
39
+ .bearer();
30
40
  };
31
- export const route = Route.make({
32
- id: "cloudflare-ai-gateway",
33
- provider: id,
34
- providerMetadataKey: "cloudflare-ai-gateway",
35
- protocol: OpenAIChat.protocol,
36
- endpoint: Endpoint.path("/chat/completions"),
37
- framing: OpenAIChat.framing,
41
+ const headers = (input) => ({
42
+ ...(input.gatewayId === undefined ? {} : { "cf-aig-gateway-id": input.gatewayId.trim() || "default" }),
43
+ ...(input.metadata === undefined
44
+ ? {}
45
+ : { "cf-aig-metadata": Schema.encodeSync(Schema.fromJsonString(Schema.Unknown))(input.metadata) }),
46
+ ...(input.cacheTtl === undefined ? {} : { "cf-aig-cache-ttl": String(input.cacheTtl) }),
47
+ ...(input.cacheKey === undefined ? {} : { "cf-aig-cache-key": input.cacheKey }),
48
+ ...(input.skipCache === undefined ? {} : { "cf-aig-skip-cache": String(input.skipCache) }),
49
+ ...(input.collectLog === undefined ? {} : { "cf-aig-collect-log": String(input.collectLog) }),
50
+ ...input.headers,
38
51
  });
39
- export const routes = [route];
52
+ const modelID = (input) => {
53
+ const value = String(input);
54
+ if (value.startsWith("workers-ai/"))
55
+ return value.slice("workers-ai/".length);
56
+ if (value.startsWith("anthropic/"))
57
+ return `anthropic/${value.slice("anthropic/".length).replaceAll(".", "-")}`;
58
+ return value;
59
+ };
40
60
  export const configure = (input) => {
41
- const { accountId: _accountId, gatewayId: _gatewayId, apiKey: _apiKey, gatewayApiKey: _gatewayApiKey, baseURL: _baseURL, auth: _auth, ...defaults } = input;
42
- const configured = route.with({
43
- ...defaults,
61
+ const defaults = {
44
62
  endpoint: { baseURL: baseURL(input) },
45
63
  auth: auth(input),
46
- });
64
+ headers: headers(input),
65
+ http: input.http,
66
+ providerOptions: input.providerOptions,
67
+ };
68
+ const responses = responsesRoute.with(defaults);
69
+ const messages = messagesRoute.with(defaults);
70
+ const chat = route.with(defaults);
47
71
  return {
48
72
  id,
49
- model: (modelID) => configured.model({ id: modelID }),
73
+ model: (input) => {
74
+ const wire = modelID(input);
75
+ if (String(input).startsWith("openai/"))
76
+ return responses.model({ id: wire });
77
+ if (String(input).startsWith("anthropic/"))
78
+ return messages.model({ id: wire });
79
+ return chat.model({ id: wire });
80
+ },
50
81
  configure,
51
82
  };
52
83
  };
53
84
  export const provider = { id, configure };
54
- export const model = (modelID, settings) => {
55
- const { accountId: _, apiKey, baseURL: _url, body, gatewayApiKey, gatewayId: _id, headers, ...providerOptions } = settings;
85
+ export const model = (modelID, { accountId, apiKey, baseURL: configuredBaseURL, body, cacheKey, cacheTtl, collectLog, gatewayApiKey, gatewayId, headers, metadata, skipCache, ...providerOptions }) => {
86
+ const connection = configuredBaseURL === undefined ? { accountId: accountId ?? "" } : { baseURL: configuredBaseURL };
56
87
  return configure({
88
+ ...connection,
57
89
  apiKey,
90
+ cacheKey,
91
+ cacheTtl,
92
+ collectLog,
58
93
  gatewayApiKey,
59
- baseURL: baseURL(settings),
94
+ gatewayId,
60
95
  headers: headers === undefined ? undefined : { ...headers },
61
96
  http: body === undefined ? undefined : { body: { ...body } },
97
+ metadata,
62
98
  providerOptions,
99
+ skipCache,
63
100
  }).model(modelID);
64
101
  };
65
102
  export * as CloudflareAIGateway from "./cloudflare-ai-gateway.js";
@@ -4,7 +4,7 @@ import { Route, type RouteDefaultsInput } from "../route/client.js";
4
4
  import { type ModelID } from "../schema/index.js";
5
5
  import type { OpenAIProviderOptionsInput } from "./openai-options.js";
6
6
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
- export declare const authEnvVars: readonly ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN"];
7
+ export declare const authEnvVars: readonly ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN", "CLOUDFLARE_API_TOKEN"];
8
8
  type WorkersAIURL = AtLeastOne<{
9
9
  readonly accountId: string;
10
10
  readonly baseURL: string;
@@ -108,7 +108,7 @@ export declare const route: Route<{
108
108
  readonly frequency_penalty?: number | undefined;
109
109
  readonly presence_penalty?: number | undefined;
110
110
  readonly prompt_cache_key?: string | undefined;
111
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
111
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
112
112
  readonly store?: boolean | undefined;
113
113
  readonly stream_options?: {
114
114
  readonly include_usage: boolean;
@@ -207,7 +207,7 @@ export declare const routes: Route<{
207
207
  readonly frequency_penalty?: number | undefined;
208
208
  readonly presence_penalty?: number | undefined;
209
209
  readonly prompt_cache_key?: string | undefined;
210
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
210
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
211
211
  readonly store?: boolean | undefined;
212
212
  readonly stream_options?: {
213
213
  readonly include_usage: boolean;
@@ -4,7 +4,7 @@ import { Route } from "../route/client.js";
4
4
  import { Endpoint } from "../route/endpoint.js";
5
5
  import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
6
6
  export const id = ProviderID.make("cloudflare-workers-ai");
7
- export const authEnvVars = ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN"];
7
+ export const authEnvVars = ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN", "CLOUDFLARE_API_TOKEN"];
8
8
  export const baseURL = (input) => {
9
9
  if (input.baseURL)
10
10
  return input.baseURL;
@@ -104,7 +104,7 @@ export declare const route: Route<{
104
104
  readonly frequency_penalty?: number | undefined;
105
105
  readonly presence_penalty?: number | undefined;
106
106
  readonly prompt_cache_key?: string | undefined;
107
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
107
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
108
108
  readonly store?: boolean | undefined;
109
109
  readonly stream_options?: {
110
110
  readonly include_usage: boolean;
@@ -203,7 +203,7 @@ export declare const routes: Route<{
203
203
  readonly frequency_penalty?: number | undefined;
204
204
  readonly presence_penalty?: number | undefined;
205
205
  readonly prompt_cache_key?: string | undefined;
206
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
206
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
207
207
  readonly store?: boolean | undefined;
208
208
  readonly stream_options?: {
209
209
  readonly include_usage: boolean;
@@ -28,7 +28,7 @@ export const configure = (input = {}) => {
28
28
  id,
29
29
  model: (modelID) => configured.model({
30
30
  id: modelID,
31
- compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false },
31
+ compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false, supportsPromptCacheKey: true },
32
32
  }),
33
33
  configure,
34
34
  };
@@ -104,7 +104,7 @@ export declare const route: Route<{
104
104
  readonly frequency_penalty?: number | undefined;
105
105
  readonly presence_penalty?: number | undefined;
106
106
  readonly prompt_cache_key?: string | undefined;
107
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
107
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
108
108
  readonly store?: boolean | undefined;
109
109
  readonly stream_options?: {
110
110
  readonly include_usage: boolean;
@@ -203,7 +203,7 @@ export declare const routes: Route<{
203
203
  readonly frequency_penalty?: number | undefined;
204
204
  readonly presence_penalty?: number | undefined;
205
205
  readonly prompt_cache_key?: string | undefined;
206
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
206
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
207
207
  readonly store?: boolean | undefined;
208
208
  readonly stream_options?: {
209
209
  readonly include_usage: boolean;
@@ -104,7 +104,7 @@ export declare const route: Route<{
104
104
  readonly frequency_penalty?: number | undefined;
105
105
  readonly presence_penalty?: number | undefined;
106
106
  readonly prompt_cache_key?: string | undefined;
107
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
107
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
108
108
  readonly store?: boolean | undefined;
109
109
  readonly stream_options?: {
110
110
  readonly include_usage: boolean;
@@ -203,7 +203,7 @@ export declare const routes: Route<{
203
203
  readonly frequency_penalty?: number | undefined;
204
204
  readonly presence_penalty?: number | undefined;
205
205
  readonly prompt_cache_key?: string | undefined;
206
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
206
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
207
207
  readonly store?: boolean | undefined;
208
208
  readonly stream_options?: {
209
209
  readonly include_usage: boolean;
@@ -23,7 +23,7 @@ export const configure = (input = {}) => {
23
23
  });
24
24
  return {
25
25
  id,
26
- model: (modelID) => configured.model({ id: modelID }),
26
+ model: (modelID) => configured.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }),
27
27
  configure,
28
28
  };
29
29
  };
@@ -109,7 +109,7 @@ export declare const routes: Route<{
109
109
  readonly frequency_penalty?: number | undefined;
110
110
  readonly presence_penalty?: number | undefined;
111
111
  readonly prompt_cache_key?: string | undefined;
112
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
112
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
113
113
  readonly store?: boolean | undefined;
114
114
  readonly stream_options?: {
115
115
  readonly include_usage: boolean;
@@ -218,7 +218,6 @@ export declare const routes: Route<{
218
218
  readonly content: string | null;
219
219
  })[];
220
220
  } | {
221
- readonly role: "system";
222
221
  readonly content: readonly {
223
222
  readonly type: "text";
224
223
  readonly text: string;
@@ -227,6 +226,10 @@ export declare const routes: Route<{
227
226
  readonly ttl?: "1h" | "5m" | undefined;
228
227
  } | undefined;
229
228
  }[];
229
+ readonly role: "system";
230
+ readonly output_config?: {
231
+ readonly effort: string;
232
+ } | undefined;
230
233
  })[];
231
234
  temperature?: number | undefined;
232
235
  stream: true;
@@ -68,12 +68,15 @@ export declare const routes: Route<{
68
68
  readonly encrypted_content: string;
69
69
  readonly id?: string | null | undefined;
70
70
  } | {
71
+ readonly type: "message";
71
72
  readonly role: "system";
72
73
  readonly content: string;
73
74
  } | {
75
+ readonly type: "message";
74
76
  readonly role: "developer";
75
77
  readonly content: string;
76
78
  } | {
79
+ readonly type: "message";
77
80
  readonly content: readonly ({
78
81
  readonly type: "input_image";
79
82
  readonly image_url: string;
@@ -90,7 +93,6 @@ export declare const routes: Route<{
90
93
  })[];
91
94
  readonly role: "user";
92
95
  readonly id?: string | undefined;
93
- readonly type?: "message" | undefined;
94
96
  readonly status?: string | undefined;
95
97
  } | {
96
98
  readonly type: "message";
@@ -138,7 +140,7 @@ export declare const routes: Route<{
138
140
  readonly instructions?: string | undefined;
139
141
  readonly reasoning?: {
140
142
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
141
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
143
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
142
144
  } | undefined;
143
145
  readonly tools?: readonly {
144
146
  readonly type: "function";
@@ -9,7 +9,7 @@ import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
9
9
  import { GoogleVertexShared } from "./google-vertex-shared.js";
10
10
  export const id = ProviderID.make("google-vertex");
11
11
  const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
12
- const body = yield* Gemini.protocol.body.from(request);
12
+ const { serviceTier: _, ...body } = yield* Gemini.protocol.body.from(request);
13
13
  // Vertex's native REST schema rejects `id` on FunctionCall/FunctionResponse parts with HTTP 400,
14
14
  // unlike AI Studio, so history minted there cannot be lowered verbatim.
15
15
  const contents = body.contents.map((content) => ({
@@ -45,6 +45,10 @@ const route = Route.make({
45
45
  return `/${model.startsWith("endpoints/") ? model : `models/${model}`}:streamGenerateContent?alt=sse`;
46
46
  }),
47
47
  auth: Auth.none,
48
+ headers: ({ request }) => {
49
+ const serviceTier = request.providerOptions?.serviceTier;
50
+ return typeof serviceTier === "string" ? { "x-vertex-ai-llm-shared-request-type": serviceTier } : {};
51
+ },
48
52
  framing: Framing.sse,
49
53
  });
50
54
  export const routes = [route];
@@ -116,7 +116,7 @@ export declare const protocol: Protocol<{
116
116
  readonly presence_penalty?: number | undefined;
117
117
  readonly prompt_cache_key?: string | undefined;
118
118
  readonly parallel_tool_calls?: boolean | undefined;
119
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
119
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
120
120
  readonly store?: boolean | undefined;
121
121
  readonly stream_options?: {
122
122
  readonly include_usage: boolean;
@@ -287,7 +287,7 @@ export declare const route: Route<{
287
287
  readonly presence_penalty?: number | undefined;
288
288
  readonly prompt_cache_key?: string | undefined;
289
289
  readonly parallel_tool_calls?: boolean | undefined;
290
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
290
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
291
291
  readonly store?: boolean | undefined;
292
292
  readonly stream_options?: {
293
293
  readonly include_usage: boolean;
@@ -130,7 +130,7 @@ export declare const routes: (Route<{
130
130
  readonly frequency_penalty?: number | undefined;
131
131
  readonly presence_penalty?: number | undefined;
132
132
  readonly prompt_cache_key?: string | undefined;
133
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
133
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
134
134
  readonly store?: boolean | undefined;
135
135
  readonly stream_options?: {
136
136
  readonly include_usage: boolean;
@@ -187,12 +187,15 @@ export declare const routes: (Route<{
187
187
  readonly encrypted_content: string;
188
188
  readonly id?: string | null | undefined;
189
189
  } | {
190
+ readonly type: "message";
190
191
  readonly role: "system";
191
192
  readonly content: string;
192
193
  } | {
194
+ readonly type: "message";
193
195
  readonly role: "developer";
194
196
  readonly content: string;
195
197
  } | {
198
+ readonly type: "message";
196
199
  readonly content: readonly ({
197
200
  readonly type: "input_image";
198
201
  readonly image_url: string;
@@ -209,7 +212,6 @@ export declare const routes: (Route<{
209
212
  })[];
210
213
  readonly role: "user";
211
214
  readonly id?: string | undefined;
212
- readonly type?: "message" | undefined;
213
215
  readonly status?: string | undefined;
214
216
  } | {
215
217
  readonly type: "message";
@@ -264,7 +266,7 @@ export declare const routes: (Route<{
264
266
  readonly instructions?: string | undefined;
265
267
  readonly reasoning?: {
266
268
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
267
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
269
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
268
270
  } | undefined;
269
271
  readonly tools?: readonly ({
270
272
  readonly type: "function";
@@ -500,7 +502,6 @@ export declare const routes: (Route<{
500
502
  readonly content: string | null;
501
503
  })[];
502
504
  } | {
503
- readonly role: "system";
504
505
  readonly content: readonly {
505
506
  readonly type: "text";
506
507
  readonly text: string;
@@ -509,6 +510,10 @@ export declare const routes: (Route<{
509
510
  readonly ttl?: "1h" | "5m" | undefined;
510
511
  } | undefined;
511
512
  }[];
513
+ readonly role: "system";
514
+ readonly output_config?: {
515
+ readonly effort: string;
516
+ } | undefined;
512
517
  })[];
513
518
  readonly stream: true;
514
519
  readonly metadata?: {
@@ -78,7 +78,7 @@ export const configure = (input = {}) => {
78
78
  const responses = (modelID) => configuredResponses.model({ id: modelID });
79
79
  const chat = (modelID) => configuredChat.model({
80
80
  id: modelID,
81
- compatibility: { maxTokensField: "max_completion_tokens", supportsStore: false },
81
+ compatibility: { maxTokensField: "max_completion_tokens", supportsStore: false, supportsPromptCacheKey: true },
82
82
  });
83
83
  const messages = (modelID) => configuredMessages.model({
84
84
  id: modelID,
@@ -209,7 +209,6 @@ export declare const routes: (Route<{
209
209
  readonly content: string | null;
210
210
  })[];
211
211
  } | {
212
- readonly role: "system";
213
212
  readonly content: readonly {
214
213
  readonly type: "text";
215
214
  readonly text: string;
@@ -218,6 +217,10 @@ export declare const routes: (Route<{
218
217
  readonly ttl?: "1h" | "5m" | undefined;
219
218
  } | undefined;
220
219
  }[];
220
+ readonly role: "system";
221
+ readonly output_config?: {
222
+ readonly effort: string;
223
+ } | undefined;
221
224
  })[];
222
225
  readonly stream: true;
223
226
  readonly metadata?: {
@@ -353,12 +356,15 @@ export declare const routes: (Route<{
353
356
  readonly encrypted_content: string;
354
357
  readonly id?: string | null | undefined;
355
358
  } | {
359
+ readonly type: "message";
356
360
  readonly role: "system";
357
361
  readonly content: string;
358
362
  } | {
363
+ readonly type: "message";
359
364
  readonly role: "developer";
360
365
  readonly content: string;
361
366
  } | {
367
+ readonly type: "message";
362
368
  readonly content: readonly ({
363
369
  readonly type: "input_image";
364
370
  readonly image_url: string;
@@ -375,7 +381,6 @@ export declare const routes: (Route<{
375
381
  })[];
376
382
  readonly role: "user";
377
383
  readonly id?: string | undefined;
378
- readonly type?: "message" | undefined;
379
384
  readonly status?: string | undefined;
380
385
  } | {
381
386
  readonly type: "message";
@@ -423,7 +428,7 @@ export declare const routes: (Route<{
423
428
  readonly instructions?: string | undefined;
424
429
  readonly reasoning?: {
425
430
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
426
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
431
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
427
432
  } | undefined;
428
433
  readonly tools?: readonly {
429
434
  readonly type: "function";
@@ -561,7 +566,7 @@ export declare const routes: (Route<{
561
566
  readonly frequency_penalty?: number | undefined;
562
567
  readonly presence_penalty?: number | undefined;
563
568
  readonly prompt_cache_key?: string | undefined;
564
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
569
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
565
570
  readonly store?: boolean | undefined;
566
571
  readonly stream_options?: {
567
572
  readonly include_usage: boolean;
@@ -207,7 +207,6 @@ export declare const routes: (Route<{
207
207
  readonly content: string | null;
208
208
  })[];
209
209
  } | {
210
- readonly role: "system";
211
210
  readonly content: readonly {
212
211
  readonly type: "text";
213
212
  readonly text: string;
@@ -216,6 +215,10 @@ export declare const routes: (Route<{
216
215
  readonly ttl?: "1h" | "5m" | undefined;
217
216
  } | undefined;
218
217
  }[];
218
+ readonly role: "system";
219
+ readonly output_config?: {
220
+ readonly effort: string;
221
+ } | undefined;
219
222
  })[];
220
223
  readonly stream: true;
221
224
  readonly metadata?: {
@@ -351,12 +354,15 @@ export declare const routes: (Route<{
351
354
  readonly encrypted_content: string;
352
355
  readonly id?: string | null | undefined;
353
356
  } | {
357
+ readonly type: "message";
354
358
  readonly role: "system";
355
359
  readonly content: string;
356
360
  } | {
361
+ readonly type: "message";
357
362
  readonly role: "developer";
358
363
  readonly content: string;
359
364
  } | {
365
+ readonly type: "message";
360
366
  readonly content: readonly ({
361
367
  readonly type: "input_image";
362
368
  readonly image_url: string;
@@ -373,7 +379,6 @@ export declare const routes: (Route<{
373
379
  })[];
374
380
  readonly role: "user";
375
381
  readonly id?: string | undefined;
376
- readonly type?: "message" | undefined;
377
382
  readonly status?: string | undefined;
378
383
  } | {
379
384
  readonly type: "message";
@@ -421,7 +426,7 @@ export declare const routes: (Route<{
421
426
  readonly instructions?: string | undefined;
422
427
  readonly reasoning?: {
423
428
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
424
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
429
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
425
430
  } | undefined;
426
431
  readonly tools?: readonly {
427
432
  readonly type: "function";
@@ -559,7 +564,7 @@ export declare const routes: (Route<{
559
564
  readonly frequency_penalty?: number | undefined;
560
565
  readonly presence_penalty?: number | undefined;
561
566
  readonly prompt_cache_key?: string | undefined;
562
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
567
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
563
568
  readonly store?: boolean | undefined;
564
569
  readonly stream_options?: {
565
570
  readonly include_usage: boolean;
@@ -63,6 +63,7 @@ export const configure = (input = {}) => {
63
63
  maxTokensField: "max_tokens",
64
64
  supportsStore: false,
65
65
  supportsStrictMode: false,
66
+ supportsPromptCacheKey: true,
66
67
  toolSchema: "moonshot",
67
68
  reasoningField: "reasoning_content",
68
69
  },
@@ -66,12 +66,15 @@ export declare const routes: import("../route/client.js").Route<{
66
66
  readonly encrypted_content: string;
67
67
  readonly id?: string | null | undefined;
68
68
  } | {
69
+ readonly type: "message";
69
70
  readonly role: "system";
70
71
  readonly content: string;
71
72
  } | {
73
+ readonly type: "message";
72
74
  readonly role: "developer";
73
75
  readonly content: string;
74
76
  } | {
77
+ readonly type: "message";
75
78
  readonly content: readonly ({
76
79
  readonly type: "input_image";
77
80
  readonly image_url: string;
@@ -88,7 +91,6 @@ export declare const routes: import("../route/client.js").Route<{
88
91
  })[];
89
92
  readonly role: "user";
90
93
  readonly id?: string | undefined;
91
- readonly type?: "message" | undefined;
92
94
  readonly status?: string | undefined;
93
95
  } | {
94
96
  readonly type: "message";
@@ -136,7 +138,7 @@ export declare const routes: import("../route/client.js").Route<{
136
138
  readonly instructions?: string | undefined;
137
139
  readonly reasoning?: {
138
140
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
139
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
141
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
140
142
  } | undefined;
141
143
  readonly tools?: readonly {
142
144
  readonly type: "function";
@@ -106,7 +106,7 @@ export declare const routes: import("../route/client.js").Route<{
106
106
  readonly frequency_penalty?: number | undefined;
107
107
  readonly presence_penalty?: number | undefined;
108
108
  readonly prompt_cache_key?: string | undefined;
109
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
109
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
110
110
  readonly store?: boolean | undefined;
111
111
  readonly stream_options?: {
112
112
  readonly include_usage: boolean;
@@ -100,7 +100,7 @@ export declare const routes: (Route<{
100
100
  readonly frequency_penalty?: number | undefined;
101
101
  readonly presence_penalty?: number | undefined;
102
102
  readonly prompt_cache_key?: string | undefined;
103
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
103
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
104
104
  readonly store?: boolean | undefined;
105
105
  readonly stream_options?: {
106
106
  readonly include_usage: boolean;
@@ -144,6 +144,11 @@ export declare const routes: (Route<{
144
144
  readonly error?: unknown;
145
145
  readonly arguments?: string | undefined;
146
146
  readonly server_label?: string | undefined;
147
+ } | {
148
+ readonly type: "configuration_update";
149
+ readonly reasoning: {
150
+ readonly effort: import("../schema/options.js").ReasoningEffort;
151
+ };
147
152
  } | {
148
153
  readonly type: "reasoning";
149
154
  readonly summary: readonly {
@@ -157,12 +162,15 @@ export declare const routes: (Route<{
157
162
  readonly encrypted_content: string;
158
163
  readonly id?: string | null | undefined;
159
164
  } | {
165
+ readonly type: "message";
160
166
  readonly role: "system";
161
167
  readonly content: string;
162
168
  } | {
169
+ readonly type: "message";
163
170
  readonly role: "developer";
164
171
  readonly content: string;
165
172
  } | {
173
+ readonly type: "message";
166
174
  readonly content: readonly ({
167
175
  readonly type: "input_image";
168
176
  readonly image_url: string;
@@ -179,7 +187,6 @@ export declare const routes: (Route<{
179
187
  })[];
180
188
  readonly role: "user";
181
189
  readonly id?: string | undefined;
182
- readonly type?: "message" | undefined;
183
190
  readonly status?: string | undefined;
184
191
  } | {
185
192
  readonly type: "message";
@@ -255,7 +262,7 @@ export declare const routes: (Route<{
255
262
  readonly instructions?: string | undefined;
256
263
  readonly reasoning?: {
257
264
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
258
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
265
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
259
266
  } | undefined;
260
267
  readonly tools?: readonly ({
261
268
  readonly type: "function";
@@ -40,7 +40,10 @@ export const configure = (input = {}) => {
40
40
  const responses = (id) => responsesRoute
41
41
  .with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true }))
42
42
  .model({ id });
43
- const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({ id });
43
+ const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
44
+ id,
45
+ compatibility: { supportsPromptCacheKey: true },
46
+ });
44
47
  const image = (modelID) => OpenAIImages.model({
45
48
  id: modelID,
46
49
  auth: auth(input),