@opencode/ai 0.0.0-dev-21920 → 0.0.0-dev-44

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 (166) hide show
  1. package/README.md +61 -19
  2. package/dist/ai-client.d.ts +2 -2
  3. package/dist/cache-policy.d.ts +4 -0
  4. package/dist/cache-policy.js +20 -6
  5. package/dist/decision-client.d.ts +3 -3
  6. package/dist/decision.d.ts +4 -1
  7. package/dist/decision.js +3 -0
  8. package/dist/effect.d.ts +4 -5
  9. package/dist/effect.js +2 -3
  10. package/dist/experimental/realtime.d.ts +3 -2
  11. package/dist/image-client.d.ts +1 -1
  12. package/dist/image.js +1 -0
  13. package/dist/index.d.ts +6 -0
  14. package/dist/llm.d.ts +3 -0
  15. package/dist/media-client.d.ts +2 -1
  16. package/dist/media-model.d.ts +3 -0
  17. package/dist/media-model.js +4 -1
  18. package/dist/protocols/alibaba-chat.d.ts +4 -0
  19. package/dist/protocols/alibaba-messages.d.ts +19 -19
  20. package/dist/protocols/alibaba-responses.d.ts +3 -3
  21. package/dist/protocols/anthropic-messages.d.ts +59 -59
  22. package/dist/protocols/anthropic-messages.js +3 -5
  23. package/dist/protocols/bedrock-converse.d.ts +110 -15
  24. package/dist/protocols/bedrock-converse.js +112 -15
  25. package/dist/protocols/bedrock-event-stream.js +1 -0
  26. package/dist/protocols/meta-messages.d.ts +19 -19
  27. package/dist/protocols/meta-messages.js +2 -1
  28. package/dist/protocols/open-responses.d.ts +3 -0
  29. package/dist/protocols/openai-chat.d.ts +588 -1
  30. package/dist/protocols/openai-chat.js +7 -2
  31. package/dist/protocols/openai-compatible-chat.d.ts +6 -2
  32. package/dist/protocols/openai-compatible-responses.d.ts +3 -3
  33. package/dist/protocols/openai-responses.d.ts +24 -0
  34. package/dist/protocols/openai-responses.js +5 -0
  35. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  36. package/dist/protocols/utils/bedrock-cache.js +7 -6
  37. package/dist/protocols/utils/cache.d.ts +14 -3
  38. package/dist/protocols/utils/cache.js +11 -4
  39. package/dist/protocols/utils/gemini-json-schema.d.ts +5 -0
  40. package/dist/protocols/utils/gemini-json-schema.js +3 -3
  41. package/dist/protocols/utils/tool-schema.js +15 -5
  42. package/dist/protocols/utils/tool-stream.d.ts +9 -0
  43. package/dist/protocols/venice-chat.d.ts +3 -0
  44. package/dist/protocols/venice-chat.js +1 -1
  45. package/dist/protocols/zai-chat.d.ts +4 -0
  46. package/dist/protocols/zai-messages.d.ts +19 -19
  47. package/dist/providers/alibaba/images.d.ts +2 -0
  48. package/dist/providers/alibaba/images.js +1 -0
  49. package/dist/providers/alibaba.d.ts +26 -21
  50. package/dist/providers/alibaba.js +12 -8
  51. package/dist/providers/amazon-bedrock-mantle.d.ts +23 -19
  52. package/dist/providers/amazon-bedrock.d.ts +34 -14
  53. package/dist/providers/amazon-bedrock.js +11 -11
  54. package/dist/providers/anthropic-compatible.d.ts +19 -19
  55. package/dist/providers/anthropic.d.ts +19 -19
  56. package/dist/providers/azure/images.d.ts +2 -0
  57. package/dist/providers/azure/images.js +1 -0
  58. package/dist/providers/azure.d.ts +15 -1
  59. package/dist/providers/azure.js +19 -1
  60. package/dist/providers/baseten/decisions.d.ts +2 -0
  61. package/dist/providers/baseten/decisions.js +1 -0
  62. package/dist/providers/baseten.d.ts +13 -4
  63. package/dist/providers/baseten.js +15 -8
  64. package/dist/providers/cerebras.d.ts +8 -0
  65. package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
  66. package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
  67. package/dist/providers/cloudflare-ai-gateway.d.ts +57 -40
  68. package/dist/providers/cloudflare-ai-gateway.js +11 -6
  69. package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
  70. package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
  71. package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
  72. package/dist/providers/cloudflare-workers-ai/images.js +1 -0
  73. package/dist/providers/cloudflare-workers-ai.d.ts +13 -3
  74. package/dist/providers/cloudflare-workers-ai.js +16 -7
  75. package/dist/providers/cohere.d.ts +8 -0
  76. package/dist/providers/deepinfra.d.ts +8 -0
  77. package/dist/providers/deepseek.d.ts +8 -0
  78. package/dist/providers/digitalocean/decisions.d.ts +2 -0
  79. package/dist/providers/digitalocean/decisions.js +1 -0
  80. package/dist/providers/digitalocean/images.d.ts +2 -0
  81. package/dist/providers/digitalocean/images.js +1 -0
  82. package/dist/providers/digitalocean.d.ts +21 -4
  83. package/dist/providers/digitalocean.js +25 -8
  84. package/dist/providers/fireworks.d.ts +8 -0
  85. package/dist/providers/google/images.d.ts +2 -0
  86. package/dist/providers/google/images.js +1 -0
  87. package/dist/providers/google-vertex/images.d.ts +2 -0
  88. package/dist/providers/google-vertex/images.js +1 -0
  89. package/dist/providers/google-vertex-chat.d.ts +4 -0
  90. package/dist/providers/google-vertex-messages.d.ts +19 -19
  91. package/dist/providers/google-vertex.d.ts +3 -1
  92. package/dist/providers/google-vertex.js +30 -13
  93. package/dist/providers/google.d.ts +5 -4
  94. package/dist/providers/google.js +15 -8
  95. package/dist/providers/groq.d.ts +8 -0
  96. package/dist/providers/meta.d.ts +23 -19
  97. package/dist/providers/minimax.d.ts +23 -19
  98. package/dist/providers/moonshot.d.ts +23 -19
  99. package/dist/providers/openai/images.d.ts +2 -0
  100. package/dist/providers/openai/images.js +1 -0
  101. package/dist/providers/openai-compatible/images.d.ts +2 -0
  102. package/dist/providers/openai-compatible/images.js +1 -0
  103. package/dist/providers/openai-compatible.d.ts +7 -1
  104. package/dist/providers/openai-compatible.js +21 -9
  105. package/dist/providers/openai.d.ts +18 -8
  106. package/dist/providers/openai.js +10 -2
  107. package/dist/providers/opencode/decisions.d.ts +2 -0
  108. package/dist/providers/opencode/decisions.js +1 -0
  109. package/dist/providers/opencode.d.ts +9 -4
  110. package/dist/providers/opencode.js +2 -1
  111. package/dist/providers/openrouter/decisions.d.ts +2 -0
  112. package/dist/providers/openrouter/decisions.js +1 -0
  113. package/dist/providers/openrouter/images.d.ts +2 -0
  114. package/dist/providers/openrouter/images.js +1 -0
  115. package/dist/providers/openrouter.d.ts +25 -4
  116. package/dist/providers/openrouter.js +31 -9
  117. package/dist/providers/togetherai.d.ts +8 -0
  118. package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
  119. package/dist/providers/typesafe-ai/decisions.js +1 -0
  120. package/dist/providers/typesafe-ai.d.ts +9 -4
  121. package/dist/providers/typesafe-ai.js +2 -1
  122. package/dist/providers/venice.d.ts +3 -0
  123. package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
  124. package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
  125. package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
  126. package/dist/providers/vercel-ai-gateway/images.js +1 -0
  127. package/dist/providers/vercel-ai-gateway.d.ts +9 -7
  128. package/dist/providers/vercel-ai-gateway.js +18 -10
  129. package/dist/providers/xai/images.d.ts +2 -0
  130. package/dist/providers/xai/images.js +1 -0
  131. package/dist/providers/xai.d.ts +9 -4
  132. package/dist/providers/xai.js +15 -8
  133. package/dist/providers/zai/images.d.ts +2 -0
  134. package/dist/providers/zai/images.js +1 -0
  135. package/dist/providers/zai-coding-plan.d.ts +23 -19
  136. package/dist/providers/zai.d.ts +9 -4
  137. package/dist/providers/zai.js +15 -8
  138. package/dist/route/client.d.ts +2 -2
  139. package/dist/route/client.js +15 -4
  140. package/dist/route/decision.d.ts +2 -1
  141. package/dist/route/decision.js +1 -0
  142. package/dist/route/executor.d.ts +1 -1
  143. package/dist/route/framing.d.ts +2 -0
  144. package/dist/route/index.d.ts +3 -0
  145. package/dist/route/index.js +3 -0
  146. package/dist/route/media.d.ts +5 -1
  147. package/dist/route/media.js +6 -2
  148. package/dist/route/transport/http.js +1 -0
  149. package/dist/route/transport/index.d.ts +1 -0
  150. package/dist/schema/events.d.ts +135 -6
  151. package/dist/schema/events.js +10 -0
  152. package/dist/schema/messages.d.ts +6 -2
  153. package/dist/schema/messages.js +3 -0
  154. package/dist/schema/options.d.ts +5 -3
  155. package/dist/schema/options.js +8 -3
  156. package/dist/speech-client.d.ts +1 -1
  157. package/dist/speech.js +2 -1
  158. package/dist/testing.d.ts +25 -24
  159. package/dist/testing.js +3 -21
  160. package/dist/transcription-client.d.ts +1 -1
  161. package/dist/transcription.js +1 -0
  162. package/dist/video-client.d.ts +1 -1
  163. package/dist/video.js +1 -0
  164. package/package.json +510 -8
  165. package/dist/provider.d.ts +0 -23
  166. package/dist/provider.js +0 -2
