@router-for-me/pi-cliproxyapi-provider 1.5.0 → 1.5.1

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 CHANGED
@@ -206,7 +206,8 @@ From CPA catalog entry → pi model:
206
206
  | `input_modalities` | `input` (`text` / `image`) |
207
207
  | `supported_reasoning_levels[].effort` | `thinkingLevelMap` + `reasoning` |
208
208
  | `supports_reasoning_effort_updates` | `compat.supportsMidConvoEffort` |
209
- | `visibility: "hide"` | skipped |
209
+ | `supports_decisions: true` | Codemode classifier using `openai-decisions` |
210
+ | `visibility: "hide"` | skip chat model registration |
210
211
 
211
212
  Unsupported pi thinking levels are set to `null` so they are hidden in the UI. When available, prices are matched against canonical model entries in `models.dev`; `cost.tiers[].tier.size` becomes pi's `inputTokensAbove`, including thresholds such as `272000`. The legacy `context_over_200k` field is used only when no explicit tiers are present. Ambiguous reseller prices are not selected arbitrarily and fall back to zero. These are catalog/list prices, not a guarantee of CPA's own markup or billing.
212
213
 
@@ -26,7 +26,13 @@ import type {
26
26
  SimpleStreamOptions,
27
27
  StreamFunction,
28
28
  } from "@earendil-works/pi-ai";
29
- import { type ExtensionAPI, type ExtensionContext, getAgentDir } from "@earendil-works/pi-coding-agent";
29
+ import { builtinProviders } from "@earendil-works/pi-ai/providers/all";
30
+ import {
31
+ type ExtensionAPI,
32
+ type ExtensionContext,
33
+ getAgentDir,
34
+ type ProviderModelConfig,
35
+ } from "@earendil-works/pi-coding-agent";
30
36
  import { ProactiveCompactionController } from "./auto-compact.ts";
31
37
  import {
32
38
  CLIPROXYAPI_CODEX_API,
@@ -506,6 +512,25 @@ function registerProvider(
506
512
  const refreshCoordinator = options.refreshCoordinator ?? new ModelRefreshCoordinator();
507
513
 
508
514
  const endpoints = resolveEndpoints(baseUrlInput);
515
+ const classify = models?.some((model) => model.decisions === true)
516
+ ? builtinProviders().find((provider) => provider.id === "openai")?.classify
517
+ : undefined;
518
+ const registeredModels = models?.flatMap<ProviderModelConfig>((model) => {
519
+ if (model.decisions !== true) return [model];
520
+ if (!classify) return [];
521
+ return [
522
+ {
523
+ type: "classifier",
524
+ api: "openai-decisions",
525
+ id: model.id,
526
+ name: model.name,
527
+ baseUrl: new URL(".", endpoints.modelsUrl).href,
528
+ input: model.input,
529
+ cost: model.cost,
530
+ contextWindow: model.contextWindow,
531
+ },
532
+ ];
533
+ });
509
534
  const oauth = createOAuthHandlers({
510
535
  pi,
511
536
  agentDir,
@@ -532,7 +557,8 @@ function registerProvider(
532
557
  // (config file / env). Never pass both for /login flows.
533
558
  oauth,
534
559
  ...(apiKey ? { apiKey } : {}),
535
- ...(models && models.length > 0 ? { models } : {}),
560
+ ...(models?.length ? { models: registeredModels } : {}),
561
+ ...(classify ? { classifiers: { "openai-decisions": { classify } } } : {}),
536
562
  });
537
563
  }
538
564
 
package/extensions/lib.ts CHANGED
@@ -83,6 +83,7 @@ export interface CodexClientModel {
83
83
  input_modalities?: string[];
84
84
  supported_reasoning_levels?: CodexReasoningLevel[] | string[];
85
85
  supports_reasoning_effort_updates?: boolean;
86
+ supports_decisions?: boolean;
86
87
  default_service_tier?: string | null;
87
88
  service_tiers?: Array<CodexServiceTier | string>;
88
89
  additional_speed_tiers?: string[];
@@ -121,6 +122,7 @@ export interface PiProviderModel {
121
122
  maxTokens: number;
122
123
  thinkingLevelMap?: ThinkingLevelMap;
123
124
  compat?: PiProviderModelCompat;
125
+ decisions?: true;
124
126
  stale?: boolean;
125
127
  lastSeenAt?: number;
126
128
  staleSince?: number;
@@ -520,7 +522,7 @@ export function codexModelId(model: CodexClientModel): string {
520
522
  }
521
523
 
522
524
  export function supportsFastServiceTier(model: CodexClientModel): boolean {
523
- return Array.isArray(model.service_tiers) && model.service_tiers.length > 0;
525
+ return model.supports_decisions !== true && Array.isArray(model.service_tiers) && model.service_tiers.length > 0;
524
526
  }
525
527
 
526
528
  export function supportsReasoningEffortUpdates(model: CodexClientModel): boolean {
@@ -536,7 +538,8 @@ export function toPiModel(
536
538
  if (!id) {
537
539
  return null;
538
540
  }
539
- if (String(model.visibility ?? "").toLowerCase() === "hide") {
541
+ const decisions = model.supports_decisions === true;
542
+ if (!decisions && String(model.visibility ?? "").toLowerCase() === "hide") {
540
543
  return null;
541
544
  }
542
545
 
@@ -579,6 +582,7 @@ export function toPiModel(
579
582
  maxTokens,
580
583
  thinkingLevelMap: buildThinkingLevelMap(efforts),
581
584
  ...(hasReasoning && supportsReasoningEffortUpdates(model) ? { compat: { supportsMidConvoEffort: true } } : {}),
585
+ ...(decisions ? { decisions } : {}),
582
586
  };
583
587
  }
584
588
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@router-for-me/pi-cliproxyapi-provider",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Pi provider extension that auto-registers CLIProxyAPI models, plus TUI elapsed/TPS status",
5
5
  "type": "module",
6
6
  "keywords": [