{"slug":"glm-4.7","name":"GLM 4.7","family":"zai","family_name":"Z.ai","developer":"Z.ai","color":"#12b5cb","status":"active","released":"2025-12-22","snapshot_of":null,"open":true,"context":200000,"max_output":131072,"knowledge_cutoff":"2025-04","modalities":["text"],"output_modalities":["text"],"reasoning":true,"tools":true,"structured_output":true,"huggingface":"zai-org/GLM-4.7","speed":11,"latency":2.96,"short":"An open-weights text model from Z.ai, priced at $1 per million blended tokens, with a 200k context window. Its benchmark scores sit mostly below the registry median.","strengths":["Open weights with a 200k context window and 131k maximum response","Blended price of $1 per million tokens, just under the registry median","Supports tool calling, reasoning mode and structured output","Four providers, including Z.ai, Zhipu AI, Novita and OpenRouter"],"weaknesses":["Intelligence index 53.5, 76th of 114 and below the 59.5 median","OTIS Mock AIME 83.3%, 78th of 95 against a 94.2% median","Terminal-Bench 33.4%, 25th of 35 against a 43.2% median"],"best_for":"Cost-sensitive agents needing open weights, long context and tool calling, where top benchmark scores are not required.","long":"GLM 4.7 is an open-weights text model from Z.ai, released in December 2025. It accepts text only and offers a 200k token context window with up to 131k tokens in a response. It supports tool calling, reasoning mode and structured output, and it is available from four providers, though it is not built into the Pydantic AI Gateway.\n\nOn the registry's composite intelligence index it scores 53.5, placing 76th of 114 and below the median of 59.5. Individual results follow the same pattern. It scores 83.3% on GPQA Diamond, 73rd of 94, and 83.3% on OTIS Mock AIME, 78th of 95. Its SimpleQA Verified and SciCode results also fall in the lower part of the table. Its LMArena text rating is close to the median, at 60th of 114.\n\nPricing is its clearest advantage. Input costs $0.60 and output costs $2.20 per million tokens, for a blended price of $1, just under the registry median. Its efficiency rank is 42nd of 194, which reflects that price against its intelligence score.","described":true,"gateway":false,"byok":true,"string":"zai:GLM-4.7","input":0.6,"output":2.2,"cache_read":0.11,"blended":1,"efficiency":53.5,"bench":{"index":53.5,"gpqa":83.3,"aime":83.3,"simpleqa":32.2,"terminal":33.4,"scicode":45.1,"webdev":1434.7,"lmarena":1435.4,"eci":143.3},"offers":[{"provider":"zai","name":"Z.ai","model_id":"GLM-4.7","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.7","gateway_string":null},{"provider":"zhipuai","name":"Zhipu AI","model_id":"GLM-4.7","api":["openai"],"input":0.276,"output":1.103,"cache_read":0.055,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":200000,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":null,"gateway_string":null},{"provider":"novita","name":"Novita","model_id":"zai-org/glm-4.7","api":["openai"],"input":0.6,"output":2.2,"cache_read":0.11,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":204800,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":null,"gateway_string":null},{"provider":"openrouter","name":"OpenRouter","model_id":"z-ai/glm-4.7","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":"openrouter:z-ai/glm-4.7","gateway_string":null}],"ranks":{"intelligence":73,"popularity":96,"efficiency":42,"speed":184,"price":91},"top_score":0.5971,"about":["An open-weights text model from Z.ai, priced at $1 per million blended tokens, with a 200k context window. Its benchmark scores sit mostly below the registry median.","GLM 4.7 is an open-weights text model from Z.ai, released in December 2025. It accepts text only and offers a 200k token context window with up to 131k tokens in a response. It supports tool calling, reasoning mode and structured output, and it is available from four providers, though it is not built into the Pydantic AI Gateway.","On the registry's composite intelligence index it scores 53.5, placing 76th of 114 and below the median of 59.5. Individual results follow the same pattern. It scores 83.3% on GPQA Diamond, 73rd of 94, and 83.3% on OTIS Mock AIME, 78th of 95. Its SimpleQA Verified and SciCode results also fall in the lower part of the table. Its LMArena text rating is close to the median, at 60th of 114.","Pricing is its clearest advantage. Input costs $0.60 and output costs $2.20 per million tokens, for a blended price of $1, just under the registry median. Its efficiency rank is 42nd of 194, which reflects that price against its intelligence score."],"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.7', 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.7', 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.7',\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.7')\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.7'","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.7'","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.7'),\n  system: 'Be concise, reply with one sentence.',\n  prompt: 'Where does \"hello world\" come from?',\n})\nconsole.log(text)","soon":false}],"benchmarks":[{"id":"index","name":"Intelligence index","unit":"","desc":"Our composite of the benchmarks below, 0-100","category":"reference","floor":0,"ceiling":100,"url":"/methodology/","credit":"Pydantic, from the sources credited below"},{"id":"gpqa","name":"GPQA Diamond","unit":"%","desc":"Graduate-level science questions, multiple choice","category":"reasoning","floor":25,"ceiling":97,"url":"https://epoch.ai/benchmarks/gpqa-diamond","credit":"Epoch AI (CC BY 4.0)"},{"id":"aime","name":"OTIS Mock AIME","unit":"%","desc":"Competition mathematics problems with exact answers","category":"reasoning","floor":0,"ceiling":100,"url":"https://epoch.ai/benchmarks/otis-mock-aime-2024-2025","credit":"Epoch AI (CC BY 4.0)"},{"id":"simpleqa","name":"SimpleQA Verified","unit":"%","desc":"Short factual questions answered from memory, without search","category":"reasoning","floor":0,"ceiling":100,"url":"https://epoch.ai/benchmarks/simpleqa-verified","credit":"Epoch AI (CC BY 4.0)"},{"id":"terminal","name":"Terminal-Bench","unit":"%","desc":"Tasks completed in a terminal; the best result of any agent using the model","category":"coding","floor":0,"ceiling":100,"url":"https://www.tbench.ai/leaderboard/terminal-bench/2.0","credit":"Terminal-Bench, via Epoch AI (CC BY 4.0)"},{"id":"scicode","name":"SciCode","unit":"%","desc":"Scientific programming problems written by researchers","category":"coding","floor":0,"ceiling":100,"url":"https://scicode-bench.github.io/","credit":"SciCode, via Epoch AI (CC BY 4.0)"},{"id":"webdev","name":"WebDev Arena","unit":"","desc":"Rating from human votes on web apps the models built","category":"coding","floor":1000,"ceiling":1900,"url":"https://web.lmarena.ai/leaderboard","credit":"LMArena, via Epoch AI (CC BY 4.0)"},{"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)"},{"id":"eci","name":"Epoch Capabilities Index","unit":"","desc":"Epoch AI's own composite across about 40 benchmarks; shown for comparison, not part of our index","category":"reference","floor":80,"ceiling":180,"url":"https://epoch.ai/benchmarks/eci","credit":"Epoch AI (CC BY 4.0)"}],"generated":"2026-11-25","gaps":{"speed":3,"index":80,"description":0}}