@opencode/ai 0.0.0-beta-19289 → 0.0.0-beta-19365
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/README.md +128 -0
- package/dist/protocols/anthropic-messages.d.ts +24 -1
- package/dist/protocols/anthropic-messages.js +55 -12
- package/dist/protocols/meta-messages.d.ts +6 -0
- package/dist/protocols/zai-chat.d.ts +202 -0
- package/dist/protocols/zai-chat.js +49 -0
- package/dist/protocols/zai-messages.d.ts +344 -0
- package/dist/protocols/zai-messages.js +27 -0
- package/dist/providers/anthropic-compatible.d.ts +6 -0
- package/dist/providers/anthropic.d.ts +6 -0
- package/dist/providers/google-vertex-messages.d.ts +6 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +2 -0
- package/dist/providers/meta.d.ts +6 -0
- package/dist/providers/minimax.d.ts +6 -0
- package/dist/providers/moonshot/chat.d.ts +1 -0
- package/dist/providers/moonshot/chat.js +1 -0
- package/dist/providers/moonshot/messages.d.ts +4 -0
- package/dist/providers/moonshot/messages.js +8 -0
- package/dist/providers/moonshot/responses.d.ts +4 -0
- package/dist/providers/moonshot/responses.js +8 -0
- package/dist/providers/moonshot.d.ts +597 -0
- package/dist/providers/moonshot.js +90 -0
- package/dist/providers/zai/chat.d.ts +1 -0
- package/dist/providers/zai/chat.js +1 -0
- package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
- package/dist/providers/zai-coding-plan/chat.js +1 -0
- package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
- package/dist/providers/zai-coding-plan/messages.js +8 -0
- package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
- package/dist/providers/zai-coding-plan/responses.js +8 -0
- package/dist/providers/zai-coding-plan.d.ts +578 -0
- package/dist/providers/zai-coding-plan.js +63 -0
- package/dist/providers/zai.d.ts +134 -8
- package/dist/providers/zai.js +32 -0
- package/dist/schema/options.d.ts +2 -0
- package/dist/schema/options.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { Protocol } from "../route/protocol.js";
|
|
2
|
+
import type { ZAIChat } from "./zai-chat.js";
|
|
3
|
+
export type OptionsInput = {
|
|
4
|
+
readonly effort?: ZAIChat.ReasoningEffort;
|
|
5
|
+
readonly thinking?: {
|
|
6
|
+
readonly type: "enabled" | "adaptive" | "disabled" | (string & {});
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const protocol: Protocol<{
|
|
10
|
+
readonly max_tokens: number;
|
|
11
|
+
readonly model: string;
|
|
12
|
+
readonly messages: readonly ({
|
|
13
|
+
readonly role: "user";
|
|
14
|
+
readonly content: readonly ({
|
|
15
|
+
readonly type: "text";
|
|
16
|
+
readonly text: string;
|
|
17
|
+
readonly cache_control?: {
|
|
18
|
+
readonly type: "ephemeral";
|
|
19
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: "image";
|
|
23
|
+
readonly source: {
|
|
24
|
+
readonly type: "base64";
|
|
25
|
+
readonly media_type: string;
|
|
26
|
+
readonly data: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "url";
|
|
29
|
+
readonly url: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: "file";
|
|
32
|
+
readonly file_id: string;
|
|
33
|
+
};
|
|
34
|
+
readonly cache_control?: {
|
|
35
|
+
readonly type: "ephemeral";
|
|
36
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
readonly transformations?: {
|
|
39
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "document";
|
|
43
|
+
readonly source: {
|
|
44
|
+
readonly type: "base64";
|
|
45
|
+
readonly media_type: "application/pdf";
|
|
46
|
+
readonly data: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "text";
|
|
49
|
+
readonly media_type: "text/plain";
|
|
50
|
+
readonly data: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "url";
|
|
53
|
+
readonly url: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "file";
|
|
56
|
+
readonly file_id: string;
|
|
57
|
+
};
|
|
58
|
+
readonly title?: string | undefined;
|
|
59
|
+
readonly context?: string | undefined;
|
|
60
|
+
readonly cache_control?: {
|
|
61
|
+
readonly type: "ephemeral";
|
|
62
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
readonly citations?: {
|
|
65
|
+
readonly enabled: boolean;
|
|
66
|
+
} | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
readonly type: "tool_result";
|
|
69
|
+
readonly content: string | readonly ({
|
|
70
|
+
readonly type: "text";
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly cache_control?: {
|
|
73
|
+
readonly type: "ephemeral";
|
|
74
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
} | {
|
|
77
|
+
readonly type: "image";
|
|
78
|
+
readonly source: {
|
|
79
|
+
readonly type: "base64";
|
|
80
|
+
readonly media_type: string;
|
|
81
|
+
readonly data: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly type: "url";
|
|
84
|
+
readonly url: string;
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: "file";
|
|
87
|
+
readonly file_id: string;
|
|
88
|
+
};
|
|
89
|
+
readonly cache_control?: {
|
|
90
|
+
readonly type: "ephemeral";
|
|
91
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
readonly transformations?: {
|
|
94
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
readonly type: "document";
|
|
98
|
+
readonly source: {
|
|
99
|
+
readonly type: "base64";
|
|
100
|
+
readonly media_type: "application/pdf";
|
|
101
|
+
readonly data: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly type: "text";
|
|
104
|
+
readonly media_type: "text/plain";
|
|
105
|
+
readonly data: string;
|
|
106
|
+
} | {
|
|
107
|
+
readonly type: "url";
|
|
108
|
+
readonly url: string;
|
|
109
|
+
} | {
|
|
110
|
+
readonly type: "file";
|
|
111
|
+
readonly file_id: string;
|
|
112
|
+
};
|
|
113
|
+
readonly title?: string | undefined;
|
|
114
|
+
readonly context?: string | undefined;
|
|
115
|
+
readonly cache_control?: {
|
|
116
|
+
readonly type: "ephemeral";
|
|
117
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
118
|
+
} | undefined;
|
|
119
|
+
readonly citations?: {
|
|
120
|
+
readonly enabled: boolean;
|
|
121
|
+
} | undefined;
|
|
122
|
+
})[];
|
|
123
|
+
readonly tool_use_id: string;
|
|
124
|
+
readonly cache_control?: {
|
|
125
|
+
readonly type: "ephemeral";
|
|
126
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
readonly is_error?: boolean | undefined;
|
|
129
|
+
})[];
|
|
130
|
+
} | {
|
|
131
|
+
readonly role: "assistant";
|
|
132
|
+
readonly content: readonly ({
|
|
133
|
+
readonly type: "text";
|
|
134
|
+
readonly text: string;
|
|
135
|
+
readonly cache_control?: {
|
|
136
|
+
readonly type: "ephemeral";
|
|
137
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
138
|
+
} | undefined;
|
|
139
|
+
} | {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly type: "tool_use";
|
|
142
|
+
readonly name: string;
|
|
143
|
+
readonly input: unknown;
|
|
144
|
+
readonly cache_control?: {
|
|
145
|
+
readonly type: "ephemeral";
|
|
146
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
} | {
|
|
149
|
+
readonly id: string;
|
|
150
|
+
readonly type: "server_tool_use";
|
|
151
|
+
readonly name: string;
|
|
152
|
+
readonly input: unknown;
|
|
153
|
+
readonly cache_control?: {
|
|
154
|
+
readonly type: "ephemeral";
|
|
155
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
} | {
|
|
158
|
+
readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
|
|
159
|
+
readonly content: unknown;
|
|
160
|
+
readonly tool_use_id: string;
|
|
161
|
+
readonly cache_control?: {
|
|
162
|
+
readonly type: "ephemeral";
|
|
163
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
164
|
+
} | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
readonly type: "thinking";
|
|
167
|
+
readonly thinking: string;
|
|
168
|
+
readonly signature: string;
|
|
169
|
+
readonly cache_control?: {
|
|
170
|
+
readonly type: "ephemeral";
|
|
171
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
} | {
|
|
174
|
+
readonly data: string;
|
|
175
|
+
readonly type: "redacted_thinking";
|
|
176
|
+
readonly cache_control?: {
|
|
177
|
+
readonly type: "ephemeral";
|
|
178
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
} | {
|
|
181
|
+
readonly type: "compaction";
|
|
182
|
+
readonly content: string | null;
|
|
183
|
+
})[];
|
|
184
|
+
} | {
|
|
185
|
+
readonly role: "system";
|
|
186
|
+
readonly content: readonly {
|
|
187
|
+
readonly type: "text";
|
|
188
|
+
readonly text: string;
|
|
189
|
+
readonly cache_control?: {
|
|
190
|
+
readonly type: "ephemeral";
|
|
191
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
}[];
|
|
194
|
+
})[];
|
|
195
|
+
readonly stream: true;
|
|
196
|
+
readonly metadata?: {
|
|
197
|
+
readonly user_id?: string | null | undefined;
|
|
198
|
+
} | undefined;
|
|
199
|
+
readonly tools?: readonly {
|
|
200
|
+
readonly description: string;
|
|
201
|
+
readonly name: string;
|
|
202
|
+
readonly input_schema: {
|
|
203
|
+
readonly [x: string]: unknown;
|
|
204
|
+
};
|
|
205
|
+
readonly cache_control?: {
|
|
206
|
+
readonly type: "ephemeral";
|
|
207
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
readonly system?: readonly {
|
|
211
|
+
readonly type: "text";
|
|
212
|
+
readonly text: string;
|
|
213
|
+
readonly cache_control?: {
|
|
214
|
+
readonly type: "ephemeral";
|
|
215
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
}[] | undefined;
|
|
218
|
+
readonly temperature?: number | undefined;
|
|
219
|
+
readonly thinking?: {
|
|
220
|
+
readonly type: string;
|
|
221
|
+
} | undefined;
|
|
222
|
+
readonly service_tier?: "auto" | "standard_only" | undefined;
|
|
223
|
+
readonly container?: string | {
|
|
224
|
+
readonly id?: string | null | undefined;
|
|
225
|
+
readonly skills?: readonly {
|
|
226
|
+
readonly [x: string]: unknown;
|
|
227
|
+
}[] | null | undefined;
|
|
228
|
+
} | null | undefined;
|
|
229
|
+
readonly inference_geo?: string | null | undefined;
|
|
230
|
+
readonly cache_control?: {
|
|
231
|
+
readonly type: "ephemeral";
|
|
232
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
233
|
+
} | undefined;
|
|
234
|
+
readonly output_config?: {
|
|
235
|
+
readonly format?: {
|
|
236
|
+
readonly type: "json_schema";
|
|
237
|
+
readonly schema: {
|
|
238
|
+
readonly [x: string]: unknown;
|
|
239
|
+
};
|
|
240
|
+
} | null | undefined;
|
|
241
|
+
readonly effort?: string | undefined;
|
|
242
|
+
} | undefined;
|
|
243
|
+
readonly context_management?: {
|
|
244
|
+
readonly edits: readonly {
|
|
245
|
+
readonly type: "compact_20260112";
|
|
246
|
+
readonly instructions?: string | undefined;
|
|
247
|
+
readonly trigger?: {
|
|
248
|
+
readonly type: "input_tokens";
|
|
249
|
+
readonly value: number;
|
|
250
|
+
} | undefined;
|
|
251
|
+
readonly pause_after_compaction?: boolean | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
} | undefined;
|
|
254
|
+
readonly tool_choice?: {
|
|
255
|
+
readonly type: "auto" | "none" | "any";
|
|
256
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
257
|
+
} | {
|
|
258
|
+
readonly type: "tool";
|
|
259
|
+
readonly name: string;
|
|
260
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
readonly top_p?: number | undefined;
|
|
263
|
+
readonly top_k?: number | undefined;
|
|
264
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
265
|
+
}, string, {
|
|
266
|
+
readonly type: string;
|
|
267
|
+
readonly message?: {
|
|
268
|
+
readonly usage?: {
|
|
269
|
+
readonly [x: string]: unknown;
|
|
270
|
+
readonly input_tokens?: number | null | undefined;
|
|
271
|
+
readonly server_tool_use?: {
|
|
272
|
+
readonly [x: string]: unknown;
|
|
273
|
+
readonly web_search_requests?: number | undefined;
|
|
274
|
+
} | null | undefined;
|
|
275
|
+
readonly output_tokens?: number | undefined;
|
|
276
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
277
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
278
|
+
readonly output_tokens_details?: {
|
|
279
|
+
readonly [x: string]: unknown;
|
|
280
|
+
readonly thinking_tokens?: number | undefined;
|
|
281
|
+
} | null | undefined;
|
|
282
|
+
readonly iterations?: readonly {
|
|
283
|
+
readonly [x: string]: unknown;
|
|
284
|
+
readonly input_tokens?: number | null | undefined;
|
|
285
|
+
readonly server_tool_use?: {
|
|
286
|
+
readonly [x: string]: unknown;
|
|
287
|
+
readonly web_search_requests?: number | undefined;
|
|
288
|
+
} | null | undefined;
|
|
289
|
+
readonly output_tokens?: number | undefined;
|
|
290
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
291
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
292
|
+
readonly output_tokens_details?: {
|
|
293
|
+
readonly [x: string]: unknown;
|
|
294
|
+
readonly thinking_tokens?: number | undefined;
|
|
295
|
+
} | null | undefined;
|
|
296
|
+
}[] | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
readonly error?: {
|
|
300
|
+
readonly type?: string | undefined;
|
|
301
|
+
readonly message?: string | undefined;
|
|
302
|
+
} | undefined;
|
|
303
|
+
readonly delta?: unknown;
|
|
304
|
+
readonly index?: number | undefined;
|
|
305
|
+
readonly usage?: {
|
|
306
|
+
readonly [x: string]: unknown;
|
|
307
|
+
readonly input_tokens?: number | null | undefined;
|
|
308
|
+
readonly server_tool_use?: {
|
|
309
|
+
readonly [x: string]: unknown;
|
|
310
|
+
readonly web_search_requests?: number | undefined;
|
|
311
|
+
} | null | undefined;
|
|
312
|
+
readonly output_tokens?: number | undefined;
|
|
313
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
314
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
315
|
+
readonly output_tokens_details?: {
|
|
316
|
+
readonly [x: string]: unknown;
|
|
317
|
+
readonly thinking_tokens?: number | undefined;
|
|
318
|
+
} | null | undefined;
|
|
319
|
+
readonly iterations?: readonly {
|
|
320
|
+
readonly [x: string]: unknown;
|
|
321
|
+
readonly input_tokens?: number | null | undefined;
|
|
322
|
+
readonly server_tool_use?: {
|
|
323
|
+
readonly [x: string]: unknown;
|
|
324
|
+
readonly web_search_requests?: number | undefined;
|
|
325
|
+
} | null | undefined;
|
|
326
|
+
readonly output_tokens?: number | undefined;
|
|
327
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
328
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
329
|
+
readonly output_tokens_details?: {
|
|
330
|
+
readonly [x: string]: unknown;
|
|
331
|
+
readonly thinking_tokens?: number | undefined;
|
|
332
|
+
} | null | undefined;
|
|
333
|
+
}[] | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
readonly content_block?: unknown;
|
|
336
|
+
}, {
|
|
337
|
+
provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
338
|
+
compactions: {};
|
|
339
|
+
providerMetadataKey: string;
|
|
340
|
+
tools: Partial<Record<number, import("./utils/tool-stream.js").PendingTool>>;
|
|
341
|
+
reasoningSignatures: {};
|
|
342
|
+
lifecycle: import("./utils/lifecycle.js").State;
|
|
343
|
+
}>;
|
|
344
|
+
export * as ZAIMessages from "./zai-messages.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Protocol } from "../route/protocol.js";
|
|
3
|
+
import { LLMRequest } from "../schema/index.js";
|
|
4
|
+
import { AnthropicMessages } from "./anthropic-messages.js";
|
|
5
|
+
import { ProviderShared } from "./shared.js";
|
|
6
|
+
const Options = Schema.Struct({
|
|
7
|
+
effort: Schema.optional(Schema.String),
|
|
8
|
+
thinking: Schema.optional(Schema.Struct({ type: Schema.String })),
|
|
9
|
+
});
|
|
10
|
+
const Body = Schema.Struct({
|
|
11
|
+
...AnthropicMessages.AnthropicMessagesBody.fields,
|
|
12
|
+
thinking: Options.fields.thinking,
|
|
13
|
+
});
|
|
14
|
+
const fromRequest = Effect.fn("ZAIMessages.fromRequest")(function* (request) {
|
|
15
|
+
const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {});
|
|
16
|
+
// Z.AI accepts enabled thinking without Anthropic's mandatory token budget.
|
|
17
|
+
const body = yield* AnthropicMessages.protocol.body.from(LLMRequest.update(request, {
|
|
18
|
+
providerOptions: { ...request.providerOptions, thinking: undefined },
|
|
19
|
+
}));
|
|
20
|
+
return { ...body, thinking: options.thinking };
|
|
21
|
+
});
|
|
22
|
+
export const protocol = Protocol.make({
|
|
23
|
+
id: "zai-messages",
|
|
24
|
+
body: { schema: Body, from: fromRequest },
|
|
25
|
+
stream: AnthropicMessages.protocol.stream,
|
|
26
|
+
});
|
|
27
|
+
export * as ZAIMessages from "./zai-messages.js";
|
|
@@ -237,9 +237,15 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
237
237
|
readonly type: "enabled";
|
|
238
238
|
readonly budget_tokens: number;
|
|
239
239
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
240
|
+
readonly block_binding?: {
|
|
241
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
242
|
+
} | undefined;
|
|
240
243
|
} | {
|
|
241
244
|
readonly type: "adaptive";
|
|
242
245
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
246
|
+
readonly block_binding?: {
|
|
247
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
248
|
+
} | undefined;
|
|
243
249
|
} | {
|
|
244
250
|
readonly type: "disabled";
|
|
245
251
|
} | undefined;
|
|
@@ -221,9 +221,15 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
221
221
|
readonly type: "enabled";
|
|
222
222
|
readonly budget_tokens: number;
|
|
223
223
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
224
|
+
readonly block_binding?: {
|
|
225
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
226
|
+
} | undefined;
|
|
224
227
|
} | {
|
|
225
228
|
readonly type: "adaptive";
|
|
226
229
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
230
|
+
readonly block_binding?: {
|
|
231
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
232
|
+
} | undefined;
|
|
227
233
|
} | {
|
|
228
234
|
readonly type: "disabled";
|
|
229
235
|
} | undefined;
|
|
@@ -235,9 +235,15 @@ export declare const routes: Route<{
|
|
|
235
235
|
readonly type: "enabled";
|
|
236
236
|
readonly budget_tokens: number;
|
|
237
237
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
238
|
+
readonly block_binding?: {
|
|
239
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
240
|
+
} | undefined;
|
|
238
241
|
} | {
|
|
239
242
|
readonly type: "adaptive";
|
|
240
243
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
244
|
+
readonly block_binding?: {
|
|
245
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
246
|
+
} | undefined;
|
|
241
247
|
} | {
|
|
242
248
|
readonly type: "disabled";
|
|
243
249
|
} | undefined;
|
|
@@ -19,6 +19,7 @@ export * as Groq from "./groq.js";
|
|
|
19
19
|
export * as Meta from "./meta.js";
|
|
20
20
|
export * as MiniMax from "./minimax.js";
|
|
21
21
|
export * as Mistral from "./mistral.js";
|
|
22
|
+
export * as Moonshot from "./moonshot.js";
|
|
22
23
|
export * as OpenAI from "./openai.js";
|
|
23
24
|
export * as OpenAICompatible from "./openai-compatible.js";
|
|
24
25
|
export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
|
|
@@ -26,3 +27,4 @@ export * as OpenRouter from "./openrouter.js";
|
|
|
26
27
|
export * as TogetherAI from "./togetherai.js";
|
|
27
28
|
export * as XAI from "./xai.js";
|
|
28
29
|
export * as ZAI from "./zai.js";
|
|
30
|
+
export * as ZAICodingPlan from "./zai-coding-plan.js";
|
package/dist/providers/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * as Groq from "./groq.js";
|
|
|
19
19
|
export * as Meta from "./meta.js";
|
|
20
20
|
export * as MiniMax from "./minimax.js";
|
|
21
21
|
export * as Mistral from "./mistral.js";
|
|
22
|
+
export * as Moonshot from "./moonshot.js";
|
|
22
23
|
export * as OpenAI from "./openai.js";
|
|
23
24
|
export * as OpenAICompatible from "./openai-compatible.js";
|
|
24
25
|
export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
|
|
@@ -26,3 +27,4 @@ export * as OpenRouter from "./openrouter.js";
|
|
|
26
27
|
export * as TogetherAI from "./togetherai.js";
|
|
27
28
|
export * as XAI from "./xai.js";
|
|
28
29
|
export * as ZAI from "./zai.js";
|
|
30
|
+
export * as ZAICodingPlan from "./zai-coding-plan.js";
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -545,9 +545,15 @@ export declare const routes: (Route<{
|
|
|
545
545
|
readonly type: "enabled";
|
|
546
546
|
readonly budget_tokens: number;
|
|
547
547
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
548
|
+
readonly block_binding?: {
|
|
549
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
550
|
+
} | undefined;
|
|
548
551
|
} | {
|
|
549
552
|
readonly type: "adaptive";
|
|
550
553
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
554
|
+
readonly block_binding?: {
|
|
555
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
556
|
+
} | undefined;
|
|
551
557
|
} | {
|
|
552
558
|
readonly type: "disabled";
|
|
553
559
|
} | undefined;
|
|
@@ -248,9 +248,15 @@ export declare const routes: (Route<{
|
|
|
248
248
|
readonly type: "enabled";
|
|
249
249
|
readonly budget_tokens: number;
|
|
250
250
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
251
|
+
readonly block_binding?: {
|
|
252
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
251
254
|
} | {
|
|
252
255
|
readonly type: "adaptive";
|
|
253
256
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
257
|
+
readonly block_binding?: {
|
|
258
|
+
readonly prefix_mismatch_behavior?: string | undefined;
|
|
259
|
+
} | undefined;
|
|
254
260
|
} | {
|
|
255
261
|
readonly type: "disabled";
|
|
256
262
|
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { model, type Settings } from "../moonshot.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { model } from "../moonshot.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
|
+
import { Moonshot } from "../moonshot.js";
|
|
3
|
+
export type Settings = Moonshot.Settings<Moonshot.MessagesOptionsInput>;
|
|
4
|
+
export declare const model: ProviderPackage.Definition<Settings, Moonshot.MessagesOptionsInput>["model"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Moonshot } from "../moonshot.js";
|
|
2
|
+
export const model = (modelID, settings) => Moonshot.configure({
|
|
3
|
+
apiKey: settings.apiKey,
|
|
4
|
+
baseURL: settings.baseURL,
|
|
5
|
+
headers: settings.headers,
|
|
6
|
+
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
7
|
+
providerOptions: settings.providerOptions,
|
|
8
|
+
}).messages(modelID);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
|
+
import { Moonshot } from "../moonshot.js";
|
|
3
|
+
export type Settings = Moonshot.Settings<Moonshot.ResponsesOptionsInput>;
|
|
4
|
+
export declare const model: ProviderPackage.Definition<Settings, Moonshot.ResponsesOptionsInput>["model"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Moonshot } from "../moonshot.js";
|
|
2
|
+
export const model = (modelID, settings) => Moonshot.configure({
|
|
3
|
+
apiKey: settings.apiKey,
|
|
4
|
+
baseURL: settings.baseURL,
|
|
5
|
+
headers: settings.headers,
|
|
6
|
+
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
7
|
+
providerOptions: settings.providerOptions,
|
|
8
|
+
}).responses(modelID);
|