@opencode/ai 2.2.5 → 2.2.6

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 (264) hide show
  1. package/README.md +133 -69
  2. package/dist/cache-policy.d.ts +1 -1
  3. package/dist/cache-policy.js +16 -4
  4. package/dist/decision-client.d.ts +3 -3
  5. package/dist/decision.d.ts +20 -125
  6. package/dist/decision.js +25 -15
  7. package/dist/effect.d.ts +4 -15
  8. package/dist/effect.js +2 -6
  9. package/dist/effort-updates.d.ts +3 -3
  10. package/dist/effort-updates.js +2 -2
  11. package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
  12. package/dist/experimental/cloudflare-run-extraction.js +4 -1
  13. package/dist/experimental/extraction.d.ts +10 -40
  14. package/dist/experimental/extraction.js +14 -13
  15. package/dist/experimental.d.ts +8 -8
  16. package/dist/experimental.js +4 -4
  17. package/dist/generation.d.ts +0 -2
  18. package/dist/generation.js +2 -2
  19. package/dist/image-client.d.ts +13 -7
  20. package/dist/image-client.js +1 -1
  21. package/dist/image.d.ts +357 -464
  22. package/dist/image.js +17 -15
  23. package/dist/index.d.ts +28 -465
  24. package/dist/index.js +18 -17
  25. package/dist/llm.d.ts +65 -266
  26. package/dist/llm.js +101 -92
  27. package/dist/loop.d.ts +38 -0
  28. package/dist/loop.js +136 -0
  29. package/dist/media-model.d.ts +1 -1
  30. package/dist/media-model.js +8 -6
  31. package/dist/media.d.ts +9 -0
  32. package/dist/media.js +37 -2
  33. package/dist/protocols/alibaba-chat.d.ts +5 -1
  34. package/dist/protocols/alibaba-chat.js +3 -3
  35. package/dist/protocols/alibaba-images.d.ts +2 -2
  36. package/dist/protocols/alibaba-messages.js +3 -3
  37. package/dist/protocols/alibaba-responses.js +8 -20
  38. package/dist/protocols/anthropic-messages.d.ts +1 -1
  39. package/dist/protocols/anthropic-messages.js +54 -173
  40. package/dist/protocols/assemblyai-transcription.d.ts +2 -2
  41. package/dist/protocols/bedrock-converse.js +10 -16
  42. package/dist/protocols/cartesia-speech.d.ts +2 -2
  43. package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
  44. package/dist/protocols/cohere-chat.js +9 -12
  45. package/dist/protocols/deepgram-speech.d.ts +2 -2
  46. package/dist/protocols/deepgram-transcription.d.ts +2 -2
  47. package/dist/protocols/elevenlabs-speech.d.ts +2 -2
  48. package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
  49. package/dist/protocols/gemini.d.ts +3 -0
  50. package/dist/protocols/gemini.js +54 -72
  51. package/dist/protocols/google-images.d.ts +2 -2
  52. package/dist/protocols/google-interactions.d.ts +3 -4
  53. package/dist/protocols/google-interactions.js +44 -30
  54. package/dist/protocols/google-speech.d.ts +2 -2
  55. package/dist/protocols/google-transcription.d.ts +2 -2
  56. package/dist/protocols/google-video.d.ts +2 -2
  57. package/dist/protocols/meta-images.d.ts +2 -2
  58. package/dist/protocols/meta-responses.js +26 -23
  59. package/dist/protocols/minimax-images.d.ts +2 -2
  60. package/dist/protocols/mistral-chat.js +7 -10
  61. package/dist/protocols/open-responses-channel.js +6 -19
  62. package/dist/protocols/open-responses-continuation.d.ts +1 -5
  63. package/dist/protocols/open-responses-continuation.js +1 -3
  64. package/dist/protocols/open-responses.d.ts +1 -21
  65. package/dist/protocols/open-responses.js +10 -15
  66. package/dist/protocols/openai-chat.d.ts +3 -23
  67. package/dist/protocols/openai-chat.js +26 -47
  68. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  69. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  70. package/dist/protocols/openai-compatible-responses.js +1 -1
  71. package/dist/protocols/openai-decisions.js +1 -1
  72. package/dist/protocols/openai-images.d.ts +2 -2
  73. package/dist/protocols/openai-responses.js +10 -29
  74. package/dist/protocols/openai-speech.d.ts +2 -2
  75. package/dist/protocols/openai-transcription.d.ts +2 -2
  76. package/dist/protocols/runway-video.d.ts +2 -2
  77. package/dist/protocols/shared.d.ts +1 -4
  78. package/dist/protocols/shared.js +13 -11
  79. package/dist/protocols/system-one.d.ts +4 -4
  80. package/dist/protocols/utils/bedrock-cache.js +2 -5
  81. package/dist/protocols/utils/bedrock-media.d.ts +0 -3
  82. package/dist/protocols/utils/cache.d.ts +3 -0
  83. package/dist/protocols/utils/cache.js +15 -2
  84. package/dist/protocols/utils/image-sizing.d.ts +1 -1
  85. package/dist/protocols/utils/responses-checkpoint.js +1 -1
  86. package/dist/protocols/utils/responses-compaction.d.ts +1 -1
  87. package/dist/protocols/utils/responses-compaction.js +6 -5
  88. package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
  89. package/dist/protocols/utils/responses-hosted-tools.js +31 -0
  90. package/dist/protocols/utils/tool-stream.d.ts +5 -271
  91. package/dist/protocols/utils/tool-stream.js +3 -13
  92. package/dist/protocols/venice-chat.d.ts +3 -1
  93. package/dist/protocols/venice-chat.js +4 -4
  94. package/dist/protocols/xai-images.d.ts +2 -2
  95. package/dist/protocols/xai-responses.js +5 -25
  96. package/dist/protocols/xai-video.d.ts +2 -2
  97. package/dist/protocols/zai-chat.d.ts +5 -1
  98. package/dist/protocols/zai-chat.js +1 -1
  99. package/dist/protocols/zai-images.d.ts +2 -2
  100. package/dist/protocols/zai-messages.js +3 -3
  101. package/dist/provider-error.d.ts +0 -1
  102. package/dist/provider-error.js +7 -80
  103. package/dist/providers/alibaba.d.ts +67 -4
  104. package/dist/providers/alibaba.js +6 -1
  105. package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
  106. package/dist/providers/amazon-bedrock-mantle.js +6 -3
  107. package/dist/providers/amazon-bedrock.d.ts +6 -7
  108. package/dist/providers/amazon-bedrock.js +1 -1
  109. package/dist/providers/anthropic-compatible.d.ts +7 -8
  110. package/dist/providers/anthropic-compatible.js +2 -5
  111. package/dist/providers/anthropic.d.ts +8 -9
  112. package/dist/providers/anthropic.js +2 -7
  113. package/dist/providers/assemblyai.d.ts +2 -2
  114. package/dist/providers/assemblyai.js +2 -7
  115. package/dist/providers/azure/messages.d.ts +2 -0
  116. package/dist/providers/azure/messages.js +1 -0
  117. package/dist/providers/azure.d.ts +322 -7
  118. package/dist/providers/azure.js +25 -9
  119. package/dist/providers/baseten.d.ts +5 -5
  120. package/dist/providers/baseten.js +7 -21
  121. package/dist/providers/cartesia.d.ts +1 -1
  122. package/dist/providers/cerebras.d.ts +5 -5
  123. package/dist/providers/cerebras.js +4 -15
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
  125. package/dist/providers/cloudflare-ai-gateway.js +28 -40
  126. package/dist/providers/cloudflare-shared.d.ts +9 -0
  127. package/dist/providers/cloudflare-shared.js +25 -0
  128. package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
  129. package/dist/providers/cloudflare-workers-ai.js +4 -20
  130. package/dist/providers/cohere/chat.js +2 -7
  131. package/dist/providers/cohere.d.ts +6 -5
  132. package/dist/providers/cohere.js +7 -13
  133. package/dist/providers/deepgram.d.ts +2 -2
  134. package/dist/providers/deepgram.js +2 -7
  135. package/dist/providers/deepinfra.d.ts +5 -5
  136. package/dist/providers/deepinfra.js +5 -13
  137. package/dist/providers/deepseek.d.ts +5 -5
  138. package/dist/providers/deepseek.js +3 -14
  139. package/dist/providers/digitalocean.d.ts +8 -5
  140. package/dist/providers/digitalocean.js +13 -14
  141. package/dist/providers/elevenlabs.d.ts +2 -2
  142. package/dist/providers/elevenlabs.js +2 -7
  143. package/dist/providers/fireworks.d.ts +5 -5
  144. package/dist/providers/fireworks.js +4 -15
  145. package/dist/providers/google/interactions.d.ts +1 -1
  146. package/dist/providers/google/interactions.js +2 -7
  147. package/dist/providers/google-vertex-chat.d.ts +3 -3
  148. package/dist/providers/google-vertex-chat.js +3 -29
  149. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  150. package/dist/providers/google-vertex-messages.d.ts +3 -3
  151. package/dist/providers/google-vertex-messages.js +3 -29
  152. package/dist/providers/google-vertex-mistral.d.ts +3 -3
  153. package/dist/providers/google-vertex-mistral.js +3 -29
  154. package/dist/providers/google-vertex-responses.d.ts +3 -3
  155. package/dist/providers/google-vertex-responses.js +4 -30
  156. package/dist/providers/google-vertex-shared.d.ts +31 -0
  157. package/dist/providers/google-vertex-shared.js +25 -0
  158. package/dist/providers/google-vertex.d.ts +3 -3
  159. package/dist/providers/google.d.ts +15 -13
  160. package/dist/providers/google.js +9 -19
  161. package/dist/providers/groq.d.ts +5 -5
  162. package/dist/providers/groq.js +4 -15
  163. package/dist/providers/meta.d.ts +5 -5
  164. package/dist/providers/meta.js +10 -23
  165. package/dist/providers/minimax/chat.js +2 -7
  166. package/dist/providers/minimax/responses.js +2 -7
  167. package/dist/providers/minimax.d.ts +5 -5
  168. package/dist/providers/minimax.js +7 -22
  169. package/dist/providers/mistral.d.ts +10 -11
  170. package/dist/providers/mistral.js +3 -14
  171. package/dist/providers/moonshot/messages.js +2 -7
  172. package/dist/providers/moonshot/responses.js +2 -7
  173. package/dist/providers/moonshot.d.ts +5 -5
  174. package/dist/providers/moonshot.js +4 -16
  175. package/dist/providers/openai-compatible-responses.d.ts +6 -7
  176. package/dist/providers/openai-compatible-responses.js +2 -8
  177. package/dist/providers/openai-compatible.d.ts +6 -7
  178. package/dist/providers/openai-compatible.js +4 -10
  179. package/dist/providers/openai.d.ts +4 -4
  180. package/dist/providers/openai.js +3 -3
  181. package/dist/providers/opencode.d.ts +4 -4
  182. package/dist/providers/opencode.js +6 -2
  183. package/dist/providers/openrouter.d.ts +8 -5
  184. package/dist/providers/openrouter.js +16 -24
  185. package/dist/providers/runway.d.ts +1 -1
  186. package/dist/providers/settings.d.ts +40 -0
  187. package/dist/providers/settings.js +19 -0
  188. package/dist/providers/togetherai.d.ts +5 -5
  189. package/dist/providers/togetherai.js +5 -15
  190. package/dist/providers/typesafe-ai.d.ts +4 -4
  191. package/dist/providers/typesafe-ai.js +6 -2
  192. package/dist/providers/venice.d.ts +4 -4
  193. package/dist/providers/venice.js +6 -2
  194. package/dist/providers/vercel-ai-gateway.d.ts +5 -5
  195. package/dist/providers/vercel-ai-gateway.js +15 -28
  196. package/dist/providers/xai.d.ts +4 -4
  197. package/dist/providers/xai.js +4 -12
  198. package/dist/providers/zai-coding-plan/messages.js +2 -7
  199. package/dist/providers/zai-coding-plan/responses.js +2 -7
  200. package/dist/providers/zai-coding-plan.d.ts +5 -5
  201. package/dist/providers/zai-coding-plan.js +8 -15
  202. package/dist/providers/zai.d.ts +5 -5
  203. package/dist/providers/zai.js +10 -22
  204. package/dist/public.d.ts +12 -0
  205. package/dist/public.js +5 -0
  206. package/dist/route/auth-options.d.ts +9 -5
  207. package/dist/route/auth-options.js +10 -7
  208. package/dist/route/client.d.ts +50 -37
  209. package/dist/route/client.js +42 -53
  210. package/dist/route/decision.d.ts +8 -8
  211. package/dist/route/decision.js +3 -3
  212. package/dist/route/executor.d.ts +5 -0
  213. package/dist/route/executor.js +10 -0
  214. package/dist/route/index.d.ts +5 -7
  215. package/dist/route/index.js +1 -1
  216. package/dist/route/media.d.ts +7 -11
  217. package/dist/route/media.js +22 -26
  218. package/dist/route/transport/http.js +6 -5
  219. package/dist/route/transport/websocket.js +7 -1
  220. package/dist/schema/errors.d.ts +16 -17
  221. package/dist/schema/errors.js +63 -12
  222. package/dist/schema/events.d.ts +2563 -2954
  223. package/dist/schema/events.js +54 -109
  224. package/dist/schema/messages.d.ts +194 -137
  225. package/dist/schema/messages.js +66 -83
  226. package/dist/schema/options.d.ts +112 -65
  227. package/dist/schema/options.js +52 -101
  228. package/dist/speech-client.d.ts +7 -7
  229. package/dist/speech.d.ts +306 -316
  230. package/dist/speech.js +16 -14
  231. package/dist/testing.d.ts +31 -175
  232. package/dist/testing.js +60 -5
  233. package/dist/tool-history.d.ts +1 -1
  234. package/dist/tool-history.js +3 -10
  235. package/dist/tool-runtime.d.ts +9 -2
  236. package/dist/tool-runtime.js +17 -31
  237. package/dist/tool.d.ts +39 -43
  238. package/dist/tool.js +16 -26
  239. package/dist/transcription-client.d.ts +7 -7
  240. package/dist/transcription.d.ts +314 -265
  241. package/dist/transcription.js +16 -14
  242. package/dist/utils/provider-codes.d.ts +3 -0
  243. package/dist/utils/provider-codes.js +41 -0
  244. package/dist/video-client.d.ts +7 -7
  245. package/dist/video-client.js +1 -1
  246. package/dist/video.d.ts +269 -287
  247. package/dist/video.js +16 -14
  248. package/package.json +9 -9
  249. package/dist/experimental/testing.d.ts +0 -3
  250. package/dist/experimental/testing.js +0 -3
  251. package/dist/testing/decision.d.ts +0 -16
  252. package/dist/testing/decision.js +0 -20
  253. package/dist/testing/image.d.ts +0 -14
  254. package/dist/testing/image.js +0 -12
  255. package/dist/testing/media.d.ts +0 -18
  256. package/dist/testing/media.js +0 -36
  257. package/dist/testing/script.d.ts +0 -28
  258. package/dist/testing/script.js +0 -60
  259. package/dist/testing/speech.d.ts +0 -14
  260. package/dist/testing/speech.js +0 -12
  261. package/dist/testing/transcription.d.ts +0 -14
  262. package/dist/testing/transcription.js +0 -12
  263. package/dist/testing/video.d.ts +0 -14
  264. package/dist/testing/video.js +0 -12
