GLM 5.4 is available on EmpirioLabs. It is Z.ai's flagship model for coding and agentic work, released through its API on December 2, 2026. It reads text, images, video, and files such as PDFs, holds up to 1M tokens of context, writes up to 128K tokens, and always reasons before it answers.
Call it through an OpenAI-compatible API with function calling, built-in web search, JSON mode, and streaming. Try it in the Playground, read the parameters in the docs, and see the current rates on the GLM 5.4 model page.
价格
Usage based. One input rate and one output rate apply at every prompt size, and reasoning tokens bill as output tokens. Web search. Built-in web search adds a fee for each request that searches. Current rates are on the model page and the pricing page.
Quickstart
Point any OpenAI SDK at the EmpirioLabs base URL and pass glm-5-4 as the model. This example sends an image with a question and sets the reasoning level:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.empiriolabs.ai/v1",
api_key=os.environ["EMPIRIOLABS_API_KEY"],
)
resp = client.chat.completions.create(
model="glm-5-4",
reasoning_effort="high",
messages=[
{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "https://media.empiriolabs.ai/assets/og/og-home-v4.jpg"}},
{"type": "text", "text": "What is this page advertising? Answer in one sentence, then write the HTML for a matching call-to-action button."},
]},
],
)
print(resp.choices[0].message.content)
print(resp.usage.prompt_tokens, "input tokens,", resp.usage.completion_tokens, "output tokens")
It printed a one-sentence summary of the page, the HTML and CSS for a matching button, and 1077 input tokens, 296 output tokens.
The same model ID works on /v1/responses, the Anthropic-shaped /v1/messages, and the Google-compatible /v1beta/models/glm-5-4:generateContent route.
Reasoning effort
GLM 5.4 always reasons. reasoning_effort takes low, high, or max; max is the default and is recommended for complex coding. A request for another level, or to turn thinking off, is served at the nearest supported level. The reasoning comes back in reasoning_content beside the answer, in a response and in a stream, and it bills as output tokens.
Images, video, and files
Send images as image_url parts and video as video_url parts, each as an https URL or a base64 data URL; a URL is recommended for video. Send a document such as a PDF as a file part with file_url or base64 file_data. One message can carry several images, and a file beside an image.
Multi-turn reasoning
By default the reasoning of earlier assistant turns is left out of the model's input. Set preserve_thinking to true to include it: return each turn's reasoning unchanged in that assistant message's reasoning_content field, and the earlier reasoning bills as input tokens. Reasoning between tool calls since the last user message is always kept.
Function calling and web search
Pass tools to let the model call your functions; it can call several in one turn, and tool_stream streams their arguments as they are written. Set tool_web_search to true and the model searches the web when it needs to, and ends its answer with a Sources list of the pages it used. count sets how many results a search returns (1 to 50), and search_recency_filter and search_domain_filter narrow them.
Things worth knowing before your first call
max_tokenscovers reasoning and the answer together. A small cap can be spent on reasoning alone, which returns an empty answer withfinish_reasonlength. Leave room above the reasoning you expect, or lowerreasoning_effortfor short replies.- The model decides when to call a function.
tool_choicetakesautoornone. A forced call (requiredor a named function) returns a 400, so ask for the call in your prompt. - Name the fields you want in JSON mode.
{"type": "json_object"}returns valid JSON, and the prompt decides its keys, so list them. A JSON Schema inresponse_formatis not enforced. - Send files by URL or as base64. A
file_idreturns a 400; usefile_urlorfile_datainstead. - The context window holds the prompt and the answer together. It is 1,048,576 tokens, and a longer request returns a 400 with the code
context_length_exceeded.
GLM 5.4 is available now in the Playground and through the EmpirioLabs API.




