From b71bece170121756d03435e48057bf48b258bebc Mon Sep 17 00:00:00 2001 From: adisusilayasa <3523adisusilayasa@gmail.com> Date: Thu, 19 Mar 2026 03:35:34 +0800 Subject: [PATCH] fix(provider): add reviewer-requested fixes for Alibaba Coding Plan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add qwen-international, dashscope-intl, dashscope-us aliases to switch case - Add coding-plan-anthropic case with anthropicmessages.NewProviderWithTimeout - Add alibaba-coding-anthropic -> coding-plan-anthropic normalization - Add qwen-international -> qwen-intl and dashscope-us -> qwen-us normalization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pkg/providers/factory_provider.go | 19 +++++++++++++++++-- pkg/providers/model_ref.go | 6 ++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pkg/providers/factory_provider.go b/pkg/providers/factory_provider.go index b9796ac4b..a7fef8f5b 100644 --- a/pkg/providers/factory_provider.go +++ b/pkg/providers/factory_provider.go @@ -115,8 +115,8 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err case "litellm", "openrouter", "groq", "zhipu", "gemini", "nvidia", "ollama", "moonshot", "shengsuanyun", "deepseek", "cerebras", - "vivgrid", "volcengine", "vllm", "qwen", "qwen-intl", "qwen-us", - "mistral", "avian", "minimax", "longcat", "modelscope", "novita", + "vivgrid", "volcengine", "vllm", "qwen", "qwen-intl", "qwen-international", "dashscope-intl", + "qwen-us", "dashscope-us", "mistral", "avian", "minimax", "longcat", "modelscope", "novita", "coding-plan", "alibaba-coding", "qwen-coding": // All other OpenAI-compatible HTTP providers if cfg.APIKey == "" && cfg.APIBase == "" { @@ -174,6 +174,21 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err cfg.RequestTimeout, ), modelID, nil + case "coding-plan-anthropic", "alibaba-coding-anthropic": + // Alibaba Coding Plan with Anthropic-compatible API + apiBase := cfg.APIBase + if apiBase == "" { + apiBase = getDefaultAPIBase(protocol) + } + if cfg.APIKey == "" { + return nil, "", fmt.Errorf("api_key is required for %q protocol (model: %s)", protocol, cfg.Model) + } + return anthropicmessages.NewProviderWithTimeout( + cfg.APIKey, + apiBase, + cfg.RequestTimeout, + ), modelID, nil + case "antigravity": return NewAntigravityProvider(), modelID, nil diff --git a/pkg/providers/model_ref.go b/pkg/providers/model_ref.go index 259d46459..be9f63bc6 100644 --- a/pkg/providers/model_ref.go +++ b/pkg/providers/model_ref.go @@ -55,6 +55,12 @@ func NormalizeProvider(provider string) string { return "gemini" case "alibaba-coding", "qwen-coding": return "coding-plan" + case "alibaba-coding-anthropic": + return "coding-plan-anthropic" + case "qwen-international", "dashscope-intl": + return "qwen-intl" + case "dashscope-us": + return "qwen-us" } return p