{"slug":"glm-4.5","name":"GLM 4.5","family":"zai","family_name":"Z.ai","developer":"Z.ai","color":"#12b5cb","status":"active","released":"2025-07-28","snapshot_of":null,"open":true,"context":131072,"max_output":98304,"knowledge_cutoff":"2025-04","modalities":["text"],"output_modalities":["text"],"reasoning":true,"tools":true,"structured_output":false,"huggingface":"zai-org/GLM-4.5","speed":46,"latency":1.83,"short":"GLM 4.5 is an open-weight text model from Z.ai, released July 2025, priced near the registry median. Its one benchmark result sits slightly below the median, and it has low popularity.","strengths":["Open weights, with tool calling and a reasoning mode","131k context window and 98k maximum response tokens","Blended price of $1 per million tokens, just below median","Served by two providers, Z.ai and OpenRouter"],"weaknesses":["LMArena text score 1430.3, 65th of 114, below median","Popularity rank 171 of 194","No structured output support; text input only"],"best_for":"Cost-conscious agents needing tool calling and reasoning on text tasks, where open weights are preferred.","long":"GLM 4.5 is an open-weight text model from Z.ai, released in July 2025. It supports tool calling and a reasoning mode, with a 131k context window and up to 98k response tokens. Its blended price of $1 per million tokens sits just below the registry median, with input at $0.60 and output at $2.20 per million tokens.\n\nIts only benchmark result is LMArena text, where it scores 1430.3, ranked 65th of 114 and just under the median of 1437.6. Its popularity ranks 171 of 194. It does not support structured output and accepts text input only. Z.ai and OpenRouter both provide it, and its knowledge cutoff is April 2025.","described":true,"gateway":false,"byok":true,"string":"zai:GLM-4.5","input":0.6,"output":2.2,"cache_read":0.11,"blended":1,"efficiency":null,"bench":{"lmarena":1430.3},"offers":[{"provider":"zai","name":"Z.ai","model_id":"GLM-4.5","api":["openai"],"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":null,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":"zai:GLM-4.5","gateway_string":null},{"provider":"openrouter","name":"OpenRouter","model_id":"z-ai/glm-4.5","api":["openai"],"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":131072,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":"openrouter:z-ai/glm-4.5","gateway_string":null}],"ranks":{"intelligence":null,"popularity":171,"efficiency":null,"speed":130,"price":91},"top_score":0.0452,"about":["GLM 4.5 is an open-weight text model from Z.ai, released July 2025, priced near the registry median. Its one benchmark result sits slightly below the median, and it has low popularity.","GLM 4.5 is an open-weight text model from Z.ai, released in July 2025. It supports tool calling and a reasoning mode, with a 131k context window and up to 98k response tokens. Its blended price of $1 per million tokens sits just below the registry median, with input at $0.60 and output at $2.20 per million tokens.","Its only benchmark result is LMArena text, where it scores 1430.3, ranked 65th of 114 and just under the median of 1437.6. Its popularity ranks 171 of 194. It does not support structured output and accepts text input only. Z.ai and OpenRouter both provide it, and its knowledge cutoff is April 2025."],"examples":[{"file":"hello.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['ZAI_API_KEY'] = '...'\n\nagent = Agent('zai:GLM-4.5', instructions='Be concise, reply with one sentence.')\n\nresult = agent.run_sync('Where does \"hello world\" come from?')\nprint(result.output)","soon":false},{"file":"structured_output.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent\n\nos.environ['ZAI_API_KEY'] = '...'\n\n\nclass CityLocation(BaseModel):\n    city: str\n    country: str\n\n\nagent = Agent('zai:GLM-4.5', output_type=CityLocation)\n\nresult = agent.run_sync('Where were the olympics held in 2012?')\nprint(result.output)\n#> city='London' country='United Kingdom'","soon":false},{"file":"tools.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\nimport random\n\nfrom pydantic_ai import Agent, RunContext\n\nos.environ['ZAI_API_KEY'] = '...'\n\nagent = Agent(\n    'zai:GLM-4.5',\n    deps_type=str,\n    instructions=\"You're a dice game, roll the die and see if it matches the user's guess.\",\n)\n\n\n@agent.tool_plain\ndef roll_dice() -> str:\n    \"\"\"Roll a six-sided die and return the result.\"\"\"\n    return str(random.randint(1, 6))\n\n\n@agent.tool\ndef get_player_name(ctx: RunContext[str]) -> str:\n    \"\"\"Get the player's name.\"\"\"\n    return ctx.deps\n\n\nresult = agent.run_sync('My guess is 4', deps='Anne')\nprint(result.output)","soon":false},{"file":"streaming.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport asyncio\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['ZAI_API_KEY'] = '...'\n\nagent = Agent('zai:GLM-4.5')\n\n\nasync def main():\n    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:\n        async for text in response.stream_text(delta=True):\n            print(text, end='', flush=True)\n\n\nasyncio.run(main())","soon":false},{"file":"pax.sh","lang":"sh","code":"export ZAI_API_KEY='...'\n\nuvx pax --model 'zai:GLM-4.5'","soon":true},{"file":"pi.sh","lang":"sh","code":"# npm install -g @earendil-works/pi-coding-agent\nexport ZAI_API_KEY='...'\n\npi --model 'zai/GLM-4.5'","soon":false},{"file":"ai_sdk.ts","lang":"ts","code":"// npm install ai @ai-sdk/openai-compatible\nimport { createOpenAICompatible } from '@ai-sdk/openai-compatible'\nimport { generateText } from 'ai'\n\nprocess.env.ZAI_API_KEY = '...'\n\nconst zai = createOpenAICompatible({\n  name: 'zai',\n  baseURL: 'https://api.zai.example/v1',\n  apiKey: process.env.ZAI_API_KEY,\n})\n\nconst { text } = await generateText({\n  model: zai('GLM-4.5'),\n  system: 'Be concise, reply with one sentence.',\n  prompt: 'Where does \"hello world\" come from?',\n})\nconsole.log(text)","soon":false}],"benchmarks":[{"id":"lmarena","name":"LMArena text","unit":"","desc":"Rating from blind human votes between pairs of chat responses","category":"preference","floor":1100,"ceiling":1600,"url":"https://lmarena.ai/leaderboard/text","credit":"LMArena (CC BY 4.0)"}],"generated":"2026-11-25","gaps":{"speed":3,"index":80,"description":0}}