feat: add glm 5 to core (#9436)

* feat: add glm 5 to core

* test glm 5
This commit is contained in:
Ari Webb
2026-02-11 14:24:23 -08:00
committed by Caren Thomas
parent 7ec2783ded
commit d0e25ae471
7 changed files with 61 additions and 5 deletions

View File

@@ -252,8 +252,11 @@ LLM_MAX_CONTEXT_WINDOW = {
"deepseek-chat": 64000,
"deepseek-reasoner": 64000,
# glm (Z.AI)
"glm-4.6": 200000,
"glm-4.5": 128000,
"glm-4.6": 200000,
"glm-4.7": 200000,
"glm-5": 200000,
"glm-5-code": 200000,
## OpenAI models: https://platform.openai.com/docs/models/overview
# gpt-5
"gpt-5": 272000,

View File

@@ -17,7 +17,12 @@ from letta.settings import model_settings
def is_zai_reasoning_model(model_name: str) -> bool:
"""Check if the model is a ZAI reasoning model (GLM-4.5+)."""
return model_name.startswith("glm-4.5") or model_name.startswith("glm-4.6") or model_name.startswith("glm-4.7")
return (
model_name.startswith("glm-4.5")
or model_name.startswith("glm-4.6")
or model_name.startswith("glm-4.7")
or model_name.startswith("glm-5")
)
class ZAIClient(OpenAIClient):

View File

@@ -29290,6 +29290,36 @@
"supports_vision": true,
"supports_web_search": true
},
"zai/glm-5": {
"cache_creation_input_token_cost": 0,
"cache_read_input_token_cost": 2e-7,
"input_cost_per_token": 1e-6,
"output_cost_per_token": 3.2e-6,
"litellm_provider": "zai",
"max_input_tokens": 200000,
"max_output_tokens": 128000,
"mode": "chat",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"source": "https://docs.z.ai/guides/overview/pricing"
},
"zai/glm-5-code": {
"cache_creation_input_token_cost": 0,
"cache_read_input_token_cost": 3e-7,
"input_cost_per_token": 1.2e-6,
"output_cost_per_token": 5e-6,
"litellm_provider": "zai",
"max_input_tokens": 200000,
"max_output_tokens": 128000,
"mode": "chat",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"source": "https://docs.z.ai/guides/overview/pricing"
},
"zai/glm-4.7": {
"cache_creation_input_token_cost": 0,
"cache_read_input_token_cost": 1.1e-7,

View File

@@ -473,7 +473,10 @@ class LLMConfig(BaseModel):
@classmethod
def is_zai_reasoning_model(cls, config: "LLMConfig") -> bool:
return config.model_endpoint_type == "zai" and (
config.model.startswith("glm-4.5") or config.model.startswith("glm-4.6") or config.model.startswith("glm-4.7")
config.model.startswith("glm-4.5")
or config.model.startswith("glm-4.6")
or config.model.startswith("glm-4.7")
or config.model.startswith("glm-5")
)
@classmethod
@@ -499,7 +502,7 @@ class LLMConfig(BaseModel):
if "gemini" in model:
return True
# ZAI GLM reasoning models
if "glm-4.5" in model or "glm-4.6" in model or "glm-4.7" in model:
if "glm-4.5" in model or "glm-4.6" in model or "glm-4.7" in model or "glm-5" in model:
return True
# DeepSeek reasoning models
if "deepseek-r1" in model or "deepseek-reasoner" in model:

View File

@@ -16,6 +16,8 @@ MODEL_CONTEXT_WINDOWS = {
"glm-4.5": 128000,
"glm-4.6": 200000,
"glm-4.7": 200000,
"glm-5": 200000,
"glm-5-code": 200000,
}

View File

@@ -37,7 +37,7 @@ all_configs = [
"openai-gpt-5.json",
"claude-4-5-sonnet.json",
"gemini-2.5-pro.json",
"zai-glm-4.6.json",
"zai-glm-5.json",
]

View File

@@ -0,0 +1,13 @@
{
"handle": "zai/glm-5",
"model_settings": {
"provider_type": "zai",
"temperature": 1.0,
"max_output_tokens": 4096,
"parallel_tool_calls": false,
"thinking": {
"type": "enabled",
"clear_thinking": false
}
}
}