Add z.ai/GLM provider via per-process Claude CLI env injection
Route glm:-prefixed models through the CLI/Anthropic path: ResolveModelId strips the glm: prefix, and CreateCliStartInfo activates the z.ai Anthropic-compatible endpoint (ANTHROPIC_BASE_URL/AUTH_TOKEN) only for that process when IsZaiModel matches, leaving every other request's OAuth login untouched. GLM model list is loaded through the existing model cache and exposed via /api/models/glm with a "GLM (z.ai)" optgroup in the agent form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
e6770bb5f8
commit
0f3d658fd3
8 files changed
+83
-9
No files matched your search
@@ -52,6 +52,12 @@ Nur deine finale Text-Antwort wird weiterverwendet. Formuliere sie vollständig
|
||||
// OpenAI-kompatible Provider werden unverändert durchgereicht (Format: "provider:model")
|
||||
if (OpenAiService.IsOpenAiProvider(model)) return model;
|
||||
|
||||
// z.ai / GLM laufen über den Anthropic-kompatiblen Claude-CLI-Pfad (NICHT über den
|
||||
// OpenAI-Provider). Prefix strippen → die rohe Modell-ID (z.B. "glm-4.6") geht an --model,
|
||||
// und das Routing erkennt Provider="" → CLI. Die z.ai-Env-Vars setzt ClaudeCliService.
|
||||
if (!string.IsNullOrEmpty(model) && model.StartsWith("glm:", System.StringComparison.OrdinalIgnoreCase))
|
||||
return model.Substring(4);
|
||||
|
||||
// Defensiv-Strip: alte "[1m]"-Suffixe aus DB transparent normalisieren.
|
||||
// 1M-Context ist seit März 2026 Default bei Opus 4.6/4.7/4.8 + Sonnet 4.6 – kein Suffix mehr nötig.
|
||||
if (!string.IsNullOrEmpty(model) && model.Contains("[1m]"))
|
||||
|
||||
Reference in new issue
Block a user