@@ -8,7 +8,7 @@ import { Framing } from "../route/framing.js";
8
8
  import { Protocol } from "../route/protocol.js";
9
9
  import { Headers } from "effect/http";
10
10
  import { HttpTransport } from "../route/transport/index.js";
11
- import { AIError, CacheTTL, HttpOptions, LLMRequest, LLMEvent, mergeJsonRecords, Usage, } from "../schema/index.js";
11
+ import { AIError, CacheTTL, LLMEvent, mergeJsonRecords, Usage, } from "../schema/index.js";
12
12
  import { JsonObject, knownString, optionalArray, optionalNull, ProviderShared, withUntypedFrames } from "./shared.js";
13
13
  import { classifyProviderFailure } from "../provider-error.js";
14
14
  import { effortUpdate, resolveEffortUpdates } from "../effort-updates.js";
@@ -402,11 +402,8 @@ const ANTHROPIC_BREAKPOINT_CAP = 4;
402
402
  const cacheControl = (breakpoints, cache) => {
403
403
  if (cache?.type !== "ephemeral" && cache?.type !== "persistent")
404
404
  return undefined;
405
- if (breakpoints.remaining <= 0) {
406
- breakpoints.dropped += 1;
405
+ if (!Cache.take(breakpoints))
407
406
  return undefined;
408
- }
409
- breakpoints.remaining -= 1;
410
407
  return { type: "ephemeral", ...(cache.ttl === undefined ? {} : { ttl: cache.ttl }) };
411
408
  };
