@opencode/ai 2.0.20 → 2.0.22
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.
- package/dist/cache-policy.js +22 -3
- package/dist/llm.d.ts +4 -0
- package/dist/promise.d.ts +8 -0
- package/dist/protocols/alibaba-chat.d.ts +20 -10
- package/dist/protocols/alibaba-chat.js +2 -1
- package/dist/protocols/anthropic-messages.js +14 -12
- package/dist/protocols/bedrock-converse.js +30 -1
- package/dist/protocols/open-responses.d.ts +4 -0
- package/dist/protocols/openai-chat.d.ts +122 -71
- package/dist/protocols/openai-chat.js +40 -37
- package/dist/protocols/openai-compatible-chat.d.ts +16 -10
- package/dist/protocols/openai-responses.js +4 -3
- package/dist/protocols/utils/cache.d.ts +5 -0
- package/dist/protocols/utils/cache.js +9 -1
- package/dist/protocols/utils/tool-stream.d.ts +12 -0
- package/dist/protocols/zai-chat.d.ts +20 -10
- package/dist/protocols/zai-chat.js +6 -3
- package/dist/provider-error.js +24 -6
- package/dist/providers/alibaba.d.ts +16 -10
- package/dist/providers/amazon-bedrock-mantle.d.ts +16 -10
- package/dist/providers/azure.d.ts +16 -10
- package/dist/providers/baseten.d.ts +32 -20
- package/dist/providers/cerebras.d.ts +32 -20
- package/dist/providers/cloudflare-ai-gateway.d.ts +32 -20
- package/dist/providers/cloudflare-ai-gateway.js +43 -35
- package/dist/providers/cloudflare-workers-ai.d.ts +32 -20
- package/dist/providers/deepinfra.d.ts +32 -20
- package/dist/providers/deepseek.d.ts +32 -20
- package/dist/providers/digitalocean.d.ts +469 -0
- package/dist/providers/digitalocean.js +53 -0
- package/dist/providers/fireworks.d.ts +32 -20
- package/dist/providers/google-vertex-chat.d.ts +16 -10
- package/dist/providers/google-vertex-messages.js +1 -1
- package/dist/providers/groq.d.ts +36 -20
- package/dist/providers/groq.js +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/dist/providers/meta.d.ts +16 -10
- package/dist/providers/minimax.d.ts +16 -10
- package/dist/providers/moonshot.d.ts +16 -10
- package/dist/providers/openai-compatible.d.ts +16 -10
- package/dist/providers/openai.d.ts +16 -10
- package/dist/providers/openrouter.d.ts +68 -40
- package/dist/providers/openrouter.js +1 -13
- package/dist/providers/togetherai.d.ts +32 -20
- package/dist/providers/xai.d.ts +16 -10
- package/dist/providers/zai-coding-plan.d.ts +16 -10
- package/dist/providers/zai.d.ts +16 -10
- package/dist/route/client.d.ts +4 -0
- package/dist/route/executor.js +13 -6
- package/dist/route/transport/http.d.ts +2 -1
- package/dist/route/transport/http.js +28 -6
- package/dist/schema/events.d.ts +176 -0
- package/dist/schema/events.js +4 -0
- package/dist/schema/options.d.ts +11 -0
- package/dist/schema/options.js +15 -2
- package/dist/testing.d.ts +32 -0
- package/dist/tool-history.js +17 -3
- package/package.json +3 -3
|
@@ -258,6 +258,8 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
258
258
|
readonly reason: {
|
|
259
259
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
260
260
|
readonly raw?: string | undefined;
|
|
261
|
+
readonly category?: string | undefined;
|
|
262
|
+
readonly explanation?: string | undefined;
|
|
261
263
|
};
|
|
262
264
|
readonly index: number;
|
|
263
265
|
readonly providerMetadata?: {
|
|
@@ -271,6 +273,8 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
271
273
|
readonly reason: {
|
|
272
274
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
273
275
|
readonly raw?: string | undefined;
|
|
276
|
+
readonly category?: string | undefined;
|
|
277
|
+
readonly explanation?: string | undefined;
|
|
274
278
|
};
|
|
275
279
|
readonly providerMetadata?: {
|
|
276
280
|
readonly [x: string]: {
|
|
@@ -481,6 +485,8 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
|
|
|
481
485
|
readonly reason: {
|
|
482
486
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
483
487
|
readonly raw?: string | undefined;
|
|
488
|
+
readonly category?: string | undefined;
|
|
489
|
+
readonly explanation?: string | undefined;
|
|
484
490
|
};
|
|
485
491
|
readonly index: number;
|
|
486
492
|
readonly providerMetadata?: {
|
|
@@ -494,6 +500,8 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
|
|
|
494
500
|
readonly reason: {
|
|
495
501
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
496
502
|
readonly raw?: string | undefined;
|
|
503
|
+
readonly category?: string | undefined;
|
|
504
|
+
readonly explanation?: string | undefined;
|
|
497
505
|
};
|
|
498
506
|
readonly providerMetadata?: {
|
|
499
507
|
readonly [x: string]: {
|
|
@@ -701,6 +709,8 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
|
|
|
701
709
|
readonly reason: {
|
|
702
710
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
703
711
|
readonly raw?: string | undefined;
|
|
712
|
+
readonly category?: string | undefined;
|
|
713
|
+
readonly explanation?: string | undefined;
|
|
704
714
|
};
|
|
705
715
|
readonly index: number;
|
|
706
716
|
readonly providerMetadata?: {
|
|
@@ -714,6 +724,8 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
|
|
|
714
724
|
readonly reason: {
|
|
715
725
|
readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
716
726
|
readonly raw?: string | undefined;
|
|
727
|
+
readonly category?: string | undefined;
|
|
728
|
+
readonly explanation?: string | undefined;
|
|
717
729
|
};
|
|
718
730
|
readonly providerMetadata?: {
|
|
719
731
|
readonly [x: string]: {
|
|
@@ -69,15 +69,18 @@ export declare const protocol: Protocol<{
|
|
|
69
69
|
})[];
|
|
70
70
|
} | {
|
|
71
71
|
readonly [x: string]: unknown;
|
|
72
|
-
readonly content: string |
|
|
72
|
+
readonly content: string | readonly {
|
|
73
|
+
readonly type: "text";
|
|
74
|
+
readonly text: string;
|
|
75
|
+
readonly cache_control?: {
|
|
76
|
+
readonly type: "ephemeral";
|
|
77
|
+
readonly ttl?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
}[] | null;
|
|
73
80
|
readonly role: "assistant";
|
|
74
81
|
readonly reasoning?: string | undefined;
|
|
75
82
|
readonly reasoning_content?: string | undefined;
|
|
76
83
|
readonly reasoning_text?: string | undefined;
|
|
77
|
-
readonly cache_control?: {
|
|
78
|
-
readonly type: "ephemeral";
|
|
79
|
-
readonly ttl?: string | undefined;
|
|
80
|
-
} | undefined;
|
|
81
84
|
readonly tool_calls?: readonly {
|
|
82
85
|
readonly function: {
|
|
83
86
|
readonly name: string;
|
|
@@ -93,13 +96,16 @@ export declare const protocol: Protocol<{
|
|
|
93
96
|
}[] | undefined;
|
|
94
97
|
readonly reasoning_details?: unknown;
|
|
95
98
|
} | {
|
|
96
|
-
readonly content: string;
|
|
97
99
|
readonly role: "tool";
|
|
98
100
|
readonly tool_call_id: string;
|
|
99
|
-
readonly
|
|
100
|
-
readonly type: "
|
|
101
|
-
readonly
|
|
102
|
-
|
|
101
|
+
readonly content: string | readonly {
|
|
102
|
+
readonly type: "text";
|
|
103
|
+
readonly text: string;
|
|
104
|
+
readonly cache_control?: {
|
|
105
|
+
readonly type: "ephemeral";
|
|
106
|
+
readonly ttl?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
}[];
|
|
103
109
|
})[];
|
|
104
110
|
readonly stream: true;
|
|
105
111
|
readonly max_completion_tokens?: number | undefined;
|
|
@@ -157,6 +163,7 @@ export declare const protocol: Protocol<{
|
|
|
157
163
|
} | null | undefined;
|
|
158
164
|
readonly usage?: {
|
|
159
165
|
readonly [x: string]: unknown;
|
|
166
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
160
167
|
readonly cached_tokens?: number | null | undefined;
|
|
161
168
|
readonly prompt_tokens?: number | null | undefined;
|
|
162
169
|
readonly completion_tokens?: number | null | undefined;
|
|
@@ -167,6 +174,7 @@ export declare const protocol: Protocol<{
|
|
|
167
174
|
readonly cache_write_tokens?: number | null | undefined;
|
|
168
175
|
} | null | undefined;
|
|
169
176
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
177
|
+
readonly cache_created_input_tokens?: number | null | undefined;
|
|
170
178
|
readonly completion_tokens_details?: {
|
|
171
179
|
readonly [x: string]: unknown;
|
|
172
180
|
readonly reasoning_tokens?: number | null | undefined;
|
|
@@ -196,6 +204,7 @@ export declare const protocol: Protocol<{
|
|
|
196
204
|
} | null | undefined;
|
|
197
205
|
readonly usage?: {
|
|
198
206
|
readonly [x: string]: unknown;
|
|
207
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
199
208
|
readonly cached_tokens?: number | null | undefined;
|
|
200
209
|
readonly prompt_tokens?: number | null | undefined;
|
|
201
210
|
readonly completion_tokens?: number | null | undefined;
|
|
@@ -206,6 +215,7 @@ export declare const protocol: Protocol<{
|
|
|
206
215
|
readonly cache_write_tokens?: number | null | undefined;
|
|
207
216
|
} | null | undefined;
|
|
208
217
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
218
|
+
readonly cache_created_input_tokens?: number | null | undefined;
|
|
209
219
|
readonly completion_tokens_details?: {
|
|
210
220
|
readonly [x: string]: unknown;
|
|
211
221
|
readonly reasoning_tokens?: number | null | undefined;
|
|
@@ -19,15 +19,18 @@ const Body = Schema.Struct({
|
|
|
19
19
|
request_id: Options.fields.requestID,
|
|
20
20
|
user_id: Options.fields.userID,
|
|
21
21
|
});
|
|
22
|
+
// Tool streaming was introduced in GLM-4.6; later versions inherit support.
|
|
23
|
+
const supportsToolStreaming = (modelID) => {
|
|
24
|
+
const match = /(?:^|\/)glm-(\d+)(?:\.(\d+))?(?:-|$)/i.exec(modelID);
|
|
25
|
+
return match !== null && (Number(match[1]) > 4 || (Number(match[1]) === 4 && Number(match[2] ?? 0) >= 6));
|
|
26
|
+
};
|
|
22
27
|
const fromRequest = Effect.fn("ZAIChat.fromRequest")(function* (request) {
|
|
23
28
|
const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {});
|
|
24
29
|
const body = yield* OpenAIChat.protocol.body.from(request);
|
|
25
30
|
return {
|
|
26
31
|
...body,
|
|
27
32
|
thinking: options.thinking,
|
|
28
|
-
|
|
29
|
-
tool_stream: options.toolStream ??
|
|
30
|
-
(body.tools?.length && /^glm-(?:4\.[67]|5(?:[.-]|$))/i.test(request.model.id) ? true : undefined),
|
|
33
|
+
tool_stream: options.toolStream ?? (body.tools?.length && supportsToolStreaming(request.model.id) ? true : undefined),
|
|
31
34
|
do_sample: options.doSample,
|
|
32
35
|
response_format: options.responseFormat,
|
|
33
36
|
request_id: options.requestID,
|
package/dist/provider-error.js
CHANGED
|
@@ -3,24 +3,34 @@ import { AuthenticationError, ContentPolicyError, InvalidRequestError, AIError,
|
|
|
3
3
|
const patterns = [
|
|
4
4
|
/prompt is too long/i,
|
|
5
5
|
/input is too long for requested model/i,
|
|
6
|
+
// Cloudflare Workers AI reports this as HTTP 413.
|
|
7
|
+
/exceeded this model context window limit/i,
|
|
6
8
|
/exceeds the context window/i,
|
|
7
9
|
/exceeds (?:the )?(?:model'?s )?maximum context length(?: of [\d,]+ tokens?|\s*\([\d,]+\))/i,
|
|
8
10
|
/input token count.*exceeds the maximum/i,
|
|
11
|
+
// Amazon Nova on Bedrock reports this as a mid-stream validationException.
|
|
12
|
+
/number of input tokens exceeds maximum length/i,
|
|
9
13
|
/tokens in request more than max tokens allowed/i,
|
|
10
14
|
/maximum prompt length is \d+/i,
|
|
11
15
|
/reduce the length of the messages/i,
|
|
16
|
+
// DeepInfra
|
|
17
|
+
/requested input length \d+ exceeds maximum input length/i,
|
|
12
18
|
/maximum context length is \d+ tokens/i,
|
|
13
19
|
/exceeds (?:the )?maximum allowed input length of [\d,]+ tokens?/i,
|
|
14
|
-
|
|
20
|
+
// Novita omits the token counts.
|
|
21
|
+
/input(?: \(\d+ tokens\))? is longer than the model'?s context length/i,
|
|
15
22
|
/exceeds the limit of \d+/i,
|
|
16
23
|
/exceeds the available context size/i,
|
|
17
24
|
/greater than the context length/i,
|
|
25
|
+
// Hugging Face Text Generation Inference, e.g. Together
|
|
26
|
+
/`inputs` tokens \+ `max_new_tokens` must be <= \d+/i,
|
|
18
27
|
/context window exceeds limit/i,
|
|
19
28
|
/exceeded model token limit/i,
|
|
20
29
|
/context[_ ]length[_ ]exceeded/i,
|
|
21
30
|
/context length is only \d+ tokens/i,
|
|
22
31
|
/input length.*exceeds.*context length/i,
|
|
23
|
-
|
|
32
|
+
// Z.ai code 1261 arrives as `Prompt too long` or `Prompt 超长`.
|
|
33
|
+
/prompt (?:too long|超长)/i,
|
|
24
34
|
/too large for model with \d+ maximum context length/i,
|
|
25
35
|
/prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i,
|
|
26
36
|
/model_context_window_exceeded/i,
|
|
@@ -88,7 +98,8 @@ const QUOTA_CODES = new Set([
|
|
|
88
98
|
"creditlimitexceeded",
|
|
89
99
|
]);
|
|
90
100
|
// Google reports an invalid API key as HTTP 400 INVALID_ARGUMENT with this `details[].reason`.
|
|
91
|
-
|
|
101
|
+
// Z.ai's Responses API reports account and plan rejections mid-stream as `permission_denied`.
|
|
102
|
+
const AUTH_CODES = new Set(["authentication_error", "permission_error", "permission_denied", "api_key_invalid"]);
|
|
92
103
|
const SERVER_CODES = new Set([
|
|
93
104
|
"api_error",
|
|
94
105
|
"internal_error",
|
|
@@ -102,6 +113,7 @@ const SERVER_CODES = new Set([
|
|
|
102
113
|
]);
|
|
103
114
|
// `invalid_request` is the Vercel AI Gateway's code for an upstream request rejection.
|
|
104
115
|
const INVALID_REQUEST_CODES = new Set([
|
|
116
|
+
"model_not_found",
|
|
105
117
|
"invalid_prompt",
|
|
106
118
|
"invalid_request",
|
|
107
119
|
"invalid_request_error",
|
|
@@ -121,14 +133,17 @@ const CONTENT_POLICY_CODES = new Set([
|
|
|
121
133
|
// OpenCode Zen replaces upstream codes outside its allow-list but keeps the original
|
|
122
134
|
// as a `[code]` label at the start of the rewritten message.
|
|
123
135
|
const GATEWAY_CODE_LABEL = /^[^:\n]+: \[([A-Za-z0-9_.-]+)\]/;
|
|
136
|
+
// xAI reports an invalid API key as HTTP 400 with the generic `invalid-argument` code.
|
|
137
|
+
const AUTH_TEXT = /incorrect api key provided/i;
|
|
124
138
|
const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?many[_\s]?requests/i;
|
|
125
139
|
// Only consulted on 429, where throttles and account caps share a status.
|
|
126
|
-
|
|
140
|
+
// Z.ai reports balance, plan expiry, plan limits, and plan model access on 429.
|
|
141
|
+
const QUOTA_TEXT = /insufficient[-_\s]?(?:quota|balance)|quota[-_\s]?exceeded|budget exceeded|usage limit|limit exhausted|package has expired|plan does not yet include/i;
|
|
127
142
|
// Policy rejections without a dedicated code, matched against the provider's own
|
|
128
143
|
// explanation only. OpenAI reuses `invalid_prompt` for usage-policy rejections while
|
|
129
144
|
// Bedrock Mantle reuses it for schema validation; Anthropic reports blocked output
|
|
130
145
|
// under `invalid_request_error`.
|
|
131
|
-
const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected as a result of our safety system/i;
|
|
146
|
+
const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected as a result of our safety system|detected potentially unsafe or sensitive content/i;
|
|
132
147
|
const SERVER_ERROR_TEXT = /\b(?:try again|(?:please |you can )?retry (?:the |this |your )?request|try (?:the |this |your )?request again|(?:currently |temporarily )?at capacity|overloaded|temporarily unavailable|service[-_\s]?unavailable|(?:server|internal)[-_\s]?error|server (?:is )?busy|provider returned (?:an )?error|resource[-_\s]?exhausted|upstream (?:connect|connection|request)|request buffer limit while retrying upstream)\b/i;
|
|
133
148
|
const Message = Schema.String.check(Schema.isPattern(/\S/));
|
|
134
149
|
const messageAt = (fields, message) => Schema.Struct(fields).pipe(Schema.decodeTo(Schema.String, {
|
|
@@ -181,7 +196,10 @@ export function classifyProviderFailure(input) {
|
|
|
181
196
|
codes.some((code) => QUOTA_CODES.has(code)) ||
|
|
182
197
|
(input.status === 429 && QUOTA_TEXT.test(text)))
|
|
183
198
|
return new QuotaExceededError(details);
|
|
184
|
-
if (input.status === 401 ||
|
|
199
|
+
if (input.status === 401 ||
|
|
200
|
+
input.status === 403 ||
|
|
201
|
+
codes.some((code) => AUTH_CODES.has(code)) ||
|
|
202
|
+
(input.status === 400 && AUTH_TEXT.test(text)))
|
|
185
203
|
return new AuthenticationError(details);
|
|
186
204
|
if (input.status === 429 ||
|
|
187
205
|
codes.some((code) => code.includes("rate_limit") || code === "too_many_requests" || code === "throttlingexception") ||
|
|
@@ -69,15 +69,18 @@ export declare const routes: (Route<{
|
|
|
69
69
|
})[];
|
|
70
70
|
} | {
|
|
71
71
|
readonly [x: string]: unknown;
|
|
72
|
-
readonly content: string |
|
|
72
|
+
readonly content: string | readonly {
|
|
73
|
+
readonly type: "text";
|
|
74
|
+
readonly text: string;
|
|
75
|
+
readonly cache_control?: {
|
|
76
|
+
readonly type: "ephemeral";
|
|
77
|
+
readonly ttl?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
}[] | null;
|
|
73
80
|
readonly role: "assistant";
|
|
74
81
|
readonly reasoning?: string | undefined;
|
|
75
82
|
readonly reasoning_content?: string | undefined;
|
|
76
83
|
readonly reasoning_text?: string | undefined;
|
|
77
|
-
readonly cache_control?: {
|
|
78
|
-
readonly type: "ephemeral";
|
|
79
|
-
readonly ttl?: string | undefined;
|
|
80
|
-
} | undefined;
|
|
81
84
|
readonly tool_calls?: readonly {
|
|
82
85
|
readonly function: {
|
|
83
86
|
readonly name: string;
|
|
@@ -93,13 +96,16 @@ export declare const routes: (Route<{
|
|
|
93
96
|
}[] | undefined;
|
|
94
97
|
readonly reasoning_details?: unknown;
|
|
95
98
|
} | {
|
|
96
|
-
readonly content: string;
|
|
97
99
|
readonly role: "tool";
|
|
98
100
|
readonly tool_call_id: string;
|
|
99
|
-
readonly
|
|
100
|
-
readonly type: "
|
|
101
|
-
readonly
|
|
102
|
-
|
|
101
|
+
readonly content: string | readonly {
|
|
102
|
+
readonly type: "text";
|
|
103
|
+
readonly text: string;
|
|
104
|
+
readonly cache_control?: {
|
|
105
|
+
readonly type: "ephemeral";
|
|
106
|
+
readonly ttl?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
}[];
|
|
103
109
|
})[];
|
|
104
110
|
readonly stream: true;
|
|
105
111
|
readonly max_completion_tokens?: number | undefined;
|
|
@@ -72,15 +72,18 @@ export declare const routes: (Route<{
|
|
|
72
72
|
})[];
|
|
73
73
|
} | {
|
|
74
74
|
readonly [x: string]: unknown;
|
|
75
|
-
readonly content: string |
|
|
75
|
+
readonly content: string | readonly {
|
|
76
|
+
readonly type: "text";
|
|
77
|
+
readonly text: string;
|
|
78
|
+
readonly cache_control?: {
|
|
79
|
+
readonly type: "ephemeral";
|
|
80
|
+
readonly ttl?: string | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
}[] | null;
|
|
76
83
|
readonly role: "assistant";
|
|
77
84
|
readonly reasoning?: string | undefined;
|
|
78
85
|
readonly reasoning_content?: string | undefined;
|
|
79
86
|
readonly reasoning_text?: string | undefined;
|
|
80
|
-
readonly cache_control?: {
|
|
81
|
-
readonly type: "ephemeral";
|
|
82
|
-
readonly ttl?: string | undefined;
|
|
83
|
-
} | undefined;
|
|
84
87
|
readonly tool_calls?: readonly {
|
|
85
88
|
readonly function: {
|
|
86
89
|
readonly name: string;
|
|
@@ -96,13 +99,16 @@ export declare const routes: (Route<{
|
|
|
96
99
|
}[] | undefined;
|
|
97
100
|
readonly reasoning_details?: unknown;
|
|
98
101
|
} | {
|
|
99
|
-
readonly content: string;
|
|
100
102
|
readonly role: "tool";
|
|
101
103
|
readonly tool_call_id: string;
|
|
102
|
-
readonly
|
|
103
|
-
readonly type: "
|
|
104
|
-
readonly
|
|
105
|
-
|
|
104
|
+
readonly content: string | readonly {
|
|
105
|
+
readonly type: "text";
|
|
106
|
+
readonly text: string;
|
|
107
|
+
readonly cache_control?: {
|
|
108
|
+
readonly type: "ephemeral";
|
|
109
|
+
readonly ttl?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}[];
|
|
106
112
|
})[];
|
|
107
113
|
readonly stream: true;
|
|
108
114
|
readonly max_completion_tokens?: number | undefined;
|
|
@@ -297,15 +297,18 @@ export declare const routes: (Route<{
|
|
|
297
297
|
})[];
|
|
298
298
|
} | {
|
|
299
299
|
readonly [x: string]: unknown;
|
|
300
|
-
readonly content: string |
|
|
300
|
+
readonly content: string | readonly {
|
|
301
|
+
readonly type: "text";
|
|
302
|
+
readonly text: string;
|
|
303
|
+
readonly cache_control?: {
|
|
304
|
+
readonly type: "ephemeral";
|
|
305
|
+
readonly ttl?: string | undefined;
|
|
306
|
+
} | undefined;
|
|
307
|
+
}[] | null;
|
|
301
308
|
readonly role: "assistant";
|
|
302
309
|
readonly reasoning?: string | undefined;
|
|
303
310
|
readonly reasoning_content?: string | undefined;
|
|
304
311
|
readonly reasoning_text?: string | undefined;
|
|
305
|
-
readonly cache_control?: {
|
|
306
|
-
readonly type: "ephemeral";
|
|
307
|
-
readonly ttl?: string | undefined;
|
|
308
|
-
} | undefined;
|
|
309
312
|
readonly tool_calls?: readonly {
|
|
310
313
|
readonly function: {
|
|
311
314
|
readonly name: string;
|
|
@@ -321,13 +324,16 @@ export declare const routes: (Route<{
|
|
|
321
324
|
}[] | undefined;
|
|
322
325
|
readonly reasoning_details?: unknown;
|
|
323
326
|
} | {
|
|
324
|
-
readonly content: string;
|
|
325
327
|
readonly role: "tool";
|
|
326
328
|
readonly tool_call_id: string;
|
|
327
|
-
readonly
|
|
328
|
-
readonly type: "
|
|
329
|
-
readonly
|
|
330
|
-
|
|
329
|
+
readonly content: string | readonly {
|
|
330
|
+
readonly type: "text";
|
|
331
|
+
readonly text: string;
|
|
332
|
+
readonly cache_control?: {
|
|
333
|
+
readonly type: "ephemeral";
|
|
334
|
+
readonly ttl?: string | undefined;
|
|
335
|
+
} | undefined;
|
|
336
|
+
}[];
|
|
331
337
|
})[];
|
|
332
338
|
readonly stream: true;
|
|
333
339
|
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 |
|
|
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
|
|
89
|
-
readonly type: "
|
|
90
|
-
readonly
|
|
91
|
-
|
|
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 |
|
|
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
|
|
205
|
-
readonly type: "
|
|
206
|
-
readonly
|
|
207
|
-
|
|
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 |
|
|
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
|
|
89
|
-
readonly type: "
|
|
90
|
-
readonly
|
|
91
|
-
|
|
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 |
|
|
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
|
|
205
|
-
readonly type: "
|
|
206
|
-
readonly
|
|
207
|
-
|
|
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;
|
|
@@ -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 |
|
|
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
|
|
608
|
-
readonly type: "
|
|
609
|
-
readonly
|
|
610
|
-
|
|
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 |
|
|
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
|
|
996
|
-
readonly type: "
|
|
997
|
-
readonly
|
|
998
|
-
|
|
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;
|