@opencode/ai 0.0.0-dev-21915 → 0.0.0-dev-21922

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 (57) hide show
  1. package/README.md +22 -2
  2. package/dist/cache-policy.d.ts +4 -0
  3. package/dist/cache-policy.js +20 -6
  4. package/dist/protocols/alibaba-chat.d.ts +4 -0
  5. package/dist/protocols/alibaba-messages.d.ts +19 -19
  6. package/dist/protocols/anthropic-messages.d.ts +59 -59
  7. package/dist/protocols/anthropic-messages.js +3 -5
  8. package/dist/protocols/bedrock-converse.d.ts +12 -12
  9. package/dist/protocols/meta-messages.d.ts +19 -19
  10. package/dist/protocols/meta-messages.js +2 -1
  11. package/dist/protocols/openai-chat.d.ts +585 -1
  12. package/dist/protocols/openai-chat.js +7 -2
  13. package/dist/protocols/openai-compatible-chat.d.ts +4 -0
  14. package/dist/protocols/openai-responses.d.ts +24 -0
  15. package/dist/protocols/openai-responses.js +5 -0
  16. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  17. package/dist/protocols/utils/bedrock-cache.js +7 -6
  18. package/dist/protocols/utils/cache.d.ts +14 -3
  19. package/dist/protocols/utils/cache.js +11 -4
  20. package/dist/protocols/venice-chat.d.ts +3 -0
  21. package/dist/protocols/venice-chat.js +1 -1
  22. package/dist/protocols/zai-chat.d.ts +4 -0
  23. package/dist/protocols/zai-messages.d.ts +19 -19
  24. package/dist/providers/alibaba.d.ts +23 -19
  25. package/dist/providers/amazon-bedrock-mantle.d.ts +23 -19
  26. package/dist/providers/amazon-bedrock.d.ts +4 -4
  27. package/dist/providers/anthropic-compatible.d.ts +19 -19
  28. package/dist/providers/anthropic.d.ts +19 -19
  29. package/dist/providers/azure.d.ts +12 -0
  30. package/dist/providers/baseten.d.ts +8 -0
  31. package/dist/providers/cerebras.d.ts +8 -0
  32. package/dist/providers/cloudflare-ai-gateway.d.ts +54 -38
  33. package/dist/providers/cloudflare-workers-ai.d.ts +8 -0
  34. package/dist/providers/cohere.d.ts +8 -0
  35. package/dist/providers/deepinfra.d.ts +8 -0
  36. package/dist/providers/deepseek.d.ts +8 -0
  37. package/dist/providers/digitalocean.d.ts +12 -0
  38. package/dist/providers/fireworks.d.ts +8 -0
  39. package/dist/providers/google-vertex-chat.d.ts +4 -0
  40. package/dist/providers/google-vertex-messages.d.ts +19 -19
  41. package/dist/providers/groq.d.ts +8 -0
  42. package/dist/providers/meta.d.ts +23 -19
  43. package/dist/providers/minimax.d.ts +23 -19
  44. package/dist/providers/moonshot.d.ts +23 -19
  45. package/dist/providers/openai-compatible.d.ts +4 -0
  46. package/dist/providers/openai.d.ts +8 -0
  47. package/dist/providers/openrouter.d.ts +16 -0
  48. package/dist/providers/togetherai.d.ts +8 -0
  49. package/dist/providers/venice.d.ts +3 -0
  50. package/dist/providers/xai.d.ts +4 -0
  51. package/dist/providers/zai-coding-plan.d.ts +23 -19
  52. package/dist/providers/zai.d.ts +4 -0
  53. package/dist/schema/messages.d.ts +2 -2
  54. package/dist/schema/options.d.ts +5 -3
  55. package/dist/schema/options.js +8 -3
  56. package/dist/utils/media-type.js +4 -0
  57. package/package.json +3 -3
