@skydiveai/pi-server 0.1.0-beta.805 → 0.1.250
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/index.d.mts +285 -79
- package/dist/index.mjs +314 -68
- package/package.json +2 -9
package/dist/index.d.mts
CHANGED
|
@@ -208,9 +208,47 @@ declare function createPrewarm({
|
|
|
208
208
|
*/
|
|
209
209
|
declare const KNOWN_PI_PROVIDERS: readonly ["amazon-bedrock", "anthropic", "google", "google-vertex", "openai", "azure-openai-responses", "openai-codex", "deepseek", "github-copilot", "xai", "groq", "cerebras", "openrouter", "vercel-ai-gateway", "zai", "mistral", "minimax", "minimax-cn", "moonshotai", "moonshotai-cn", "huggingface", "fireworks", "opencode", "opencode-go", "kimi-coding", "cloudflare-workers-ai", "cloudflare-ai-gateway", "xiaomi", "xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"];
|
|
210
210
|
declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
211
|
+
/** Exact model id the serving endpoint expects. */id: z.ZodString; /** Display name shown in pi surfaces and session logs. */
|
|
212
|
+
name: z.ZodString; /** pi-ai provider key — also the auth-storage key for `apiKey`. */
|
|
213
|
+
provider: z.ZodEnum<["amazon-bedrock", "anthropic", "google", "google-vertex", "openai", "azure-openai-responses", "openai-codex", "deepseek", "github-copilot", "xai", "groq", "cerebras", "openrouter", "vercel-ai-gateway", "zai", "mistral", "minimax", "minimax-cn", "moonshotai", "moonshotai-cn", "huggingface", "fireworks", "opencode", "opencode-go", "kimi-coding", "cloudflare-workers-ai", "cloudflare-ai-gateway", "xiaomi", "xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"]>; /** Provider API root, e.g. "https://openrouter.ai/api/v1". */
|
|
214
|
+
baseUrl: z.ZodString;
|
|
215
|
+
reasoning: z.ZodBoolean;
|
|
216
|
+
thinkingLevelMap: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
218
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
220
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
222
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
off?: string | null | undefined;
|
|
225
|
+
minimal?: string | null | undefined;
|
|
226
|
+
low?: string | null | undefined;
|
|
227
|
+
medium?: string | null | undefined;
|
|
228
|
+
high?: string | null | undefined;
|
|
229
|
+
xhigh?: string | null | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
off?: string | null | undefined;
|
|
232
|
+
minimal?: string | null | undefined;
|
|
233
|
+
low?: string | null | undefined;
|
|
234
|
+
medium?: string | null | undefined;
|
|
235
|
+
high?: string | null | undefined;
|
|
236
|
+
xhigh?: string | null | undefined;
|
|
237
|
+
}>>;
|
|
238
|
+
input: z.ZodArray<z.ZodEnum<["text", "image"]>, "atleastone">;
|
|
239
|
+
contextWindow: z.ZodNumber;
|
|
240
|
+
maxTokens: z.ZodNumber;
|
|
241
|
+
/**
|
|
242
|
+
* Optional runtime API key for `provider`, installed as a per-request key
|
|
243
|
+
* so the model registry's auth lookup succeeds. Deployments that resolve
|
|
244
|
+
* real credentials elsewhere (e.g. at an egress proxy) can pass whatever
|
|
245
|
+
* placeholder that layer recognizes — the value is opaque to this server.
|
|
246
|
+
*/
|
|
247
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
211
248
|
api: z.ZodLiteral<"openai-completions">;
|
|
212
249
|
compat: z.ZodOptional<z.ZodObject<{
|
|
213
250
|
supportsReasoningEffort: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
supportsStore: z.ZodOptional<z.ZodBoolean>;
|
|
214
252
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
215
253
|
thinkingFormat: z.ZodOptional<z.ZodEnum<["openai", "openrouter", "deepseek", "zai", "qwen", "qwen-chat-template"]>>;
|
|
216
254
|
supportsStrictMode: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -218,20 +256,79 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
218
256
|
cacheControlFormat: z.ZodOptional<z.ZodLiteral<"anthropic">>;
|
|
219
257
|
}, "strip", z.ZodTypeAny, {
|
|
220
258
|
supportsReasoningEffort?: boolean | undefined;
|
|
259
|
+
supportsStore?: boolean | undefined;
|
|
221
260
|
requiresThinkingAsText?: boolean | undefined;
|
|
222
|
-
thinkingFormat?: "
|
|
261
|
+
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
223
262
|
supportsStrictMode?: boolean | undefined;
|
|
224
263
|
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
225
264
|
cacheControlFormat?: "anthropic" | undefined;
|
|
226
265
|
}, {
|
|
227
266
|
supportsReasoningEffort?: boolean | undefined;
|
|
267
|
+
supportsStore?: boolean | undefined;
|
|
228
268
|
requiresThinkingAsText?: boolean | undefined;
|
|
229
|
-
thinkingFormat?: "
|
|
269
|
+
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
230
270
|
supportsStrictMode?: boolean | undefined;
|
|
231
271
|
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
232
272
|
cacheControlFormat?: "anthropic" | undefined;
|
|
233
|
-
}>>;
|
|
234
|
-
|
|
273
|
+
}>>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
id: string;
|
|
276
|
+
name: string;
|
|
277
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
278
|
+
baseUrl: string;
|
|
279
|
+
reasoning: boolean;
|
|
280
|
+
thinkingLevelMap?: {
|
|
281
|
+
off?: string | null | undefined;
|
|
282
|
+
minimal?: string | null | undefined;
|
|
283
|
+
low?: string | null | undefined;
|
|
284
|
+
medium?: string | null | undefined;
|
|
285
|
+
high?: string | null | undefined;
|
|
286
|
+
xhigh?: string | null | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
289
|
+
contextWindow: number;
|
|
290
|
+
maxTokens: number;
|
|
291
|
+
apiKey?: string | undefined;
|
|
292
|
+
api: "openai-completions";
|
|
293
|
+
compat?: {
|
|
294
|
+
supportsReasoningEffort?: boolean | undefined;
|
|
295
|
+
supportsStore?: boolean | undefined;
|
|
296
|
+
requiresThinkingAsText?: boolean | undefined;
|
|
297
|
+
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
298
|
+
supportsStrictMode?: boolean | undefined;
|
|
299
|
+
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
300
|
+
cacheControlFormat?: "anthropic" | undefined;
|
|
301
|
+
} | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
id: string;
|
|
304
|
+
name: string;
|
|
305
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
306
|
+
baseUrl: string;
|
|
307
|
+
reasoning: boolean;
|
|
308
|
+
thinkingLevelMap?: {
|
|
309
|
+
off?: string | null | undefined;
|
|
310
|
+
minimal?: string | null | undefined;
|
|
311
|
+
low?: string | null | undefined;
|
|
312
|
+
medium?: string | null | undefined;
|
|
313
|
+
high?: string | null | undefined;
|
|
314
|
+
xhigh?: string | null | undefined;
|
|
315
|
+
} | undefined;
|
|
316
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
317
|
+
contextWindow: number;
|
|
318
|
+
maxTokens: number;
|
|
319
|
+
apiKey?: string | undefined;
|
|
320
|
+
api: "openai-completions";
|
|
321
|
+
compat?: {
|
|
322
|
+
supportsReasoningEffort?: boolean | undefined;
|
|
323
|
+
supportsStore?: boolean | undefined;
|
|
324
|
+
requiresThinkingAsText?: boolean | undefined;
|
|
325
|
+
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
326
|
+
supportsStrictMode?: boolean | undefined;
|
|
327
|
+
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
328
|
+
cacheControlFormat?: "anthropic" | undefined;
|
|
329
|
+
} | undefined;
|
|
330
|
+
}>, z.ZodObject<{
|
|
331
|
+
/** Exact model id the serving endpoint expects. */id: z.ZodString; /** Display name shown in pi surfaces and session logs. */
|
|
235
332
|
name: z.ZodString; /** pi-ai provider key — also the auth-storage key for `apiKey`. */
|
|
236
333
|
provider: z.ZodEnum<["amazon-bedrock", "anthropic", "google", "google-vertex", "openai", "azure-openai-responses", "openai-codex", "deepseek", "github-copilot", "xai", "groq", "cerebras", "openrouter", "vercel-ai-gateway", "zai", "mistral", "minimax", "minimax-cn", "moonshotai", "moonshotai-cn", "huggingface", "fireworks", "opencode", "opencode-go", "kimi-coding", "cloudflare-workers-ai", "cloudflare-ai-gateway", "xiaomi", "xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"]>; /** Provider API root, e.g. "https://openrouter.ai/api/v1". */
|
|
237
334
|
baseUrl: z.ZodString;
|
|
@@ -268,24 +365,23 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
268
365
|
* placeholder that layer recognizes — the value is opaque to this server.
|
|
269
366
|
*/
|
|
270
367
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
368
|
+
api: z.ZodLiteral<"anthropic-messages">;
|
|
369
|
+
compat: z.ZodOptional<z.ZodObject<{
|
|
370
|
+
supportsEagerToolInputStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
371
|
+
supportsLongCacheRetention: z.ZodOptional<z.ZodBoolean>;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
374
|
+
supportsLongCacheRetention?: boolean | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
377
|
+
supportsLongCacheRetention?: boolean | undefined;
|
|
378
|
+
}>>;
|
|
271
379
|
}, "strip", z.ZodTypeAny, {
|
|
272
|
-
api: "openai-completions";
|
|
273
380
|
id: string;
|
|
274
381
|
name: string;
|
|
275
|
-
provider: "amazon-bedrock" | "anthropic" | "
|
|
382
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
276
383
|
baseUrl: string;
|
|
277
384
|
reasoning: boolean;
|
|
278
|
-
input: ["text" | "image", ...("text" | "image")[]];
|
|
279
|
-
contextWindow: number;
|
|
280
|
-
maxTokens: number;
|
|
281
|
-
compat?: {
|
|
282
|
-
supportsReasoningEffort?: boolean | undefined;
|
|
283
|
-
requiresThinkingAsText?: boolean | undefined;
|
|
284
|
-
thinkingFormat?: "openai" | "deepseek" | "openrouter" | "zai" | "qwen" | "qwen-chat-template" | undefined;
|
|
285
|
-
supportsStrictMode?: boolean | undefined;
|
|
286
|
-
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
287
|
-
cacheControlFormat?: "anthropic" | undefined;
|
|
288
|
-
} | undefined;
|
|
289
385
|
thinkingLevelMap?: {
|
|
290
386
|
off?: string | null | undefined;
|
|
291
387
|
minimal?: string | null | undefined;
|
|
@@ -294,25 +390,21 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
294
390
|
high?: string | null | undefined;
|
|
295
391
|
xhigh?: string | null | undefined;
|
|
296
392
|
} | undefined;
|
|
393
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
394
|
+
contextWindow: number;
|
|
395
|
+
maxTokens: number;
|
|
297
396
|
apiKey?: string | undefined;
|
|
397
|
+
api: "anthropic-messages";
|
|
398
|
+
compat?: {
|
|
399
|
+
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
400
|
+
supportsLongCacheRetention?: boolean | undefined;
|
|
401
|
+
} | undefined;
|
|
298
402
|
}, {
|
|
299
|
-
api: "openai-completions";
|
|
300
403
|
id: string;
|
|
301
404
|
name: string;
|
|
302
|
-
provider: "amazon-bedrock" | "anthropic" | "
|
|
405
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
303
406
|
baseUrl: string;
|
|
304
407
|
reasoning: boolean;
|
|
305
|
-
input: ["text" | "image", ...("text" | "image")[]];
|
|
306
|
-
contextWindow: number;
|
|
307
|
-
maxTokens: number;
|
|
308
|
-
compat?: {
|
|
309
|
-
supportsReasoningEffort?: boolean | undefined;
|
|
310
|
-
requiresThinkingAsText?: boolean | undefined;
|
|
311
|
-
thinkingFormat?: "openai" | "deepseek" | "openrouter" | "zai" | "qwen" | "qwen-chat-template" | undefined;
|
|
312
|
-
supportsStrictMode?: boolean | undefined;
|
|
313
|
-
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
314
|
-
cacheControlFormat?: "anthropic" | undefined;
|
|
315
|
-
} | undefined;
|
|
316
408
|
thinkingLevelMap?: {
|
|
317
409
|
off?: string | null | undefined;
|
|
318
410
|
minimal?: string | null | undefined;
|
|
@@ -321,20 +413,17 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
321
413
|
high?: string | null | undefined;
|
|
322
414
|
xhigh?: string | null | undefined;
|
|
323
415
|
} | undefined;
|
|
416
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
417
|
+
contextWindow: number;
|
|
418
|
+
maxTokens: number;
|
|
324
419
|
apiKey?: string | undefined;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
compat: z.ZodOptional<z.ZodObject<{
|
|
328
|
-
supportsEagerToolInputStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
329
|
-
supportsLongCacheRetention: z.ZodOptional<z.ZodBoolean>;
|
|
330
|
-
}, "strip", z.ZodTypeAny, {
|
|
331
|
-
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
332
|
-
supportsLongCacheRetention?: boolean | undefined;
|
|
333
|
-
}, {
|
|
420
|
+
api: "anthropic-messages";
|
|
421
|
+
compat?: {
|
|
334
422
|
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
335
423
|
supportsLongCacheRetention?: boolean | undefined;
|
|
336
|
-
}
|
|
337
|
-
|
|
424
|
+
} | undefined;
|
|
425
|
+
}>, z.ZodObject<{
|
|
426
|
+
/** Exact model id the serving endpoint expects. */id: z.ZodString; /** Display name shown in pi surfaces and session logs. */
|
|
338
427
|
name: z.ZodString; /** pi-ai provider key — also the auth-storage key for `apiKey`. */
|
|
339
428
|
provider: z.ZodEnum<["amazon-bedrock", "anthropic", "google", "google-vertex", "openai", "azure-openai-responses", "openai-codex", "deepseek", "github-copilot", "xai", "groq", "cerebras", "openrouter", "vercel-ai-gateway", "zai", "mistral", "minimax", "minimax-cn", "moonshotai", "moonshotai-cn", "huggingface", "fireworks", "opencode", "opencode-go", "kimi-coding", "cloudflare-workers-ai", "cloudflare-ai-gateway", "xiaomi", "xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"]>; /** Provider API root, e.g. "https://openrouter.ai/api/v1". */
|
|
340
429
|
baseUrl: z.ZodString;
|
|
@@ -371,20 +460,13 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
371
460
|
* placeholder that layer recognizes — the value is opaque to this server.
|
|
372
461
|
*/
|
|
373
462
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
463
|
+
api: z.ZodLiteral<"openai-responses">;
|
|
374
464
|
}, "strip", z.ZodTypeAny, {
|
|
375
|
-
api: "anthropic-messages";
|
|
376
465
|
id: string;
|
|
377
466
|
name: string;
|
|
378
|
-
provider: "amazon-bedrock" | "anthropic" | "
|
|
467
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
379
468
|
baseUrl: string;
|
|
380
469
|
reasoning: boolean;
|
|
381
|
-
input: ["text" | "image", ...("text" | "image")[]];
|
|
382
|
-
contextWindow: number;
|
|
383
|
-
maxTokens: number;
|
|
384
|
-
compat?: {
|
|
385
|
-
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
386
|
-
supportsLongCacheRetention?: boolean | undefined;
|
|
387
|
-
} | undefined;
|
|
388
470
|
thinkingLevelMap?: {
|
|
389
471
|
off?: string | null | undefined;
|
|
390
472
|
minimal?: string | null | undefined;
|
|
@@ -393,21 +475,93 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
393
475
|
high?: string | null | undefined;
|
|
394
476
|
xhigh?: string | null | undefined;
|
|
395
477
|
} | undefined;
|
|
478
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
479
|
+
contextWindow: number;
|
|
480
|
+
maxTokens: number;
|
|
396
481
|
apiKey?: string | undefined;
|
|
482
|
+
api: "openai-responses";
|
|
397
483
|
}, {
|
|
398
|
-
api: "anthropic-messages";
|
|
399
484
|
id: string;
|
|
400
485
|
name: string;
|
|
401
|
-
provider: "amazon-bedrock" | "anthropic" | "
|
|
486
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
402
487
|
baseUrl: string;
|
|
403
488
|
reasoning: boolean;
|
|
404
|
-
|
|
489
|
+
thinkingLevelMap?: {
|
|
490
|
+
off?: string | null | undefined;
|
|
491
|
+
minimal?: string | null | undefined;
|
|
492
|
+
low?: string | null | undefined;
|
|
493
|
+
medium?: string | null | undefined;
|
|
494
|
+
high?: string | null | undefined;
|
|
495
|
+
xhigh?: string | null | undefined;
|
|
496
|
+
} | undefined;
|
|
497
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
405
498
|
contextWindow: number;
|
|
406
499
|
maxTokens: number;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
500
|
+
apiKey?: string | undefined;
|
|
501
|
+
api: "openai-responses";
|
|
502
|
+
}>, z.ZodObject<Omit<{
|
|
503
|
+
/** Exact model id the serving endpoint expects. */id: z.ZodString; /** Display name shown in pi surfaces and session logs. */
|
|
504
|
+
name: z.ZodString; /** pi-ai provider key — also the auth-storage key for `apiKey`. */
|
|
505
|
+
provider: z.ZodEnum<["amazon-bedrock", "anthropic", "google", "google-vertex", "openai", "azure-openai-responses", "openai-codex", "deepseek", "github-copilot", "xai", "groq", "cerebras", "openrouter", "vercel-ai-gateway", "zai", "mistral", "minimax", "minimax-cn", "moonshotai", "moonshotai-cn", "huggingface", "fireworks", "opencode", "opencode-go", "kimi-coding", "cloudflare-workers-ai", "cloudflare-ai-gateway", "xiaomi", "xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"]>; /** Provider API root, e.g. "https://openrouter.ai/api/v1". */
|
|
506
|
+
baseUrl: z.ZodString;
|
|
507
|
+
reasoning: z.ZodBoolean;
|
|
508
|
+
thinkingLevelMap: z.ZodOptional<z.ZodObject<{
|
|
509
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
510
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
511
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
512
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
513
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
514
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
515
|
+
}, "strip", z.ZodTypeAny, {
|
|
516
|
+
off?: string | null | undefined;
|
|
517
|
+
minimal?: string | null | undefined;
|
|
518
|
+
low?: string | null | undefined;
|
|
519
|
+
medium?: string | null | undefined;
|
|
520
|
+
high?: string | null | undefined;
|
|
521
|
+
xhigh?: string | null | undefined;
|
|
522
|
+
}, {
|
|
523
|
+
off?: string | null | undefined;
|
|
524
|
+
minimal?: string | null | undefined;
|
|
525
|
+
low?: string | null | undefined;
|
|
526
|
+
medium?: string | null | undefined;
|
|
527
|
+
high?: string | null | undefined;
|
|
528
|
+
xhigh?: string | null | undefined;
|
|
529
|
+
}>>;
|
|
530
|
+
input: z.ZodArray<z.ZodEnum<["text", "image"]>, "atleastone">;
|
|
531
|
+
contextWindow: z.ZodNumber;
|
|
532
|
+
maxTokens: z.ZodNumber;
|
|
533
|
+
/**
|
|
534
|
+
* Optional runtime API key for `provider`, installed as a per-request key
|
|
535
|
+
* so the model registry's auth lookup succeeds. Deployments that resolve
|
|
536
|
+
* real credentials elsewhere (e.g. at an egress proxy) can pass whatever
|
|
537
|
+
* placeholder that layer recognizes — the value is opaque to this server.
|
|
538
|
+
*/
|
|
539
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
540
|
+
api: z.ZodLiteral<"openai-codex-responses">;
|
|
541
|
+
}, "apiKey">, "strip", z.ZodTypeAny, {
|
|
542
|
+
id: string;
|
|
543
|
+
name: string;
|
|
544
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
545
|
+
baseUrl: string;
|
|
546
|
+
reasoning: boolean;
|
|
547
|
+
thinkingLevelMap?: {
|
|
548
|
+
off?: string | null | undefined;
|
|
549
|
+
minimal?: string | null | undefined;
|
|
550
|
+
low?: string | null | undefined;
|
|
551
|
+
medium?: string | null | undefined;
|
|
552
|
+
high?: string | null | undefined;
|
|
553
|
+
xhigh?: string | null | undefined;
|
|
410
554
|
} | undefined;
|
|
555
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
556
|
+
contextWindow: number;
|
|
557
|
+
maxTokens: number;
|
|
558
|
+
api: "openai-codex-responses";
|
|
559
|
+
}, {
|
|
560
|
+
id: string;
|
|
561
|
+
name: string;
|
|
562
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
563
|
+
baseUrl: string;
|
|
564
|
+
reasoning: boolean;
|
|
411
565
|
thinkingLevelMap?: {
|
|
412
566
|
off?: string | null | undefined;
|
|
413
567
|
minimal?: string | null | undefined;
|
|
@@ -416,7 +570,10 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
|
|
|
416
570
|
high?: string | null | undefined;
|
|
417
571
|
xhigh?: string | null | undefined;
|
|
418
572
|
} | undefined;
|
|
419
|
-
|
|
573
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
574
|
+
contextWindow: number;
|
|
575
|
+
maxTokens: number;
|
|
576
|
+
api: "openai-codex-responses";
|
|
420
577
|
}>]>;
|
|
421
578
|
type ModelSpec = z.infer<typeof modelSpecSchema>;
|
|
422
579
|
/**
|
|
@@ -426,16 +583,53 @@ type ModelSpec = z.infer<typeof modelSpecSchema>;
|
|
|
426
583
|
*/
|
|
427
584
|
declare function parseModelSpec(input: unknown, log: Logger): ModelSpec | null;
|
|
428
585
|
declare function buildModelFromSpec(spec: ModelSpec): {
|
|
586
|
+
id: string;
|
|
587
|
+
name: string;
|
|
588
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
589
|
+
baseUrl: string;
|
|
590
|
+
reasoning: boolean;
|
|
591
|
+
thinkingLevelMap?: {
|
|
592
|
+
off?: string | null | undefined;
|
|
593
|
+
minimal?: string | null | undefined;
|
|
594
|
+
low?: string | null | undefined;
|
|
595
|
+
medium?: string | null | undefined;
|
|
596
|
+
high?: string | null | undefined;
|
|
597
|
+
xhigh?: string | null | undefined;
|
|
598
|
+
} | undefined;
|
|
599
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
600
|
+
cost: {
|
|
601
|
+
input: number;
|
|
602
|
+
output: number;
|
|
603
|
+
cacheRead: number;
|
|
604
|
+
cacheWrite: number;
|
|
605
|
+
};
|
|
606
|
+
contextWindow: number;
|
|
607
|
+
maxTokens: number;
|
|
608
|
+
api: "openai-completions";
|
|
429
609
|
compat?: {
|
|
430
610
|
supportsReasoningEffort?: boolean | undefined;
|
|
611
|
+
supportsStore?: boolean | undefined;
|
|
431
612
|
requiresThinkingAsText?: boolean | undefined;
|
|
432
|
-
thinkingFormat?: "
|
|
613
|
+
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
433
614
|
supportsStrictMode?: boolean | undefined;
|
|
434
615
|
maxTokensField?: "max_completion_tokens" | "max_tokens" | undefined;
|
|
435
616
|
cacheControlFormat?: "anthropic" | undefined;
|
|
436
617
|
} | undefined;
|
|
437
|
-
|
|
438
|
-
|
|
618
|
+
} | {
|
|
619
|
+
id: string;
|
|
620
|
+
name: string;
|
|
621
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
622
|
+
baseUrl: string;
|
|
623
|
+
reasoning: boolean;
|
|
624
|
+
thinkingLevelMap?: {
|
|
625
|
+
off?: string | null | undefined;
|
|
626
|
+
minimal?: string | null | undefined;
|
|
627
|
+
low?: string | null | undefined;
|
|
628
|
+
medium?: string | null | undefined;
|
|
629
|
+
high?: string | null | undefined;
|
|
630
|
+
xhigh?: string | null | undefined;
|
|
631
|
+
} | undefined;
|
|
632
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
439
633
|
cost: {
|
|
440
634
|
input: number;
|
|
441
635
|
output: number;
|
|
@@ -444,6 +638,17 @@ declare function buildModelFromSpec(spec: ModelSpec): {
|
|
|
444
638
|
};
|
|
445
639
|
contextWindow: number;
|
|
446
640
|
maxTokens: number;
|
|
641
|
+
api: "anthropic-messages";
|
|
642
|
+
compat?: {
|
|
643
|
+
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
644
|
+
supportsLongCacheRetention?: boolean | undefined;
|
|
645
|
+
} | undefined;
|
|
646
|
+
} | {
|
|
647
|
+
id: string;
|
|
648
|
+
name: string;
|
|
649
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
650
|
+
baseUrl: string;
|
|
651
|
+
reasoning: boolean;
|
|
447
652
|
thinkingLevelMap?: {
|
|
448
653
|
off?: string | null | undefined;
|
|
449
654
|
minimal?: string | null | undefined;
|
|
@@ -452,18 +657,7 @@ declare function buildModelFromSpec(spec: ModelSpec): {
|
|
|
452
657
|
high?: string | null | undefined;
|
|
453
658
|
xhigh?: string | null | undefined;
|
|
454
659
|
} | undefined;
|
|
455
|
-
|
|
456
|
-
name: string;
|
|
457
|
-
provider: "amazon-bedrock" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "deepseek" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "mistral" | "minimax" | "minimax-cn" | "moonshotai" | "moonshotai-cn" | "huggingface" | "fireworks" | "opencode" | "opencode-go" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | "xiaomi" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-sgp";
|
|
458
|
-
baseUrl: string;
|
|
459
|
-
reasoning: boolean;
|
|
460
|
-
} | {
|
|
461
|
-
compat?: {
|
|
462
|
-
supportsEagerToolInputStreaming?: boolean | undefined;
|
|
463
|
-
supportsLongCacheRetention?: boolean | undefined;
|
|
464
|
-
} | undefined;
|
|
465
|
-
api: "anthropic-messages";
|
|
466
|
-
input: ["text" | "image", ...("text" | "image")[]];
|
|
660
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
467
661
|
cost: {
|
|
468
662
|
input: number;
|
|
469
663
|
output: number;
|
|
@@ -472,6 +666,13 @@ declare function buildModelFromSpec(spec: ModelSpec): {
|
|
|
472
666
|
};
|
|
473
667
|
contextWindow: number;
|
|
474
668
|
maxTokens: number;
|
|
669
|
+
api: "openai-responses";
|
|
670
|
+
} | {
|
|
671
|
+
id: string;
|
|
672
|
+
name: string;
|
|
673
|
+
provider: "amazon-bedrock" | "anthropic" | "azure-openai-responses" | "cerebras" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "deepseek" | "fireworks" | "github-copilot" | "google" | "google-vertex" | "groq" | "huggingface" | "kimi-coding" | "minimax" | "minimax-cn" | "mistral" | "moonshotai" | "moonshotai-cn" | "openai" | "openai-codex" | "opencode" | "opencode-go" | "openrouter" | "vercel-ai-gateway" | "xai" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "zai";
|
|
674
|
+
baseUrl: string;
|
|
675
|
+
reasoning: boolean;
|
|
475
676
|
thinkingLevelMap?: {
|
|
476
677
|
off?: string | null | undefined;
|
|
477
678
|
minimal?: string | null | undefined;
|
|
@@ -480,11 +681,16 @@ declare function buildModelFromSpec(spec: ModelSpec): {
|
|
|
480
681
|
high?: string | null | undefined;
|
|
481
682
|
xhigh?: string | null | undefined;
|
|
482
683
|
} | undefined;
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
684
|
+
input: ["image" | "text", ...("image" | "text")[]];
|
|
685
|
+
cost: {
|
|
686
|
+
input: number;
|
|
687
|
+
output: number;
|
|
688
|
+
cacheRead: number;
|
|
689
|
+
cacheWrite: number;
|
|
690
|
+
};
|
|
691
|
+
contextWindow: number;
|
|
692
|
+
maxTokens: number;
|
|
693
|
+
api: "openai-codex-responses";
|
|
488
694
|
};
|
|
489
695
|
/**
|
|
490
696
|
* Resolve the model a request should run on: a valid `x_model` wins,
|
|
@@ -557,10 +763,10 @@ declare const payloadSchema: z.ZodObject<{
|
|
|
557
763
|
blockReason: z.ZodEnum<["insufficient_balance", "payment_failed", "hard_spend_limit_reached"]>;
|
|
558
764
|
message: z.ZodString;
|
|
559
765
|
}, "strict", z.ZodTypeAny, {
|
|
560
|
-
blockReason: "
|
|
766
|
+
blockReason: "hard_spend_limit_reached" | "insufficient_balance" | "payment_failed";
|
|
561
767
|
message: string;
|
|
562
768
|
}, {
|
|
563
|
-
blockReason: "
|
|
769
|
+
blockReason: "hard_spend_limit_reached" | "insufficient_balance" | "payment_failed";
|
|
564
770
|
message: string;
|
|
565
771
|
}>;
|
|
566
772
|
type BillingBlockedProviderSignal = z.infer<typeof payloadSchema>;
|