412
409
  const providerMetadata = (key, metadata) => ({ [key]: metadata });
@@ -488,68 +485,15 @@ const lowerServerToolResult = Effect.fnUntraced(function* (part, providerMetadat
488
485
  content: payload,
489
486
  };
490
487
  });
491
- const fileIdFromMetadata = (metadata) => {
492
- if (!metadata)
493
- return undefined;
494
- const anthropic = metadata.anthropic;
495
- if (ProviderShared.isRecord(anthropic)) {
496
- if (typeof anthropic.file_id === "string")
497
- return anthropic.file_id;
498
- if (typeof anthropic.fileId === "string")
499
- return anthropic.fileId;
500
- }
501
- if (typeof metadata.file_id === "string")
502
- return metadata.file_id;
503
- if (typeof metadata.fileId === "string")
504
- return metadata.fileId;
505
- return undefined;
506
- };
507
- const transformationsFromMetadata = (metadata) => {
508
- if (!metadata)
509
- return undefined;
510
- const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
511
- const raw = anthropic?.transformations ?? metadata.transformations;
512
- if (ProviderShared.isRecord(raw)) {
513
- const value = raw.oversized_image;
514
- if (value === "downsize" || value === "error")
515
- return { oversized_image: value };
516
- }
517
- if (anthropic && (anthropic.oversized_image === "downsize" || anthropic.oversized_image === "error"))
518
- return { oversized_image: anthropic.oversized_image };
519
- return undefined;
520
- };
521
- const documentTitleFromPart = (part) => {
522
- if (part.metadata !== undefined) {
523
- const anthropic = part.metadata.anthropic;
524
- if (ProviderShared.isRecord(anthropic) && typeof anthropic.title === "string")
525
- return anthropic.title;
526
- if (typeof part.metadata.title === "string")
527
- return part.metadata.title;
528
- }
529
- if (part.filename && part.filename.length > 0)
530
- return part.filename;
531
- return undefined;
532
- };
533
- const documentContextFromMetadata = (metadata) => {
534
- if (!metadata)
535
- return undefined;
536
- const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
537
- if (anthropic && typeof anthropic.context === "string")
538
- return anthropic.context;
539
- if (typeof metadata.context === "string")
540
- return metadata.context;
541
- return undefined;
542
- };
543
- const citationsFromMetadata = (metadata) => {
544
- if (!metadata)
545
- return undefined;
546
- const raw = ProviderShared.isRecord(metadata.anthropic)
547
- ? (metadata.anthropic.citations ?? metadata.citations)
548
- : metadata.citations;
549
- if (ProviderShared.isRecord(raw) && typeof raw.enabled === "boolean")
550
- return { enabled: raw.enabled };
551
- return undefined;
552
- };
488
+ // Per-part Anthropic block fields, read from `providerMetadata[providerMetadataKey]` with Anthropic's wire names.
489
+ const MediaOptions = Schema.Struct({
490
+ file_id: Schema.optional(Schema.String),
491
+ title: Schema.optional(Schema.String),
492
+ context: Schema.optional(Schema.String),
493
+ citations: Schema.optional(Schema.Struct({ enabled: Schema.Boolean })),
494
+ transformations: Schema.optional(AnthropicImageTransformations),
495
+ });
496
+ const decodeMediaOptions = ProviderShared.validateWith(Schema.decodeUnknownEffect(MediaOptions));
553
497
  const isHttpUrl = (value) => /^https?:\/\//i.test(value.trim());