@@ -49,7 +49,7 @@ export declare const routes: (Route<{
49
49
  readonly text: string;
50
50
  readonly cache_control?: {
51
51
  readonly type: "ephemeral";
52
- readonly ttl?: "1h" | "5m" | undefined;
52
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
53
53
  } | undefined;
54
54
  }[] | undefined;
55
55
  readonly messages: readonly ({
@@ -59,7 +59,7 @@ export declare const routes: (Route<{
59
59
  readonly text: string;
60
60
  readonly cache_control?: {
61
61
  readonly type: "ephemeral";
62
- readonly ttl?: "1h" | "5m" | undefined;
62
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
63
63
  } | undefined;
64
64
  } | {
65
65
  readonly type: "image";
@@ -76,7 +76,7 @@ export declare const routes: (Route<{
76
76
  };
77
77
  readonly cache_control?: {
78
78
  readonly type: "ephemeral";
79
- readonly ttl?: "1h" | "5m" | undefined;
79
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
80
80
  } | undefined;
81
81
  readonly transformations?: {
82
82
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -96,7 +96,7 @@ export declare const routes: (Route<{
96
96
  };
97
97
  readonly cache_control?: {
98
98
  readonly type: "ephemeral";
99
- readonly ttl?: "1h" | "5m" | undefined;
99
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
100
100
  } | undefined;
101
101
  } | {
102
102
  readonly type: "document";
@@ -117,7 +117,7 @@ export declare const routes: (Route<{
117
117
  };
118
118
  readonly cache_control?: {
119
119
  readonly type: "ephemeral";
120
- readonly ttl?: "1h" | "5m" | undefined;
120
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
121
121
  } | undefined;
122
122
  readonly title?: string | undefined;
123
123
  readonly context?: string | undefined;
@@ -132,7 +132,7 @@ export declare const routes: (Route<{
132
132
  readonly text: string;
133
133
  readonly cache_control?: {
134
134
  readonly type: "ephemeral";
135
- readonly ttl?: "1h" | "5m" | undefined;
135
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
136
136
  } | undefined;
137
137
  } | {
138
138
  readonly type: "image";
@@ -149,7 +149,7 @@ export declare const routes: (Route<{
149
149
  };
150
150
  readonly cache_control?: {
151
151
  readonly type: "ephemeral";
152
- readonly ttl?: "1h" | "5m" | undefined;
152
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
153
153
  } | undefined;
154
154
  readonly transformations?: {
155
155
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -169,7 +169,7 @@ export declare const routes: (Route<{
169
169
  };
170
170
  readonly cache_control?: {
171
171
  readonly type: "ephemeral";
172
- readonly ttl?: "1h" | "5m" | undefined;
172
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
173
173
  } | undefined;
174
174
  } | {
175
175
  readonly type: "document";
@@ -190,7 +190,7 @@ export declare const routes: (Route<{
190
190
  };
191
191
  readonly cache_control?: {
192
192
  readonly type: "ephemeral";
193
- readonly ttl?: "1h" | "5m" | undefined;
193
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
194
194
  } | undefined;
195
195
  readonly title?: string | undefined;
196
196
  readonly context?: string | undefined;
@@ -201,7 +201,7 @@ export declare const routes: (Route<{
201
201
  readonly is_error?: boolean | undefined;
202
202
  readonly cache_control?: {
203
203
  readonly type: "ephemeral";
204
- readonly ttl?: "1h" | "5m" | undefined;
204
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
205
205
  } | undefined;
206
206
  })[];
207
207
  } | {
@@ -214,7 +214,7 @@ export declare const routes: (Route<{
214
214
  readonly text: string;
215
215
  readonly cache_control?: {
216
216
  readonly type: "ephemeral";
217
- readonly ttl?: "1h" | "5m" | undefined;
217
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
218
218
  } | undefined;
219
219
  } | {
220
220
  readonly type: "thinking";
@@ -222,14 +222,14 @@ export declare const routes: (Route<{
222
222
  readonly signature: string;
223
223
  readonly cache_control?: {
224
224
  readonly type: "ephemeral";
225
- readonly ttl?: "1h" | "5m" | undefined;
225
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
226
226
  } | undefined;
227
227
  } | {
228
228
  readonly type: "redacted_thinking";
229
229
  readonly data: string;
230
230
  readonly cache_control?: {
231
231
  readonly type: "ephemeral";
232
- readonly ttl?: "1h" | "5m" | undefined;
232
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
233
233
  } | undefined;
234
234
  } | {
235
235
  readonly type: "tool_use";
@@ -238,7 +238,7 @@ export declare const routes: (Route<{
238
238
  readonly input: unknown;
239
239
  readonly cache_control?: {
240
240
  readonly type: "ephemeral";
241
- readonly ttl?: "1h" | "5m" | undefined;
241
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
242
242
  } | undefined;
243
243
  } | {
244
244
  readonly type: "server_tool_use";
@@ -247,7 +247,7 @@ export declare const routes: (Route<{
247
247
  readonly input: unknown;
248
248
  readonly cache_control?: {
249
249
  readonly type: "ephemeral";
250
- readonly ttl?: "1h" | "5m" | undefined;
250
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
251
251
  } | undefined;
252
252
  } | {
253
253
  readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
@@ -255,7 +255,7 @@ export declare const routes: (Route<{
255
255
  readonly content: unknown;
256
256
  readonly cache_control?: {
257
257
  readonly type: "ephemeral";
258
- readonly ttl?: "1h" | "5m" | undefined;
258
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
259
259
  } | undefined;
260
260
  })[];
261
261
  } | {
@@ -265,7 +265,7 @@ export declare const routes: (Route<{
265
265
  readonly text: string;
266
266
  readonly cache_control?: {
267
267
  readonly type: "ephemeral";
268
- readonly ttl?: "1h" | "5m" | undefined;
268
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
269
269
  } | undefined;
270
270
  }[];
271
271
  readonly output_config?: {
@@ -280,7 +280,7 @@ export declare const routes: (Route<{
280
280
  };
281
281
  readonly cache_control?: {
282
282
  readonly type: "ephemeral";
283
- readonly ttl?: "1h" | "5m" | undefined;
283
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
284
284
  } | undefined;
285
285
  }[] | undefined;
286
286
  readonly tool_choice?: {
@@ -324,7 +324,7 @@ export declare const routes: (Route<{
324
324
  } | undefined;
325
325
  readonly cache_control?: {
326
326
  readonly type: "ephemeral";
327
- readonly ttl?: "1h" | "5m" | undefined;
327
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
328
328
  } | undefined;
329
329
  readonly container?: string | {
330
330
  readonly id?: string | null | undefined;
@@ -639,6 +639,10 @@ export declare const routes: (Route<{
639
639
  } | undefined;
640
640
  readonly store?: boolean | undefined;
641
641
  readonly prompt_cache_key?: string | undefined;
642
+ readonly prompt_cache_retention?: string | undefined;
643
+ readonly prompt_cache_options?: {
644
+ readonly ttl?: string | undefined;
645
+ } | undefined;
642
646
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
643
647
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
644
648
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -135,6 +135,10 @@ export declare const routes: import("../route/client.js").Route<{
135
135
  } | undefined;
136
136
  readonly store?: boolean | undefined;
137
137
  readonly prompt_cache_key?: string | undefined;
138
+ readonly prompt_cache_retention?: string | undefined;
139
+ readonly prompt_cache_options?: {
140
+ readonly ttl?: string | undefined;
141
+ } | undefined;
138
142
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
139
143
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
140
144
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -132,6 +132,10 @@ export declare const routes: (Route<{
132
132
  } | undefined;
133
133
  readonly store?: boolean | undefined;
134
134
  readonly prompt_cache_key?: string | undefined;
135
+ readonly prompt_cache_retention?: string | undefined;
136
+ readonly prompt_cache_options?: {
137
+ readonly ttl?: string | undefined;
138
+ } | undefined;
135
139
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
136
140
  readonly verbosity?: OpenString<"high" | "low" | "medium"> | undefined;
137
141
  readonly service_tier?: OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -301,6 +305,10 @@ export declare const routes: (Route<{
301
305
  readonly top_p?: number | undefined;
302
306
  readonly presence_penalty?: number | undefined;
303
307
  readonly frequency_penalty?: number | undefined;
308
+ readonly prompt_cache_retention?: string | undefined;
309
+ readonly prompt_cache_options?: {
310
+ readonly ttl?: string | undefined;
311
+ } | undefined;
304
312
  readonly tools?: readonly ({
305
313
  readonly type: "namespace";
306
314
  readonly name: string;
@@ -205,6 +205,10 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
205
205
  }>>;
206
206
  readonly store: Schema.optional<Schema.Boolean>;
207
207
  readonly prompt_cache_key: Schema.optional<Schema.String>;
208
+ readonly prompt_cache_retention: Schema.optional<Schema.String>;
209
+ readonly prompt_cache_options: Schema.optional<Schema.Struct<{
210
+ readonly ttl: Schema.optional<Schema.String>;
211
+ }>>;
208
212
  readonly reasoning_effort: Schema.optional<Schema.declare<import("../schema/options.js").ReasoningEffort, import("../schema/options.js").ReasoningEffort>>;
209
213
  readonly verbosity: Schema.optional<Schema.declare<OpenString<"high" | "low" | "medium">, OpenString<"high" | "low" | "medium">>>;
210
214
  readonly service_tier: Schema.optional<Schema.declare<OpenString<"auto" | "default" | "flex" | "priority">, OpenString<"auto" | "default" | "flex" | "priority">>>;
@@ -351,6 +355,10 @@ export declare const protocol: Protocol<{
351
355
  } | undefined;
352
356
  store?: boolean | undefined;
353
357
  prompt_cache_key?: string | undefined;
358
+ prompt_cache_retention?: string | undefined;
359
+ prompt_cache_options?: {
360
+ readonly ttl?: string | undefined;
361
+ } | undefined;
354
362
  reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
355
363
  verbosity?: OpenString<"high" | "low" | "medium"> | undefined;
356
364
  service_tier?: OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -580,6 +588,10 @@ export declare const route: Route<{
580
588
  } | undefined;
581
589
  store?: boolean | undefined;
582
590
  prompt_cache_key?: string | undefined;
591
+ prompt_cache_retention?: string | undefined;
592
+ prompt_cache_options?: {
593
+ readonly ttl?: string | undefined;
594
+ } | undefined;
583
595
  reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
584
596
  verbosity?: OpenString<"high" | "low" | "medium"> | undefined;
585
597
  service_tier?: OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -737,6 +749,10 @@ export declare const routes: Route<{
737
749
  } | undefined;
738
750
  store?: boolean | undefined;
739
751
  prompt_cache_key?: string | undefined;
752
+ prompt_cache_retention?: string | undefined;
753
+ prompt_cache_options?: {
754
+ readonly ttl?: string | undefined;
755
+ } | undefined;
740
756
  reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
741
757
  verbosity?: OpenString<"high" | "low" | "medium"> | undefined;
742
758
  service_tier?: OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -133,6 +133,10 @@ export declare const route: Route<{
133
133
  } | undefined;
134
134
  readonly store?: boolean | undefined;
135
135
  readonly prompt_cache_key?: string | undefined;
136
+ readonly prompt_cache_retention?: string | undefined;
137
+ readonly prompt_cache_options?: {
138
+ readonly ttl?: string | undefined;
139
+ } | undefined;
136
140
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
137
141
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
138
142
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -272,6 +276,10 @@ export declare const routes: Route<{
272
276
  } | undefined;
273
277
  readonly store?: boolean | undefined;
274
278
  readonly prompt_cache_key?: string | undefined;
279
+ readonly prompt_cache_retention?: string | undefined;
280
+ readonly prompt_cache_options?: {
281
+ readonly ttl?: string | undefined;
282
+ } | undefined;
275
283
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
276
284
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
277
285
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -44,6 +44,9 @@ export declare const routes: Route<{
44
44
  } | undefined;
45
45
  readonly store?: boolean | undefined;
46
46
  readonly prompt_cache_key?: string | undefined;
47
+ readonly prompt_cache_options?: {
48
+ readonly ttl?: string | undefined;
49
+ } | undefined;
47
50
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
48
51
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
49
52
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -144,6 +144,10 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
144
144
  } | undefined;
145
145
  readonly store?: boolean | undefined;
146
146
  readonly prompt_cache_key?: string | undefined;
147
+ readonly prompt_cache_retention?: string | undefined;
148
+ readonly prompt_cache_options?: {
149
+ readonly ttl?: string | undefined;
150
+ } | undefined;
147
151
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
148
152
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
149
153
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -320,6 +320,10 @@ export declare const routes: (Route<{
320
320
  } | undefined;
321
321
  readonly store?: boolean | undefined;
322
322
  readonly prompt_cache_key?: string | undefined;
323
+ readonly prompt_cache_retention?: string | undefined;
324
+ readonly prompt_cache_options?: {
325
+ readonly ttl?: string | undefined;
326
+ } | undefined;
323
327
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
324
328
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
325
329
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -365,7 +369,7 @@ export declare const routes: (Route<{
365
369
  readonly text: string;
366
370
  readonly cache_control?: {
367
371
  readonly type: "ephemeral";
368
- readonly ttl?: "1h" | "5m" | undefined;
372
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
369
373
  } | undefined;
370
374
  }[] | undefined;
371
375
  readonly messages: readonly ({
@@ -375,7 +379,7 @@ export declare const routes: (Route<{
375
379
  readonly text: string;
376
380
  readonly cache_control?: {
377
381
  readonly type: "ephemeral";
378
- readonly ttl?: "1h" | "5m" | undefined;
382
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
379
383
  } | undefined;
380
384
  } | {
381
385
  readonly type: "image";
@@ -392,7 +396,7 @@ export declare const routes: (Route<{
392
396
  };
393
397
  readonly cache_control?: {
394
398
  readonly type: "ephemeral";
395
- readonly ttl?: "1h" | "5m" | undefined;
399
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
396
400
  } | undefined;
397
401
  readonly transformations?: {
398
402
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -412,7 +416,7 @@ export declare const routes: (Route<{
412
416
  };
413
417
  readonly cache_control?: {
414
418
  readonly type: "ephemeral";
415
- readonly ttl?: "1h" | "5m" | undefined;
419
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
416
420
  } | undefined;
417
421
  } | {
418
422
  readonly type: "document";
@@ -433,7 +437,7 @@ export declare const routes: (Route<{
433
437
  };
434
438
  readonly cache_control?: {
435
439
  readonly type: "ephemeral";
436
- readonly ttl?: "1h" | "5m" | undefined;
440
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
437
441
  } | undefined;
438
442
  readonly title?: string | undefined;
439
443
  readonly context?: string | undefined;
@@ -448,7 +452,7 @@ export declare const routes: (Route<{
448
452
  readonly text: string;
449
453
  readonly cache_control?: {
450
454
  readonly type: "ephemeral";
451
- readonly ttl?: "1h" | "5m" | undefined;
455
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
452
456
  } | undefined;
453
457
  } | {
454
458
  readonly type: "image";
@@ -465,7 +469,7 @@ export declare const routes: (Route<{
465
469
  };
466
470
  readonly cache_control?: {
467
471
  readonly type: "ephemeral";
468
- readonly ttl?: "1h" | "5m" | undefined;
472
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
469
473
  } | undefined;
470
474
  readonly transformations?: {
471
475
  readonly oversized_image?: "downsize" | "error" | undefined;
@@ -485,7 +489,7 @@ export declare const routes: (Route<{
485
489
  };
486
490
  readonly cache_control?: {
487
491
  readonly type: "ephemeral";
488
- readonly ttl?: "1h" | "5m" | undefined;
492
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
489
493
  } | undefined;
490
494
  } | {
491
495
  readonly type: "document";
@@ -506,7 +510,7 @@ export declare const routes: (Route<{
506
510
  };
507
511
  readonly cache_control?: {
508
512
  readonly type: "ephemeral";
509
- readonly ttl?: "1h" | "5m" | undefined;
513
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
510
514
  } | undefined;
511
515
  readonly title?: string | undefined;
512
516
  readonly context?: string | undefined;
@@ -517,7 +521,7 @@ export declare const routes: (Route<{
517
521
  readonly is_error?: boolean | undefined;
518
522
  readonly cache_control?: {
519
523
  readonly type: "ephemeral";
520
- readonly ttl?: "1h" | "5m" | undefined;
524
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
521
525
  } | undefined;
522
526
  })[];
523
527
  } | {
@@ -530,7 +534,7 @@ export declare const routes: (Route<{
530
534
  readonly text: string;
531
535
  readonly cache_control?: {
532
536
  readonly type: "ephemeral";
533
- readonly ttl?: "1h" | "5m" | undefined;
537
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
534
538
  } | undefined;
535
539
  } | {
536
540
  readonly type: "thinking";
@@ -538,14 +542,14 @@ export declare const routes: (Route<{
538
542
  readonly signature: string;
539
543
  readonly cache_control?: {
540
544
  readonly type: "ephemeral";
541
- readonly ttl?: "1h" | "5m" | undefined;
545
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
542
546
  } | undefined;
543
547
  } | {
544
548
  readonly type: "redacted_thinking";
545
549
  readonly data: string;
546
550
  readonly cache_control?: {
547
551
  readonly type: "ephemeral";
548
- readonly ttl?: "1h" | "5m" | undefined;
552
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
549
553
  } | undefined;
550
554
  } | {
551
555
  readonly type: "tool_use";
@@ -554,7 +558,7 @@ export declare const routes: (Route<{
554
558
  readonly input: unknown;
555
559
  readonly cache_control?: {
556
560
  readonly type: "ephemeral";
557
- readonly ttl?: "1h" | "5m" | undefined;
561
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
558
562
  } | undefined;
559
563
  } | {
560
564
  readonly type: "server_tool_use";
@@ -563,7 +567,7 @@ export declare const routes: (Route<{
563
567
  readonly input: unknown;
564
568
  readonly cache_control?: {
565
569
  readonly type: "ephemeral";
566
- readonly ttl?: "1h" | "5m" | undefined;
570
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
567
571
  } | undefined;
568
572
  } | {
569
573
  readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
@@ -571,7 +575,7 @@ export declare const routes: (Route<{
571
575
  readonly content: unknown;
572
576
  readonly cache_control?: {
573
577
  readonly type: "ephemeral";
574
- readonly ttl?: "1h" | "5m" | undefined;
578
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
575
579
  } | undefined;
576
580
  })[];
577
581
  } | {
@@ -581,7 +585,7 @@ export declare const routes: (Route<{
581
585
  readonly text: string;
582
586
  readonly cache_control?: {
583
587
  readonly type: "ephemeral";
584
- readonly ttl?: "1h" | "5m" | undefined;
588
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
585
589
  } | undefined;
586
590
  }[];
587
591
  readonly output_config?: {
@@ -596,7 +600,7 @@ export declare const routes: (Route<{
596
600
  };
597
601
  readonly cache_control?: {
598
602
  readonly type: "ephemeral";
599
- readonly ttl?: "1h" | "5m" | undefined;
603
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
600
604
  } | undefined;
601
605
  }[] | undefined;
602
606
  readonly tool_choice?: {
@@ -624,7 +628,7 @@ export declare const routes: (Route<{
624
628
  } | undefined;
625
629
  readonly cache_control?: {
626
630
  readonly type: "ephemeral";
627
- readonly ttl?: "1h" | "5m" | undefined;
631
+ readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
628
632
  } | undefined;
629
633
  readonly container?: string | {
630
634
  readonly id?: string | null | undefined;
@@ -135,6 +135,10 @@ export declare const routes: Route<{
135
135
  } | undefined;
136
136
  readonly store?: boolean | undefined;
137
137
  readonly prompt_cache_key?: string | undefined;
138
+ readonly prompt_cache_retention?: string | undefined;
139
+ readonly prompt_cache_options?: {
140
+ readonly ttl?: string | undefined;
141
+ } | undefined;
138
142
  readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
139
143
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
140
144
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -691,7 +691,7 @@ declare const requestSchema: Schema.Struct<{
691
691
  readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
692
692
  readonly tail: Schema.Natural;
693
693
  }>]>>;
694
- readonly ttlSeconds: Schema.optional<Schema.Number>;
694
+ readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
695
695
  }>]>>;
696
696
  readonly promptCacheKey: Schema.optional<Schema.String>;
697
697
  readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
@@ -728,7 +728,7 @@ declare const LLMRequest_base: Schema.Class<LLMRequest<LanguageModel<{
728
728
  readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
729
729
  readonly tail: Schema.Natural;
730
730
  }>]>>;
731
- readonly ttlSeconds: Schema.optional<Schema.Number>;
731
+ readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
732
732
  }>]>>;
733
733
  readonly promptCacheKey: Schema.optional<Schema.String>;
734
734
  readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
@@ -170,9 +170,11 @@ export declare const LanguageModelSchema: Schema.declare<LanguageModel<{
170
170
  }, CompactionOperations | undefined>, LanguageModel<{
171
171
  readonly [x: string]: unknown;
172
172
  }, CompactionOperations | undefined>>;
173
+ export declare const CacheTTL: Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>;
174
+ export type CacheTTL = typeof CacheTTL.Type;
173
175
  declare const CacheHint_base: Schema.Class<CacheHint, Schema.Struct<{
174
176
  readonly type: Schema.Literals<readonly ["ephemeral", "persistent"]>;
175
- readonly ttlSeconds: Schema.optional<Schema.Number>;
177
+ readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
176
178
  }>, {}>;
177
179
  export declare class CacheHint extends CacheHint_base {
178
180
  }
@@ -182,7 +184,7 @@ export declare const CachePolicyObject: Schema.Struct<{
182
184
  readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
183
185
  readonly tail: Schema.Natural;
184
186
  }>]>>;
185
- readonly ttlSeconds: Schema.optional<Schema.Number>;
187
+ readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
186
188
  }>;
187
189
  export type CachePolicyObject = Schema.Schema.Type<typeof CachePolicyObject>;
188
190
  export declare const CachePolicy: Schema.Union<readonly [Schema.Literal<"auto">, Schema.Literal<"none">, Schema.Struct<{
@@ -191,7 +193,7 @@ export declare const CachePolicy: Schema.Union<readonly [Schema.Literal<"auto">,
191
193
  readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
192
194
  readonly tail: Schema.Natural;
193
195
  }>]>>;
194
- readonly ttlSeconds: Schema.optional<Schema.Number>;
196
+ readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
195
197
  }>]>;
196
198
  export type CachePolicy = Schema.Schema.Type<typeof CachePolicy>;
197
199
  export {};
@@ -210,9 +210,12 @@ export class LanguageModel {
210
210
  export const LanguageModelSchema = Schema.declare((value) => value instanceof LanguageModel, {
211
211
  expected: "LLM.LanguageModel",
212
212
  });
213
+ // Provider cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. It is sent as given;
214
+ // each provider accepts its own set, and omitting it keeps the provider default.
215
+ export const CacheTTL = Schema.TemplateLiteral([Schema.Number, Schema.Literals(["ms", "s", "m", "h", "d"])]).check(Schema.isPattern(/^\d+(ms|s|m|h|d)$/));
213
216
  export class CacheHint extends Schema.Class("LLM.CacheHint")({
214
217
  type: Schema.Literals(["ephemeral", "persistent"]),
215
- ttlSeconds: Schema.optional(Schema.Number),
218
+ ttl: Schema.optional(CacheTTL),
216
219
  }) {
217
220
  }
218
221
  // Auto-placement policy for prompt caching. The protocol-neutral lowering step
@@ -224,7 +227,9 @@ export class CacheHint extends Schema.Class("LLM.CacheHint")({
224
227
  // tool loops.
225
228
  //
226
229
  // Pass `"none"` to opt out entirely (the legacy behavior). Pass the granular
227
- // object form to override individual choices.
230
+ // object form to choose placements exactly; an object with only `ttl` keeps
231
+ // the automatic placements and sets their lifetime. Routes without inline
232
+ // markers send `ttl` as a request-level cache option where one exists.
228
233
  export const CachePolicyObject = Schema.Struct({
229
234
  tools: Schema.optional(Schema.Boolean),
230
235
  system: Schema.optional(Schema.Boolean),
@@ -233,6 +238,6 @@ export const CachePolicyObject = Schema.Struct({
233
238
  Schema.Literal("latest-assistant"),
234
239
  Schema.Struct({ tail: Schema.Natural }),
235
240
  ])),
236
- ttlSeconds: Schema.optional(Schema.Number),
241
+ ttl: Schema.optional(CacheTTL),
237
242
  });
238
243
  export const CachePolicy = Schema.Union([Schema.Literal("auto"), Schema.Literal("none"), CachePolicyObject]);
@@ -58,8 +58,12 @@ const EXTENSIONS = {
58
58
  jpeg: "image/jpeg",
59
59
  gif: "image/gif",
60
60
  webp: "image/webp",
61
+ avif: "image/avif",
62
+ heic: "image/heic",
63
+ heif: "image/heif",
61
64
  pdf: "application/pdf",
62
65
  mp4: "video/mp4",
66
+ mov: "video/quicktime",
63
67
  webm: "video/webm",
64
68
  mp3: "audio/mpeg",
65
69
  m4a: "audio/mp4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-dev-21915",
3
+ "version": "0.0.0-dev-21922",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@clack/prompts": "1.0.0-alpha.1",
37
37
  "@effect/platform-node": "4.0.1",
38
- "@opencode/http-recorder": "0.0.0-dev-21915",
38
+ "@opencode/http-recorder": "0.0.0-dev-21922",
39
39
  "@tsconfig/bun": "1.0.9",
40
40
  "@types/bun": "1.4.3",
41
41
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/credential-providers": "3.1057.0",
46
46
  "@smithy/eventstream-codec": "4.2.14",
47
47
  "@smithy/util-utf8": "4.2.2",
48
- "@opencode/schema": "0.0.0-dev-21915",
48
+ "@opencode/schema": "0.0.0-dev-21922",
49
49
  "aws4fetch": "1.0.20",
50
50
  "effect": "4.0.1",
51
51
  "google-auth-library": "10.5.0"