Direct
Direct upstream connection — best when you need native behavior and the full context window.
| Input context | Input | Output | Cache read |
|---|---|---|---|
| ≤ 32K | 0.59/M | 2.65/M | 0.15/M |
| > 32K | 0.88/M | 2.65/M | 0.15/M |

GLM-5GLM-5 is Z.ai's flagship open-source foundation model, designed for complex system design and long-horizon agentic workflows. It is built for expert developers, delivering production-grade performance in large-scale programming tasks, comparable to leading closed-source models. With advanced agentic planning, deep backend reasoning, and iterative self-correction, GLM-5 goes beyond code generation to full-system building and autonomous execution.
The same model is available through multiple service channels — choose based on latency, reliability and cost.
Prices in $ / 1M tokensprovider field to the request body, for example "provider": { "channel": "direct" }. Valid values are direct / stable / economical; omit it to use the default channel.Direct upstream connection — best when you need native behavior and the full context window.
| Input context | Input | Output | Cache read |
|---|---|---|---|
| ≤ 32K | 0.59/M | 2.65/M | 0.15/M |
| > 32K | 0.88/M | 2.65/M | 0.15/M |
GLM-5 is the flagship open-source foundation model from Z.ai, built for complex system design and long-horizon agentic workflows. It targets expert-level developers: delivering production-grade performance on large-scale programming tasks, comparable to leading closed-source models.
GLM-5 is positioned as more than just "being able to write code." With advanced agentic planning, deep backend reasoning, and iterative self-correction capabilities, it goes beyond code generation into the realm of full-system construction and autonomous execution.
SeaWhale AI offers GLM-5 through an OpenAI-compatible interface, supporting tool calling, streaming output, and long-horizon agentic workflows.
Get an API Key · Model ID:
GLM-5
GLM-5 excels at system-level work: architecture design, module decomposition, interface definition, and dependency governance. It targets engineering problems that require holistic consideration, not single-function implementation.
In backend engineering scenarios, GLM-5 handles tasks that require deep reasoning, such as data model design, concurrency and consistency issues, and performance bottleneck identification.
The built-in agentic architecture supports autonomous planning, tool calling, web browsing, and multi-step workflow management, and can directly serve as the foundation for engineering agents.
GLM-5 proactively checks intermediate results and improves its own output during execution, significantly reducing rework rates in long-horizon tasks.
| Scenario | Description |
|---|---|
| System architecture design | Holistic design and evaluation of complex systems |
| Backend engineering | Data models, concurrency, performance optimization |
| Engineering agent foundation | Development agents requiring autonomous planning and execution |
| Large-scale programming tasks | Production-grade needs of expert developers |
| Private deployment | On-premises solutions under an open-source license |
| Domestic substitution | Independently controllable enterprise-grade foundation model |
| Capability | GLM-5 | GLM-5 Turbo | GLM-5.1 |
|---|---|---|---|
| Model ID | GLM-5 |
GLM-5-Turbo |
GLM-5.1 |
| Positioning | Flagship open-source foundation | Fast inference tier | Long-horizon engineering agent |
| Context window | 131K tokens | 131K tokens | 131K tokens |
| Max output | 131K tokens | 131K tokens | 131K tokens |
| Focus | System design and deep reasoning | Speed and responsiveness | 8-hour continuous execution |
| Open-source license | MIT | — | MIT |
Specific billing is subject to the real-time price card at the top of the page.
1. Create a SeaWhale AI API Key Generate a key in the console and add credits.
2. Use it for system-level work GLM-5's strengths lie in holistic design and deep reasoning. For simple code completion, GLM-5 Turbo is more cost-effective; complex architecture problems are where GLM-5 is worth the investment.
3. Call the API
curl -X POST https://api.haijingai.com/v1/chat/completions \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "GLM-5",
"messages": [
{"role": "user", "content": "Design a horizontally scalable order system: data sharding, idempotency guarantees, and eventual consistency solutions, with item-by-item justification."}
],
"stream": true
}'
What is the relationship between GLM-5 and GLM-5.1? GLM-5 is the flagship open-source foundation. GLM-5.1 substantially strengthens long-horizon task capabilities (can work continuously for over 8 hours) and achieved first place among open-source models on SWE-Bench Pro.
What kind of developers is GLM-5 for? It targets expert-level developers and scenarios requiring holistic system design. For everyday code completion, a lighter tier offers better cost-effectiveness.
What are the context and output limits? 131,072-token context, with an output limit of 131,072 tokens as well.
What does built-in agentic architecture mean? The model itself is trained for autonomous planning, tool calling, web browsing, and multi-step workflow management, so it can take on the role of an agent without requiring an additional framework.
Can it be deployed privately? Yes. The GLM-5 series uses the MIT open-source license, model weights are public, and commercial use and private deployment are permitted.
How does it compare to closed-source flagships? It reaches a level comparable to leading closed-source models on large-scale programming tasks, while also offering open-source controllability and cost advantages.
GLM-5https://api.haijingai.com/v2/"provider": { "channel": "direct" }SeaWhale AI is compatible with the OpenAI API protocol, so you can call it with the OpenAI SDK or plain HTTP requests. Streaming is enabled by default.
curl https://api.haijingai.com/v2/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"model": "GLM-5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"provider": { "channel": "direct" },
"stream": true
}'
# provider is optional — remove this line to use the default channelfrom openai import OpenAI
client = OpenAI(
base_url="https://api.haijingai.com/v2",
api_key="<API_KEY>",
)
stream = client.chat.completions.create(
model="GLM-5",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
stream=True,
# Optional: pick a service channel; omit to use the default
extra_body={"provider": {"channel": "direct"}},
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.haijingai.com/v2',
apiKey: '<API_KEY>',
})
const stream = await client.chat.completions.create({
model: 'GLM-5',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' },
],
stream: true,
// Optional: pick a service channel; omit to use the default
// @ts-expect-error provider is a SeaWhale AI extension, not in the OpenAI SDK types
provider: { channel: 'direct' },
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}