554
498
  const lowerMedia = Effect.fnUntraced(function* (part, request, breakpoints) {
555
499
  const mime = part.media.mediaType.toLowerCase();
@@ -567,105 +511,51 @@ const lowerMedia = Effect.fnUntraced(function* (part, request, breakpoints) {
567
511
  ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
568
512
  };
569
513
  }
570
- const fileId = fileIdFromMetadata(part.metadata);
571
- // SDK file sources: FileImageSource:2350 / FileDocumentSource:2344 {type:"file", file_id}
572
- if (fileId) {
573
- if (mime.startsWith("image/"))
574
- return {
575
- type: "image",
576
- source: { type: "file", file_id: fileId },
577
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
578
- ...(transformationsFromMetadata(part.metadata) === undefined
579
- ? {}
580
- : { transformations: transformationsFromMetadata(part.metadata) }),
581
- };
514
+ const options = yield* decodeMediaOptions(part.providerMetadata?.[request.model.route.providerMetadataKey ?? request.model.provider] ?? {});
515
+ const image = (source) => ({
516
+ type: "image",
517
+ source,
518
+ ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
519
+ ...(options.transformations === undefined ? {} : { transformations: options.transformations }),
520
+ });
521
+ const document = (source) => {
522
+ const title = options.title ?? (part.filename ? part.filename : undefined);
582
523
  return {
583
524
  type: "document",
584
- source: { type: "file", file_id: fileId },
525
+ source,
585
526
  ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
586
- ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
587
- ...(documentContextFromMetadata(part.metadata) === undefined
588
- ? {}
589
- : { context: documentContextFromMetadata(part.metadata) }),
590
- ...(citationsFromMetadata(part.metadata) === undefined
591
- ? {}
592
- : { citations: citationsFromMetadata(part.metadata) }),
527
+ ...(title === undefined ? {} : { title }),
528
+ ...(options.context === undefined ? {} : { context: options.context }),
529
+ ...(options.citations === undefined ? {} : { citations: options.citations }),
593
530
  };
531
+ };
532
+ // SDK file sources: FileImageSource:2350 / FileDocumentSource:2344 {type:"file", file_id}
533
+ if (options.file_id) {
534
+ if (mime.startsWith("image/"))
535
+ return image({ type: "file", file_id: options.file_id });
536
+ return document({ type: "file", file_id: options.file_id });
594
537
  }
595
538
  const rawString = ProviderShared.mediaUrl(part.media)?.trim();
596
539
  // SDK URL sources: URLImageSource:3817 / URLPDFSource:3823 {type:"url", url}
597
540
  if (rawString && isHttpUrl(rawString)) {
598
541
  if (mime.startsWith("image/"))
599
- return {
600
- type: "image",
601
- source: { type: "url", url: rawString },
602
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
603
- ...(transformationsFromMetadata(part.metadata) === undefined
604
- ? {}
605
- : { transformations: transformationsFromMetadata(part.metadata) }),
606
- };
542
+ return image({ type: "url", url: rawString });
607
543
  if (mime === "application/pdf")
608
- return {
609
- type: "document",
610
- source: { type: "url", url: rawString },
611
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
612
- ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
613
- ...(documentContextFromMetadata(part.metadata) === undefined
614
- ? {}
615
- : { context: documentContextFromMetadata(part.metadata) }),
616
- ...(citationsFromMetadata(part.metadata) === undefined
617
- ? {}
618
- : { citations: citationsFromMetadata(part.metadata) }),
619
- };
544
+ return document({ type: "url", url: rawString });
620
545
  }
621
546
  const media = yield* ProviderShared.requireInlineMedia("Anthropic Messages", part.media);
622
547
  // SDK PlainTextSource:2716 {type:"text", media_type:"text/plain", data}
623
- if (mime === "text/plain") {
624
- const textData = Buffer.from(media.base64, "base64").toString("utf8");
625
- return {
626
- type: "document",
627
- source: { type: "text", media_type: "text/plain", data: textData },
628
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
629
- ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
630
- ...(documentContextFromMetadata(part.metadata) === undefined
631
- ? {}
632
- : { context: documentContextFromMetadata(part.metadata) }),
633
- ...(citationsFromMetadata(part.metadata) === undefined
634
- ? {}
635
- : { citations: citationsFromMetadata(part.metadata) }),
636
- };
637
- }
548
+ if (mime === "text/plain")
549
+ return document({
550
+ type: "text",
551
+ media_type: "text/plain",
552
+ data: Buffer.from(media.base64, "base64").toString("utf8"),
553
+ });
638
554
  if (media.mime === "application/pdf")
639
- return {
640
- type: "document",
641
- source: {
642
- type: "base64",
643
- media_type: "application/pdf",
644
- data: media.base64,
645
- },
646
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
647
- ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }),
648
- ...(documentContextFromMetadata(part.metadata) === undefined
649
- ? {}
650
- : { context: documentContextFromMetadata(part.metadata) }),
651
- ...(citationsFromMetadata(part.metadata) === undefined
652
- ? {}
653
- : { citations: citationsFromMetadata(part.metadata) }),
654
- };
555
+ return document({ type: "base64", media_type: "application/pdf", data: media.base64 });
655
556
  if (!media.mime.startsWith("image/"))
656
557
  return yield* invalid(`Anthropic Messages does not support media type ${part.media.mediaType}`);
657
- return {
658
- type: "image",
659
- source: {
660
- type: "base64",
661
- media_type: media.mime,
662
- data: media.base64,
663
- },
664
- ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
665
- ...(transformationsFromMetadata(part.metadata) === undefined
666
- ? {}
667
- : { transformations: transformationsFromMetadata(part.metadata) }),
668
- };
558
+ return image({ type: "base64", media_type: media.mime, data: media.base64 });
669
559
  });
