@opencode/ai 2.0.19 → 2.0.21

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 (56) hide show
  1. package/dist/cache-policy.js +21 -3
  2. package/dist/llm.d.ts +1 -1
  3. package/dist/promise.d.ts +2 -2
  4. package/dist/protocols/alibaba-chat.d.ts +16 -10
  5. package/dist/protocols/alibaba-responses.d.ts +14 -14
  6. package/dist/protocols/anthropic-messages.js +2 -15
  7. package/dist/protocols/bedrock-converse.d.ts +1 -1
  8. package/dist/protocols/bedrock-converse.js +38 -12
  9. package/dist/protocols/meta-messages.d.ts +5 -1
  10. package/dist/protocols/meta-messages.js +11 -4
  11. package/dist/protocols/meta-responses.d.ts +16 -16
  12. package/dist/protocols/mistral-chat.d.ts +6 -0
  13. package/dist/protocols/mistral-chat.js +8 -5
  14. package/dist/protocols/open-responses.d.ts +31 -31
  15. package/dist/protocols/openai-chat.d.ts +114 -71
  16. package/dist/protocols/openai-chat.js +31 -32
  17. package/dist/protocols/openai-compatible-chat.d.ts +16 -10
  18. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  19. package/dist/protocols/openai-responses.d.ts +22 -22
  20. package/dist/protocols/utils/claude-model.d.ts +8 -0
  21. package/dist/protocols/utils/claude-model.js +15 -0
  22. package/dist/protocols/utils/tool-stream.d.ts +3 -3
  23. package/dist/protocols/xai-responses.d.ts +14 -14
  24. package/dist/protocols/zai-chat.d.ts +16 -10
  25. package/dist/provider-error.d.ts +1 -0
  26. package/dist/provider-error.js +23 -1
  27. package/dist/providers/alibaba.d.ts +18 -12
  28. package/dist/providers/amazon-bedrock-mantle.d.ts +18 -12
  29. package/dist/providers/azure.d.ts +20 -14
  30. package/dist/providers/baseten.d.ts +32 -20
  31. package/dist/providers/cerebras.d.ts +32 -20
  32. package/dist/providers/cloudflare-ai-gateway.d.ts +36 -24
  33. package/dist/providers/cloudflare-ai-gateway.js +43 -35
  34. package/dist/providers/cloudflare-workers-ai.d.ts +32 -20
  35. package/dist/providers/deepinfra.d.ts +32 -20
  36. package/dist/providers/deepseek.d.ts +32 -20
  37. package/dist/providers/fireworks.d.ts +32 -20
  38. package/dist/providers/google-vertex-chat.d.ts +16 -10
  39. package/dist/providers/google-vertex-responses.d.ts +2 -2
  40. package/dist/providers/groq.d.ts +32 -20
  41. package/dist/providers/meta.d.ts +23 -13
  42. package/dist/providers/minimax.d.ts +18 -12
  43. package/dist/providers/moonshot.d.ts +18 -12
  44. package/dist/providers/openai-compatible-responses.d.ts +2 -2
  45. package/dist/providers/openai-compatible.d.ts +16 -10
  46. package/dist/providers/openai.d.ts +18 -12
  47. package/dist/providers/openrouter.d.ts +64 -40
  48. package/dist/providers/togetherai.d.ts +32 -20
  49. package/dist/providers/xai.d.ts +16 -10
  50. package/dist/providers/zai-coding-plan.d.ts +18 -12
  51. package/dist/providers/zai.d.ts +16 -10
  52. package/dist/route/client.d.ts +1 -1
  53. package/dist/route/executor.js +12 -8
  54. package/dist/schema/events.d.ts +30 -30
  55. package/dist/testing.d.ts +8 -8
  56. package/package.json +3 -3
@@ -58,15 +58,18 @@ export declare const route: Route<{
58
58
  })[];
