Direct
Direct upstream connection — best when you need native behavior and the full context window.
| Input context | Input | Output | Cache read |
|---|---|---|---|
| ≤ 32K | 0.88/M | 3.53/M | 0.19/M |
| > 32K | 1.18/M | 4.12/M | 0.29/M |

GLM-5.1GLM-5.1 achieves a major leap in coding capabilities, particularly notable in handling long-horizon tasks. Unlike previous models built around minute-level interactions, GLM-5.1 can independently and continuously handle a single task for over 8 hours, autonomously planning, executing, and improving itself throughout the process, ultimately delivering complete engineering-level results.
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.88/M | 3.53/M | 0.19/M |
| > 32K | 1.18/M | 4.12/M | 0.29/M |
GLM-5.1 is a flagship engineering agent model released and open-sourced by Zhipu AI in April 2026, built on a 744B MoE architecture and licensed under MIT. It achieves a significant leap in coding capability, with its most outstanding feature being the handling of long-horizon tasks: unlike previous models built around minute-level interactions, GLM-5.1 can independently work on a single task for over 8 hours continuously, autonomously planning, executing, and improving itself throughout the process, ultimately delivering complete engineering-grade results.
On the authoritative SWE-Bench Pro coding benchmark, GLM-5.1 scores 58.4, surpassing GPT-5.4, Claude Opus 4.6, and Gemini 3.1 Pro, making it the first open-source model to beat all closed-source flagship models on this leaderboard.
SeaWhale AI offers GLM-5.1 through an OpenAI-compatible interface, supporting tool calling, streaming output, and long-horizon agent workflows.
Get API Key · Model ID:
GLM-5.1
This is GLM-5.1's most core differentiator. Previous models were designed around minute-level interactions and required constant human intervention; GLM-5.1 can take on a complete task and then work continuously for more than 8 hours, autonomously planning, executing, self-checking, and improving.
The 58.4 score comes from real software engineering tasks—understanding repositories, locating issues, writing fixes, and passing verification. This is the first open-source model to surpass all closed-source flagship models on this benchmark.
The large-scale sparse mixture-of-experts architecture controls inference cost while maintaining strong capability, representing a typical path for open-source large models to balance capability and cost-effectiveness.
GLM-5.1 has a built-in agent architecture designed for autonomous planning, tool calling, web browsing, and multi-step workflow management, and can be directly used as the core model for coding agents.
| Scenario | Description |
|---|---|
| Long-horizon coding agents | Start with one instruction, work continuously for hours, and deliver |
| Repository-level bug fixing | Real engineering tasks of the SWE-Bench Pro type |
| Autonomous development workflows | End-to-end execution from requirement understanding to code delivery |
| Domestic substitution | Enterprise coding models that need to be independently controllable |
| Private deployment | Local deployment under the MIT license |
| Cost-sensitive agents | Cost advantages from open-source models |
| Capability | GLM-5.1 | GLM-5 | GLM-5.2 |
|---|---|---|---|
| Model ID | GLM-5.1 |
GLM-5 |
GLM-5.2 |
| Architecture | 744B MoE | Flagship open-source base model | Large-scale reasoning model |
| Context window | 131K tokens | 131K tokens | 1M tokens |
| SWE-Bench Pro | 58.4 (first open-source) | — | Higher |
| Long-horizon capability | 8+ hours continuous | Long-horizon agent | More stable |
| Open-source license | MIT | 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 and add credits in the console.
2. Provide the full task description in one go GLM-5.1 excels at long-duration autonomous execution. Clearly state the complete requirements, constraints, and acceptance criteria in the first round and let it run on its own; this works far better than multiple rounds of piecemeal follow-up questions.
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.1",
"messages": [
{"role": "user", "content": "Implement a complete task scheduling service: data models, REST API, retry mechanisms, and unit tests. Deliver it once everything passes."}
],
"stream": true
}'
When was GLM-5.1 released? It was released in April 2026 and open-sourced under the MIT license.
What does "working continuously for 8 hours" mean? It means the model can autonomously execute a single task for more than 8 hours, during which it plans on its own, calls tools, checks results, and improves itself without requiring repeated human intervention.
What level is a score of 58.4 on SWE-Bench Pro? It surpasses GPT-5.4, Claude Opus 4.6, and Gemini 3.1 Pro, making it the first open-source model to beat all closed-source flagship models on this benchmark.
How do I choose between GLM-5.1 and GLM-5.2? Choose GLM-5.2 if you need a 1M-token long context; GLM-5.1 remains a strong choice when 130K tokens are enough and cost is a priority.
What are the context and output limits? 131,072 tokens of context, with the same 131,072-token output limit; input and output are equal.
Can it be deployed privately? Yes. The MIT license permits free commercial use and private deployment, and the model weights are public.
GLM-5.1https://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.1",
"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.1",
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.1',
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 ?? '')
}