670
560
  // Tool results may carry structured text, images, and documents. Keep media as provider-native
671
561
  // content instead of JSON-stringifying base64 into a prompt string.
@@ -705,6 +595,9 @@ const requireThinkingSignature = (request) => {
705
595
  };
706
596
  // Opus 4.8 and every Claude 5 model accept mid-conversation system messages; later versions inherit support.
707
597
  const supportsNativeSystemUpdates = (request) => {
598
+ const override = request.model.capabilities?.systemUpdates;
599
+ if (override !== undefined)
600
+ return override;
708
601
  const version = claudeVersion(request.model.id);
709
602
  if (version === undefined)
710
603
  return false;
@@ -793,7 +686,6 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
793
686
  content.push(yield* lowerMedia(part, request, breakpoints));
794
687
  continue;
795
688
  }
796
- return yield* ProviderShared.unsupportedContent("Anthropic Messages", "user", ["text", "media"]);
797
689
  }
798
690
  if (content.length > 0)
799
691
  messages.push({ role: "user", content });
@@ -850,8 +742,6 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
850
742
  }
851
743
  const content = [];
852
744
  for (const part of message.content) {
853
- if (!ProviderShared.supportsContent(part, ["tool-result"]))
854
- return yield* ProviderShared.unsupportedContent("Anthropic Messages", "tool", ["tool-result"]);
855
745
  content.push({
856
746
  type: "tool_result",
857
747
  tool_use_id: scrubToolCallID(part.id),
@@ -869,15 +759,14 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
869
759
  yield* releaseHeld();
870
760
  return messages;
871
761
  });
872
- // TODO: Move per-model capability heuristics (`supportsEffortUpdates`, `supportsNativeSystemUpdates`,
873
- // `supportsThinkingBlockBinding`) into explicit model/provider `compatibility` metadata so the protocol
874
- // only reads `request.model.compatibility`.
762
+ // The model-ID checks below are fallbacks for models that leave `capabilities.reasoning.updates`,
763
+ // `capabilities.systemUpdates` and `compatibility.supportsThinkingBlockBinding` unset.
875
764
  const isThinkingOff = Schema.is(AnthropicThinkingDisabled);
876
765
  // Per-turn effort started with Claude Opus 5 and every Claude 5.1 model; later versions of any family inherit it.
877
766
  const supportsEffortUpdates = (request) => {
878
767
  if (isThinkingOff(request.providerOptions?.thinking))
879
768
  return false;
880
- const override = request.model.compatibility?.supportsEffortUpdates;
769
+ const override = request.model.capabilities?.reasoning?.updates;
881
770
  if (override !== undefined)
882
771
  return override;
883
772
  const version = claudeVersion(request.model.id);
@@ -913,7 +802,6 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
913
802
  const outputConfig = options.output_config ?? options.outputConfig;
914
803
  const format = outputConfig?.format ?? undefined;
915
804
  const updates = resolveEffortUpdates(request, options.effort ?? outputConfig?.effort ?? undefined);
916
- const generation = request.generation;
917
805
  // Allocate the 4-breakpoint budget in invalidation order: tools → system →
918
806
  // messages. Tools live highest in the cache hierarchy, so when callers
919
807
  // over-mark we keep their tool hints and shed the message-tail ones first.
@@ -931,11 +819,9 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
931
819
  cache_control: cacheControl(breakpoints, part.cache),
932
820
  }));
933
821
  const messages = yield* lowerMessages(flattened.request, breakpoints);
934
- if (breakpoints.dropped > 0) {
935
- yield* Effect.logWarning(`Anthropic Messages: dropped ${breakpoints.dropped} cache breakpoint(s); the API allows at most ${ANTHROPIC_BREAKPOINT_CAP} per request.`);
936
- }
822
+ yield* Cache.warnDropped(breakpoints, "Anthropic Messages", ANTHROPIC_BREAKPOINT_CAP);
937
823
  const output_config = updates.effort === undefined && format === undefined ? undefined : { effort: updates.effort, format };
