@skydiveai/pi-server 0.1.0-beta.3193 → 0.1.0-beta.3200

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 CHANGED
@@ -422,6 +422,158 @@ declare const modelSpecSchema: z.ZodDiscriminatedUnion<"api", [z.ZodObject<{
422
422
  supportsEagerToolInputStreaming?: boolean | undefined;
423
423
  supportsLongCacheRetention?: boolean | undefined;
424
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. */
427
+ name: z.ZodString; /** pi-ai provider key — also the auth-storage key for `apiKey`. */
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". */
429
+ baseUrl: z.ZodString;
430
+ reasoning: z.ZodBoolean;
431
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
432
+ off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
433
+ minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
434
+ low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
435
+ medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
436
+ high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
437
+ xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
438
+ }, "strip", z.ZodTypeAny, {
439
+ off?: string | null | undefined;
440
+ minimal?: string | null | undefined;
441
+ low?: string | null | undefined;
442
+ medium?: string | null | undefined;
443
+ high?: string | null | undefined;
444
+ xhigh?: string | null | undefined;
445
+ }, {
446
+ off?: string | null | undefined;
447
+ minimal?: string | null | undefined;
448
+ low?: string | null | undefined;
449
+ medium?: string | null | undefined;
450
+ high?: string | null | undefined;
451
+ xhigh?: string | null | undefined;
452
+ }>>;
453
+ input: z.ZodArray<z.ZodEnum<["text", "image"]>, "atleastone">;
454
+ contextWindow: z.ZodNumber;
455
+ maxTokens: z.ZodNumber;
456
+ /**
457
+ * Optional runtime API key for `provider`, installed as a per-request key
458
+ * so the model registry's auth lookup succeeds. Deployments that resolve
459
+ * real credentials elsewhere (e.g. at an egress proxy) can pass whatever
460
+ * placeholder that layer recognizes — the value is opaque to this server.
461
+ */
462
+ apiKey: z.ZodOptional<z.ZodString>;
463
+ api: z.ZodLiteral<"openai-responses">;
464
+ }, "strip", z.ZodTypeAny, {
465
+ id: string;
466
+ name: string;
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";
468
+ baseUrl: string;
469
+ reasoning: boolean;
470
+ thinkingLevelMap?: {
471
+ off?: string | null | undefined;
472
+ minimal?: string | null | undefined;
473
+ low?: string | null | undefined;
474
+ medium?: string | null | undefined;
475
+ high?: string | null | undefined;
476
+ xhigh?: string | null | undefined;
477
+ } | undefined;
478
+ input: ["image" | "text", ...("image" | "text")[]];
479
+ contextWindow: number;
480
+ maxTokens: number;
481
+ apiKey?: string | undefined;
482
+ api: "openai-responses";
483
+ }, {
484
+ id: string;
485
+ name: string;
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";
487
+ baseUrl: string;
488
+ reasoning: boolean;
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")[]];
498
+ contextWindow: number;
499
+ maxTokens: number;
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;
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;
565
+ thinkingLevelMap?: {
566
+ off?: string | null | undefined;
567
+ minimal?: string | null | undefined;
568
+ low?: string | null | undefined;
569
+ medium?: string | null | undefined;
570
+ high?: string | null | undefined;
571
+ xhigh?: string | null | undefined;
572
+ } | undefined;
573
+ input: ["image" | "text", ...("image" | "text")[]];
574
+ contextWindow: number;
575
+ maxTokens: number;
576
+ api: "openai-codex-responses";
425
577
  }>]>;
426
578
  type ModelSpec = z.infer<typeof modelSpecSchema>;
427
579
  /**
@@ -491,6 +643,54 @@ declare function buildModelFromSpec(spec: ModelSpec): {
491
643
  supportsEagerToolInputStreaming?: boolean | undefined;
492
644
  supportsLongCacheRetention?: boolean | undefined;
493
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;
652
+ thinkingLevelMap?: {
653
+ off?: string | null | undefined;
654
+ minimal?: string | null | undefined;
655
+ low?: string | null | undefined;
656
+ medium?: string | null | undefined;
657
+ high?: string | null | undefined;
658
+ xhigh?: string | null | undefined;
659
+ } | undefined;
660
+ input: ["image" | "text", ...("image" | "text")[]];
661
+ cost: {
662
+ input: number;
663
+ output: number;
664
+ cacheRead: number;
665
+ cacheWrite: number;
666
+ };
667
+ contextWindow: number;
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;
676
+ thinkingLevelMap?: {
677
+ off?: string | null | undefined;
678
+ minimal?: string | null | undefined;
679
+ low?: string | null | undefined;
680
+ medium?: string | null | undefined;
681
+ high?: string | null | undefined;
682
+ xhigh?: string | null | undefined;
683
+ } | undefined;
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";
494
694
  };
495
695
  /**
496
696
  * Resolve the model a request should run on: a valid `x_model` wins,
package/dist/index.mjs CHANGED
@@ -781,15 +781,26 @@ const baseSpecShape = {
781
781
  */
782
782
  apiKey: z.string().min(1).optional()
783
783
  };
784
- const modelSpecSchema = z.discriminatedUnion("api", [z.object({
785
- ...baseSpecShape,
786
- api: z.literal("openai-completions"),
787
- compat: openaiCompletionsCompatSchema.optional()
788
- }), z.object({
789
- ...baseSpecShape,
790
- api: z.literal("anthropic-messages"),
791
- compat: anthropicMessagesCompatSchema.optional()
792
- })]);
784
+ const modelSpecSchema = z.discriminatedUnion("api", [
785
+ z.object({
786
+ ...baseSpecShape,
787
+ api: z.literal("openai-completions"),
788
+ compat: openaiCompletionsCompatSchema.optional()
789
+ }),
790
+ z.object({
791
+ ...baseSpecShape,
792
+ api: z.literal("anthropic-messages"),
793
+ compat: anthropicMessagesCompatSchema.optional()
794
+ }),
795
+ z.object({
796
+ ...baseSpecShape,
797
+ api: z.literal("openai-responses")
798
+ }),
799
+ z.object({
800
+ ...baseSpecShape,
801
+ api: z.literal("openai-codex-responses")
802
+ }).omit({ apiKey: true })
803
+ ]);
793
804
  /**
794
805
  * Parse a request-body `x_model`. Null when absent or invalid — never a
795
806
  * request rejection, so a malformed spec degrades to the legacy body-model
@@ -836,6 +847,14 @@ function buildModelFromSpec(spec) {
836
847
  api: spec.api,
837
848
  ...spec.compat ? { compat: spec.compat } : {}
838
849
  };
850
+ case "openai-responses": return {
851
+ ...base,
852
+ api: spec.api
853
+ };
854
+ case "openai-codex-responses": return {
855
+ ...base,
856
+ api: spec.api
857
+ };
839
858
  default: throw new Error(`Unhandled x_model api: ${String(spec)}`);
840
859
  }
841
860
  }
@@ -857,7 +876,7 @@ function resolveRequestModel({ modelInput, modelSpecInput, defaultModel, log })
857
876
  * always wins.
858
877
  */
859
878
  function withSpecApiKey(keys, modelSpec) {
860
- if (!modelSpec?.apiKey || keys[modelSpec.provider]) return keys;
879
+ if (!modelSpec || !("apiKey" in modelSpec) || !modelSpec.apiKey || keys[modelSpec.provider]) return keys;
861
880
  return {
862
881
  ...keys,
863
882
  [modelSpec.provider]: modelSpec.apiKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skydiveai/pi-server",
3
- "version": "0.1.0-beta.3193",
3
+ "version": "0.1.0-beta.3200",
4
4
  "homepage": "https://skydive.com",
5
5
  "license": "MIT",
6
6
  "author": "Create, Inc.",