We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.
Z.ai: GLM 5.1
z-ai/glm-5.1Try Z.ai: GLM 5.1 now
Runs on your balance at the prices above. New accounts start with free usage.
One API. Every model.
Session cost $0.00
Settings
Advanced parameters
Z.ai: GLM 5.1 at a glance
- Input price is 211% higher than the median of 434 Text models.
- Context window of 204,800 tokens, enough for long documents and multi-turn conversations.
- Supports tool (function) calling for agents and integrations.
- Supports structured JSON output with a schema.
- Supports reasoning effort control.
- A typical request (1,000 input / 500 output tokens) costs about $0.01.
About Z.ai: GLM 5.1
Z.ai: GLM 5.1 is a text model from Z.ai, listed under the model id z-ai/glm-5.1. It is positioned by its provider as a step forward in coding capability, with emphasis on long-horizon tasks. Z.ai describes it as able to work independently and continuously on tasks, in contrast to earlier models built around minute-level interactions.
The model takes text input and returns text output. It has a context window of 204,800 tokens and a maximum output of 128,000 tokens. Alongside standard sampling controls, it exposes a reasoning parameter and an include_reasoning option, so a request can ask for reasoning content in the response. It also supports structured outputs and response_format, which lets you constrain generation to a schema rather than parsing free text. Tool use is supported through tools and tool_choice. Other supported parameters include frequency_penalty, presence_penalty, repetition_penalty, temperature, top_p, top_k, min_p, seed, stop, logit_bias, logprobs, top_logprobs, and max_tokens.
Those capabilities point to a few practical uses. The large context window and long maximum output suit work that spans many files or long documents, such as repository-level code tasks, multi-step refactors, and extended agent runs where the model keeps going without a human turn at every step. The reasoning controls help on problems that benefit from a visible intermediate trace. Structured outputs fit extraction and classification pipelines where the downstream code expects a fixed shape. Tool calling makes it usable as the decision layer in an agent that reads files, runs queries, or calls internal services.
You call it through api14's OpenAI-compatible API using the model id z-ai/glm-5.1. Because the interface follows the OpenAI chat completions shape, existing OpenAI SDKs and clients work with a base URL change, and requests carry the usual messages array plus any of the parameters listed above.
There is no stated restriction on input or output beyond text, so if you need image, audio, or other modalities, a different model would be the better fit. Likewise, the supported parameter list defines what the endpoint accepts, so anything outside it should not be expected to take effect.
How to call the Z.ai: GLM 5.1 API
- Create an API key in your dashboard.
- Install the official openai SDK for your language.
- Set baseURL to https://api14.com/api/v1 and model to "z-ai/glm-5.1".
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "z-ai/glm-5.1",
"messages": [
{
"role": "user",
"content": "Explain vector databases in two sentences."
}
]
});
console.log(result.choices[0].message.content);
Supported parameters
frequency_penaltyinclude_reasoninglogit_biaslogprobsmax_tokensmin_ppresence_penaltyreasoningrepetition_penaltyresponse_formatseedstopstructured_outputstemperaturetool_choicetoolstop_ktop_logprobstop_pSpecifications
- Context length
- 204,800
- Max output
- 131,072
- Input
- text
- Output
- text
Requests on api14 · last 7 days
Z.ai: GLM 5.1: frequently asked questions
- How much does the Z.ai: GLM 5.1 API cost?
- Z.ai: GLM 5.1 costs Input $4.90 / 1M tokens. It is charged from your USD balance only for successful requests; failed requests are free.
- What is the context window of Z.ai: GLM 5.1?
- Z.ai: GLM 5.1 reads up to 204,800 tokens per request: prompt, history and documents together. It writes up to 131,072 output tokens per response.
- What can Z.ai: GLM 5.1 do?
- Z.ai: GLM 5.1 accepts text and returns text. It supports tool calling, structured JSON output, reasoning effort control.
- How do I call Z.ai: GLM 5.1 from my code?
- Point any OpenAI SDK at https://api14.com/api/v1 and set the model to "z-ai/glm-5.1". No other code changes. Copy a ready example from the code panel on this page.
- What are alternatives to Z.ai: GLM 5.1?
- Comparable Text models at a similar price: Qwen: Qwen3.7 Max, OpenAI: GPT-5.1 (batch), OpenAI: GPT-5 (batch). Each runs through the same API key, so switching is one string.
Z.ai: GLM 5.1 community
New topicThis community has no topics yet. Open the first one about Z.ai: GLM 5.1.