Refactor pi plan mode

This commit is contained in:
Martin Pander
2026-07-23 19:39:51 +02:00
parent 23d13f93b7
commit 377d1cb03a
8 changed files with 69 additions and 22 deletions

View File

@@ -0,0 +1,187 @@
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
export default function (pi: ExtensionAPI) {
// ── Anthropic via Langdock ──────────────────────────────────────────────
pi.registerProvider("anthropic", {
baseUrl: "https://api.langdock.com/anthropic/eu",
apiKey: "$LANGDOCK_API_KEY",
api: "anthropic-messages",
models: [
{
id: "claude-opus-4-8-default",
name: "Opus 4.8",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 32000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
{
id: "claude-sonnet-5-default",
name: "Sonnet 5",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 16384,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
{
id: "claude-opus-4-6-default",
name: "Opus 4.6",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 32000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
{
id: "claude-haiku-4-5-20251001",
name: "Haiku 4.5",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 16384,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
],
});
// ── OpenAI via Langdock ─────────────────────────────────────────────────
pi.registerProvider("openai", {
baseUrl: "https://api.langdock.com/openai/eu/v1",
apiKey: "$LANGDOCK_API_KEY",
api: "openai-completions",
models: [
{
id: "gpt-5.6-sol",
name: "GPT-5.6 Sol",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.6-terra",
name: "GPT-5.6 Terra",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.6-luna",
name: "GPT-5.6 Luna",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.5",
name: "GPT-5.5",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.4-mini",
name: "GPT-5.4 Mini",
reasoning: false,
input: ["text"],
contextWindow: 272000,
maxTokens: 16384,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
],
});
// ── Google via Langdock ─────────────────────────────────────────────────
// pi.registerProvider("google", {
// baseUrl: "https://api.langdock.com/google/eu/v1beta",
// apiKey: "$LANGDOCK_API_KEY",
// api: "google-generative-ai",
// models: [
// {
// id: "models/gemini-3.5-flash",
// name: "Gemini 3.5 Flash",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 1048576,
// maxTokens: 8192,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// {
// id: "models/gemini-2.5-flash",
// name: "Gemini 2.5 Flash",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 1048576,
// maxTokens: 8192,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// {
// id: "models/gemini-2.5-pro",
// name: "Gemini 2.5 Pro",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 2097152,
// maxTokens: 65536,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// ],
// });
// ── Hide unwanted built-in providers ────────────────────────────────────
const keep = new Set([
"openrouter",
]);
const hide = [
"ant-ling",
"azure-openai",
"azure-openai-responses",
"deepseek",
"nvidia-nim",
"google-vertex",
"amazon-bedrock",
"google",
"mistral",
"groq",
"cerebras",
"cloudflare-ai-gateway",
"cloudflare-workers-ai",
"xai",
"vercel-ai-gateway",
"zai-coding-plan-global",
"zai-coding-plan-china",
"opencode-zen",
"opencode-go",
"huggingface",
"fireworks",
"together-ai",
"kimi-for-coding",
"minimax",
"xiaomi-mimo",
"xiaomi-mimo-china",
"xiaomi-mimo-amsterdam",
"xiaomi-mimo-singapore",
];
for (const provider of hide) {
if (!keep.has(provider)) {
try {
pi.unregisterProvider(provider);
} catch {
// provider may not exist in this build
}
}
}
}