938
- const maxTokens = generation?.maxTokens ?? DEFAULT_MAX_TOKENS;
824
+ const maxTokens = request.maxTokens ?? DEFAULT_MAX_TOKENS;
939
825
  const body = {
940
826
  model: request.model.id,
941
827
  system,
@@ -944,10 +830,10 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
944
830
  tool_choice: toolChoice,
945
831
  stream: true,
946
832
  max_tokens: maxTokens,
947
- temperature: generation?.temperature,
948
- top_p: generation?.topP,
949
- top_k: generation?.topK,
950
- stop_sequences: generation?.stop,
833
+ temperature: request.temperature,
834
+ top_p: request.topP,
835
+ top_k: request.topK,
836
+ stop_sequences: request.stop,
951
837
  thinking: applyThinkingBindingDefault(request.model, fitThinking(options.thinking, maxTokens)),
952
838
  output_config,
953
839
  // top-level passthrough per SDK MessageCreateParamsBase:4638,4643,4649,4654,4670
@@ -1421,7 +1307,7 @@ export const transport = () => {
1421
1307
  const requiredBetas = requiredBetaHeaders(input.body);
1422
1308
  if (requiredBetas.length === 0)
1423
1309
  return http.prepare(input);
1424
- const headers = Headers.fromInput(input.request.http?.headers);
1310
+ const headers = Headers.fromInput(input.request.headers);
1425
1311
  const existingBetas = (headers["anthropic-beta"] ?? "")
1426
1312
  .split(",")
1427
1313
  .map((item) => item.trim())
@@ -1429,12 +1315,7 @@ export const transport = () => {
1429
1315
  const betas = new Set([...existingBetas, ...requiredBetas]);
1430
1316
  return http.prepare({
1431
1317
  ...input,
1432
- request: LLMRequest.update(input.request, {
1433
- http: new HttpOptions({
1434
- ...input.request.http,
1435
- headers: { ...headers, "anthropic-beta": [...betas].join(",") },
1436
- }),
1437
- }),
1318
+ request: { ...input.request, headers: { ...headers, "anthropic-beta": [...betas].join(",") } },
1438
1319
  });
1439
1320
  },
1440
1321
  };
@@ -2,7 +2,7 @@ import { Schema } from "effect";
2
2
  import { MediaProtocol } from "../route/media-protocol.js";
3
3
  import { MediaRoute } from "../route/media.js";
4
4
  import { type OpenString } from "../schema/index.js";
5
- import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequestFor } from "../transcription.js";
5
+ import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequest } from "../transcription.js";
6
6
  export declare const DEFAULT_BASE_URL = "https://api.assemblyai.com";
7
7
  export declare const PATH = "/v2/transcript";
8
8
  export declare const UPLOAD_PATH = "/v2/upload";
@@ -24,7 +24,7 @@ export type AssemblyAITranscriptionOptions = {
24
24
  };
25
25
  readonly speech_models?: ReadonlyArray<OpenString<"universal-3-5-pro" | "universal-2">>;
26
26
  } & Record<string, unknown>;
27
- export type Request = TranscriptionRequestFor<AssemblyAITranscriptionOptions>;
27
+ export type Request = TranscriptionRequest<TranscriptionModel<AssemblyAITranscriptionOptions>>;
28
28
  export declare const Token: Schema.Struct<{
29
29
  readonly transcriptID: Schema.String;
30
30
  }>;
@@ -9,6 +9,7 @@ import { classifyProviderFailure } from "../provider-error.js";
9
9
  import { JsonObject, optionalArray, ProviderShared } from "./shared.js";
10
10
  import { BedrockAuth } from "./utils/bedrock-auth.js";
11
11
  import { BedrockCache } from "./utils/bedrock-cache.js";
12
+ import { warnDropped } from "./utils/cache.js";
12
13
  import { BedrockMedia } from "./utils/bedrock-media.js";
13
14
  import { claudeVersion, supportsThinkingBlockBinding, THINKING_BINDING_BETA } from "./utils/claude-model.js";
14
15
  import { Lifecycle } from "./utils/lifecycle.js";