59
59
  } | {
60
60
  readonly [x: string]: unknown;
61
- readonly content: string | null;
61
+ readonly content: string | readonly {
62
+ readonly type: "text";
63
+ readonly text: string;
64
+ readonly cache_control?: {
65
+ readonly type: "ephemeral";
66
+ readonly ttl?: string | undefined;
67
+ } | undefined;
68
+ }[] | null;
62
69
  readonly role: "assistant";
63
70
  readonly reasoning?: string | undefined;
64
71
  readonly reasoning_content?: string | undefined;
65
72
  readonly reasoning_text?: string | undefined;
66
- readonly cache_control?: {
67
- readonly type: "ephemeral";
68
- readonly ttl?: string | undefined;
69
- } | undefined;
70
73
  readonly tool_calls?: readonly {
71
74
  readonly function: {
72
75
  readonly name: string;
@@ -82,13 +85,16 @@ export declare const route: Route<{
82
85
  }[] | undefined;
83
86
  readonly reasoning_details?: unknown;
84
87
  } | {
85
- readonly content: string;
86
88
  readonly role: "tool";
87
89
  readonly tool_call_id: string;
88
- readonly cache_control?: {
89
- readonly type: "ephemeral";
90
- readonly ttl?: string | undefined;
91
- } | undefined;
90
+ readonly content: string | readonly {
91
+ readonly type: "text";
92
+ readonly text: string;
93
+ readonly cache_control?: {
94
+ readonly type: "ephemeral";
95
+ readonly ttl?: string | undefined;
96
+ } | undefined;
97
+ }[];
92
98
  })[];
93
99
  readonly stream: true;
94
100
  readonly max_completion_tokens?: number | undefined;
@@ -174,15 +180,18 @@ export declare const routes: Route<{
174
180
  })[];
