GLM 5.4
glm-5.4Use the GLM-5.4 API to review code, interpret visual references, and work through complex technical tasks with written explanations and proposed implementations. Provide your instructions, relevant code or documents, and images when you need visual analysis. Use it to turn a screenshot into interface code, investigate a defect across a long specification, or plan a game or 3D scene that your own tools can build. Set an output budget and check the proposed changes against your requirements. The detail page includes request examples, supported parameters, provider selection, and token-based usage pricing.
Auto route pricing
Route source: neolink
- Input / Output
- Input: $1.330Output: $4.180
- Cache read / write
- Cache read: $0.260Cache write: Price not supplied
- Context / Max output
- 1000K / 128K
- Live routes
- 1
Rates / 1M tokens
Image output: Price not supplied
These are separate usage rates, not a total request price.
On this page
Overview
Overview for neolink
GLM-5.4: Visual Coding, Reasoning, and Long-Context Analysis
Bring a technical question, a code excerpt, or a visual reference to GLM-5.4 and ask for an explanation you can inspect. The model combines text and visual understanding with coding and reasoning, making it useful when a task crosses the boundary between a written specification and the work needed to implement it.
From a reference to an implementation
Start with the outcome you need: an interface, a corrected function, a design proposal, or a sequence of steps for a larger project. Add the constraints that determine whether the result will be useful, such as the target framework, accepted inputs, required behavior, and how the result will be checked.
- Visual interface work: describe the desired behavior and attach a screenshot when you want code that follows a layout. Review the generated implementation for accessibility, responsive behavior, and missing interactions.
- Code and specification review: provide the relevant functions, requirements, and error symptoms. Ask for failure cases and a correction that explains its assumptions.
- Work with external tools: use the model to plan code for a game, a 3D scene, or an engineering workflow. Your application executes the tools and supplies their results for the next step.
GLM-5.4 returns text. A request about video, games, or 3D design can produce code or instructions; rendering a video, running a game, or producing a 3D file requires the corresponding software or tools.
Start with a code review
This small task makes the quality of an answer easy to check. The input function works for a nonempty list of numbers, but an empty collection and an iterator need closer attention.
Review this function for empty input and generator input. Explain the failure cases, suggest a corrected version, and list test cases.
def average(values):
return sum(values) / len(values)Look for an explicit decision about empty input, support for the input types you intend to accept, and tests that cover the proposed behavior. Run suggested code in your own environment before using it in an application.
Call the API through OpenAny
Use glm-5.4 as the public model ID. Set OPENANY_API_KEY to your OpenAny key and send a Chat Completions request. The example selects the Neo route and asks for a complete JSON response.
curl 'https://api.openany.si/v1/chat/completions' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"model": "glm-5.4",
"route": {
"provider": "neolink"
},
"messages": [
{
"role": "user",
"content": "Review this function for empty input and generator input. Explain the failure cases, suggest a corrected version, and list test cases.\n\ndef average(values):\n return sum(values) / len(values)"
}
],
"max_tokens": 4096,
"stream": false
}'The request is a prepared template. The result depends on the supplied input, output budget, and the selected route.
Understand the response
Read the assistant answer from choices[0].message.content. A compatible route may also return reasoning in reasoning_content. Inspect finish_reason before treating a long answer as complete. The following is a structural example with labeled placeholders, not a captured generation.
{
"id": "chatcmpl-EXAMPLE",
"object": "chat.completion",
"created": 0,
"model": "glm-5.4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "[Reasoning text, when returned by the selected route.]",
"content": "[Example placeholder: the generated code review and proposed correction appear here.]"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0
}
}
}Use images and longer source material
The published specification lists a 1M-token context window and a maximum output of 128K tokens. Keep room for the answer when assembling a long prompt, and choose a smaller output budget for focused work. The example requests 4,096 output tokens; the maximum is not the default response length.
For image understanding, use message content blocks with type: image_url and put an HTTPS image URL or a supported Base64 data URL in image_url.url. Add a text block explaining what to inspect. Use images you are authorized to process, and check accepted media sizes and formats for the selected provider. Manufacturer documentation also lists video and file inputs; this example focuses on text and image messages.
Choose the controls that matter
| Parameter | Use |
|---|---|
| messages | Supply the task, relevant source material, and previous conversation when needed. |
| max_tokens | Set the output budget. Complex reasoning can use a substantial part of this budget. |
| stream | Use false for a complete JSON result or true for streaming when supported by your client. |
| temperature / top_p | The manufacturer's recommended values are 1 and 0.95. |
| thinking / reasoning_effort | The model supports enabled thinking. The manufacturer recommends max reasoning effort and preserving thinking across turns; confirm route compatibility before relying on these optional controls. |
| tools | Describe functions your application can execute. Validate calls and return execution results to the model. |
Token pricing and caching
The configured OpenAny prices below are 95% of Z.ai's published international USD list prices. Amounts are per 1,000,000 tokens.
| Usage | Official USD list price | OpenAny price |
|---|---|---|
| Input | $1.40 | $1.33 |
| Output | $4.40 | $4.18 |
| Cached input | $0.26 | $0.247 |
Cached-input pricing applies when cached token usage is reported. A cache-creation price is not configured for this route. Tool execution and any separately charged services are outside this token-price table. Check the selected route's current pricing before submitting a large request.
Common questions
Can GLM-5.4 generate a video or a 3D file directly?
The model output is text. It can write code or guide a tool workflow, while the relevant rendering or modeling tools produce the media or files.
Should I always request the largest output?
Choose a budget that fits the task. For a long analysis, ask for a defined structure and inspect the completion reason. A larger budget permits longer work but does not guarantee a particular answer length.
How do I use tool calling?
Provide function definitions, inspect the model's requested calls, execute approved operations in your application, and send the results back so the model can continue.
What does the response preview represent?
The configured preview is a labeled schema example. Run a request with your own input to see a generated answer, and inspect its reported usage and completion status.
Playground
Review code or interpret visual references using Chat Completions. The response example contains labeled placeholders.
Other parameters (1)
Live response
Run a request to see the actual response. Published samples are in Examples.
Agent handoff preview
Providers
| Provider | Pricing | Latency | Uptime | Supply | Route |
|---|---|---|---|---|---|
Live | Input $1.330 / 1M tokensSave 5% vs official Output $4.180Save 5% vs official Cache read $0.260 Cache write — | 339ms | — | Verified |
- Input
- $1.330Save 5% vs official
- Output
- $4.180Save 5% vs official
- Cache read
- $0.260
Source: the selected provider route in OpenAny's public model catalog. A price update timestamp is not supplied.
API
- Base URL
https://api.openany.si/v1- POST
/v1/chat/completions- Authentication
Authorization: Bearer $OPENANY_API_KEY
Request parameters
| Parameter | Type / range | Default value | Required | Description |
|---|---|---|---|---|
prompt | string | Review this function for empty input and generator input. Explain the failure cases, suggest a corrected version, and list test cases.
def average(values):
return sum(values) / len(values) | Yes | Prompt |
max_tokens | integer · 1 ~ 128000 | 4096 | No | Maximum output tokens |
Error handling
400Check the model ID and request fields.429Retry with exponential backoff.5xxRetry only temporary provider failures.JSON Schema
View JSON Schema
Examples
Request example
POST /v1/chat/completionscurl 'https://api.openany.si/v1/chat/completions' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_tokens": 4096,
"messages": [
{
"content": "Review this function for empty input and generator input. Explain the failure cases, suggest a corrected version, and list test cases.\n\ndef average(values):\n return sum(values) / len(values)",
"role": "user"
}
],
"model": "glm-5.4",
"stream": false
}'Response example
Official schema example with placeholders, not a live response
{
"id": "chatcmpl-EXAMPLE",
"model": "glm-5.4",
"usage": {
"total_tokens": 0,
"prompt_tokens": 0,
"completion_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "[Example placeholder: the generated code review and proposed correction appear here.]",
"reasoning_content": "[Reasoning text, when returned by the selected route.]"
},
"finish_reason": "stop"
}
],
"created": 0
}