Add GLM-5.2 support (#9967)

Co-authored-by: Douwe M Osinga <douwe@sidewalklabs.com>
This commit is contained in:
SynthLuvr
2026-06-25 18:59:16 +02:00
committed by GitHub
parent 9c96bd7ebc
commit 37d93ceaca
6 changed files with 14 additions and 50 deletions
@@ -890,31 +890,6 @@ mod tests {
assert!(!config.preserves_thinking);
}
#[test]
fn test_zai_json_deserializes() {
let json = include_str!("../providers/declarative/zai.json");
let config: DeclarativeProviderConfig =
serde_json::from_str(json).expect("zai.json should parse");
assert_eq!(config.name, "zai");
assert_eq!(config.display_name, "Z.AI");
assert!(matches!(config.engine, ProviderEngine::Anthropic));
assert_eq!(config.api_key_env, "ZHIPU_API_KEY");
assert_eq!(config.base_url, "${ZAI_BASE_URL}");
assert_eq!(config.catalog_provider_id, Some("zai".to_string()));
assert_eq!(config.fast_model, Some("glm-4.5-air".to_string()));
assert!(config.preserves_thinking);
assert_eq!(config.supports_streaming, Some(true));
assert_eq!(config.models[0].name, "glm-5.1");
let env_vars = config.env_vars.as_ref().expect("env_vars should be set");
assert_eq!(env_vars.len(), 1);
assert_eq!(env_vars[0].name, "ZAI_BASE_URL");
assert_eq!(
env_vars[0].default,
Some("https://api.z.ai/api/anthropic".to_string())
);
}
#[test]
fn test_openai_reasoning_provider_json_preserves_thinking() {
for (name, json) in [
@@ -973,28 +948,6 @@ mod tests {
assert_eq!(config.models[0].context_limit, 131072);
}
#[test]
fn test_nearai_json_deserializes() {
let json = include_str!("../providers/declarative/nearai.json");
let config: DeclarativeProviderConfig =
serde_json::from_str(json).expect("nearai.json should parse");
assert_eq!(config.name, "nearai");
assert_eq!(config.display_name, "NEAR AI Cloud");
assert!(matches!(config.engine, ProviderEngine::OpenAI));
assert_eq!(config.api_key_env, "NEARAI_API_KEY");
assert_eq!(config.base_url, "https://cloud-api.near.ai/v1");
assert_eq!(config.catalog_provider_id, Some("nearai".to_string()));
assert_eq!(config.dynamic_models, Some(true));
assert_eq!(config.supports_streaming, Some(true));
assert!(config.preserves_thinking);
assert_eq!(
config.model_doc_link,
Some("https://docs.near.ai/".to_string())
);
assert_eq!(config.models[0].name, "zai-org/GLM-5.1-FP8");
assert!(config.models[0].reasoning);
}
#[test]
fn test_vercel_ai_gateway_json_deserializes() {
let json = include_str!("../providers/declarative/vercel_ai_gateway.json");
@@ -8,6 +8,11 @@
"catalog_provider_id": "nearai",
"dynamic_models": true,
"models": [
{
"name": "zai-org/GLM-5.2",
"context_limit": 1000000,
"reasoning": true
},
{
"name": "zai-org/GLM-5.1-FP8",
"context_limit": 202752,
@@ -17,6 +17,11 @@
"context_limit": 204800,
"max_tokens": 131072
},
{
"name": "zai-org/glm-5.2",
"context_limit": 1000000,
"max_tokens": 131072
},
{
"name": "zai-org/glm-5.1",
"context_limit": 204800,
@@ -19,6 +19,7 @@
"fast_model": "glm-4.5-air",
"preserves_thinking": true,
"models": [
{"name": "glm-5.2", "context_limit": 1000000},
{"name": "glm-5.1", "context_limit": 200000},
{"name": "glm-5", "context_limit": 204800},
{"name": "glm-5-turbo", "context_limit": 200000},
@@ -11,7 +11,7 @@
"required": false,
"secret": false,
"default": "https://open.bigmodel.cn/api/paas/v4",
"description": "Zhipu API base URL. Change to https://open.bigmodel.cn/api/coding/paas/v4 for Coding Plan models like GLM-5.1."
"description": "Zhipu API base URL. Change to https://open.bigmodel.cn/api/coding/paas/v4 for Coding Plan models like GLM-5.2."
}
],
"catalog_provider_id": "zhipuai",
@@ -22,7 +22,8 @@
{"name": "glm-4.6", "context_limit": 204800},
{"name": "glm-4.7", "context_limit": 204800},
{"name": "glm-4.7-flash", "context_limit": 200000},
{"name": "glm-5", "context_limit": 204800}
{"name": "glm-5", "context_limit": 204800},
{"name": "glm-5.2", "context_limit": 1000000, "reasoning": true}
],
"preserves_thinking": true,
"supports_streaming": true
-1
View File
@@ -369,7 +369,6 @@ mod tests {
assert_eq!(nearai.provider_type(), ProviderType::Declarative);
assert!(nearai.supports_inventory_refresh());
assert_eq!(meta.display_name, "NEAR AI Cloud");
assert_eq!(meta.default_model, "zai-org/GLM-5.1-FP8");
assert_eq!(meta.model_doc_link, "https://docs.near.ai/");
assert!(!meta.setup_steps.is_empty());