Skip to content
Apothem
Harnesses

GLM (Z.ai)

Apothem harness adapter for GLM (Z.ai) as a configurable model backend.

Vendor: Z.ai Install name: glm Status: GA Native config: <project>/.apothem/providers/glm.toml

The glm adapter configures GLM (Z.ai) as a model backend. A tool that speaks the Anthropic-compatible or OpenAI-compatible protocol is pointed at GLM by setting a backend base URL and a key, and you select the adapter with --harness glm like any other. It writes a provider configuration file that records both compatibility surfaces so any compatible tool can be wired to the GLM model family.

Z.ai also ships a first-party coding tool of its own, ZCode, which Z.ai's documentation calls an "Agentic Development Environment". This adapter does not configure ZCode. Apothem has not checked ZCode's own configuration surface, so the adapter writes nothing for it.

Installation

apothem install --harness glm --project /path/to/project

The adapter writes one project-scope provider file recording the GLM backend endpoints and operator-configurable placeholders.

Files written: <project>/.apothem/providers/glm.toml

Profile-to-native-config mapping

The provider file records two backends. The Anthropic-compatible backend uses the base URL https://api.z.ai/api/anthropic; a tool that speaks the Anthropic protocol routes to GLM by setting ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and optionally API_TIMEOUT_MS. The [backends.anthropic_compatible.env] table in the file lists those variables and also ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL, which map the tool's opus, sonnet, and haiku roles to GLM models. The OpenAI-compatible backend uses the base URL https://api.z.ai/api/coding/paas/v4. The auth token is a placeholder you replace with your own Z.ai key — Apothem never writes a real secret. Model ids are version-volatile, so Apothem pins none; the file carries <GLM_MODEL_ID> placeholders you fill from the current Z.ai documentation. Nothing from the shared profile goes into this file; it is a fixed template.

Role-to-model mapping

Z.ai's own statements about the role-to-model mapping disagree, so the file leaves the three ANTHROPIC_DEFAULT_*_MODEL values as placeholders and carries a TODO(clarify) comment above them. You decide which mapping to use:

  • The manual settings.json example in the vendor's Anthropic-compatible setup guide maps opus and sonnet to glm-5.3[1m] and haiku to glm-5.3-flash[1m], and sets CLAUDE_CODE_AUTO_COMPACT_WINDOW to 1000000.
  • The same guide's stated default mapping lists GLM-5.3-Flash for all three roles.
  • Z.ai's @z_ai/coding-helper tool defaults to glm-5.3-flash, appends [1m] to all three roles, and writes a compaction window of 1048576.

Apothem pins none of these values and does not choose between them.

Compatibility notes

The GLM backend exposes no surface for rules, commands, skills, or hooks, so the adapter writes only the backend provider file and nothing else. Apothem has not checked whether ZCode exposes such surfaces. Your Z.ai key and your model-id choices stay operator-owned. The vendor surface conventions the adapter relies on are pinned at src/apothem/harnesses/glm/STANDARD-CONVENTION-PIN.md, snapshotted against the live Z.ai documentation.

GLM runs the GLM model family from Z.ai; see the vendor configuration reference for the current backend, model, and Anthropic-compatible configuration surface.

Verification

apothem verify --harness glm --project /path/to/project

The verify command confirms that:

  1. The native config exists at the expected path.
  2. The provider file is present and non-empty.
  3. The adapter-specific verification routine reports success.

Updating

apothem update --harness glm --project /path/to/project

The provider file is yours once it exists. install and update both write the template only when .apothem/providers/glm.toml is absent, and neither ever overwrites it afterwards, so your key reference and model choices survive every re-run. To pick up a newer template, move your file aside, run update, and copy your values into the new file.

Uninstalling

apothem uninstall --harness glm --project /path/to/project

Removes the provider file only when Apothem created it and it is still an unedited template, backing it up under the Apothem backup root first. An unedited file written by an earlier release counts when Apothem's install record for the project shows it wrote the file: the manifest records the digest of each template the project has shipped. Without an install record, only an exact copy of the current template is removed. A file you created or edited is left in place. The shared profile YAML and the Apothem engine are unaffected.

Conformity gate

python -m apothem.conformity.gate --all .

Troubleshooting

SymptomFix
Config file not foundRe-run apothem install --harness glm --project /path/to/project
Verification failedThe provider file is missing or empty. If it is missing, run apothem update --harness glm --project /path/to/project. If it is empty, move .apothem/providers/glm.toml aside first, then run update and verify again
Unexpected config contentEdit .apothem/providers/glm.toml directly; Apothem never rewrites an existing file, and the shared profile adds nothing to it. For a fresh template, move the file aside and run apothem update --harness glm --project /path/to/project

Configuration knobs

FlagDefaultDescription
--dry-runfalsePreview install without writing files.

See also

On this page