@@ -4,7 +4,7 @@ import { AlibabaMessages } from "../protocols/alibaba-messages.js";
4
4
  import { AlibabaResponses } from "../protocols/alibaba-responses.js";
5
5
  import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
6
6
  import { Route, type RouteDefaultsInput } from "../route/client.js";
7
- import { ToolDefinition, type ModelID } from "../schema/index.js";
7
+ import { ToolDefinition, type ModelID, type ProviderOptions } from "../schema/index.js";
8
8
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
9
9
  export type Region = "ap-southeast-1" | "cn-beijing" | "cn-hongkong" | "us-east-1" | "eu-central-1" | "ap-northeast-1" | (string & {});
10
10
  export type ChatOptionsInput = AlibabaChat.OptionsInput;
@@ -145,6 +145,10 @@ export declare const routes: (Route<{
145
145
  } | undefined;
146
146
  readonly store?: boolean | undefined;
147
147
  readonly prompt_cache_key?: string | undefined;
148
+ readonly prompt_cache_retention?: string | undefined;
149
+ readonly prompt_cache_options?: {
150
+ readonly ttl?: string | undefined;
151
+ } | undefined;
148
152
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
149
153
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
150
154
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -201,7 +205,7 @@ export declare const routes: (Route<{
201
205
  readonly text: string;
202
206
  readonly cache_control?: {
203
207
  readonly type: "ephemeral";
204
- readonly ttl?: "1h" | "5m" | undefined;
208
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
205
209
  } | undefined;
206
210
  }[] | undefined;
207
211
  readonly messages: readonly ({
@@ -211,7 +215,7 @@ export declare const routes: (Route<{
211
215
  readonly text: string;
212
216
  readonly cache_control?: {
213
217
  readonly type: "ephemeral";
214
- readonly ttl?: "1h" | "5m" | undefined;
218
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
215
219
  } | undefined;
216
220
  } | {
217
221
  readonly type: "image";
@@ -228,7 +232,7 @@ export declare const routes: (Route<{
228
232
  };
229
233
  readonly cache_control?: {
230
234
  readonly type: "ephemeral";
231
- readonly ttl?: "1h" | "5m" | undefined;
235
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
232
236
  } | undefined;
233
237
  readonly transformations?: {
234
238
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -248,7 +252,7 @@ export declare const routes: (Route<{
248
252
  };
249
253
  readonly cache_control?: {
250
254
  readonly type: "ephemeral";
251
- readonly ttl?: "1h" | "5m" | undefined;
255
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
252
256
  } | undefined;
253
257
  } | {
254
258
  readonly type: "document";
@@ -269,7 +273,7 @@ export declare const routes: (Route<{
269
273
  };
270
274
  readonly cache_control?: {
271
275
  readonly type: "ephemeral";
272
- readonly ttl?: "1h" | "5m" | undefined;
276
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
273
277
  } | undefined;
274
278
  readonly title?: string | undefined;
275
279
  readonly context?: string | undefined;
@@ -284,7 +288,7 @@ export declare const routes: (Route<{
284
288
  readonly text: string;
285
289
  readonly cache_control?: {
286
290
  readonly type: "ephemeral";
287
- readonly ttl?: "1h" | "5m" | undefined;
291
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
288
292
  } | undefined;
289
293
  } | {
290
294
  readonly type: "image";
@@ -301,7 +305,7 @@ export declare const routes: (Route<{
301
305
  };
302
306
  readonly cache_control?: {
303
307
  readonly type: "ephemeral";
304
- readonly ttl?: "1h" | "5m" | undefined;
308
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
305
309
  } | undefined;
306
310
  readonly transformations?: {
307
311
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -321,7 +325,7 @@ export declare const routes: (Route<{
321
325
  };
322
326
  readonly cache_control?: {
323
327
  readonly type: "ephemeral";
324
- readonly ttl?: "1h" | "5m" | undefined;
328
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
325
329
  } | undefined;
326
330
  } | {
327
331
  readonly type: "document";
@@ -342,7 +346,7 @@ export declare const routes: (Route<{
342
346
  };
343
347
  readonly cache_control?: {
344
348
  readonly type: "ephemeral";
345
- readonly ttl?: "1h" | "5m" | undefined;
349
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
346
350
  } | undefined;
347
351
  readonly title?: string | undefined;
348
352
  readonly context?: string | undefined;
@@ -353,7 +357,7 @@ export declare const routes: (Route<{
353
357
  readonly is_error?: boolean | undefined;
354
358
  readonly cache_control?: {
355
359
  readonly type: "ephemeral";
356
- readonly ttl?: "1h" | "5m" | undefined;
360
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
357
361
  } | undefined;
358
362
  })[];
359
363
  } | {
@@ -366,7 +370,7 @@ export declare const routes: (Route<{
366
370
  readonly text: string;
367
371
  readonly cache_control?: {
368
372
  readonly type: "ephemeral";
369
- readonly ttl?: "1h" | "5m" | undefined;
373
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
370
374
  } | undefined;
371
375
  } | {
372
376
  readonly type: "thinking";
@@ -374,14 +378,14 @@ export declare const routes: (Route<{
374
378
  readonly signature: string;
375
379
  readonly cache_control?: {
376
380
  readonly type: "ephemeral";
377
- readonly ttl?: "1h" | "5m" | undefined;
381
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
378
382
  } | undefined;
379
383
  } | {
380
384
  readonly type: "redacted_thinking";
381
385
  readonly data: string;
382
386
  readonly cache_control?: {
383
387
  readonly type: "ephemeral";
384
- readonly ttl?: "1h" | "5m" | undefined;
388
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
385
389
  } | undefined;
386
390
  } | {
387
391
  readonly type: "tool_use";
@@ -390,7 +394,7 @@ export declare const routes: (Route<{
390
394
  readonly input: unknown;
391
395
  readonly cache_control?: {
392
396
  readonly type: "ephemeral";
393
- readonly ttl?: "1h" | "5m" | undefined;
397
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
394
398
  } | undefined;
395
399
  } | {
396
400
  readonly type: "server_tool_use";
@@ -399,7 +403,7 @@ export declare const routes: (Route<{
399
403
  readonly input: unknown;
400
404
  readonly cache_control?: {
401
405
  readonly type: "ephemeral";
402
- readonly ttl?: "1h" | "5m" | undefined;
406
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
403
407
  } | undefined;
404
408
  } | {
405
409
  readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
@@ -407,7 +411,7 @@ export declare const routes: (Route<{
407
411
  readonly content: unknown;
408
412
  readonly cache_control?: {
409
413
  readonly type: "ephemeral";
410
- readonly ttl?: "1h" | "5m" | undefined;
414
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
411
415
  } | undefined;
412
416
  })[];
413
417
  } | {
@@ -417,7 +421,7 @@ export declare const routes: (Route<{
417
421
  readonly text: string;
418
422
  readonly cache_control?: {
419
423
  readonly type: "ephemeral";
420
- readonly ttl?: "1h" | "5m" | undefined;
424
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
421
425
  } | undefined;
422
426
  }[];
423
427
  readonly output_config?: {
@@ -432,7 +436,7 @@ export declare const routes: (Route<{
432
436
  };
433
437
  readonly cache_control?: {
434
438
  readonly type: "ephemeral";
435
- readonly ttl?: "1h" | "5m" | undefined;
439
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
436
440
  } | undefined;
437
441
  }[] | undefined;
438
442
  readonly tool_choice?: {
@@ -460,7 +464,7 @@ export declare const routes: (Route<{
460
464
  } | undefined;
461
465
  readonly cache_control?: {
462
466
  readonly type: "ephemeral";
463
- readonly ttl?: "1h" | "5m" | undefined;
467
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
464
468
  } | undefined;
465
469
  readonly container?: string | {
466
470
  readonly id?: string | null | undefined;
@@ -722,7 +726,7 @@ export declare const configure: (input: Config) => {
722
726
  readonly previousResponseId?: string | undefined;
723
727
  readonly conversation?: string | undefined;
724
728
  }, import("../route/client.js").CompactionOperations | undefined>;
725
- image: (id: string | ModelID) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
729
+ image: (id: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
726
730
  configure: typeof configure;
727
731
  };
728
732
  export declare const provider: {
@@ -732,6 +736,7 @@ export declare const provider: {
732
736
  export declare const model: ProviderPackage.Definition<Settings, ChatOptionsInput>["model"];
733
737
  export declare const messagesModel: ProviderPackage.Definition<Settings<MessagesOptionsInput>, MessagesOptionsInput>["model"];
734
738
  export declare const responsesModel: ProviderPackage.Definition<Settings<ResponsesOptionsInput>, ResponsesOptionsInput>["model"];
739
+ export declare const imageModel: (id: string, settings: Settings) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
735
740
  export declare const webSearch: () => ToolDefinition;
736
741
  export declare const webExtractor: () => ToolDefinition;
737
742
  export declare const codeInterpreter: () => ToolDefinition;
@@ -8,7 +8,7 @@ import { Route } from "../route/client.js";
8
8
  import { Endpoint } from "../route/endpoint.js";
9
9
  import { Framing } from "../route/framing.js";
10
10
  import { MediaRoute } from "../route/media.js";
11
- import { ProviderConfigurationError, ProviderID, ToolDefinition } from "../schema/index.js";
11
+ import { ProviderConfigurationError, ProviderID, ToolDefinition, } from "../schema/index.js";
12
12
  export const id = ProviderID.make("alibaba");
13
13
  const hosts = new Map([
14
14
  ["ap-southeast-1", "dashscope-intl.aliyuncs.com"],
@@ -69,20 +69,24 @@ export const configure = (input) => {
69
69
  .model({ id, compatibility: { requireSignature: false } });
70
70
  const responses = (id) => responsesRoute.with(common).model({ id });
71
71
  const media = MediaRoute.deployment({ ...input, baseURL: baseURL ?? `https://${host}/api/v1` }, opts.auth);
72
- const image = (id) => AlibabaImages.model({ ...media, id });
72
+ const image = (id, providerOptions) => AlibabaImages.model({ ...media, id, providerOptions });
73
73
  return { id, model: chat, chat, messages, responses, image, configure };
74
74
  };
75
75
  export const provider = { id, configure };
76
- export const model = (id, input) => fromSettings(input).chat(id);
77
- export const messagesModel = (id, input) => fromSettings(input).messages(id);
78
- export const responsesModel = (id, input) => fromSettings(input).responses(id);
79
- function fromSettings(input) {
76
+ export const model = (id, input) => configure(config(input)).chat(id);
77
+ export const messagesModel = (id, input) => configure(config(input)).messages(id);
78
+ export const responsesModel = (id, input) => configure(config(input)).responses(id);
79
+ export const imageModel = (id, settings) => {
80
+ const input = config(settings);
81
+ return configure(input).image(id, input.providerOptions);
82
+ };
83
+ function config(input) {
80
84
  const { body, ...rest } = input;
81
- return configure({
85
+ return {
82
86
  ...rest,
83
87
  http: body === undefined ? undefined : { body },
84
88
  providerOptions: Struct.omit(rest, ["apiKey", "baseURL", "headers", "region", "workspaceID"]),
85
- });
89
+ };
86
90
  }
87
91
  export const webSearch = () => hostedTool("web_search", "Search the web with Alibaba's hosted search tool.");
88
92
  export const webExtractor = () => hostedTool("web_extractor", "Extract web page content with Alibaba's hosted tool.");
@@ -48,7 +48,7 @@ export declare const routes: (Route<{
48
48
  readonly text: string;
49
49
  readonly cache_control?: {
50
50
  readonly type: "ephemeral";
51
- readonly ttl?: "1h" | "5m" | undefined;
51
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
52
52
  } | undefined;
53
53
  }[] | undefined;
54
54
  readonly messages: readonly ({
@@ -58,7 +58,7 @@ export declare const routes: (Route<{
58
58
  readonly text: string;
59
59
  readonly cache_control?: {
60
60
  readonly type: "ephemeral";
61
- readonly ttl?: "1h" | "5m" | undefined;
61
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
62
62
  } | undefined;
63
63
  } | {
64
64
  readonly type: "image";
@@ -75,7 +75,7 @@ export declare const routes: (Route<{
75
75
  };
76
76
  readonly cache_control?: {
77
77
  readonly type: "ephemeral";
78
- readonly ttl?: "1h" | "5m" | undefined;
78
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
79
79
  } | undefined;
80
80
  readonly transformations?: {
81
81
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -95,7 +95,7 @@ export declare const routes: (Route<{
95
95
  };
96
96
  readonly cache_control?: {
97
97
  readonly type: "ephemeral";
98
- readonly ttl?: "1h" | "5m" | undefined;
98
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
99
99
  } | undefined;
100
100
  } | {
101
101
  readonly type: "document";
@@ -116,7 +116,7 @@ export declare const routes: (Route<{
116
116
  };
117
117
  readonly cache_control?: {
118
118
  readonly type: "ephemeral";
119
- readonly ttl?: "1h" | "5m" | undefined;
119
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
120
120
  } | undefined;
121
121
  readonly title?: string | undefined;
122
122
  readonly context?: string | undefined;
@@ -131,7 +131,7 @@ export declare const routes: (Route<{
131
131
  readonly text: string;
132
132
  readonly cache_control?: {
133
133
  readonly type: "ephemeral";
134
- readonly ttl?: "1h" | "5m" | undefined;
134
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
135
135
  } | undefined;
136
136
  } | {
137
137
  readonly type: "image";
@@ -148,7 +148,7 @@ export declare const routes: (Route<{
148
148
  };
149
149
  readonly cache_control?: {
150
150
  readonly type: "ephemeral";
151
- readonly ttl?: "1h" | "5m" | undefined;
151
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
152
152
  } | undefined;
153
153
  readonly transformations?: {
154
154
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -168,7 +168,7 @@ export declare const routes: (Route<{
168
168
  };
169
169
  readonly cache_control?: {
170
170
  readonly type: "ephemeral";
171
- readonly ttl?: "1h" | "5m" | undefined;
171
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
172
172
  } | undefined;
173
173
  } | {
174
174
  readonly type: "document";
@@ -189,7 +189,7 @@ export declare const routes: (Route<{
189
189
  };
190
190
  readonly cache_control?: {
191
191
  readonly type: "ephemeral";
192
- readonly ttl?: "1h" | "5m" | undefined;
192
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
193
193
  } | undefined;
194
194
  readonly title?: string | undefined;
195
195
  readonly context?: string | undefined;
@@ -200,7 +200,7 @@ export declare const routes: (Route<{
200
200
  readonly is_error?: boolean | undefined;
201
201
  readonly cache_control?: {
202
202
  readonly type: "ephemeral";
203
- readonly ttl?: "1h" | "5m" | undefined;
203
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
204
204
  } | undefined;
205
205
  })[];
206
206
  } | {
@@ -213,7 +213,7 @@ export declare const routes: (Route<{
213
213
  readonly text: string;
214
214
  readonly cache_control?: {
215
215
  readonly type: "ephemeral";
216
- readonly ttl?: "1h" | "5m" | undefined;
216
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
217
217
  } | undefined;
218
218
  } | {
219
219
  readonly type: "thinking";
@@ -221,14 +221,14 @@ export declare const routes: (Route<{
221
221
  readonly signature: string;
222
222
  readonly cache_control?: {
223
223
  readonly type: "ephemeral";
224
- readonly ttl?: "1h" | "5m" | undefined;
224
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
225
225
  } | undefined;
226
226
  } | {
227
227
  readonly type: "redacted_thinking";
228
228
  readonly data: string;
229
229
  readonly cache_control?: {
230
230
  readonly type: "ephemeral";
231
- readonly ttl?: "1h" | "5m" | undefined;
231
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
232
232
  } | undefined;
233
233
  } | {
234
234
  readonly type: "tool_use";
@@ -237,7 +237,7 @@ export declare const routes: (Route<{
237
237
  readonly input: unknown;
238
238
  readonly cache_control?: {
239
239
  readonly type: "ephemeral";
240
- readonly ttl?: "1h" | "5m" | undefined;
240
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
241
241
  } | undefined;
242
242
  } | {
243
243
  readonly type: "server_tool_use";
@@ -246,7 +246,7 @@ export declare const routes: (Route<{
246
246
  readonly input: unknown;
247
247
  readonly cache_control?: {
248
248
  readonly type: "ephemeral";
249
- readonly ttl?: "1h" | "5m" | undefined;
249
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
250
250
  } | undefined;
251
251
  } | {
252
252
  readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
@@ -254,7 +254,7 @@ export declare const routes: (Route<{
254
254
  readonly content: unknown;
255
255
  readonly cache_control?: {
256
256
  readonly type: "ephemeral";
257
- readonly ttl?: "1h" | "5m" | undefined;
257
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
258
258
  } | undefined;
259
259
  })[];
260
260
  } | {
@@ -264,7 +264,7 @@ export declare const routes: (Route<{
264
264
  readonly text: string;
265
265
  readonly cache_control?: {
266
266
  readonly type: "ephemeral";
267
- readonly ttl?: "1h" | "5m" | undefined;
267
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
268
268
  } | undefined;
269
269
  }[];
270
270
  readonly output_config?: {
@@ -279,7 +279,7 @@ export declare const routes: (Route<{
279
279
  };
280
280
  readonly cache_control?: {
281
281
  readonly type: "ephemeral";
282
- readonly ttl?: "1h" | "5m" | undefined;
282
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
283
283
  } | undefined;
284
284
  }[] | undefined;
285
285
  readonly tool_choice?: {
@@ -323,7 +323,7 @@ export declare const routes: (Route<{
323
323
  } | undefined;
324
324
  readonly cache_control?: {
325
325
  readonly type: "ephemeral";
326
- readonly ttl?: "1h" | "5m" | undefined;
326
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
327
327
  } | undefined;
328
328
  readonly container?: string | {
329
329
  readonly id?: string | null | undefined;
@@ -638,6 +638,10 @@ export declare const routes: (Route<{
638
638
  } | undefined;
639
639
  readonly store?: boolean | undefined;
640
640
  readonly prompt_cache_key?: string | undefined;
641
+ readonly prompt_cache_retention?: string | undefined;
642
+ readonly prompt_cache_options?: {
643
+ readonly ttl?: string | undefined;
644
+ } | undefined;
641
645
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
642
646
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
643
647
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -18,8 +18,9 @@ export type Config = RouteDefaultsInput & {
18
18
  readonly region?: string;
19
19
  /** Override the computed `https://bedrock-runtime.<region>.amazonaws.com` URL. */
20
20
  readonly baseURL?: string;
21
+ readonly providerOptions?: BedrockConverse.OptionsInput;
21
22
  };
22
- export interface Settings extends ProviderPackage.Settings {
23
+ export type Settings = ProviderPackage.Settings & BedrockConverse.OptionsInput & {
23
24
  readonly apiKey?: string;
24
25
  readonly auth?: "bearer" | "sigv4";
25
26
  readonly baseURL?: string;
@@ -27,8 +28,7 @@ export interface Settings extends ProviderPackage.Settings {
27
28
  readonly profile?: string;
28
29
  readonly region?: string;
29
30
  readonly topP?: number;
30
- readonly thinking?: BedrockConverse.OptionsInput["thinking"];
31
- }
31
+ };
32
32
  export declare const routes: import("../route/client.js").Route<{
33
33
  readonly modelId: string;
34
34
  readonly messages: readonly ({
@@ -36,7 +36,7 @@ export declare const routes: import("../route/client.js").Route<{
36
36
  readonly content: readonly ({
37
37
  readonly cachePoint: {
38
38
  readonly type: "default";
39
- readonly ttl?: "1h" | "5m" | undefined;
39
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
40
40
  };
41
41
  } | {
42
42
  readonly image: {
@@ -86,7 +86,7 @@ export declare const routes: import("../route/client.js").Route<{
86
86
  readonly content: readonly ({
87
87
  readonly cachePoint: {
88
88
  readonly type: "default";
89
- readonly ttl?: "1h" | "5m" | undefined;
89
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
90
90
  };
91
91
  } | {
92
92
  readonly text: string;
@@ -110,7 +110,7 @@ export declare const routes: import("../route/client.js").Route<{
110
110
  readonly system?: readonly ({
111
111
  readonly cachePoint: {
112
112
  readonly type: "default";
113
- readonly ttl?: "1h" | "5m" | undefined;
113
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
114
114
  };
115
115
  } | {
116
116
  readonly text: string;
@@ -125,7 +125,7 @@ export declare const routes: import("../route/client.js").Route<{
125
125
  readonly tools: readonly ({
126
126
  readonly cachePoint: {
127
127
  readonly type: "default";
128
- readonly ttl?: "1h" | "5m" | undefined;
128
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
129
129
  };
130
130
  } | {
131
131
  readonly toolSpec: {
@@ -151,22 +151,42 @@ export declare const routes: import("../route/client.js").Route<{
151
151
  readonly additionalModelRequestFields?: {
152
152
  readonly [x: string]: unknown;
153
153
  } | undefined;
154
+ readonly serviceTier?: {
155
+ readonly type: import("../schema/options.js").OpenString<"default" | "flex" | "priority" | "reserved">;
156
+ } | undefined;
157
+ readonly guardrailConfig?: {
158
+ readonly guardrailIdentifier: string;
159
+ readonly guardrailVersion: string;
160
+ readonly trace?: import("../schema/options.js").OpenString<"disabled" | "enabled" | "enabled_full"> | undefined;
161
+ readonly streamProcessingMode?: import("../schema/options.js").OpenString<"async" | "sync"> | undefined;
162
+ } | undefined;
163
+ readonly outputConfig?: {
164
+ readonly textFormat: {
165
+ readonly type: import("../schema/options.js").OpenString<"json_schema">;
166
+ readonly structure: {
167
+ readonly jsonSchema: {
168
+ readonly schema: string;
169
+ readonly name?: string | undefined;
170
+ readonly description?: string | undefined;
171
+ };
172
+ };
173
+ };
174
+ } | undefined;
175
+ readonly requestMetadata?: {
176
+ readonly [x: string]: string;
177
+ } | undefined;
154
178
  }, import("../route/transport/http.js").HttpPrepared<{
155
179
  readonly [x: string]: unknown;
156
180
  readonly rawBody: string;
157
181
  }>, import("../route/client.js").CompactionOperations | undefined>[];
158
182
  export declare const configure: (input?: Config) => {
159
183
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
160
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
161
- readonly [x: string]: unknown;
162
- }, import("../route/client.js").CompactionOperations | undefined>;
184
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
163
185
  configure: typeof configure;
164
186
  };
165
187
  export declare const provider: {
166
188
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
167
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
168
- readonly [x: string]: unknown;
169
- }, import("../route/client.js").CompactionOperations | undefined>;
189
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
170
190
  configure: typeof configure;
171
191
  };
172
- export declare const model: ProviderPackage.Definition<Settings>["model"];
192
+ export declare const model: ProviderPackage.Definition<Settings, BedrockConverse.OptionsInput>["model"];
@@ -28,15 +28,15 @@ export const configure = (input = {}) => {
28
28
  };
29
29
  };
30
30
  export const provider = configure();
31
- export const model = (modelID, settings) => configure({
32
- apiKey: settings.apiKey,
33
- auth: settings.auth,
34
- baseURL: settings.baseURL,
35
- credentials: settings.credentials,
36
- generation: settings.topP === undefined ? undefined : { topP: settings.topP },
37
- headers: settings.headers === undefined ? undefined : { ...settings.headers },
38
- http: settings.body === undefined ? undefined : { body: { ...settings.body } },
39
- providerOptions: settings.thinking === undefined ? undefined : { thinking: settings.thinking },
40
- profile: settings.profile,
41
- region: settings.region,
31
+ export const model = (modelID, { apiKey, auth, baseURL, credentials, profile, region, topP, headers, body, ...providerOptions }) => configure({
32
+ apiKey,
33
+ auth,
34
+ baseURL,
35
+ credentials,
36
+ generation: topP === undefined ? undefined : { topP },
37
+ headers: headers === undefined ? undefined : { ...headers },
38
+ http: body === undefined ? undefined : { body: { ...body } },
39
+ providerOptions,
40
+ profile,
41
+ region,
42
42
  }).model(modelID);