char-slop/ai-dots
ai dotfiles
git clone https://git.t4t.associates/char-slop/ai-dots
ff9e5cc
main
1import type { 2ExtensionAPI , 3ProviderModelConfig , 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 = { 15api :"anthropic-messages" as const , 16baseUrl :anthropicUrl , 17reasoning :true , 18input :[ "text" ] as ProviderModelConfig [ "input" ], 19 cost, 20maxTokens :65_536 , 21thinkingLevelMap :{ off :null }, 22compat :{ thinkingFormat :"qwen" as const }, 23}; 24 25const deepseekModel = { 26 ...anthropicModel , 27api :"openai-completions" as const , 28baseUrl :openaiUrl , 29maxTokens :393_216 , 30compat :{ 31supportsStore :false , 32supportsDeveloperRole :false , 33supportsReasoningEffort :false , 34maxTokensField :"max_tokens" as const , 35thinkingFormat :"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 , 49name :"Qwen 3.7 Plus" , 50input :[ "text" , "image" ], 51contextWindow :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 , 62name :"GLM 5.2" , 63contextWindow :1_048_576 , 64maxTokens :131_072 , 65}, 66], 67[ 68"deepseek-v4-pro" , 69{ 70 ...deepseekModel , 71name :"DeepSeek V4 Pro" , 72contextWindow :1_000_000 , 73}, 74], 75[ 76"deepseek-v4-flash-0731" , 77{ 78 ...deepseekModel , 79name :"DeepSeek V4 Flash 0731" , 80contextWindow :1_048_576 , 81}, 82], 83[ 84"qwen3.8-max" , 85{ 86 ...anthropicModel , 87name :"Qwen 3.8 Max" , 88input :[ "text" , "image" ], 89contextWindow :1_000_000 , 90maxTokens :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 , 101name :"DeepSeek V4 Pro 0813" , 102contextWindow :1_048_576 , 103}, 104], 105]); 106 107export default function ( pi :ExtensionAPI ) { 108pi . registerProvider ( "alibaba-plan" , { 109name :"Alibaba Model Studio Plan" , 110baseUrl :anthropicUrl , 111api :"anthropic-messages" , 112apiKey :"$ALIBABA_API_KEY" , 113authHeader :true , 114models :[ ...MODELS ]. map (([ id , model ]) => ({ id, ...model })), 115}); 116}