@@ -297,8 +298,6 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
297
298
  if (message.role === "user") {
298
299
  const content = [];
299
300
  for (const part of message.content) {
300
- if (!ProviderShared.supportsContent(part, ["text", "media"]))
301
- return yield* ProviderShared.unsupportedContent("Bedrock Converse", "user", ["text", "media"]);
302
301
  if (part.type === "text") {
303
302
  content.push(...textWithCache(breakpoints, part.text, part.cache));
304
303
  continue;
@@ -351,8 +350,6 @@ const lowerMessages = Effect.fnUntraced(function* (request, breakpoints) {
351
350
  }
352
351
  const content = [];
353
352
  for (const part of message.content) {
354
- if (!ProviderShared.supportsContent(part, ["tool-result"]))
355
- return yield* ProviderShared.unsupportedContent("Bedrock Converse", "tool", ["tool-result"]);
356
353
  const result = yield* lowerToolResult(part, documentNames, normalizeID);
357
354
  const images = hoistImages
358
355
  ? result.toolResult.content.filter((item) => "image" in item)
@@ -463,11 +460,10 @@ const applyThinkingBindingDefault = (request, thinking) => {
463
460
  const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request) {
464
461
  const toolChoice = request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined;
465
462
  const flattened = ProviderShared.flattenToolRequest(request);
466
- const generation = request.generation;
467
463
  const options = yield* decodeOptions(request.providerOptions ?? {});
468
464
  const maxTokens = isNova2(request.model) && (options.effort === "high" || isHighReasoningEffort(request.http?.body))
469
465
  ? undefined
470
- : generation?.maxTokens;
466
+ : request.maxTokens;
471
467
  const thinking = applyThinkingBindingDefault(request, (() => {
472
468
  if (options.thinking?.type === "enabled")
473
469
  return {
@@ -480,7 +476,7 @@ const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request)
480
476
  return { type: "adaptive" };
481
477
  })());
482
478
  const additionalModelRequestFields = {
483
- ...(generation?.topK === undefined ? {} : { top_k: generation.topK }),
479
+ ...(request.topK === undefined ? {} : { top_k: request.topK }),
484
480
  ...(thinking === undefined ? {} : { thinking }),
485
481
  ...(options.effort === undefined ? {} : effortFields(request.model, options.effort)),
486
482
  // Converse takes Anthropic betas in the body, and Bedrock rejects `block_binding` without this one.
@@ -501,20 +497,18 @@ const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request)
501
497
  })();
502
498
  const system = lowerSystem(breakpoints, request.system);
503
499
  const messages = yield* lowerMessages(flattened.request, breakpoints);
504
- if (breakpoints.dropped > 0) {
505
- yield* Effect.logWarning(`Bedrock Converse: dropped ${breakpoints.dropped} cache breakpoint(s); the API allows at most ${BedrockCache.BEDROCK_BREAKPOINT_CAP} per request.`);
506
- }
500
+ yield* warnDropped(breakpoints, "Bedrock Converse", BedrockCache.BEDROCK_BREAKPOINT_CAP);
507
501
  const inferenceConfig = (() => {
508
502
  if (maxTokens === undefined &&
509
- generation?.temperature === undefined &&
510
- generation?.topP === undefined &&
511
- (generation?.stop === undefined || generation.stop.length === 0))
503
+ request.temperature === undefined &&
504
+ request.topP === undefined &&
505
+ (request.stop === undefined || request.stop.length === 0))
512
506
  return undefined;
513
507
  return {
514
508
  maxTokens,
515
- temperature: generation?.temperature,
516
- topP: generation?.topP,
517
- stopSequences: generation?.stop,
509
+ temperature: request.temperature,
510
+ topP: request.topP,
511
+ stopSequences: request.stop,
518
512
  };
519
513
  })();
520
514
  return {
@@ -1,7 +1,7 @@
1
1
  import { MediaProtocol } from "../route/media-protocol.js";
2
2
  import { MediaRoute } from "../route/media.js";
3
3
  import { type OpenString } from "../schema/index.js";
4
- import { SpeechModel, type SpeechRequestFor } from "../speech.js";
4
+ import { SpeechModel, type SpeechRequest } from "../speech.js";
5
5
  import { SpeechStream } from "./utils/speech-stream.js";
6
6
  export declare const DEFAULT_BASE_URL = "https://api.cartesia.ai";
7
7
  export declare const API_VERSION = "2026-08-14";
@@ -18,7 +18,7 @@ export type CartesiaSpeechOptions = {
18
18
  };
19
19
  readonly pronunciation_dict_id?: string;
20
20
  } & Record<string, unknown>;
21
- export type Request = SpeechRequestFor<CartesiaSpeechOptions>;
21
+ export type Request = SpeechRequest<SpeechModel<CartesiaSpeechOptions>>;
22
22
  interface State extends SpeechStream.Audio {
23
23
  readonly done: boolean;
24
24
  }
@@ -1,4 +1,4 @@
1
- import { ImageModel, ImageResponse, type ImageRequestFor } from "../image.js";
1
+ import { ImageModel, ImageResponse, type ImageRequest } from "../image.js";
2
2
  import { MediaProtocol } from "../route/media-protocol.js";
3
3
  import type { MediaRoute } from "../route/media.js";
4
4
  /**
@@ -14,7 +14,7 @@ export type CloudflareWorkersAIImageOptions = {
14
14
  readonly guidance?: number;
15
15
  readonly negative_prompt?: string;
16
16
  } & Record<string, unknown>;
17
- export type Request = ImageRequestFor<CloudflareWorkersAIImageOptions>;
17
+ export type Request = ImageRequest<ImageModel<CloudflareWorkersAIImageOptions>>;
18
18
  export declare const protocol: MediaProtocol.Inline<Request, ImageResponse>;
19
19
  export declare const model: (input: MediaRoute.ModelInput) => ImageModel<CloudflareWorkersAIImageOptions>;
20
20
  export declare const CloudflareWorkersAIImages: {
@@ -208,16 +208,16 @@ const fromRequest = Effect.fn("CohereChat.fromRequest")(function* (request) {
208
208
  // Cohere rejects budgets above max_tokens; fitting also leaves room for the answer.
209
209
  token_budget: options.thinking.tokenBudget === undefined
210
210
  ? undefined
211
- : ProviderShared.fitThinkingBudget(options.thinking.tokenBudget, request.generation?.maxTokens),
211
+ : ProviderShared.fitThinkingBudget(options.thinking.tokenBudget, request.maxTokens),
212
212
  },
213
- max_tokens: request.generation?.maxTokens,
214
- temperature: request.generation?.temperature,
215
- p: request.generation?.topP,
216
- k: request.generation?.topK,
217
- seed: request.generation?.seed,
218
- stop_sequences: request.generation?.stop,
219
- frequency_penalty: request.generation?.frequencyPenalty,
220
- presence_penalty: request.generation?.presencePenalty,
213
+ max_tokens: request.maxTokens,
214
+ temperature: request.temperature,
215
+ p: request.topP,
216
+ k: request.topK,
217
+ seed: request.seed,
218
+ stop_sequences: request.stop,
219
+ frequency_penalty: request.frequencyPenalty,
220
+ presence_penalty: request.presencePenalty,
221
221
  };
222
222
  });
223
223
  const finishReason = (raw) => {
@@ -304,9 +304,6 @@ export const protocol = Protocol.make({
304
304
  initial: () => ({ lifecycle: Lifecycle.initial(), tools: ToolStream.empty(), finished: false }),
305
305
  step,
306
306
  terminal: (event) => event.type === "message-end",
307
- onHalt: (state) => state.finished
308
- ? Effect.succeed([])
309
- : Effect.fail(ProviderShared.eventError(ADAPTER, "Cohere stream ended without message-end")),
310
307
  },
311
308
  });
312
309
  export const route = Route.make({
@@ -1,7 +1,7 @@
1
1
  import { MediaProtocol } from "../route/media-protocol.js";
2
2
  import { MediaRoute } from "../route/media.js";
3
3
  import { type OpenString } from "../schema/index.js";
4
- import { SpeechModel, type SpeechRequestFor } from "../speech.js";
4
+ import { SpeechModel, type SpeechRequest } from "../speech.js";
5
5
  import { SpeechStream } from "./utils/speech-stream.js";
6
6
  export declare const DEFAULT_BASE_URL = "https://api.deepgram.com";
7
7
  export declare const PATH = "/v1/speak";
@@ -14,7 +14,7 @@ export type DeepgramSpeechOptions = {
14
14
  readonly mip_opt_out?: boolean;
15
15
  readonly tag?: string;
16
16
  } & Record<string, unknown>;
17
- export type Request = SpeechRequestFor<DeepgramSpeechOptions>;
17
+ export type Request = SpeechRequest<SpeechModel<DeepgramSpeechOptions>>;
18
18
  export declare const protocol: MediaProtocol.Streamed<Request, {
19
19
  readonly type: "audio-delta";
20
20
  readonly chunk: Uint8Array<ArrayBufferLike>;
@@ -1,7 +1,7 @@
1
1
  import { MediaProtocol } from "../route/media-protocol.js";
2
2
  import { MediaRoute } from "../route/media.js";
3
3
  import { type OpenString } from "../schema/index.js";
4
- import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequestFor } from "../transcription.js";
4
+ import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequest } from "../transcription.js";
5
5
  export declare const DEFAULT_BASE_URL = "https://api.deepgram.com";
6
6
  export declare const PATH = "/v1/listen";
7
7
  export type DeepgramTranscriptionOptions = {
@@ -17,7 +17,7 @@ export type DeepgramTranscriptionOptions = {
17
17
  readonly mip_opt_out?: boolean;
18
18
  readonly tag?: string | ReadonlyArray<string>;
19
19
  } & Record<string, unknown>;
20
- export type Request = TranscriptionRequestFor<DeepgramTranscriptionOptions>;
20
+ export type Request = TranscriptionRequest<TranscriptionModel<DeepgramTranscriptionOptions>>;
21
21
  export declare const protocol: MediaProtocol.Inline<Request, TranscriptionResponse>;
22
22
  export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<DeepgramTranscriptionOptions>;
23
23
  export declare const DeepgramTranscription: {
@@ -1,7 +1,7 @@
1
1
  import { MediaProtocol } from "../route/media-protocol.js";
2
2
  import { MediaRoute } from "../route/media.js";
3
3
  import { type OpenString } from "../schema/index.js";
4
- import { SpeechModel, type SpeechRequestFor } from "../speech.js";
4
+ import { SpeechModel, type SpeechRequest } from "../speech.js";
5
5
  import { SpeechStream } from "./utils/speech-stream.js";
6
6
  export declare const DEFAULT_BASE_URL = "https://api.elevenlabs.io";
7
7
  export declare const PATH = "/v1/text-to-speech";
@@ -17,7 +17,7 @@ export type ElevenLabsSpeechOptions = {
17
17
  readonly seed?: number;
18
18
  readonly apply_text_normalization?: OpenString<"auto" | "on" | "off">;
19
19
  } & Record<string, unknown>;
20
- export type Request = SpeechRequestFor<ElevenLabsSpeechOptions>;
20
+ export type Request = SpeechRequest<SpeechModel<ElevenLabsSpeechOptions>>;
21
21
  export declare const protocol: MediaProtocol.Streamed<Request, {
22
22
  readonly type: "audio-delta";
23
23
  readonly chunk: Uint8Array<ArrayBufferLike>;
@@ -1,7 +1,7 @@
1
1
  import { MediaProtocol } from "../route/media-protocol.js";
2
2
  import { MediaRoute } from "../route/media.js";
3
3
  import { type OpenString } from "../schema/index.js";
4
- import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequestFor } from "../transcription.js";
4
+ import { TranscriptionModel, TranscriptionResponse, type TranscriptionRequest } from "../transcription.js";
5
5
  export declare const DEFAULT_BASE_URL = "https://api.elevenlabs.io";
6
6
  export declare const PATH = "/v1/speech-to-text";
7
7
  export type ElevenLabsTranscriptionOptions = {
@@ -19,7 +19,7 @@ export type ElevenLabsTranscriptionOptions = {
19
19
  readonly entity_redaction?: string | ReadonlyArray<string>;
20
20
  readonly entity_redaction_mode?: OpenString<"redacted" | "entity_type" | "enumerated_entity_type">;
21
21
  } & Record<string, unknown>;
22
- export type Request = TranscriptionRequestFor<ElevenLabsTranscriptionOptions>;
22
+ export type Request = TranscriptionRequest<TranscriptionModel<ElevenLabsTranscriptionOptions>>;
23
23
  export declare const protocol: MediaProtocol.Inline<Request, TranscriptionResponse>;
24
24
  export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<ElevenLabsTranscriptionOptions>;
25
25
  export declare const ElevenLabsTranscription: {
@@ -109,6 +109,7 @@ declare const GeminiUsage: Schema.Struct<{
109
109
  readonly cachedContentTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
110
110
  readonly thoughtsTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
111
111
  readonly promptTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
112
+ readonly toolUsePromptTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
112
113
  readonly candidatesTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
113
114
  readonly totalTokenCount: Schema.optional<Schema.NullOr<Schema.Number>>;
114
115
  }>;
@@ -264,6 +265,7 @@ export declare const protocol: Protocol<{
264
265
  readonly cachedContentTokenCount?: number | null | undefined;
265
266
  readonly thoughtsTokenCount?: number | null | undefined;
266
267
  readonly promptTokenCount?: number | null | undefined;
268
+ readonly toolUsePromptTokenCount?: number | null | undefined;
267
269
  readonly candidatesTokenCount?: number | null | undefined;
268
270
  readonly totalTokenCount?: number | null | undefined;
269
271
  } | null | undefined;
@@ -292,6 +294,7 @@ export declare const protocol: Protocol<{
292
294
  readonly cachedContentTokenCount?: number | null | undefined;
293
295
  readonly thoughtsTokenCount?: number | null | undefined;
294
296
  readonly promptTokenCount?: number | null | undefined;
297
+ readonly toolUsePromptTokenCount?: number | null | undefined;
295
298
  readonly candidatesTokenCount?: number | null | undefined;
296
299
  readonly totalTokenCount?: number | null | undefined;
297
300
  } | null | undefined;