pi-dynamic-providers 0.0.1 → 0.0.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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ A [Pi coding agent](https://pi.dev) extension to automatically discover and regi
9
9
  ## Features
10
10
 
11
11
  - **Dynamic Model Discovery**: Queries the `/models` endpoint at startup and dynamically registers available models with the Pi provider registry.
12
- - **Reasoning Model Support**: Automatically detects reasoning/thinking models (via `reasoning_efforts` metadata or naming heuristics) and sets up appropriate thinking levels.
12
+ - **Reasoning Model Support**: Enables reasoning support for models with configurable thinking levels up to `max`.
13
13
  - **Manual Hot-Reload**: Provides a `/refresh-models` command to reload the remote model catalog without restarting Pi.
14
14
  - **Flexible Configuration**: Reads configuration from `~/.pi/agent/dynamic-models/config.json`.
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dynamic-providers",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Pi extension to dynamically discover and register models from OpenAI-compatible endpoints",
5
5
  "author": "cybershape",
6
6
  "license": "MIT",
@@ -19,6 +19,8 @@ interface RemoteModelItem {
19
19
  context_length?: number;
20
20
  reasoning_efforts?: Array<{ value: string }>;
21
21
  supported_in_api?: boolean;
22
+ /** Backend used by the upstream gateway, e.g. "responses" or "chat_completions". */
23
+ api_backend?: string;
22
24
  }
23
25
 
24
26
  /**
@@ -77,23 +79,20 @@ async function syncModels(pi: ExtensionAPI): Promise<number> {
77
79
  const models = rawList
78
80
  .filter((m) => m.supported_in_api !== false)
79
81
  .map((m) => {
80
- const isReasoning =
81
- (Array.isArray(m.reasoning_efforts) && m.reasoning_efforts.length > 0) ||
82
- m.id.toLowerCase().includes("thinking") ||
83
- (m.name ? m.name.toLowerCase().includes("thinking") : false);
84
-
85
82
  const contextWindow = m.context_window || m.context_length || defaultContextWindow;
83
+ const useResponsesApi = (m.api_backend || "").toLowerCase() === "responses";
86
84
 
87
85
  return {
88
86
  id: m.id,
89
87
  name: m.name || m.id,
90
- reasoning: isReasoning,
91
- ...(isReasoning && {
92
- thinkingLevelMap: {
93
- xhigh: "xhigh",
94
- max: "max",
95
- },
96
- }),
88
+ reasoning: true,
89
+ // Model-level override: upstream gateways that are backed by the Responses API
90
+ // must be called via /responses instead of /chat/completions.
91
+ ...(useResponsesApi && { api: "openai-responses" }),
92
+ thinkingLevelMap: {
93
+ xhigh: "xhigh",
94
+ max: "max",
95
+ },
97
96
  input: ["text", "image"] as ("text" | "image")[],
98
97
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
99
98
  contextWindow,