GLM 5.4 API
Z.ai's GLM for coding and long-context reasoning.
On this page
GLM 5.4 API pricing
Pay per token from prepaid credits. No subscription.
| Token type | RouterHub |
|---|---|
| Input | $0.30 |
| Output | $0.9429 |
| Cached input | $0.05571 |
Compatible with the tools you already use
One key, one base URL. OpenAI and Anthropic compatible.
GLM 5.4 uses Chat Completions. See the tools that support this model.
Start for free
Plus up to $5 bonus credit on your first top-up.
Context window and API compatibility
GLM 5.4 uses the OpenAI-compatible Chat Completions API over POST /v1/chat/completions and has a context window of 1,000,000 tokens. Use model ID glm-5.4 in requests.
- Exact model ID
glm-5.4- Provider
- Z.ai
- Variant
- Standard
- Supported API
- OpenAI-compatible Chat Completions API (
/v1/chat/completions) - Availability
- Preview
- Context window
- 1,000,000 tokens
- Maximum input
- Not published
- Maximum output
- 128,000 tokens
- Input types
- text
- Coding tools
- OpenCode, VS Code + Continue, VS Code + Cline, Hermes Agent
Make your first API request
Set ROUTERHUB_API_KEY locally, then send a request with the exact model ID below.
curl --connect-timeout 30 --max-time 600 https://routerhub.si/v1/chat/completions \
-H "Authorization: Bearer $ROUTERHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.4","messages":[{"role":"user","content":"Write a short noir scene set in a lighthouse."}],"max_tokens":256}'Python: install openai with pip. This example requests 256 output tokens and disables automatic retries. Check Usage before resending a paid request.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ROUTERHUB_API_KEY"],
base_url="https://routerhub.si/v1",
timeout=600.0,
max_retries=0,
)
response = client.chat.completions.create(
model="glm-5.4",
messages=[{"role": "user", "content": "Write a short noir scene set in a lighthouse."}],
max_tokens=256,
)
print(response.choices[0].message.content)Compare GLM 5.4 variants
| Model / exact API ID | Input / 1M | Output / 1M | Actions |
|---|---|---|---|
glm-5.4 |
$0.30 | $0.94 | Chat |
glm-5.4-uncensored |
$0.40 | $1.26 | Chat |
Common questions
What is GLM 5.4?
GLM 5.4 is a Z.ai language model served through RouterHub using the OpenAI-compatible Chat Completions API. Its exact API model ID is glm-5.4.
How much does GLM 5.4 cost?
RouterHub charges $0.30 input, $0.05571 cached input and $0.9429 output per million tokens (prices as of 2026-11-22). A typical chat message of about 1,000 input and 500 output tokens costs about 0.077¢. Usage is billed against your prepaid balance.
What is the GLM 5.4 context window?
Context window: 1,000,000 tokens. Maximum input: Not published. Maximum output: 128,000 tokens.
Which API does GLM 5.4 support?
Use the OpenAI-compatible Chat Completions API at https://routerhub.si/v1/chat/completions with the exact model ID glm-5.4 and your RouterHub API key (Authorization: Bearer header).
Which coding tools work with GLM 5.4?
OpenCode, VS Code + Continue, VS Code + Cline, Hermes Agent. These tools support this model’s Chat Completions endpoint with the configurations in their setup guides.
Can I try GLM 5.4 for free?
GLM 5.4 needs a free RouterHub account with prepaid credits. New accounts get $5 free on their first top-up of $20 or more.
Related models and guides
- GLM API pricing and setupGuide
- GLM uncensored modelsGuide
- GLM 5.3$0.15 / $0.47 per 1M tokens
- GLM 5.3 Uncensored$0.20 / $0.63 per 1M tokens
- GLM 5.3 Abliterated$0.40 / $1.33 per 1M tokens
- GLM 5.3 Flash$0.10 / $0.33 per 1M tokens
- GLM 5.3 Flash Uncensored$0.15 / $0.50 per 1M tokens
- GLM 5.3 Flash Abliterated$0.30 / $1.00 per 1M tokens
- All models and prices44 models