175
181
  } | {
176
182
  readonly [x: string]: unknown;
177
- readonly content: string | null;
183
+ readonly content: string | readonly {
184
+ readonly type: "text";
185
+ readonly text: string;
186
+ readonly cache_control?: {
187
+ readonly type: "ephemeral";
188
+ readonly ttl?: string | undefined;
189
+ } | undefined;
190
+ }[] | null;
178
191
  readonly role: "assistant";
179
192
  readonly reasoning?: string | undefined;
180
193
  readonly reasoning_content?: string | undefined;
181
194
  readonly reasoning_text?: string | undefined;
182
- readonly cache_control?: {
183
- readonly type: "ephemeral";
184
- readonly ttl?: string | undefined;
185
- } | undefined;
186
195
  readonly tool_calls?: readonly {
187
196
  readonly function: {
188
197
  readonly name: string;
@@ -198,13 +207,16 @@ export declare const routes: Route<{
198
207
  }[] | undefined;
199
208
  readonly reasoning_details?: unknown;
200
209
  } | {
201
- readonly content: string;
202
210
  readonly role: "tool";
203
211
  readonly tool_call_id: string;
204
- readonly cache_control?: {
205
- readonly type: "ephemeral";
206
- readonly ttl?: string | undefined;
207
- } | undefined;
212
+ readonly content: string | readonly {
213
+ readonly type: "text";
214
+ readonly text: string;
215
+ readonly cache_control?: {
216
+ readonly type: "ephemeral";
217
+ readonly ttl?: string | undefined;
218
+ } | undefined;
219
+ }[];
208
220
  })[];
209
221
  readonly stream: true;
210
222
  readonly max_completion_tokens?: number | undefined;
@@ -99,8 +99,8 @@ export declare const responsesRoute: import("../route/client.js").Route<{
99
99
  } | {
100
100
  readonly type: "input_file";
101
101
  readonly filename: string;
102
- readonly file_data?: string | undefined;
103
102
  readonly detail?: string | undefined;
103
+ readonly file_data?: string | undefined;
104
104
  readonly file_url?: string | undefined;
105
105
  } | {
106
106
  readonly type: "input_text";
@@ -136,8 +136,8 @@ export declare const responsesRoute: import("../route/client.js").Route<{
136
136
  } | {
137
137
  readonly type: "input_file";
138
138
  readonly filename: string;
139
- readonly file_data?: string | undefined;
140
139
  readonly detail?: string | undefined;
140
+ readonly file_data?: string | undefined;
141
141
  readonly file_url?: string | undefined;
142
142
  } | {
143
143
  readonly type: "input_text";
@@ -577,15 +577,18 @@ export declare const route: import("../route/client.js").Route<{
577
577
  })[];
578
578
  } | {
579
579
  readonly [x: string]: unknown;
580
- readonly content: string | null;
580
+ readonly content: string | readonly {
581
+ readonly type: "text";
582
+ readonly text: string;
583
+ readonly cache_control?: {
584
+ readonly type: "ephemeral";
585
+ readonly ttl?: string | undefined;
586
+ } | undefined;
587
+ }[] | null;
581
588
  readonly role: "assistant";
582
589
  readonly reasoning?: string | undefined;
583
590
  readonly reasoning_content?: string | undefined;
584
591
  readonly reasoning_text?: string | undefined;
585
- readonly cache_control?: {
586
- readonly type: "ephemeral";
587
- readonly ttl?: string | undefined;
588
- } | undefined;
589
592
  readonly tool_calls?: readonly {
590
593
  readonly function: {
591
594
  readonly name: string;
@@ -601,13 +604,16 @@ export declare const route: import("../route/client.js").Route<{
601
604
  }[] | undefined;
602
605
  readonly reasoning_details?: unknown;
603
606
  } | {
604
- readonly content: string;
605
607
  readonly role: "tool";
606
608
  readonly tool_call_id: string;
607
- readonly cache_control?: {
608
- readonly type: "ephemeral";
609
- readonly ttl?: string | undefined;
610
- } | undefined;
609
+ readonly content: string | readonly {
610
+ readonly type: "text";
611
+ readonly text: string;
612
+ readonly cache_control?: {
613
+ readonly type: "ephemeral";
614
+ readonly ttl?: string | undefined;
615
+ } | undefined;
616
+ }[];
611
617
  })[];
612
618
  readonly stream: true;
613
619
  readonly max_completion_tokens?: number | undefined;
@@ -965,15 +971,18 @@ export declare const routes: (import("../route/client.js").Route<{
965
971
  })[];
966
972
  } | {
967
973
  readonly [x: string]: unknown;
968
- readonly content: string | null;
974
+ readonly content: string | readonly {
975
+ readonly type: "text";
976
+ readonly text: string;
977
+ readonly cache_control?: {
978
+ readonly type: "ephemeral";
979
+ readonly ttl?: string | undefined;
980
+ } | undefined;
981
+ }[] | null;
969
982
  readonly role: "assistant";
970
983
  readonly reasoning?: string | undefined;
971
984
  readonly reasoning_content?: string | undefined;
972
985
  readonly reasoning_text?: string | undefined;
973
- readonly cache_control?: {
974
- readonly type: "ephemeral";
975
- readonly ttl?: string | undefined;
976
- } | undefined;
977
986
  readonly tool_calls?: readonly {
978
987
  readonly function: {
979
988
  readonly name: string;
@@ -989,13 +998,16 @@ export declare const routes: (import("../route/client.js").Route<{
989
998
  }[] | undefined;
990
999
  readonly reasoning_details?: unknown;
991
1000
  } | {
992
- readonly content: string;
993
1001
  readonly role: "tool";
994
1002
  readonly tool_call_id: string;
995
- readonly cache_control?: {
996
- readonly type: "ephemeral";
997
- readonly ttl?: string | undefined;
998
- } | undefined;
1003
+ readonly content: string | readonly {
1004
+ readonly type: "text";
1005
+ readonly text: string;
1006
+ readonly cache_control?: {
1007
+ readonly type: "ephemeral";
1008
+ readonly ttl?: string | undefined;
1009
+ } | undefined;
1010
+ }[];
999
1011
  })[];
1000
1012
  readonly stream: true;
1001
1013
  readonly max_completion_tokens?: number | undefined;
@@ -1106,8 +1118,8 @@ export declare const routes: (import("../route/client.js").Route<{
1106
1118
  } | {
1107
1119
  readonly type: "input_file";
1108
1120
  readonly filename: string;
1109
- readonly file_data?: string | undefined;
1110
1121
  readonly detail?: string | undefined;
1122
+ readonly file_data?: string | undefined;
1111
1123
  readonly file_url?: string | undefined;
1112
1124
  } | {
1113
1125
  readonly type: "input_text";
@@ -1143,8 +1155,8 @@ export declare const routes: (import("../route/client.js").Route<{
1143
1155
  } | {
1144
1156
  readonly type: "input_file";
1145
1157
  readonly filename: string;
1146
- readonly file_data?: string | undefined;
1147
1158
  readonly detail?: string | undefined;
1159
+ readonly file_data?: string | undefined;
1148
1160
  readonly file_url?: string | undefined;
1149
1161
  } | {
1150
1162
  readonly type: "input_text";
@@ -7,13 +7,20 @@ export const authEnvVars = ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
7
7
  export const baseURL = (input) => {
8
8
  if (input.baseURL)
9
9
  return input.baseURL;
10
- if (!input.accountId)
11
- throw new ProviderConfigurationError({
12
- provider: id,
13
- message: "CloudflareAIGateway.configure requires accountId unless baseURL is supplied",
14
- });
15
- return `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(input.accountId)}/ai/v1`;
10
+ return `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(requireAccountId(input))}/ai/v1`;
16
11
  };
12
+ // Cloudflare's REST API rejects parts of the Anthropic Messages and OpenAI Responses request shapes, such as
13
+ // system prompt blocks and `minimal` reasoning effort, so these models use the provider-native gateway endpoints.
14
+ const passthroughURL = (input, provider) => `https://gateway.ai.cloudflare.com/v1/${encodeURIComponent(requireAccountId(input))}/${encodeURIComponent(gatewayId(input))}/${provider}`;
15
+ const requireAccountId = (input) => {
16
+ if (input.accountId)
17
+ return input.accountId;
18
+ throw new ProviderConfigurationError({
19
+ provider: id,
20
+ message: "CloudflareAIGateway.configure requires accountId unless baseURL is supplied",
21
+ });
22
+ };
23
+ const gatewayId = (input) => input.gatewayId?.trim() || "default";
17
24
  export const responsesRoute = OpenAIResponses.route.with({
18
25
  id: "cloudflare-ai-gateway-responses",
19
26
  provider: id,
@@ -30,16 +37,10 @@ export const route = OpenAIChat.route.with({
30
37
  endpoint: { baseURL: undefined },
31
38
  });
32
39
  export const routes = [responsesRoute, messagesRoute, route];
33
- const auth = (input) => {
34
- if ("auth" in input && input.auth)
35
- return input.auth;
36
- return Auth.optional(input.gatewayApiKey ?? ("apiKey" in input ? input.apiKey : undefined), "apiKey")
37
- .orElse(Auth.config(authEnvVars[0]))
38
- .orElse(Auth.config(authEnvVars[1]))
39
- .bearer();
40
- };
40
+ const credential = (input) => Auth.optional(input.gatewayApiKey ?? ("apiKey" in input ? input.apiKey : undefined), "apiKey")
41
+ .orElse(Auth.config(authEnvVars[0]))
42
+ .orElse(Auth.config(authEnvVars[1]));
41
43
  const headers = (input) => ({
42
- ...(input.gatewayId === undefined ? {} : { "cf-aig-gateway-id": input.gatewayId.trim() || "default" }),
43
44
  ...(input.metadata === undefined
44
45
  ? {}
45
46
  : { "cf-aig-metadata": Schema.encodeSync(Schema.fromJsonString(Schema.Unknown))(input.metadata) }),
@@ -49,34 +50,41 @@ const headers = (input) => ({
49
50
  ...(input.collectLog === undefined ? {} : { "cf-aig-collect-log": String(input.collectLog) }),
50
51
  ...input.headers,
51
52
  });
52
- const modelID = (input) => {
53
- const value = String(input);
54
- if (value.startsWith("workers-ai/"))
55
- return value.slice("workers-ai/".length);
56
- if (value.startsWith("anthropic/"))
57
- return `anthropic/${value.slice("anthropic/".length).replaceAll(".", "-")}`;
58
- return value;
59
- };
60
53
  export const configure = (input) => {
61
- const defaults = {
54
+ const custom = "auth" in input && input.auth ? input.auth : undefined;
55
+ const rest = {
62
56
  endpoint: { baseURL: baseURL(input) },
63
- auth: auth(input),
64
- headers: headers(input),
57
+ auth: custom ?? credential(input).bearer(),
58
+ headers: { "cf-aig-gateway-id": gatewayId(input), ...headers(input) },
65
59
  http: input.http,
66
60
  providerOptions: input.providerOptions,
67
61
  };
68
- const responses = responsesRoute.with(defaults);
69
- const messages = messagesRoute.with(defaults);
70
- const chat = route.with(defaults);
62
+ // A custom baseURL stands in for the REST API, so every model keeps using it with gateway model IDs.
63
+ const native = input.baseURL === undefined;
64
+ const passthrough = (provider) => native
65
+ ? {
66
+ ...rest,
67
+ endpoint: { baseURL: passthroughURL(input, provider) },
68
+ auth: custom ?? Auth.bearerHeader("cf-aig-authorization", credential(input)),
69
+ headers: headers(input),
70
+ }
71
+ : rest;
72
+ const responses = responsesRoute.with(passthrough("openai"));
73
+ const messages = messagesRoute.with(passthrough("anthropic/v1"));
74
+ const chat = route.with(rest);
71
75
  return {
72
76
  id,
73
77
  model: (input) => {
74
- const wire = modelID(input);
75
- if (String(input).startsWith("openai/"))
76
- return responses.model({ id: wire });
77
- if (String(input).startsWith("anthropic/"))
78
- return messages.model({ id: wire });
79
- return chat.model({ id: wire });
78
+ const value = String(input);
79
+ if (value.startsWith("openai/"))
80
+ return responses.model({ id: native ? value.slice("openai/".length) : value });
81
+ if (value.startsWith("anthropic/"))
82
+ return messages.model({
83
+ id: native ? value.slice("anthropic/".length).replaceAll(".", "-") : value,
84
+ });
85
+ if (value.startsWith("workers-ai/"))
86
+ return chat.model({ id: value.slice("workers-ai/".length) });
87
+ return chat.model({ id: value });
80
88
  },
81
89
  configure,
82
90
  };
@@ -62,15 +62,18 @@ export declare const route: Route<{
62
62
  })[];
63
63
  } | {
64
64
  readonly [x: string]: unknown;
65
- readonly content: string | null;
65
+ readonly content: string | readonly {
66
+ readonly type: "text";
67
+ readonly text: string;
68
+ readonly cache_control?: {
69
+ readonly type: "ephemeral";
70
+ readonly ttl?: string | undefined;
71
+ } | undefined;
72
+ }[] | null;
66
73
  readonly role: "assistant";
67
74
  readonly reasoning?: string | undefined;
68
75
  readonly reasoning_content?: string | undefined;
69
76
  readonly reasoning_text?: string | undefined;
70
- readonly cache_control?: {
71
- readonly type: "ephemeral";
72
- readonly ttl?: string | undefined;
73
- } | undefined;
74
77
  readonly tool_calls?: readonly {
75
78
  readonly function: {
76
79
  readonly name: string;
@@ -86,13 +89,16 @@ export declare const route: Route<{
86
89
  }[] | undefined;
87
90
  readonly reasoning_details?: unknown;
88
91
  } | {
89
- readonly content: string;
90
92
  readonly role: "tool";
91
93
  readonly tool_call_id: string;
92
- readonly cache_control?: {
93
- readonly type: "ephemeral";
94
- readonly ttl?: string | undefined;
95
- } | undefined;
94
+ readonly content: string | readonly {
95
+ readonly type: "text";
96
+ readonly text: string;
97
+ readonly cache_control?: {
98
+ readonly type: "ephemeral";
99
+ readonly ttl?: string | undefined;
100
+ } | undefined;
101
+ }[];
96
102
  })[];
97
103
  readonly stream: true;
98
104
  readonly max_completion_tokens?: number | undefined;
@@ -178,15 +184,18 @@ export declare const routes: Route<{
178
184
  })[];
179
185
  } | {
180
186
  readonly [x: string]: unknown;
181
- readonly content: string | null;
187
+ readonly content: string | readonly {
188
+ readonly type: "text";
189
+ readonly text: string;
190
+ readonly cache_control?: {
191
+ readonly type: "ephemeral";
192
+ readonly ttl?: string | undefined;
193
+ } | undefined;
194
+ }[] | null;
182
195
  readonly role: "assistant";
183
196
  readonly reasoning?: string | undefined;
184
197
  readonly reasoning_content?: string | undefined;
185
198
  readonly reasoning_text?: string | undefined;
186
- readonly cache_control?: {
187
- readonly type: "ephemeral";
188
- readonly ttl?: string | undefined;
189
- } | undefined;
190
199
  readonly tool_calls?: readonly {
191
200
  readonly function: {
192
201
  readonly name: string;
@@ -202,13 +211,16 @@ export declare const routes: Route<{
202
211
  }[] | undefined;
203
212
  readonly reasoning_details?: unknown;
204
213
  } | {
205
- readonly content: string;
206
214
  readonly role: "tool";
207
215
  readonly tool_call_id: string;
208
- readonly cache_control?: {
209
- readonly type: "ephemeral";
210
- readonly ttl?: string | undefined;
211
- } | undefined;
216
+ readonly content: string | readonly {
217
+ readonly type: "text";
218
+ readonly text: string;
219
+ readonly cache_control?: {
220
+ readonly type: "ephemeral";
221
+ readonly ttl?: string | undefined;
222
+ } | undefined;
223
+ }[];
212
224
  })[];
213
225
  readonly stream: true;
214
226
  readonly max_completion_tokens?: number | undefined;
@@ -58,15 +58,18 @@ export declare const route: Route<{
58
58
  })[];
59
59
  } | {
60
60
  readonly [x: string]: unknown;
61
- readonly content: string | null;
61
+ readonly content: string | readonly {
62
+ readonly type: "text";
63
+ readonly text: string;
64
+ readonly cache_control?: {
65
+ readonly type: "ephemeral";
66
+ readonly ttl?: string | undefined;
67
+ } | undefined;
68
+ }[] | null;
62
69
  readonly role: "assistant";
63
70
  readonly reasoning?: string | undefined;
64
71
  readonly reasoning_content?: string | undefined;
65
72
  readonly reasoning_text?: string | undefined;
66
- readonly cache_control?: {
67
- readonly type: "ephemeral";
68
- readonly ttl?: string | undefined;
69
- } | undefined;
70
73
  readonly tool_calls?: readonly {
71
74
  readonly function: {
72
75
  readonly name: string;
@@ -82,13 +85,16 @@ export declare const route: Route<{
82
85
  }[] | undefined;
83
86
  readonly reasoning_details?: unknown;
84
87
  } | {
85
- readonly content: string;
86
88
  readonly role: "tool";
87
89
  readonly tool_call_id: string;
88
- readonly cache_control?: {
89
- readonly type: "ephemeral";
90
- readonly ttl?: string | undefined;
91
- } | undefined;
90
+ readonly content: string | readonly {
91
+ readonly type: "text";
92
+ readonly text: string;
93
+ readonly cache_control?: {
94
+ readonly type: "ephemeral";
95
+ readonly ttl?: string | undefined;
96
+ } | undefined;
97
+ }[];
92
98
  })[];
93
99
  readonly stream: true;
94
100
  readonly max_completion_tokens?: number | undefined;
@@ -174,15 +180,18 @@ export declare const routes: Route<{
174
180
  })[];
175
181
  } | {
176
182
  readonly [x: string]: unknown;
177
- readonly content: string | null;
183
+ readonly content: string | readonly {
184
+ readonly type: "text";
185
+ readonly text: string;
186
+ readonly cache_control?: {
187
+ readonly type: "ephemeral";
188
+ readonly ttl?: string | undefined;
189
+ } | undefined;
190
+ }[] | null;
178
191
  readonly role: "assistant";
179
192
  readonly reasoning?: string | undefined;
180
193
  readonly reasoning_content?: string | undefined;
181
194
  readonly reasoning_text?: string | undefined;
182
- readonly cache_control?: {
183
- readonly type: "ephemeral";
184
- readonly ttl?: string | undefined;
185
- } | undefined;
186
195
  readonly tool_calls?: readonly {
187
196
  readonly function: {
188
197
  readonly name: string;
@@ -198,13 +207,16 @@ export declare const routes: Route<{
198
207
  }[] | undefined;
199
208
  readonly reasoning_details?: unknown;
200
209
  } | {
201
- readonly content: string;
202
210
  readonly role: "tool";
203
211
  readonly tool_call_id: string;
204
- readonly cache_control?: {
205
- readonly type: "ephemeral";
206
- readonly ttl?: string | undefined;
207
- } | undefined;
212
+ readonly content: string | readonly {
213
+ readonly type: "text";
214
+ readonly text: string;
215
+ readonly cache_control?: {
216
+ readonly type: "ephemeral";
217
+ readonly ttl?: string | undefined;
218
+ } | undefined;
219
+ }[];
208
220
  })[];
209
221
  readonly stream: true;
210
222
  readonly max_completion_tokens?: number | undefined;
@@ -58,15 +58,18 @@ export declare const route: Route<{
58
58
  })[];
59
59
  } | {
60
60
  readonly [x: string]: unknown;
61
- readonly content: string | null;
61
+ readonly content: string | readonly {
62
+ readonly type: "text";
63
+ readonly text: string;
64
+ readonly cache_control?: {
65
+ readonly type: "ephemeral";
66
+ readonly ttl?: string | undefined;
67
+ } | undefined;
68
+ }[] | null;
62
69
  readonly role: "assistant";
63
70
  readonly reasoning?: string | undefined;
64
71
  readonly reasoning_content?: string | undefined;
65
72
  readonly reasoning_text?: string | undefined;
66
- readonly cache_control?: {
67
- readonly type: "ephemeral";
68
- readonly ttl?: string | undefined;
69
- } | undefined;
70
73
  readonly tool_calls?: readonly {
71
74
  readonly function: {
72
75
  readonly name: string;
@@ -82,13 +85,16 @@ export declare const route: Route<{
82
85
  }[] | undefined;
83
86
  readonly reasoning_details?: unknown;
84
87
  } | {
85
- readonly content: string;
86
88
  readonly role: "tool";
87
89
  readonly tool_call_id: string;
88
- readonly cache_control?: {
89
- readonly type: "ephemeral";
90
- readonly ttl?: string | undefined;
91
- } | undefined;
90
+ readonly content: string | readonly {
91
+ readonly type: "text";
92
+ readonly text: string;
93
+ readonly cache_control?: {
94
+ readonly type: "ephemeral";
95
+ readonly ttl?: string | undefined;
96
+ } | undefined;
97
+ }[];
92
98
  })[];
93
99
  readonly stream: true;
94
100
  readonly max_completion_tokens?: number | undefined;
@@ -174,15 +180,18 @@ export declare const routes: Route<{
174
180
  })[];
175
181
  } | {
176
182
  readonly [x: string]: unknown;
177
- readonly content: string | null;
183
+ readonly content: string | readonly {
184
+ readonly type: "text";
185
+ readonly text: string;
186
+ readonly cache_control?: {
187
+ readonly type: "ephemeral";
188
+ readonly ttl?: string | undefined;
189
+ } | undefined;
190
+ }[] | null;
178
191
  readonly role: "assistant";
179
192
  readonly reasoning?: string | undefined;
180
193
  readonly reasoning_content?: string | undefined;
181
194
  readonly reasoning_text?: string | undefined;
182
- readonly cache_control?: {
183
- readonly type: "ephemeral";
184
- readonly ttl?: string | undefined;
185
- } | undefined;
186
195
  readonly tool_calls?: readonly {
187
196
  readonly function: {
188
197
  readonly name: string;
@@ -198,13 +207,16 @@ export declare const routes: Route<{
198
207
  }[] | undefined;
199
208
  readonly reasoning_details?: unknown;
200
209
  } | {
201
- readonly content: string;
202
210
  readonly role: "tool";
203
211
  readonly tool_call_id: string;
204
- readonly cache_control?: {
205
- readonly type: "ephemeral";
206
- readonly ttl?: string | undefined;
207
- } | undefined;
212
+ readonly content: string | readonly {
213
+ readonly type: "text";
214
+ readonly text: string;
215
+ readonly cache_control?: {
216
+ readonly type: "ephemeral";
217
+ readonly ttl?: string | undefined;
218
+ } | undefined;
219
+ }[];
208
220
  })[];
209
221
  readonly stream: true;
210
222
  readonly max_completion_tokens?: number | undefined;