mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 05:02:14 +00:00
Migrate zai provider from Anthropic to OpenAI-compatible API
- Migrate glm-4.5, glm-4.5-air, glm-4.5-flash, glm-4.6, glm-4.7 from anthropic-messages to openai-completions API - Updated baseUrl from https://api.z.ai/api/anthropic to https://api.z.ai/api/coding/paas/v4 - Added compat setting to disable developer role for zai models - Filter empty text blocks in openai-completions to avoid zai API validation errors - Fixed zai provider tests to use OpenAI-style options (reasoningEffort)
This commit is contained in:
parent
65fb9116fb
commit
0250b7ac03
4 changed files with 34 additions and 29 deletions
|
|
@ -258,7 +258,7 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
}
|
||||
}
|
||||
|
||||
// Process xAi models
|
||||
// Process zAi models
|
||||
if (data.zai?.models) {
|
||||
for (const [modelId, model] of Object.entries(data.zai.models)) {
|
||||
const m = model as ModelsDevModel;
|
||||
|
|
@ -268,9 +268,9 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
models.push({
|
||||
id: modelId,
|
||||
name: m.name || modelId,
|
||||
api: supportsImage ? "openai-completions" : "anthropic-messages",
|
||||
api: "openai-completions",
|
||||
provider: "zai",
|
||||
baseUrl: supportsImage ? "https://api.z.ai/api/coding/paas/v4" : "https://api.z.ai/api/anthropic",
|
||||
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
||||
reasoning: m.reasoning === true,
|
||||
input: supportsImage ? ["text", "image"] : ["text"],
|
||||
cost: {
|
||||
|
|
@ -279,11 +279,9 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
cacheRead: m.cost?.cache_read || 0,
|
||||
cacheWrite: m.cost?.cache_write || 0,
|
||||
},
|
||||
...(supportsImage ? {
|
||||
compat: {
|
||||
supportsDeveloperRole: false,
|
||||
},
|
||||
} : {}),
|
||||
compat: {
|
||||
supportsDeveloperRole: false,
|
||||
},
|
||||
contextWindow: m.limit?.context || 4096,
|
||||
maxTokens: m.limit?.output || 4096,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue