@opencode/ai 2.2.6 → 2.3.0

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 (177) hide show
  1. package/README.md +208 -98
  2. package/dist/ai-client.d.ts +2 -2
  3. package/dist/ai-client.js +2 -1
  4. package/dist/decision.d.ts +10 -0
  5. package/dist/decision.js +2 -0
  6. package/dist/effect.d.ts +14 -7
  7. package/dist/effect.js +6 -1
  8. package/dist/embedding-client.d.ts +21 -0
  9. package/dist/embedding-client.js +30 -0
  10. package/dist/embedding.d.ts +111 -0
  11. package/dist/embedding.js +75 -0
  12. package/dist/experimental.d.ts +0 -4
  13. package/dist/experimental.js +0 -3
  14. package/dist/image-client.d.ts +1 -1
  15. package/dist/image-client.js +2 -6
  16. package/dist/image.d.ts +0 -1
  17. package/dist/image.js +0 -3
  18. package/dist/index.d.ts +18 -50
  19. package/dist/index.js +35 -13
  20. package/dist/media-model.d.ts +2 -0
  21. package/dist/media-model.js +3 -1
  22. package/dist/media.d.ts +9 -3
  23. package/dist/media.js +27 -7
  24. package/dist/protocols/alibaba-chat.d.ts +4 -0
  25. package/dist/protocols/anthropic-messages.js +3 -3
  26. package/dist/protocols/google-decisions.d.ts +13 -0
  27. package/dist/protocols/google-decisions.js +133 -0
  28. package/dist/protocols/google-embed-content.d.ts +34 -0
  29. package/dist/protocols/google-embed-content.js +110 -0
  30. package/dist/protocols/google-interactions-video.d.ts +43 -0
  31. package/dist/protocols/google-interactions-video.js +186 -0
  32. package/dist/protocols/google-interactions.d.ts +14 -1
  33. package/dist/protocols/google-interactions.js +1 -1
  34. package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
  35. package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
  36. package/dist/protocols/index.d.ts +4 -0
  37. package/dist/protocols/index.js +4 -0
  38. package/dist/protocols/minimax-video.d.ts +54 -0
  39. package/dist/protocols/minimax-video.js +292 -0
  40. package/dist/protocols/open-responses.d.ts +1 -1
  41. package/dist/protocols/open-responses.js +31 -8
  42. package/dist/protocols/openai-chat.d.ts +24 -0
  43. package/dist/protocols/openai-chat.js +37 -11
  44. package/dist/protocols/openai-compatible-chat.d.ts +1 -0
  45. package/dist/protocols/openai-decisions.js +14 -1
  46. package/dist/protocols/openai-embeddings.d.ts +16 -0
  47. package/dist/protocols/openai-embeddings.js +76 -0
  48. package/dist/protocols/openrouter-video.d.ts +41 -0
  49. package/dist/protocols/openrouter-video.js +138 -0
  50. package/dist/protocols/seedance-video.d.ts +50 -0
  51. package/dist/protocols/seedance-video.js +216 -0
  52. package/dist/protocols/shared.d.ts +13 -3
  53. package/dist/protocols/shared.js +27 -4
  54. package/dist/protocols/system-one.d.ts +45 -1
  55. package/dist/protocols/system-one.js +50 -8
  56. package/dist/protocols/utils/responses-compaction.js +1 -1
  57. package/dist/protocols/venice-chat.d.ts +4 -0
  58. package/dist/protocols/xai-video.d.ts +8 -2
  59. package/dist/protocols/xai-video.js +20 -15
  60. package/dist/protocols/zai-chat.d.ts +4 -0
  61. package/dist/provider-error.js +7 -1
  62. package/dist/providers/alibaba/embeddings.d.ts +2 -0
  63. package/dist/providers/alibaba/embeddings.js +1 -0
  64. package/dist/providers/alibaba.d.ts +3 -0
  65. package/dist/providers/alibaba.js +14 -1
  66. package/dist/providers/amazon-bedrock-mantle.d.ts +1 -0
  67. package/dist/providers/azure/embeddings.d.ts +2 -0
  68. package/dist/providers/azure/embeddings.js +1 -0
  69. package/dist/providers/azure.d.ts +3 -0
  70. package/dist/providers/azure.js +15 -0
  71. package/dist/providers/baseten.d.ts +2 -0
  72. package/dist/providers/byteplus/videos.d.ts +2 -0
  73. package/dist/providers/byteplus/videos.js +1 -0
  74. package/dist/providers/byteplus.d.ts +26 -0
  75. package/dist/providers/byteplus.js +21 -0
  76. package/dist/providers/cerebras.d.ts +2 -0
  77. package/dist/providers/cloudflare-ai-gateway.d.ts +2 -0
  78. package/dist/providers/cloudflare-workers-ai.d.ts +2 -0
  79. package/dist/providers/cohere/embeddings.d.ts +2 -0
  80. package/dist/providers/cohere/embeddings.js +1 -0
  81. package/dist/providers/cohere.d.ts +8 -0
  82. package/dist/providers/cohere.js +17 -1
  83. package/dist/providers/deepinfra/embeddings.d.ts +2 -0
  84. package/dist/providers/deepinfra/embeddings.js +1 -0
  85. package/dist/providers/deepinfra.d.ts +6 -1
  86. package/dist/providers/deepinfra.js +15 -1
  87. package/dist/providers/deepseek.d.ts +2 -0
  88. package/dist/providers/digitalocean/embeddings.d.ts +2 -0
  89. package/dist/providers/digitalocean/embeddings.js +1 -0
  90. package/dist/providers/digitalocean.d.ts +10 -0
  91. package/dist/providers/digitalocean.js +15 -0
  92. package/dist/providers/fireworks/embeddings.d.ts +2 -0
  93. package/dist/providers/fireworks/embeddings.js +1 -0
  94. package/dist/providers/fireworks.d.ts +6 -1
  95. package/dist/providers/fireworks.js +15 -1
  96. package/dist/providers/google/decisions.d.ts +2 -0
  97. package/dist/providers/google/decisions.js +1 -0
  98. package/dist/providers/google/embeddings.d.ts +2 -0
  99. package/dist/providers/google/embeddings.js +1 -0
  100. package/dist/providers/google/videos.d.ts +2 -0
  101. package/dist/providers/google/videos.js +1 -0
  102. package/dist/providers/google-vertex/embeddings.d.ts +2 -0
  103. package/dist/providers/google-vertex/embeddings.js +1 -0
  104. package/dist/providers/google-vertex-chat.d.ts +1 -0
  105. package/dist/providers/google-vertex.d.ts +7 -0
  106. package/dist/providers/google-vertex.js +52 -0
  107. package/dist/providers/google.d.ts +17 -4
  108. package/dist/providers/google.js +27 -3
  109. package/dist/providers/groq.d.ts +5 -0
  110. package/dist/providers/index.d.ts +2 -1
  111. package/dist/providers/index.js +2 -1
  112. package/dist/providers/meta.d.ts +1 -0
  113. package/dist/providers/minimax/videos.d.ts +3 -0
  114. package/dist/providers/minimax/videos.js +1 -0
  115. package/dist/providers/minimax.d.ts +7 -1
  116. package/dist/providers/minimax.js +10 -1
  117. package/dist/providers/moonshot.d.ts +1 -0
  118. package/dist/providers/openai/embeddings.d.ts +2 -0
  119. package/dist/providers/openai/embeddings.js +1 -0
  120. package/dist/providers/openai-compatible/decisions.d.ts +2 -0
  121. package/dist/providers/openai-compatible/decisions.js +1 -0
  122. package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
  123. package/dist/providers/openai-compatible/embeddings.js +1 -0
  124. package/dist/providers/openai-compatible.d.ts +6 -0
  125. package/dist/providers/openai-compatible.js +27 -0
  126. package/dist/providers/openai.d.ts +7 -0
  127. package/dist/providers/openai.js +14 -0
  128. package/dist/providers/openrouter/embeddings.d.ts +2 -0
  129. package/dist/providers/openrouter/embeddings.js +1 -0
  130. package/dist/providers/openrouter/videos.d.ts +2 -0
  131. package/dist/providers/openrouter/videos.js +1 -0
  132. package/dist/providers/openrouter.d.ts +21 -0
  133. package/dist/providers/openrouter.js +23 -0
  134. package/dist/providers/togetherai.d.ts +2 -0
  135. package/dist/providers/venice.d.ts +1 -0
  136. package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
  137. package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
  138. package/dist/providers/vercel-ai-gateway.d.ts +4 -0
  139. package/dist/providers/vercel-ai-gateway.js +15 -1
  140. package/dist/providers/volcengine/videos.d.ts +2 -0
  141. package/dist/providers/volcengine/videos.js +1 -0
  142. package/dist/providers/volcengine.d.ts +26 -0
  143. package/dist/providers/volcengine.js +21 -0
  144. package/dist/providers/xai.d.ts +1 -0
  145. package/dist/providers/zai-coding-plan.d.ts +1 -0
  146. package/dist/providers/zai.d.ts +1 -0
  147. package/dist/public.d.ts +4 -0
  148. package/dist/public.js +2 -0
  149. package/dist/route/embedding.d.ts +61 -0
  150. package/dist/route/embedding.js +88 -0
  151. package/dist/route/executor-service.d.ts +6 -0
  152. package/dist/route/executor-service.js +7 -0
  153. package/dist/route/executor.d.ts +7 -1
  154. package/dist/route/executor.js +7 -2
  155. package/dist/route/media-protocol.d.ts +12 -11
  156. package/dist/route/media.d.ts +2 -0
  157. package/dist/route/media.js +31 -22
  158. package/dist/route/transport/http.js +1 -1
  159. package/dist/schema/messages.d.ts +1 -1
  160. package/dist/schema/messages.js +1 -5
  161. package/dist/schema/options.d.ts +8 -0
  162. package/dist/schema/options.js +1 -0
  163. package/dist/speech-client.d.ts +1 -1
  164. package/dist/speech-client.js +4 -4
  165. package/dist/transcription-client.d.ts +1 -1
  166. package/dist/transcription-client.js +1 -2
  167. package/dist/video-client.d.ts +16 -84
  168. package/dist/video-client.js +28 -13
  169. package/dist/video.d.ts +56 -1072
  170. package/dist/video.js +28 -65
  171. package/package.json +355 -255
  172. package/dist/protocols/google-video.d.ts +0 -26
  173. package/dist/protocols/google-video.js +0 -146
  174. package/dist/protocols/runway-video.d.ts +0 -38
  175. package/dist/protocols/runway-video.js +0 -141
  176. package/dist/providers/runway.d.ts +0 -20
  177. package/dist/providers/runway.js +0 -17
