Skip to content
Sign in

GLM-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.

Context window131K
Provider智谱AI
Released2026/04/14

Playground

Pricing

The same model is available through multiple service channels — choose based on latency, reliability and cost.

Prices in $ / 1M tokens
To pick a channel, add a provider field to the request body, for example "provider": { "channel": "direct" }. Valid values are direct / stable / economical; omit it to use the default channel.

Direct

Direct upstream connection — best when you need native behavior and the full context window.

Input contextInputOutputCache read
≤ 32K0.59/M2.65/M0.15/M
> 32K0.88/M2.65/M0.15/M

Overview

Input
Text
Output
Text

GLM-5 API: Flagship Open-Source Foundation Model for Complex System Design

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


Why Choose GLM-5

  • Flagship open-source foundation — Production-grade performance in large-scale programming tasks
  • Built for full-system construction — Not just code generation, but system design and autonomous execution
  • Built-in agentic architecture — Autonomous planning, tool use, web browsing, multi-step workflow management
  • Iterative self-correction — Proactively checks and improves its own output during execution
  • 131K context and output — Symmetric input/output limits, unrestricted long-form engineering output

Core Capabilities

01 Complex System Design

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.

  • System architecture design and evaluation
  • Module decomposition and interface definition
  • Cross-module dependency governance

02 Deep Backend Reasoning

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.

  • Data model and index design
  • Concurrency and consistency analysis
  • Performance bottleneck identification and optimization

03 Agentic Planning and Autonomous Execution

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.

  • Autonomous task decomposition and planning
  • Multi-tool orchestration and execution
  • Long-chain workflow management

04 Iterative Self-Correction

GLM-5 proactively checks intermediate results and improves its own output during execution, significantly reducing rework rates in long-horizon tasks.

  • Self-checking of intermediate results
  • Path adjustment after error detection
  • Completeness verification before delivery

Best Use Cases

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

GLM-5 vs. GLM-5.1 and GLM-5 Turbo

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.


How to Use the GLM-5 API

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.seawhaleai.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
  }'

FAQ

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.


Why Choose SeaWhale AI for the GLM-5 API

  • No need to build your own cluster — Large-parameter models require no self-provisioned GPU resources
  • OpenAI-compatible interface — Connect existing code by changing two lines
  • Full series available — Switch between GLM-5 / 5.1 / 5.2 / 5-Turbo / 5V-Turbo under the same account
  • CNY settlement — Domestic models priced in CNY with clear accounting

API

API integration

Model IDUse this value as the model in inference requests
GLM-5
API KeyBearer token used to authenticate inference requests
Base URLOpenAI compatible · /chat/completions
OpenAIhttps://api.seawhaleai.com/v2/
provider OptionalSelects a service channel; omit it and the system picks the default
"provider": { "channel": "direct" }

GLM-5 usage examples

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.

About the provider parameter (optional, a SeaWhale AI extension): most models are served over several channels that differ slightly in price and reliability. Add a provider field to the request body to pick one; omit it and the system selects the default channel — normal calls are unaffected.

provider is not part of the official OpenAI protocol — it is a SeaWhale AI extension that only takes effect on this platform. The OpenAI SDK allows custom fields like this to pass through; see the examples below.

ValueChannelBest for
directDirectThe official upstream link, for native behavior and the full context window
stablePreferredBalanced availability and speed — a good default for production traffic
economicalEconomyCost first, well suited to batch processing and price-sensitive workloads

Available channels and their prices are listed under "Pricing" above (channels vary by model). Additional notes:

  • Syntax: "provider": { "channel": "direct" }.
  • If the requested channel is not enabled for that model, the request automatically falls back to the default channel and returns normally — it does not error.
  • With the official SDKs: in Python pass it via extra_body; in Node.js put it directly on the request object and it passes through. In TypeScript projects, add a // @ts-expect-error line to skip the type check.
js
curl https://api.seawhaleai.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 channel
js
from openai import OpenAI

client = OpenAI(
    base_url="https://api.seawhaleai.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)
js
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://api.seawhaleai.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 ?? '')
}