Notice: MAI Image 2.7 launch limited-time 20% off, covering the full text-to-image and image editing lineup, try it now
Notice: MAGI 2 launch limited-time 20% off, covering text-to-video, image-to-video, and reference-to-video across the board. Try it now
Notice: Seed Audio 1.5 launch limited-time 20% off, covering text-to-audio, video dubbing, audio track separation, and video translation across the board. Try it now
Notice: HeyGen Avatar 6 Turbo is 20% off for a limited time, and all three video pipelines are eligible.Try it now
Notice: Midjourney Niji 8 is now available, 20% off · Create now
Notice: Hunyuan Image 3.0 launch limited-time 20% off, for both text-to-image and instruction-based editing · Try it now
Announcement 1 of 6
Blog

Tutorial

5 GLM 5.4 Use Cases for Developers: From Large Codebases to 3D

Dec 2, 2026 3 min read
Stepped stack of flat sheets on a cream background, graphite gray with a single terracotta sheet.
Model
glm-5.4
On this page

Use cases that follow from the model

GLM 5.4 is the flagship model from Z.ai (Zhipu) for complex coding and long-horizon reasoning. It has a 1M-token context window and up to 128K output tokens, and thinking is always on; on HiAPI it currently accepts text input and returns text. It uses a Loop Transformer design that reuses the 28 layers of the GLM-5 base model and runs them twice, without adding parameters.

Each of the five use cases below builds on those traits and explains what to give the model and how to check the result.

A long band of cream paper layers folding back on itself, with one terracotta layer in the middle.
Layered paper folding forward, echoing one set of layers run twice.

1. Building and maintaining large codebases

Give the model the relevant source files, interface definitions and requirements, and ask it to analyze across files, locate the problem and propose changes. Label each file with its path, and state which behavior must not change and how to run the tests. Review and test the generated code before merging.

Scattered paper layers on the left pass a terracotta panel and become neatly aligned thin layers on the right.
Scattered source and requirements become an ordered change plan.

2. Multi-step reasoning and debugging

Incident reviews, design arguments and complex rule derivations need long chains of analysis and repeated checks. Provide the logs, constraints and causes you have already ruled out, ask the model to list hypotheses, evidence and verification steps, then check each one yourself.

3. Very long document analysis

With 1M tokens of context, long technical documents, contracts or several sources fit in one request. Say what to focus on and ask for each conclusion to cite its section so you can trace it back. For important decisions, re-check the citations against the original.

A tall stack of paper on the left splits into several small stacks, then gathers on the right into one stack with an ochre top layer.
Key points with sources, pulled together from a large body of material.

4. Game and interactive prototypes

Ask the model to write the code for a game or interactive page, run it locally, and send back errors and changes you want for the next round. Specify the runtime, controls, win and lose rules and visual requirements, and start with a minimal playable version.

5. Video and 3D through code

GLM 5.4 can write code that generates or edits video and builds 3D models. It delivers scripts and instructions; the video or model files come from running those scripts with the right tools. Name the library or software, size, duration or structure in your prompt, then give feedback based on what the script produces.

How to call the GLM 5.4 API

Endpoint /v1/chat/completions, model name glm-5.4:

GLM 5.4 always thinks before it answers, so complex tasks can take several minutes. The example streams the response ("stream": true, and -N for curl) so output arrives in chunks instead of the connection waiting idle for the full answer and timing out.

curl -N https://api.hiapi.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.4",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Write a single-file HTML5 canvas game: a paddle catches falling blocks. Use arrow keys, show the score, and add a restart button."}
    ]
  }'

Thinking cannot be turned off, so leave enough output length and response time for the reasoning.

Pricing and budget

Billing itemPrice (USD / 1M tokens)
Input$1.177
Output$4.118
Cached input read$0.26

For example, one game prototype iteration with 20K input tokens and 30K output tokens: 0.02 × $1.177 + 0.03 × $4.118 ≈ $0.147. One long-document analysis with 500K input tokens and 20K output tokens: 0.5 × $1.177 + 0.02 × $4.118 ≈ $0.671. Both examples assume no cached reads.

Start with the task that costs your team the most effort, write down the acceptance criteria, and track pass rate and cost per run before expanding. See the GLM 5.4 model page for parameters and current pricing.

Related articles

View all articles →

Start building with persistent AI artifacts

Get your API key and call image, video and audio models through one task-based API.

Read the API docs