@@ -3,10 +3,14 @@ export * as BedrockConverse from "./bedrock-converse.js";
3
3
  export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js";
4
4
  export * as CohereChat from "./cohere-chat.js";
5
5
  export * as Gemini from "./gemini.js";
6
+ export * as GoogleDecisions from "./google-decisions.js";
7
+ export * as GoogleEmbedContent from "./google-embed-content.js";
6
8
  export * as GoogleInteractions from "./google-interactions.js";
9
+ export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js";
7
10
  export * as MistralChat from "./mistral-chat.js";
8
11
  export * as OpenAIChat from "./openai-chat.js";
9
12
  export * as OpenAIDecisions from "./openai-decisions.js";
13
+ export * as OpenAIEmbeddings from "./openai-embeddings.js";
10
14
  export * as OpenAIImages from "./openai-images.js";
11
15
  export * as OpenAICompatibleChat from "./openai-compatible-chat.js";
12
16
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -0,0 +1,54 @@
1
+ import { Schema } from "effect";
2
+ import { MediaProtocol } from "../route/media-protocol.js";
3
+ import { MediaRoute } from "../route/media.js";
4
+ import { type OpenString } from "../schema/index.js";
5
+ import { VideoModel, VideoResponse, type VideoRequest } from "../video.js";
6
+ /** The API host without a version: H3 is served under `/v2` and Hailuo under `/v1`. */
7
+ export declare const DEFAULT_BASE_URL = "https://api.minimax.io";
8
+ export declare const PATH = "/v2/video_generation";
9
+ export declare const STATUS_PATH = "/v2/query/video_generation";
10
+ export declare const HAILUO_PATH = "/v1/video_generation";
11
+ export declare const HAILUO_STATUS_PATH = "/v1/query/video_generation";
12
+ export declare const FILE_PATH = "/v1/files/retrieve";
13
+ /**
14
+ * Provider-native options, merged into the body. Common fields (`start`, `end`, `references`, `duration`, `aspect`,
15
+ * `resolution`, `sound`) live on the request. `extra` and `response_format` are H3 (v2) fields; `prompt_optimizer`
16
+ * and `fast_pretreatment` are Hailuo (v1) fields; both APIs take `callback_url`.
17
+ */
18
+ export type MiniMaxVideoOptions = {
19
+ readonly extra?: {
20
+ readonly prompt_expansion_mode?: OpenString<"disabled" | "balanced" | "quality">;
21
+ };
22
+ readonly response_format?: OpenString<"task" | "flat">;
23
+ readonly prompt_optimizer?: boolean;
24
+ readonly fast_pretreatment?: boolean;
25
+ readonly callback_url?: string;
26
+ } & Record<string, unknown>;
27
+ export type Request = VideoRequest<VideoModel<MiniMaxVideoOptions>>;
28
+ export declare const Token: Schema.Struct<{
29
+ readonly taskID: Schema.String;
30
+ }>;
31
+ export type Token = Schema.Schema.Type<typeof Token>;
32
+ export declare const protocol: MediaProtocol.Queued<Request, VideoResponse, {
33
+ readonly taskID: string;
34
+ }>;
35
+ export declare const hailuoProtocol: MediaProtocol.Queued<Request, VideoResponse, {
36
+ readonly taskID: string;
37
+ }>;
38
+ /** H3 and later models on the v2 API. */
39
+ export declare const h3Model: (input: MediaRoute.ModelInput) => VideoModel<MiniMaxVideoOptions>;
40
+ /** Hailuo and the `*-01` models on the v1 API. */
41
+ export declare const hailuoModel: (input: MediaRoute.ModelInput) => VideoModel<MiniMaxVideoOptions>;
42
+ /** Picks the API by model family: Hailuo and `*-01` models use v1, everything else v2. */
43
+ export declare const model: (input: MediaRoute.ModelInput) => VideoModel<MiniMaxVideoOptions>;
44
+ export declare const MiniMaxVideo: {
45
+ readonly protocol: MediaProtocol.Queued<Request, VideoResponse, {
46
+ readonly taskID: string;
47
+ }>;
48
+ readonly hailuoProtocol: MediaProtocol.Queued<Request, VideoResponse, {
49
+ readonly taskID: string;
50
+ }>;
51
+ readonly model: typeof model;
52
+ readonly h3Model: typeof h3Model;
53
+ readonly hailuoModel: typeof hailuoModel;
54
+ };
@@ -0,0 +1,292 @@
1
+ import { Duration, Effect, Schema } from "effect";
2
+ import { Media } from "../media.js";
3
+ import { MediaProtocol } from "../route/media-protocol.js";
4
+ import { MediaRoute } from "../route/media.js";
5
+ import { AIError, QuotaExceededError, mergeJsonRecords } from "../schema/index.js";
6
+ import { VideoModel, VideoResponse, seconds } from "../video.js";
7
+ import { ProviderShared, optionalNull } from "./shared.js";
8
+ // MiniMax runs two video APIs with different bodies, statuses and results: H3 on v2 and Hailuo on v1.
9
+ const route = MediaProtocol.identity({ id: "minimax-video", name: "MiniMax Video", provider: "minimax" });
10
+ const hailuoRoute = MediaProtocol.identity({
11
+ id: "minimax-hailuo-video",
12
+ name: "MiniMax Hailuo Video",
13
+ provider: "minimax",
14
+ });
15
+ /** The API host without a version: H3 is served under `/v2` and Hailuo under `/v1`. */
16
+ export const DEFAULT_BASE_URL = "https://api.minimax.io";
17
+ export const PATH = "/v2/video_generation";
18
+ export const STATUS_PATH = "/v2/query/video_generation";
19
+ export const HAILUO_PATH = "/v1/video_generation";
20
+ export const HAILUO_STATUS_PATH = "/v1/query/video_generation";
21
+ export const FILE_PATH = "/v1/files/retrieve";
22
+ const DOWNLOAD_RETENTION = Duration.hours(1);
23
+ // ---------------------------------------------------------------------------
24
+ // 2. Token and response schemas
25
+ // ---------------------------------------------------------------------------
26
+ export const Token = Schema.Struct({ taskID: Schema.String });
27
+ const BaseResp = optionalNull(Schema.Struct({
28
+ status_code: Schema.Number,
29
+ status_msg: optionalNull(Schema.String),
30
+ }));
31
+ const StartResponse = Schema.Struct({ task_id: Schema.String });
32
+ const Task = Schema.Struct({
33
+ id: optionalNull(Schema.String),
34
+ model: optionalNull(Schema.String),
35
+ status: optionalNull(Schema.String),
36
+ error: optionalNull(Schema.Struct({
37
+ code: optionalNull(Schema.Union([Schema.String, Schema.Number])),
38
+ message: optionalNull(Schema.String),
39
+ })),
40
+ content: optionalNull(Schema.Struct({ url: optionalNull(Schema.String) })),
41
+ resolution: optionalNull(Schema.String),
42
+ duration: optionalNull(Schema.Number),
43
+ ratio: optionalNull(Schema.String),
44
+ usage: optionalNull(Schema.Record(Schema.String, Schema.Unknown)),
45
+ });
46
+ // `response_format: "flat"` moves the task fields from `task` to the top level.
47
+ const TaskResponse = Schema.Struct({ ...Task.fields, task: optionalNull(Task) });
48
+ const HailuoStartResponse = Schema.Struct({ task_id: optionalNull(Schema.String), base_resp: BaseResp });
49
+ const HailuoTask = Schema.Struct({
50
+ status: optionalNull(Schema.String),
51
+ file_id: optionalNull(Schema.String),
52
+ video_width: optionalNull(Schema.Number),
53
+ video_height: optionalNull(Schema.Number),
54
+ base_resp: BaseResp,
55
+ });
56
+ const HailuoFile = Schema.Struct({
57
+ file: optionalNull(Schema.Struct({
58
+ download_url: optionalNull(Schema.String),
59
+ })),
60
+ base_resp: BaseResp,
61
+ });
62
+ const STATUS = {
63
+ queued: "queued",
64
+ running: "running",
65
+ succeeded: "completed",
66
+ failed: "failed",
67
+ cancelled: "cancelled",
68
+ };
69
+ const HAILUO_STATUS = {
70
+ Preparing: "queued",
71
+ Queueing: "queued",
72
+ Processing: "running",
73
+ Success: "completed",
74
+ Fail: "failed",
75
+ };
76
+ // ---------------------------------------------------------------------------
77
+ // 3. Failures
78
+ // ---------------------------------------------------------------------------
79
+ // Error codes from https://platform.minimax.io/docs/api-reference/errorcode; unknown codes are provider-side.
80
+ const FAILURE = {
81
+ 1002: "RateLimit",
82
+ 1004: "Authentication",
83
+ 1039: "RateLimit",
84
+ 2013: "InvalidRequest",
85
+ 2049: "Authentication",
86
+ };
87
+ const INSUFFICIENT_BALANCE = 1008;
88
+ // 1026 flags the input and 1027 the generated video.
89
+ const CONTENT_POLICY = new Set(["1026", "1027"]);
90
+ const failed = (output, name, code, detail) => {
91
+ const message = `${name} generation failed${code === undefined ? "" : ` (${code})`}${detail === undefined ? "" : `: ${detail}`}`;
92
+ if (code !== undefined && CONTENT_POLICY.has(String(code)))
93
+ return output.contentPolicy(message);
94
+ if (code !== undefined && Number(code) === INSUFFICIENT_BALANCE)
95
+ return new AIError({ reason: new QuotaExceededError({ message, body: output.body, http: output.http }) });
96
+ return output.ended("failed", message, MediaProtocol.failure(FAILURE, code));
97
+ };
98
+ // v1 answers errors with HTTP 200 and a non-zero `base_resp.status_code`.
99
+ const baseError = (output, base) => base === undefined || base === null || base.status_code === 0
100
+ ? undefined
101
+ : failed(output, hailuoRoute.name, base.status_code, base.status_msg ?? undefined);
102
+ // ---------------------------------------------------------------------------
103
+ // 5. Request body construction
104
+ // ---------------------------------------------------------------------------
105
+ /** H3 takes URLs, data URIs and `mm_file://{file_id}` references to MiniMax files. */
106
+ const mediaUrl = (asset) => ProviderShared.mediaReference(asset, route.provider, route.name).pipe(Effect.map((reference) => (reference.type === "ref" ? `mm_file://${reference.value}` : reference.value)));
107
+ const ROLES = { image: "reference_image", video: "reference_video", audio: "reference_audio" };
108
+ const item = (asset, role) => mediaUrl(asset).pipe(Effect.map((url) => {
109
+ const type = asset.kind === "video" ? "video_url" : asset.kind === "audio" ? "audio_url" : "image_url";
110
+ return { type, [type]: { url }, role };
111
+ }));
112
+ const reference = (asset) => item(asset, asset.kind === "video" || asset.kind === "audio" ? ROLES[asset.kind] : ROLES.image);
113
+ /** MiniMax spells resolutions in uppercase (`480P`, `768P`, `2K`). */
114
+ const resolution = (request) => request.resolution?.toUpperCase();
115
+ const fromRequest = Effect.fn("MiniMaxVideo.fromRequest")(function* (request) {
116
+ // H3 always generates a soundtrack and has no field to turn it off.
117
+ if (request.sound === false)
118
+ return yield* route.unsupported("video.sound", `${route.name} always generates sound and can't be silenced`);
119
+ const content = [
120
+ { type: "text", text: request.prompt },
121
+ ...(request.start === undefined ? [] : [yield* item(request.start, "first_frame")]),
122
+ ...(request.end === undefined ? [] : [yield* item(request.end, "last_frame")]),
123
+ ...(yield* Effect.forEach(request.references ?? [], reference)),
124
+ ];
125
+ return MediaProtocol.json(mergeJsonRecords({
126
+ model: request.model.id,
127
+ content,
128
+ resolution: resolution(request),
129
+ duration: request.duration === undefined ? undefined : seconds(request.duration),
130
+ ratio: request.aspect === "auto" ? "adaptive" : request.aspect,
131
+ }, request.providerOptions, request.http?.body) ?? {});
132
+ });
133
+ /** v1 documents URLs and data URLs only, so MiniMax file references aren't sent. */
134
+ const hailuoUrl = (asset) => ProviderShared.mediaReference(asset, undefined, hailuoRoute.name).pipe(Effect.map((reference) => reference.value));
135
+ const hailuoFromRequest = Effect.fn("MiniMaxHailuoVideo.fromRequest")(function* (request) {
136
+ const references = request.references ?? [];
137
+ if (references.some((asset) => asset.kind === "video" || asset.kind === "audio"))
138
+ return yield* hailuoRoute.unsupported("video.references", `${hailuoRoute.name} takes only image (subject) references`);
139
+ // Hailuo output is always silent and its shape follows the model or the first frame, with no field for either.
140
+ if (request.sound === true)
141
+ return yield* hailuoRoute.unsupported("video.sound", `${hailuoRoute.name} generates silent video only`);
142
+ if (request.aspect !== undefined && request.aspect !== "auto")
143
+ return yield* hailuoRoute.unsupported("video.aspect", `${hailuoRoute.name} has no aspect ratio input`);
144
+ const subjects = yield* Effect.forEach(references, (asset) => hailuoUrl(asset).pipe(Effect.map((url) => ({ type: "character", image: [url] }))));
145
+ return MediaProtocol.json(mergeJsonRecords({
146
+ model: request.model.id,
147
+ prompt: request.prompt,
148
+ first_frame_image: request.start === undefined ? undefined : yield* hailuoUrl(request.start),
149
+ last_frame_image: request.end === undefined ? undefined : yield* hailuoUrl(request.end),
150
+ subject_reference: subjects.length === 0 ? undefined : subjects,
151
+ duration: request.duration === undefined ? undefined : seconds(request.duration),
152
+ resolution: resolution(request),
153
+ }, request.providerOptions, request.http?.body) ?? {});
154
+ });
155
+ // ---------------------------------------------------------------------------
156
+ // 6. Response decoding
157
+ // ---------------------------------------------------------------------------
158
+ const decodeStart = route.decodeStarted(StartResponse, (value) => ({
159
+ token: { taskID: value.task_id },
160
+ snapshot: { id: value.task_id, status: "queued" },
161
+ }));
162
+ const decodeTask = route.decodeJson(TaskResponse);
163
+ const decodeStatus = Effect.fn("MiniMaxVideo.decodeStatus")(function* (response, context) {
164
+ const output = yield* decodeTask(response);
165
+ const task = output.value.task ?? output.value;
166
+ return { id: context.token.taskID, status: MediaProtocol.status(STATUS, task.status ?? "") };
167
+ });
168
+ const decodeResult = Effect.fn("MiniMaxVideo.decodeResult")(function* (response, context) {
169
+ const output = yield* decodeTask(response);
170
+ const task = output.value.task ?? output.value;
171
+ const status = MediaProtocol.status(STATUS, task.status ?? "");
172
+ if (status === "queued" || status === "running")
173
+ return yield* output.pending(context.token.taskID);
174
+ if (status === "failed")
175
+ return yield* failed(output, route.name, task.error?.code ?? undefined, task.error?.message ?? undefined);
176
+ if (status !== "completed")
177
+ return yield* output.ended("cancelled", `${route.name} task ${context.token.taskID} was cancelled`);
178
+ const url = task.content?.url ?? undefined;
179
+ if (url === undefined)
180
+ return yield* output.invalid(`${route.name} completed without a video URL`);
181
+ const duration = task.duration ?? undefined;
182
+ const total = task.usage?.total_seconds;
183
+ return new VideoResponse({
184
+ // The URL is time-limited without a documented window; reading the result again returns a fresh one.
185
+ videos: [
186
+ Media.url(url, {
187
+ mediaType: "video/mp4",
188
+ info: duration === undefined ? undefined : { durationSeconds: duration },
189
+ }),
190
+ ],
191
+ usage: typeof total === "number" ? { type: "seconds", seconds: total } : undefined,
192
+ providerMetadata: {
193
+ minimax: {
194
+ taskId: context.token.taskID,
195
+ model: task.model ?? undefined,
196
+ resolution: task.resolution ?? undefined,
197
+ ratio: task.ratio ?? undefined,
198
+ usage: task.usage ?? undefined,
199
+ },
200
+ },
201
+ });
202
+ });
203
+ const decodeHailuoStart = Effect.fn("MiniMaxHailuoVideo.decodeStart")(function* (response) {
204
+ const output = yield* hailuoRoute.decodeJson(HailuoStartResponse)(response);
205
+ const error = baseError(output, output.value.base_resp);
206
+ if (error)
207
+ return yield* error;
208
+ const taskID = output.value.task_id ?? "";
209
+ if (taskID === "")
210
+ return yield* output.invalid(`${hailuoRoute.name} returned no task_id`);
211
+ return { token: { taskID }, snapshot: { id: taskID, status: "queued" } };
212
+ });
213
+ const decodeHailuoTask = hailuoRoute.decodeJson(HailuoTask);
214
+ const decodeHailuoStatus = Effect.fn("MiniMaxHailuoVideo.decodeStatus")(function* (response, context) {
215
+ const output = yield* decodeHailuoTask(response);
216
+ const status = MediaProtocol.status(HAILUO_STATUS, output.value.status ?? "");
217
+ // A failed task also carries its reason in `base_resp`; any other non-zero code is a failed read.
218
+ const error = status === "failed" ? undefined : baseError(output, output.value.base_resp);
219
+ if (error)
220
+ return yield* error;
221
+ return { id: context.token.taskID, status };
222
+ });
223
+ const decodeHailuoFile = hailuoRoute.decodeJson(HailuoFile);
224
+ const decodeHailuoResult = Effect.fn("MiniMaxHailuoVideo.decodeResult")(function* (response, context) {
225
+ const output = yield* decodeHailuoTask(response);
226
+ const task = output.value;
227
+ const status = MediaProtocol.status(HAILUO_STATUS, task.status ?? "");
228
+ const error = baseError(output, task.base_resp);
229
+ if (status === "failed")
230
+ return yield* error ?? failed(output, hailuoRoute.name, undefined, undefined);
231
+ if (error)
232
+ return yield* error;
233
+ if (status !== "completed")
234
+ return yield* output.pending(context.token.taskID);
235
+ const fileID = task.file_id ?? "";
236
+ if (fileID === "")
237
+ return yield* output.invalid(`${hailuoRoute.name} completed without a file_id`);
238
+ // The task names a file; its download URL takes a second lookup and is valid for one hour.
239
+ const file = yield* decodeHailuoFile(yield* context.get(`${FILE_PATH}?file_id=${encodeURIComponent(fileID)}`));
240
+ const fileError = baseError(file, file.value.base_resp);
241
+ if (fileError)
242
+ return yield* fileError;
243
+ const url = file.value.file?.download_url ?? undefined;
244
+ if (url === undefined)
245
+ return yield* file.invalid(`${hailuoRoute.name} returned no download_url for ${fileID}`);
246
+ const width = task.video_width ?? undefined;
247
+ const height = task.video_height ?? undefined;
248
+ return new VideoResponse({
249
+ videos: [
250
+ yield* MediaProtocol.expiringUrl(url, DOWNLOAD_RETENTION, {
251
+ mediaType: "video/mp4",
252
+ info: width === undefined && height === undefined ? undefined : { width, height },
253
+ }),
254
+ ],
255
+ providerMetadata: {
256
+ minimax: { taskId: context.token.taskID, fileId: fileID },
257
+ },
258
+ });
259
+ });
260
+ // ---------------------------------------------------------------------------
261
+ // 7. Protocol and route
262
+ // ---------------------------------------------------------------------------
263
+ export const protocol = MediaProtocol.queued(route, {
264
+ token: Token,
265
+ start: { body: { from: fromRequest }, decode: decodeStart },
266
+ status: { path: (token) => `${STATUS_PATH}/${token.taskID}`, decode: decodeStatus },
267
+ result: { path: (token) => `${STATUS_PATH}/${token.taskID}`, decode: decodeResult },
268
+ // Cancels a queued task; MiniMax rejects it once the task is running.
269
+ cancel: { method: "DELETE", path: (token) => `${PATH}/${token.taskID}` },
270
+ });
271
+ const hailuoStatusPath = (token) => `${HAILUO_STATUS_PATH}?task_id=${encodeURIComponent(token.taskID)}`;
272
+ export const hailuoProtocol = MediaProtocol.queued(hailuoRoute, {
273
+ token: Token,
274
+ start: { body: { from: hailuoFromRequest }, decode: decodeHailuoStart },
275
+ status: { path: hailuoStatusPath, decode: decodeHailuoStatus },
276
+ result: { path: hailuoStatusPath, decode: decodeHailuoResult },
277
+ });
278
+ /** H3 and later models on the v2 API. */
279
+ export const h3Model = (input) => VideoModel.fromRoute({ protocol, baseURL: DEFAULT_BASE_URL, path: PATH }, input);
280
+ /** Hailuo and the `*-01` models on the v1 API. */
281
+ export const hailuoModel = (input) => VideoModel.fromRoute({ protocol: hailuoProtocol, baseURL: DEFAULT_BASE_URL, path: HAILUO_PATH }, input);
282
+ // v1 is MiniMax's legacy API with a fixed model list; every newer model ships on v2.
283
+ const isHailuo = (modelID) => /^(minimax-hailuo-|[tis]2v-01|video-01)/i.test(modelID);
284
+ /** Picks the API by model family: Hailuo and `*-01` models use v1, everything else v2. */
285
+ export const model = (input) => (isHailuo(input.id) ? hailuoModel(input) : h3Model(input));
286
+ export const MiniMaxVideo = {
287
+ protocol,
288
+ hailuoProtocol,
289
+ model,
290
+ h3Model,
291
+ hailuoModel,
292
+ };
@@ -1566,7 +1566,7 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
1566
1566
  }[];
