char-slop/ai-dots

ai dotfiles

git clone https://git.t4t.associates/char-slop/ai-dots

Charlotte Somalibaba: add qwen flashff9e5cc

main
2.6 KiB116 linesraw
1import type {
2  ExtensionAPI,
3  ProviderModelConfig,
4} from "@earendil-works/pi-coding-agent";
5
6const anthropicUrl =
7  "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic";
8const openaiUrl =
9  "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
10const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
11
12type ModelConfig = Omit<ProviderModelConfig, "id">;
13
14const anthropicModel = {
15  api: "anthropic-messages" as const,
16  baseUrl: anthropicUrl,
17  reasoning: true,
18  input: ["text"] as ProviderModelConfig["input"],
19  cost,
20  maxTokens: 65_536,
21  thinkingLevelMap: { off: null },
22  compat: { thinkingFormat: "qwen" as const },
23};
24
25const deepseekModel = {
26  ...anthropicModel,
27  api: "openai-completions" as const,
28  baseUrl: openaiUrl,
29  maxTokens: 393_216,
30  compat: {
31    supportsStore: false,
32    supportsDeveloperRole: false,
33    supportsReasoningEffort: false,
34    maxTokensField: "max_tokens" as const,
35    thinkingFormat: "qwen" as const,
36  },
37};
38
39// Coding Plan does not expose a model-catalog API.
40const MODELS = new Map<string, ModelConfig>([
41  [
42    "qwen3.7-max",
43    { ...anthropicModel, name: "Qwen 3.7 Max", contextWindow: 1_000_000 },
44  ],
45  [
46    "qwen3.7-plus",
47    {
48      ...anthropicModel,
49      name: "Qwen 3.7 Plus",
50      input: ["text", "image"],
51      contextWindow: 1_000_000,
52    },
53  ],
54  [
55    "qwen3.6-flash",
56    { ...anthropicModel, name: "Qwen 3.6 Flash", contextWindow: 1_000_000 },
57  ],
58  [
59    "glm-5.2",
60    {
61      ...anthropicModel,
62      name: "GLM 5.2",
63      contextWindow: 1_048_576,
64      maxTokens: 131_072,
65    },
66  ],
67  [
68    "deepseek-v4-pro",
69    {
70      ...deepseekModel,
71      name: "DeepSeek V4 Pro",
72      contextWindow: 1_000_000,
73    },
74  ],
75  [
76    "deepseek-v4-flash-0731",
77    {
78      ...deepseekModel,
79      name: "DeepSeek V4 Flash 0731",
80      contextWindow: 1_048_576,
81    },
82  ],
83  [
84    "qwen3.8-max",
85    {
86      ...anthropicModel,
87      name: "Qwen 3.8 Max",
88      input: ["text", "image"],
89      contextWindow: 1_000_000,
90      maxTokens: 131_072,
91    },
92  ],
93  [
94    "qwen3.8-flash",
95    { ...anthropicModel, name: "Qwen 3.8 Flash", contextWindow: 1_000_000 },
96  ],
97  [
98    "deepseek-v4-pro-0813",
99    {
100      ...deepseekModel,
101      name: "DeepSeek V4 Pro 0813",
102      contextWindow: 1_048_576,
103    },
104  ],
105]);
106
107export default function (pi: ExtensionAPI) {
108  pi.registerProvider("alibaba-plan", {
109    name: "Alibaba Model Studio Plan",
110    baseUrl: anthropicUrl,
111    api: "anthropic-messages",
112    apiKey: "$ALIBABA_API_KEY",
113    authHeader: true,
114    models: [...MODELS].map(([id, model]) => ({ id, ...model })),
115  });
116}