Stelladocs
API Providers

Z.ai

GLM models over an OpenAI-compatible API — Stella's default worker tier, first in auto-detection, with a dedicated coding-plan endpoint for subscription pricing.

Z.ai serves the GLM family, and glm-5.2 is Stella's default worker tier: excellent coding at a fraction of flagship price ($0.60/$2.20 per Mtok against $3.00/$15.00). Z.ai sits first in auto-detection — if a ZAI_API_KEY is present, it is the provider you get without asking. Stella speaks the OpenAI-compatible dialect against https://api.z.ai/api/paas/v4.

Setup

export ZAI_API_KEY="..."

Prefer a file? Store the key in ~/.config/stella/credentials.toml, or rename the env var Stella reads with providers.zai.api_key_env — see overriding the key source.

Selecting models

The provider id is zai; the default model is glm-5.2.

stella --model zai/glm-5.2 run "implement the pagination endpoint"
export STELLA_MODEL=zai/glm-5.2

The coding-plan endpoint

If you subscribe to a Z.ai GLM coding plan, your quota lives on a dedicated endpoint — the flat subscription that makes glm-5.2 a workhorse you stop metering. Route Stella to it either way:

export ZAI_GLM_CODING_PLAN=1

or, provider-agnostically, in settings.json:

~/.config/stella/settings.json
{
  "providers": {
    "zai": {
      "base_url": "https://api.z.ai/api/coding/paas/v4"
    }
  }
}

That snippet is user-scope on purpose — in a project's .stella/settings.json, base_url is ignored unless STELLA_TRUST_PROJECT=1 (see the project trust boundary).

The endpoint precedence chain, top to bottom: --base-url (or its env form STELLA_BASE_URL) beats ZAI_GLM_CODING_PLAN=1, which beats the settings.json base_url, which beats the built-in default. Two silent traps follow: with both the env toggle and the settings route set, the file value is overridden — and a stray --base-url or STELLA_BASE_URL overrides both, taking you off the coding-plan endpoint without a word. Unset the layers you are not using.

The full recipe — plan setup, verification that requests actually hit the coding-plan endpoint, per-agent wiring — lives in the Z.ai coding-plan example.

Thinking

GLM thinking maps directly from Stella's reasoning setting: reasoning: "on" sends thinking: {"type": "enabled"} on the wire, "off" sends {"type": "disabled"}. Set it per agent in agent_engine_config.

In the pipeline

glm-5.2 is the worker of the balanced profile — flagship-adjacent coding under a claude-fable-5 or gpt-5.5 judge — and the judge of the dirt-cheap profile over a deepseek-chat worker. On a coding plan, it is the obvious default for high-volume fleet work. Per-agent wiring lives in agent_engine_config.

Catalog pricing

ModelContextIn $/MtokOut $/MtokCached-in $/Mtok
glm-5.2200k0.602.200.11

List prices from Stella's seed catalog — coding-plan subscriptions bill differently (flat quota, not per token); verify with Z.ai. Your local catalog re-syncs from models.dev via stella models refresh. See the Model guide for the full cross-provider table.

Stella is totally free and open source, dual-licensed MIT or Apache 2.0— your choice: MIT's three-paragraph simplicity, or Apache 2.0's explicit patent grant that enterprises prefer. Use it, fork it, embed it, ship it — no account, no phone-home, no strings. What that means →

On this page