1567
1567
  } | undefined;
1568
1568
  }, AIError, never>;
1569
- export declare const mapUsage: (usage: OpenResponsesUsage | null | undefined, providerMetadataKey: string) => Usage | undefined;
1569
+ export declare const mapUsage: (usage: OpenResponsesUsage | null | undefined, providerMetadataKey: string, ...frames: ReadonlyArray<unknown>) => Usage | undefined;
1570
1570
  export declare const metadataKey: (model: LLMRequest["model"]) => string;
1571
1571
  export declare const providerMetadata: (state: ParserState, metadata: Record<string, unknown>) => ProviderMetadata;
1572
1572
  export type StepResult = readonly [ParserState, ReadonlyArray<LLMEvent>];
@@ -671,7 +671,7 @@ export const fromRequest = (request) => fromRequestWithAdapter(request, BASE_ADA
671
671
  // cached-read and cache-write subsets, and `output_tokens` (inclusive total)
672
672
  // with a `reasoning_tokens` subset. Pass the totals through and derive the
673
673
  // non-cached breakdown.
674
- export const mapUsage = (usage, providerMetadataKey) => {
674
+ export const mapUsage = (usage, providerMetadataKey, ...frames) => {
675
675
  if (!usage)
676
676
  return undefined;
677
677
  const cached = usage.input_tokens_details?.cached_tokens;
@@ -686,10 +686,29 @@ export const mapUsage = (usage, providerMetadataKey) => {
686
686
  cacheWriteInputTokens: cacheWrite,
687
687
  reasoningTokens: reasoning,
688
688
  totalTokens: ProviderShared.totalTokens(usage.input_tokens, usage.output_tokens, usage.total_tokens),
689
- ...ProviderShared.reportedBilling(usage),
689
+ ...ProviderShared.reportedBilling(usage, ...frames),
690
690
  providerMetadata: { [providerMetadataKey]: usage },
691
691
  });
692
692
  };
693
+ // GitHub Copilot lists the filters that ran; the blocking one names its rule in `content_filter_raw`.
694
+ const decodeContentFilters = Schema.decodeUnknownOption(Schema.Array(Schema.Struct({
695
+ source_type: Schema.optional(Schema.String),
696
+ blocked: Schema.optional(Schema.Boolean),
697
+ content_filter_raw: Schema.optional(Schema.Array(Schema.Struct({
698
+ action: Schema.optional(Schema.String),
699
+ label: Schema.optional(Schema.String),
700
+ result: Schema.optional(Schema.Unknown),
701
+ }))),
702
+ content_filter_results: Schema.optional(Schema.Unknown),
703
+ })));
704
+ const contentFilterCategory = (raw) => {
705
+ const blocked = Option.getOrElse(decodeContentFilters(raw), () => []).filter((filter) => filter.blocked);
706
+ const filter = blocked.find((item) => item.source_type === "completion") ?? blocked[0];
707
+ if (!filter)
708
+ return undefined;
709
+ return (filter.content_filter_raw?.find((rule) => rule.action === "BLOCK" && rule.result === true)?.label ??
710
+ ProviderShared.contentFilterCategory(filter.content_filter_results));
711
+ };
693
712
  const mapFinishReason = (event, hasFunctionCall) => {
694
713
  const reason = event.response?.incomplete_details?.reason;
695
714
  if (reason === undefined) {
@@ -749,12 +768,13 @@ const ITEM_ID_PREFIX = {
749
768
  custom_tool_call: "ctc",
750
769
  compaction: "cmp",
751
770
  };
752
- // An item without an id adopts the id already open in its output slot,
753
- // otherwise it gets a locally minted one.
771
+ // An item adopts the id already open in its output slot, since GitHub Copilot
772
+ // sends a different id on every event, including the item's own done event.
773
+ // Otherwise it keeps its id or gets a locally minted one.
754
774
  const resolveItem = (state, item, index) => ({
755
775
  ...item,
756
- id: item.id ??
757
- (index === undefined ? undefined : state.outputItems[index]) ??
776
+ id: (index === undefined ? undefined : state.outputItems[index]) ??
777
+ item.id ??
758
778
  `${ITEM_ID_PREFIX[item.type] ?? "item"}_${crypto.randomUUID().replaceAll("-", "")}`,
759
779
  });
760
780
  // Registered output slots are authoritative for `item_id` routing, and items
@@ -1128,12 +1148,15 @@ const onResponseFinish = Effect.fnUntraced(function* (state, event) {
1128
1148
  };
1129
1149
  events.push(...pending.events);
1130
1150
  }
1151
+ const normalized = mapFinishReason(event, current.hasFunctionCall);
1131
1152
  const lifecycle = Lifecycle.finish(current.lifecycle, events, {
1132
1153
  reason: {
1133
- normalized: mapFinishReason(event, current.hasFunctionCall),
1154
+ normalized,
1134
1155
  raw: event.response?.incomplete_details?.reason,
1156
+ ...(normalized === "content-filter" ? { category: contentFilterCategory(event.response?.content_filters) } : {}),
1135
1157
  },
1136
- usage: mapUsage(event.response?.usage, current.providerMetadataKey),
1158
+ // Copilot reports its billing on the terminal event, beside `response`.
1159
+ usage: mapUsage(event.response?.usage, current.providerMetadataKey, event, event.response),
1137
1160
  providerMetadata: event.response?.id || event.response?.service_tier
1138
1161
  ? providerMetadata(current, {
1139
1162
  responseId: event.response.id,
@@ -158,6 +158,7 @@ export declare const OpenAIChatMessage: Schema.toTaggedUnion<"role", readonly [S
158
158
  readonly reasoning: Schema.optional<Schema.String>;
159
159
  readonly reasoning_text: Schema.optional<Schema.String>;
160
160
  readonly reasoning_details: Schema.optional<Schema.Unknown>;
161
+ readonly reasoning_opaque: Schema.optional<Schema.String>;
161
162
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
162
163
  readonly role: Schema.Literal<"tool">;
163
164
  readonly tool_call_id: Schema.String;
@@ -259,6 +260,7 @@ export declare const bodyFields: {
259
260
  readonly reasoning: Schema.optional<Schema.String>;
260
261
  readonly reasoning_text: Schema.optional<Schema.String>;
261
262
  readonly reasoning_details: Schema.optional<Schema.Unknown>;
263
+ readonly reasoning_opaque: Schema.optional<Schema.String>;
262
264
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
263
265
  readonly role: Schema.Literal<"tool">;
264
266
  readonly tool_call_id: Schema.String;
@@ -428,6 +430,7 @@ declare const OpenAIChatBody: Schema.Struct<{
428
430
  readonly reasoning: Schema.optional<Schema.String>;
429
431
  readonly reasoning_text: Schema.optional<Schema.String>;
430
432
  readonly reasoning_details: Schema.optional<Schema.Unknown>;
433
+ readonly reasoning_opaque: Schema.optional<Schema.String>;
431
434
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
432
435
  readonly role: Schema.Literal<"tool">;
433
436
  readonly tool_call_id: Schema.String;
@@ -518,6 +521,7 @@ export declare const OpenAIChatUsage: Schema.StructWithRest<Schema.Struct<{
518
521
  readonly prompt_cache_hit_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
519
522
  readonly cache_read_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
520
523
  readonly cache_created_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
524
+ readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
521
525
  readonly prompt_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
522
526
  readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
523
527
  readonly cache_write_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
@@ -548,6 +552,7 @@ export declare const OpenAIChatDelta: Schema.StructWithRest<Schema.Struct<{
548
552
  readonly reasoning: Schema.optional<Schema.NullOr<Schema.String>>;
549
553
  readonly reasoning_text: Schema.optional<Schema.NullOr<Schema.String>>;
550
554
  readonly reasoning_details: Schema.optional<Schema.NullOr<Schema.Unknown>>;
555
+ readonly reasoning_opaque: Schema.optional<Schema.NullOr<Schema.String>>;
551
556
  readonly tool_calls: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Struct<{
552
557
  readonly index: Schema.optional<Schema.NullOr<Schema.Number>>;
553
558
  readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
@@ -570,6 +575,7 @@ export declare const OpenAIChatChoice: Schema.StructWithRest<Schema.Struct<{
570
575
  readonly reasoning: Schema.optional<Schema.NullOr<Schema.String>>;
571
576
  readonly reasoning_text: Schema.optional<Schema.NullOr<Schema.String>>;
572
577
  readonly reasoning_details: Schema.optional<Schema.NullOr<Schema.Unknown>>;
578
+ readonly reasoning_opaque: Schema.optional<Schema.NullOr<Schema.String>>;
573
579
  readonly tool_calls: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Struct<{
574
580
  readonly index: Schema.optional<Schema.NullOr<Schema.Number>>;
575
581
  readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
@@ -594,6 +600,7 @@ export declare const OpenAIChatChoice: Schema.StructWithRest<Schema.Struct<{
594
600
  readonly prompt_cache_hit_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
595
601
  readonly cache_read_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
596
602
  readonly cache_created_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
603
+ readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
597
604
  readonly prompt_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
598
605
  readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
599
606
  readonly cache_write_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
@@ -614,6 +621,7 @@ export declare const OpenAIChatEvent: Schema.StructWithRest<Schema.Struct<{
614
621
  readonly reasoning: Schema.optional<Schema.NullOr<Schema.String>>;
615
622
  readonly reasoning_text: Schema.optional<Schema.NullOr<Schema.String>>;
616
623
  readonly reasoning_details: Schema.optional<Schema.NullOr<Schema.Unknown>>;
624
+ readonly reasoning_opaque: Schema.optional<Schema.NullOr<Schema.String>>;
617
625
  readonly tool_calls: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Struct<{
618
626
  readonly index: Schema.optional<Schema.NullOr<Schema.Number>>;
619
627
  readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
@@ -638,6 +646,7 @@ export declare const OpenAIChatEvent: Schema.StructWithRest<Schema.Struct<{
638
646
  readonly prompt_cache_hit_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
639
647
  readonly cache_read_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
640
648
  readonly cache_created_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
649
+ readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
641
650
  readonly prompt_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
642
651
  readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
643
652
  readonly cache_write_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
@@ -657,6 +666,7 @@ export declare const OpenAIChatEvent: Schema.StructWithRest<Schema.Struct<{
657
666
  readonly prompt_cache_hit_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
658
667
  readonly cache_read_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
659
668
  readonly cache_created_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
669
+ readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
660
670
  readonly prompt_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
661
671
  readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
662
672
  readonly cache_write_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
@@ -695,6 +705,8 @@ export interface ParserState {
695
705
  readonly reasoningTextObserved: boolean;
696
706
  readonly reasoningDetails: Array<ReasoningDetail>;
697
707
  readonly reasoningDetailsObserved: boolean;
708
+ /** Latest `reasoning_opaque`; interleaved reasoning sends a new one before each tool call. */
709
+ readonly reasoningOpaque?: string;
698
710
  readonly reasoningEmitted: boolean;
699
711
  readonly latestToolIndex?: number;
700
712
  readonly nextToolIndex: number;
@@ -820,6 +832,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
820
832
  readonly reasoning?: string | undefined;
821
833
  readonly reasoning_text?: string | undefined;
822
834
  readonly reasoning_details?: unknown;
835
+ readonly reasoning_opaque?: string | undefined;
823
836
  })[];
824
837
  tools: ({
825
838
  readonly type: "function";
@@ -992,6 +1005,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
992
1005
  readonly reasoning?: string | undefined;
993
1006
  readonly reasoning_text?: string | undefined;
994
1007
  readonly reasoning_details?: unknown;
1008
+ readonly reasoning_opaque?: string | undefined;
995
1009
  })[];
996
1010
  tools: ({
997
1011
  readonly type: "function";
@@ -1166,6 +1180,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1166
1180
  readonly reasoning?: string | undefined;
1167
1181
  readonly reasoning_text?: string | undefined;
1168
1182
  readonly reasoning_details?: unknown;
1183
+ readonly reasoning_opaque?: string | undefined;
1169
1184
  })[];
1170
1185
  tools: ({
1171
1186
  readonly type: "function";
@@ -1338,6 +1353,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1338
1353
  readonly reasoning?: string | undefined;
1339
1354
  readonly reasoning_text?: string | undefined;
1340
1355
  readonly reasoning_details?: unknown;
1356
+ readonly reasoning_opaque?: string | undefined;
1341
1357
  })[];
1342
1358
  tools: ({
1343
1359
  readonly type: "function";
@@ -1510,6 +1526,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1510
1526
  readonly reasoning?: string | undefined;
1511
1527
  readonly reasoning_text?: string | undefined;
1512
1528
  readonly reasoning_details?: unknown;
1529
+ readonly reasoning_opaque?: string | undefined;
1513
1530
  })[];
1514
1531
  tools: ({
1515
1532
  readonly type: "function";
@@ -1684,6 +1701,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1684
1701
  readonly reasoning?: string | undefined;
1685
1702
  readonly reasoning_text?: string | undefined;
1686
1703
  readonly reasoning_details?: unknown;
1704
+ readonly reasoning_opaque?: string | undefined;
1687
1705
  })[];
1688
1706
  tools: ({
1689
1707
  readonly type: "function";
@@ -2050,6 +2068,7 @@ export declare const protocol: Protocol<{
2050
2068
  readonly reasoning?: string | undefined;
2051
2069
  readonly reasoning_text?: string | undefined;
2052
2070
  readonly reasoning_details?: unknown;
2071
+ readonly reasoning_opaque?: string | undefined;
2053
2072
  })[];
2054
2073
  readonly tools?: readonly ({
2055
2074
  readonly type: "function";
@@ -2135,6 +2154,7 @@ export declare const protocol: Protocol<{
2135
2154
  readonly reasoning?: string | null | undefined;
2136
2155
  readonly reasoning_text?: string | null | undefined;
2137
2156
  readonly reasoning_details?: unknown;
2157
+ readonly reasoning_opaque?: string | null | undefined;
2138
2158
  readonly tool_calls?: readonly {
2139
2159
  readonly index?: number | null | undefined;
2140
2160
  readonly id?: string | null | undefined;
@@ -2160,6 +2180,7 @@ export declare const protocol: Protocol<{
2160
2180
  readonly prompt_cache_hit_tokens?: number | null | undefined;
2161
2181
  readonly cache_read_input_tokens?: number | null | undefined;
2162
2182
  readonly cache_created_input_tokens?: number | null | undefined;
2183
+ readonly reasoning_tokens?: number | null | undefined;
2163
2184
  readonly prompt_tokens_details?: {
2164
2185
  readonly [x: string]: unknown;
2165
2186
  readonly cached_tokens?: number | null | undefined;
@@ -2182,6 +2203,7 @@ export declare const protocol: Protocol<{
2182
2203
  readonly prompt_cache_hit_tokens?: number | null | undefined;
2183
2204
  readonly cache_read_input_tokens?: number | null | undefined;
2184
2205
  readonly cache_created_input_tokens?: number | null | undefined;
2206
+ readonly reasoning_tokens?: number | null | undefined;
2185
2207
  readonly prompt_tokens_details?: {
2186
2208
  readonly [x: string]: unknown;
2187
2209
  readonly cached_tokens?: number | null | undefined;
@@ -2301,6 +2323,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
2301
2323
  readonly reasoning?: string | undefined;
2302
2324
  readonly reasoning_text?: string | undefined;
2303
2325
  readonly reasoning_details?: unknown;
2326
+ readonly reasoning_opaque?: string | undefined;
2304
2327
  })[];
2305
2328
  readonly tools?: readonly ({
2306
2329
  readonly type: "function";
@@ -2475,6 +2498,7 @@ export declare const route: Route<{
2475
2498
  readonly reasoning?: string | undefined;
2476
2499
  readonly reasoning_text?: string | undefined;
2477
2500
  readonly reasoning_details?: unknown;
2501
+ readonly reasoning_opaque?: string | undefined;
2478
2502
  })[];
2479
2503
  readonly tools?: readonly ({
2480
2504
  readonly type: "function";