@oh-my-pi/pi-catalog 18.1.2 → 18.1.3

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.
@@ -2958,6 +2958,7 @@ function openCodeBaseUrlForApi(api: Api, basePath: string): string {
2958
2958
  // Runtime-discovered rows cached before model-identity corrections retain
2959
2959
  // stale capability metadata until the authoritative catalog TTL expires.
2960
2960
  const OPENCODE_CACHE_MIGRATION_MODEL_IDS = ["glm-5.3-flash"] as const;
2961
+ const OPENCODE_ZEN_CACHE_MIGRATION_MODEL_IDS = ["gemini-3.7-flash"] as const;
2961
2962
 
2962
2963
  // Billing-variant suffixes the OpenCode gateways append to a base model id
2963
2964
  // without changing its transport (`deepseek-v4-flash-free`,
@@ -3026,8 +3027,12 @@ function openCodeModelManagerOptions(
3026
3027
  dynamicModelsAuthoritative: true,
3027
3028
  // Per-id route pins and capability migrations are cache identity:
3028
3029
  // without this, rows cached before a correction keep the stale route or
3029
- // thinking surface until TTL expiry (#8957, #9960).
3030
- dropCachedModelIdsOnStaticMismatch: [...apiRouteExactModelIds(providerId), ...OPENCODE_CACHE_MIGRATION_MODEL_IDS],
3030
+ // thinking surface until TTL expiry (#8957, #9960, #10543).
3031
+ dropCachedModelIdsOnStaticMismatch: [
3032
+ ...apiRouteExactModelIds(providerId),
3033
+ ...OPENCODE_CACHE_MIGRATION_MODEL_IDS,
3034
+ ...(providerId === "opencode-zen" ? OPENCODE_ZEN_CACHE_MIGRATION_MODEL_IDS : []),
3035
+ ],
3031
3036
  modelsDev: {
3032
3037
  fetch: () => fetchRevalidatedWellKnownModelsWithTimeout(config?.fetch),
3033
3038
  map: payload => {
@@ -3487,6 +3492,20 @@ export const ALIBABA_TOKEN_PLAN_STATIC_MODELS: readonly ModelSpec<"openai-comple
3487
3492
  },
3488
3493
  compat: ALIBABA_TOKEN_PLAN_QWEN_EFFORT_COMPAT,
3489
3494
  },
3495
+ {
3496
+ id: "qwen3.8-flash",
3497
+ name: "Qwen3.8 Flash",
3498
+ api: "openai-completions",
3499
+ provider: "alibaba-token-plan",
3500
+ baseUrl: ALIBABA_TOKEN_PLAN_BASE_URL,
3501
+ reasoning: true,
3502
+ input: ["text", "image"],
3503
+ cost: ALIBABA_TOKEN_PLAN_COST,
3504
+ contextWindow: 1_000_000,
3505
+ maxTokens: 131_072,
3506
+ thinking: ALIBABA_TOKEN_PLAN_REASONING,
3507
+ compat: ALIBABA_TOKEN_PLAN_COMPAT,
3508
+ },
3490
3509
  {
3491
3510
  id: "qwen3.7-max",
3492
3511
  name: "Qwen3.7 Max",
@@ -6495,6 +6514,26 @@ const OPENCODE_GO_API_RESOLUTION = createOpenCodeApiResolution("https://opencode
6495
6514
 
6496
6515
  const COPILOT_BASE_URL = "https://api.githubcopilot.com";
6497
6516
 
6517
+ const ZAI_ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic";
6518
+ // The `zai` catalog provider is the GLM Coding Plan: `/login zai` validates and
6519
+ // stores credentials against the coding-plan endpoint (see registry/zai.ts), so
6520
+ // the native OpenAI transport must ride the coding-plan base rather than the
6521
+ // general PAYG `/api/paas/v4`, which would bypass plan quota or fail auth.
6522
+ const ZAI_OPENAI_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
6523
+
6524
+ /** Resolves the transport and endpoint for one Z.AI model catalog entry. */
6525
+ export function resolveZaiApi(modelId: string): { api: "anthropic-messages" | "openai-completions"; baseUrl: string } {
6526
+ const api = apiRouteFor("zai", modelId)?.api ?? "anthropic-messages";
6527
+ switch (api) {
6528
+ case "anthropic-messages":
6529
+ return { api, baseUrl: ZAI_ANTHROPIC_BASE_URL };
6530
+ case "openai-completions":
6531
+ return { api, baseUrl: ZAI_OPENAI_BASE_URL };
6532
+ default:
6533
+ throw new Error(`Unsupported Z.AI API route: ${api}`);
6534
+ }
6535
+ }
6536
+
6498
6537
  const COPILOT_DEFAULT_RESOLUTION = {
6499
6538
  api: "openai-completions",
6500
6539
  baseUrl: COPILOT_BASE_URL,
@@ -6772,7 +6811,9 @@ const MODELS_DEV_PROVIDER_DESCRIPTORS_CODING_PLANS: readonly ModelsDevProviderDe
6772
6811
  // SKU as "Free" in `/models`. The PAYG key carries the real per-token rates for
6773
6812
  // the identical model ids, so the enumerated token costs line up with the other
6774
6813
  // subscription providers for comparison (issue #5598).
6775
- anthropicMessagesDescriptor("zai", "zai", "https://api.z.ai/api/anthropic"),
6814
+ anthropicMessagesDescriptor("zai", "zai", ZAI_ANTHROPIC_BASE_URL, {
6815
+ resolveApi: modelId => resolveZaiApi(modelId),
6816
+ }),
6776
6817
  // --- Umans AI ---
6777
6818
  // Source the pay-as-you-go catalog: the coding-plan key publishes subscription
6778
6819
  // costs as zero, while `/models/info` omits pricing entirely. The generator
@@ -389,6 +389,9 @@ const devinDiscovery = once(() => import("../discovery/devin"));
389
389
 
390
390
  export interface ZaiModelManagerConfig {}
391
391
 
392
- export function zaiModelManagerOptions(_config: ZaiModelManagerConfig = {}): ModelManagerOptions<"anthropic-messages"> {
392
+ /** Creates model-manager options for Z.AI's mixed native and Anthropic transports. */
393
+ export function zaiModelManagerOptions(
394
+ _config: ZaiModelManagerConfig = {},
395
+ ): ModelManagerOptions<"anthropic-messages" | "openai-completions"> {
393
396
  return { providerId: "zai" };
394
397
  }
package/src/types.ts CHANGED
@@ -1055,6 +1055,8 @@ export interface Model<TApi extends Api = Api> {
1055
1055
  * inferring it from the transport API.
1056
1056
  */
1057
1057
  requiresGlyphTokenization?: boolean;
1058
+ /** Whether this model requires Cursor's tool-schema combiner projection. */
1059
+ requiresCursorToolSchemaProjection?: boolean;
1058
1060
  /**
1059
1061
  * Model id to send on the wire when it differs from `id`. Used by catalog
1060
1062
  * variants that present one upstream model under several local entries —
@@ -1212,7 +1214,12 @@ export interface Model<TApi extends Api = Api> {
1212
1214
  */
1213
1215
  export interface ModelSpec<TApi extends Api = Api> extends Omit<
1214
1216
  Model<TApi>,
1215
- "compat" | "identity" | "compatConfig" | "requiresGlyphTokenization" | "supportsComputerUseConfig"
1217
+ | "compat"
1218
+ | "identity"
1219
+ | "compatConfig"
1220
+ | "requiresGlyphTokenization"
1221
+ | "requiresCursorToolSchemaProjection"
1222
+ | "supportsComputerUseConfig"
1216
1223
  > {
1217
1224
  /** Sparse compatibility overrides; resolved into `Model.compat` by `buildModel`. */
1218
1225
  compat?: CompatConfigOf<TApi>;