Files
ragflow/conf/models/zhipu-ai.json
Panda Dev bf90c8948a Go: implement ListModels in ZhipuAI driver (#14886)
### What problem does this PR solve?

Fixes #14884

The ZhipuAI Go driver in `internal/entity/models/zhipu-ai.go` had a stub
`ListModels` method that always returned `"zhipu-ai, no such method"`.
The DeepSeek, Gitee, NVIDIA, OpenAI, SiliconFlow, and OpenRouter drivers
in the same package already implement `ListModels` against the
OpenAI-compatible `/models` endpoint, and the model picker UI relies on
it. This PR brings ZhipuAI in line with that pattern.

### Changes

- `internal/entity/models/zhipu-ai.go`: implement
`ZhipuAIModel.ListModels`.
  - Resolve region with default fallback.
- GET `${BaseURL[region]}/${URLSuffix.Models}` (resolves to
`https://open.bigmodel.cn/api/paas/v4/models` with the default region).
- Send `Authorization: Bearer <api_key>` when an API key is configured.
Omit the header when the key is empty, so an unauthenticated caller gets
a clear `401` from upstream.
- Surface non-200 responses with the upstream status line and body,
matching the other Go drivers.
- Parse the response via the package-level `DSModelList` / `DSModel`
types already used by DeepSeek, Gitee, and SiliconFlow.
- When the response includes `owned_by`, render the entry as
`id@owned_by`, matching the convention of Gitee and SiliconFlow.
- `conf/models/zhipu-ai.json`: add `"models": "models"` to `url_suffix`.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2026-05-13 16:39:14 +08:00

271 lines
4.7 KiB
JSON

{
"name": "ZHIPU-AI",
"url": {
"default": "https://open.bigmodel.cn/api/paas/v4"
},
"url_suffix": {
"chat": "chat/completions",
"async_chat": "async/chat/completions",
"async_result": "async-result",
"embedding": "embeddings",
"rerank": "rerank",
"files": "files",
"models": "models"
},
"class": "glm",
"models": [
{
"name": "glm-5",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-5-turbo",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-5v-turbo",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.7",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.7-flashx",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.6",
"max_tokens": 204800,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.6v-Flash",
"max_tokens": 131072,
"model_types": [
"chat",
"vision"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5",
"max_tokens": 131072,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5-x",
"max_tokens": 131072,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5-air",
"max_tokens": 131072,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5-airx",
"max_tokens": 131072,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5-flash",
"max_tokens": 131072,
"model_types": [
"chat"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4.5v",
"max_tokens": 64000,
"model_types": [
"vision"
],
"thinking": {
"default_value": true,
"clear_thinking": true
}
},
{
"name": "glm-4-plus",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4-0520",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4-airx",
"max_tokens": 8000,
"model_types": [
"chat"
]
},
{
"name": "glm-4-air",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4-flash",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4-flashx",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "glm-4-long",
"max_tokens": 1000000,
"model_types": [
"chat"
]
},
{
"name": "glm-4v",
"max_tokens": 2000,
"model_types": [
"vision"
]
},
{
"name": "glm-4-9b",
"max_tokens": 8192,
"model_types": [
"chat"
]
},
{
"name": "embedding-2",
"max_tokens": 512,
"model_types": [
"embedding"
]
},
{
"name": "embedding-3",
"max_tokens": 512,
"model_types": [
"embedding"
]
},
{
"name": "glm-asr-2512",
"max_tokens": 4096,
"model_types": [
"asr"
]
},
{
"name": "glm-tts",
"model_types": [
"tts"
]
},
{
"name": "glm-ocr",
"model_types": [
"ocr"
]
},
{
"name": "rerank",
"model_types": [
"rerank"
]
}
]
}