@oh-my-pi/pi-catalog 16.3.2 → 16.3.4

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.
@@ -12,6 +12,7 @@ import {
12
12
  aimlApiModelManagerOptions,
13
13
  alibabaCodingPlanModelManagerOptions,
14
14
  anthropicModelManagerOptions,
15
+ basetenModelManagerOptions,
15
16
  cerebrasModelManagerOptions,
16
17
  cloudflareAiGatewayModelManagerOptions,
17
18
  coreWeaveModelManagerOptions,
@@ -73,6 +74,14 @@ export const CATALOG_PROVIDERS = [
73
74
  createModelManagerOptions: (config: ModelManagerConfig) => alibabaCodingPlanModelManagerOptions(config),
74
75
  catalogDiscovery: { label: "Alibaba Coding Plan" },
75
76
  },
77
+ {
78
+ id: "baseten",
79
+ defaultModel: "moonshotai/Kimi-K2.7-Code",
80
+ envVars: ["BASETEN_API_KEY"],
81
+ createModelManagerOptions: (config: ModelManagerConfig) => basetenModelManagerOptions(config),
82
+ dynamicModelsAuthoritative: true,
83
+ catalogDiscovery: { label: "Baseten" },
84
+ },
76
85
  {
77
86
  id: "amazon-bedrock",
78
87
  defaultModel: "us.anthropic.claude-opus-4-8",
@@ -458,9 +467,10 @@ export const CATALOG_PROVIDERS = [
458
467
  },
459
468
  {
460
469
  id: "zhipu-coding-plan",
461
- defaultModel: "glm-5.2",
470
+ defaultModel: "glm-5.1",
462
471
  envVars: ["ZHIPU_API_KEY"],
463
472
  createModelManagerOptions: (config: ModelManagerConfig) => zhipuCodingPlanModelManagerOptions(config),
473
+ dynamicModelsAuthoritative: true,
464
474
  catalogDiscovery: { label: "Zhipu Coding Plan" },
465
475
  },
466
476
  ] as const satisfies readonly ProviderCatalogEntry[];
@@ -1283,6 +1283,7 @@ export function zhipuCodingPlanModelManagerOptions(
1283
1283
  const baseUrl = config?.baseUrl ?? "https://open.bigmodel.cn/api/coding/paas/v4";
1284
1284
  return {
1285
1285
  providerId: "zhipu-coding-plan",
1286
+ dynamicModelsAuthoritative: true,
1286
1287
  ...(apiKey && {
1287
1288
  fetchDynamicModels: () =>
1288
1289
  fetchOpenAICompatibleModels({
@@ -2550,6 +2551,103 @@ export function veniceModelManagerOptions(
2550
2551
  };
2551
2552
  }
2552
2553
 
2554
+ // ---------------------------------------------------------------------------
2555
+ // 14.5 Baseten
2556
+ // ---------------------------------------------------------------------------
2557
+
2558
+ export interface BasetenModelManagerConfig {
2559
+ apiKey?: string;
2560
+ baseUrl?: string;
2561
+ fetch?: FetchImpl;
2562
+ }
2563
+
2564
+ export function basetenModelManagerOptions(
2565
+ config?: BasetenModelManagerConfig,
2566
+ ): ModelManagerOptions<"openai-completions"> {
2567
+ const apiKey = config?.apiKey;
2568
+ const baseUrl = config?.baseUrl ?? "https://inference.baseten.co/v1";
2569
+ const references = createBundledReferenceMap<"openai-completions">("baseten");
2570
+ return {
2571
+ providerId: "baseten",
2572
+ dynamicModelsAuthoritative: true,
2573
+ ...(apiKey && {
2574
+ fetchDynamicModels: () =>
2575
+ fetchOpenAICompatibleModels({
2576
+ api: "openai-completions",
2577
+ provider: "baseten",
2578
+ baseUrl,
2579
+ apiKey,
2580
+ mapModel: (entry, defaults) => {
2581
+ const reference = references.get(defaults.id);
2582
+ const raw = entry as Record<string, unknown> & {
2583
+ supported_features?: unknown;
2584
+ input_modalities?: unknown;
2585
+ pricing?: Record<string, unknown>;
2586
+ };
2587
+ const features = Array.isArray(raw.supported_features) ? raw.supported_features : [];
2588
+ const modalities = Array.isArray(raw.input_modalities) ? raw.input_modalities : [];
2589
+
2590
+ const isBasetenNativeReasoning =
2591
+ defaults.id === "openai/gpt-oss-120b" ||
2592
+ defaults.id === "deepseek-ai/DeepSeek-V4-Pro" ||
2593
+ defaults.id === "zai-org/GLM-5.2";
2594
+ const reasoning =
2595
+ isBasetenNativeReasoning &&
2596
+ (features.includes("reasoning") || features.includes("reasoning_effort"));
2597
+ const supportsTools = features.includes("tools") ? undefined : false;
2598
+ const vision = modalities.includes("image") || (reference?.input.includes("image") ?? false);
2599
+
2600
+ const pricing = raw.pricing ?? {};
2601
+ const cost = {
2602
+ input: toPositiveNumber(pricing.prompt, 0) * 1_000_000,
2603
+ output: toPositiveNumber(pricing.completion, 0) * 1_000_000,
2604
+ cacheRead: toPositiveNumber(pricing.input_cache_read, 0) * 1_000_000,
2605
+ cacheWrite: 0,
2606
+ };
2607
+
2608
+ const contextWindow = toPositiveNumber(
2609
+ raw.context_length,
2610
+ reference?.contextWindow ?? defaults.contextWindow,
2611
+ );
2612
+ const maxTokens = toPositiveNumber(
2613
+ raw.max_completion_tokens,
2614
+ reference?.maxTokens ?? defaults.maxTokens,
2615
+ );
2616
+
2617
+ const baseModel = mapWithBundledReference(entry, defaults, reference);
2618
+
2619
+ const isEffortReasoning = defaults.id === "openai/gpt-oss-120b" || defaults.id === "zai-org/GLM-5.2";
2620
+ const thinking = isEffortReasoning
2621
+ ? {
2622
+ mode: "effort" as const,
2623
+ efforts: [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High, Effort.XHigh],
2624
+ effortMap: {
2625
+ minimal: "high",
2626
+ low: "high",
2627
+ medium: "high",
2628
+ high: "high",
2629
+ xhigh: "max",
2630
+ },
2631
+ }
2632
+ : undefined;
2633
+
2634
+ return {
2635
+ ...baseModel,
2636
+ reasoning,
2637
+ input: vision ? ["text", "image"] : ["text"],
2638
+ cost,
2639
+ contextWindow,
2640
+ maxTokens,
2641
+ ...(thinking ? { thinking } : {}),
2642
+ ...(supportsTools === false ? { supportsTools } : {}),
2643
+ };
2644
+ },
2645
+ fetch: config?.fetch,
2646
+ }),
2647
+ }),
2648
+ };
2649
+ }
2650
+
2553
2651
  // ---------------------------------------------------------------------------
2554
2652
  // 15. Together
2555
2653
  // ---------------------------------------------------------------------------
package/src/types.ts CHANGED
@@ -592,6 +592,17 @@ export type ResolvedAnthropicCompat = Required<AnthropicCompat> & {
592
592
  * env headers, and cache-TTL shaping without per-request URL parsing.
593
593
  */
594
594
  officialEndpoint: boolean;
595
+ /**
596
+ * The configured endpoint enforces Anthropic's signature protocol on
597
+ * replayed thinking blocks — either the official API itself or a proxy
598
+ * that forwards to it (GitHub Copilot, ZenMux, Cloudflare AI Gateway's
599
+ * `/anthropic` route, Google Vertex's `publishers/anthropic/…`).
600
+ * Downstream transforms strip stale cross-model thinking signatures on
601
+ * these endpoints so the signing proxy doesn't 400 with
602
+ * `Invalid signature in thinking block` (#4297). Superset of
603
+ * {@link officialEndpoint}.
604
+ */
605
+ signingEndpoint: boolean;
595
606
  };
596
607
 
597
608
  /**