Adds DeepSeek and Qwen presets to both endpoint protocols: OpenAI-compatible (api.deepseek.com, dashscope-intl compatible-mode/v1) and Anthropic-compatible (api.deepseek.com/anthropic, dashscope-intl apps/anthropic). Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -308,12 +308,18 @@ pub const OPENAI_PRESETS: &[ApiPreset] = &[
|
||||
ApiPreset { name: "Mistral AI", base_url: "https://api.mistral.ai/v1" },
|
||||
ApiPreset { name: "Mammouth AI", base_url: "https://api.mammouth.ai/v1" },
|
||||
ApiPreset { name: "OpenCode Go", base_url: "https://opencode.ai/zen/go/v1" },
|
||||
ApiPreset { name: "DeepSeek", base_url: "https://api.deepseek.com" },
|
||||
ApiPreset { name: "Qwen", base_url: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1" },
|
||||
ApiPreset { name: "OpenRouter", base_url: "https://openrouter.ai/api/v1" },
|
||||
];
|
||||
|
||||
/// Anthropic-compatible endpoints people use. The base URL is the one their documentation calls
|
||||
/// `ANTHROPIC_BASE_URL`: the `/v1` is added where needed.
|
||||
pub const ANTHROPIC_PRESETS: &[ApiPreset] = &[ApiPreset { name: "Anthropic", base_url: "https://api.anthropic.com/v1" }];
|
||||
pub const ANTHROPIC_PRESETS: &[ApiPreset] = &[
|
||||
ApiPreset { name: "Anthropic", base_url: "https://api.anthropic.com/v1" },
|
||||
ApiPreset { name: "DeepSeek", base_url: "https://api.deepseek.com/anthropic" },
|
||||
ApiPreset { name: "Qwen", base_url: "https://dashscope-intl.aliyuncs.com/apps/anthropic" },
|
||||
];
|
||||
|
||||
/// The presets offered for an endpoint protocol.
|
||||
pub fn presets(protocol: Protocol) -> &'static [ApiPreset] {
|
||||
@@ -470,6 +476,12 @@ mod tests {
|
||||
assert!(presets(Protocol::OpenAi).iter().any(|p| p.name == "Mammouth AI" && key_safe_for(p.base_url)));
|
||||
assert!(presets(Protocol::OpenAi).iter().any(|p| p.name == "Mistral AI" && p.base_url == "https://api.mistral.ai/v1"));
|
||||
assert!(presets(Protocol::Anthropic).iter().any(|p| p.base_url == "https://api.anthropic.com/v1"));
|
||||
for name in ["DeepSeek", "Qwen"] {
|
||||
assert!(presets(Protocol::OpenAi).iter().any(|p| p.name == name), "OpenAI-compatible preset for {name}");
|
||||
assert!(presets(Protocol::Anthropic).iter().any(|p| p.name == name), "Anthropic-compatible preset for {name}");
|
||||
}
|
||||
assert!(presets(Protocol::Anthropic).iter().any(|p| p.base_url == "https://api.deepseek.com/anthropic"));
|
||||
assert!(presets(Protocol::Anthropic).iter().any(|p| p.base_url == "https://dashscope-intl.aliyuncs.com/apps/anthropic"));
|
||||
}
|
||||
|
||||
/// The first preset is the one an Add dialog opens with, and the one taken for Ollama.
|
||||
|
||||
+4
-2
@@ -291,7 +291,8 @@ Grok Build also supports `XAI_API_KEY` for users who choose API authentication.
|
||||
- **OpenAI-compatible API:** a preset (Ollama `http://localhost:11434/v1`, LM Studio
|
||||
`http://localhost:1234/v1`, OpenClaw `http://localhost:18789/v1`, OpenAI, Mistral AI
|
||||
`https://api.mistral.ai/v1`, Mammouth AI `https://api.mammouth.ai/v1`,
|
||||
OpenCode Go `https://opencode.ai/zen/go/v1`, OpenRouter
|
||||
OpenCode Go `https://opencode.ai/zen/go/v1`, DeepSeek `https://api.deepseek.com`,
|
||||
Qwen `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`, OpenRouter
|
||||
`https://openrouter.ai/api/v1`) or a custom URL, the model name, and an optional key.
|
||||
OpenCode Go models are routed to their endpoint by themselves (`/responses`,
|
||||
`/messages` or Gemini for those families, `/chat/completions` for the rest),
|
||||
@@ -301,7 +302,8 @@ Grok Build also supports `XAI_API_KEY` for users who choose API authentication.
|
||||
the mismatch.
|
||||
For OpenClaw, turn on its chat endpoint (`gateway.http.endpoints.chatCompletions.enabled` in its
|
||||
config) and use its gateway token as the key; the models it lists are its agents, such as `openclaw/default`.
|
||||
- **Anthropic-compatible API:** a preset (Anthropic) or a custom URL, for an endpoint that
|
||||
- **Anthropic-compatible API:** a preset (Anthropic, DeepSeek `https://api.deepseek.com/anthropic`,
|
||||
Qwen `https://dashscope-intl.aliyuncs.com/apps/anthropic`) or a custom URL, for an endpoint that
|
||||
speaks the Anthropic Messages API (`{base}/v1/messages`). This covers Anthropic itself and
|
||||
providers that offer an Anthropic-compatible endpoint, such as DeepSeek and Qwen.
|
||||
- The **Model** picker lists the endpoint's models, without a key where the endpoint allows that
|
||||
|
||||
Reference in New Issue
Block a user