Client Integrations

Working provider configuration for Codex, OpenCode, Oh My Pi, Cursor, Claude Code, and Continue, plus the errors each of those setups tends to hit.

GLM 5 exposes documented OpenAI-compatible Chat Completions and Responses APIs. A client must send requests to the GLM 5 base URL, use a GLM 5 key, and select a model ID that GET /models returns.

Verify the API first

Before configuring an IDE or agent client, verify the key and endpoint directly:

curl https://glm5.app/api/v1/models \
  -H "Authorization: Bearer $GLM5_API_KEY"

If this request fails, fix the key, paid API balance, or endpoint first. A client-specific setup cannot repair an API request that fails here.

OpenCode

OpenCode supports custom OpenAI-compatible providers. Add your credential with /connect and choose Other, then configure GLM 5 in your OpenCode config. Current OpenCode releases may use either the provider/npm/options schema or the newer providers/package/settings schema, so follow the schema generated by your installed version.

A current OpenAI-compatible provider configuration looks like this:

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "glm5": {
      "name": "GLM5",
      "env": ["GLM5_API_KEY"],
      "package": "@opencode-ai/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://glm5.app/api/v1"
      },
      "models": {
        "glm-5.3-flash": { "name": "GLM 5.3 Flash" },
        "glm-5.3": { "name": "GLM 5.3" }
      }
    }
  }
}

After saving, select the provider/model in OpenCode. Keep the API key in the local credential store or GLM5_API_KEY, never in source control.

Oh My Pi (omp)

omp (Oh My Pi) supports custom OpenAI-compatible providers through ~/.omp/agent/models.yml. Use the Responses protocol for GLM5:

providers:
  glm5:
    baseUrl: https://glm5.app/api/v1
    api: openai-responses
    apiKey: GLM5_API_KEY
    models:
      - id: glm-5.3-flash
        name: GLM 5.3 Flash
        contextWindow: 1000000
        maxTokens: 8192

Set GLM5_API_KEY in the same shell that starts omp. To make the model the default for new sessions, add this to ~/.omp/agent/config.yml:

modelRoles:
  default: glm5/glm-5.3-flash

Verify discovery and start a session:

omp models glm5
omp

On Windows native, the equivalent files are %USERPROFILE%\\.omp\\agent\\models.yml and %USERPROFILE%\\.omp\\agent\\config.yml. In WSL, use the Linux paths unless you explicitly configure a shared OMP agent directory. Keep apiKey as the environment-variable name and never commit the real key.

Codex Desktop / CLI

Codex custom providers use the Responses API. GLM5 supports the Responses endpoint and translates the request into the same metered GLM5 model runtime. Configure the provider at the user level so it applies to both Codex CLI and the Codex desktop app:

model = "glm-5.3-flash"
model_provider = "glm5"

[model_providers.glm5]
name = "GLM5"
base_url = "https://glm5.app/api/v1"
env_key = "GLM5_API_KEY"
wire_api = "responses"

Set the key in your local shell before starting Codex:

export GLM5_API_KEY="sk-glm5-..."
codex --model glm-5.3-flash

On macOS and Linux, export affects the current terminal session. On Windows, use PowerShell or Command Prompt instead:

$env:GLM5_API_KEY = "sk-glm5-..."
codex --profile glm5
set GLM5_API_KEY=sk-glm5-...
codex --profile glm5

The profile file has the same name on all platforms; only the home directory changes:

PlatformProfile path
macOS / Linux~/.codex/glm5.config.toml
Windows PowerShell$env:USERPROFILE\.codex\glm5.config.toml
Windows WSL~/.codex/glm5.config.toml (or the configured CODEX_HOME)

The Responses adapter supports text streaming, function calls, and the standard input/output item shapes. Keep the full input history in the request; GLM5 does not persist Codex response state server-side.

Verify the setup

Inside Codex, run /status and confirm that the active model is glm-5.3-flash. If the request fails, check the key without printing it:

test -n "${GLM5_API_KEY:-}" && echo "GLM5_API_KEY is set"

An MCP startup incomplete warning, such as a Linear OAuth warning, is a separate MCP connection issue and does not indicate a GLM5 API failure.

Return to the original Codex provider

The GLM5 setup is a profile overlay. To return to your normal Codex provider, stop the current session and start Codex without the profile:

codex

This keeps your original ~/.codex/config.toml, MCP servers, and OpenAI login unchanged. You do not need to delete the base Codex config.

To disable only the GLM5 profile while keeping a recoverable backup:

mv ~/.codex/glm5.config.toml ~/.codex/glm5.config.toml.disabled
unset GLM5_API_KEY

If GLM5_API_KEY was added to ~/.zshrc or ~/.bashrc, remove that one export line and reload the matching shell file. Do not remove ~/.codex/config.toml; it may contain your existing provider, MCP, permissions, and notification settings.

Browser, MCP, and API errors are different

These messages do not mean the GLM5 API configuration is wrong:

MessageMeaningAction
MCP startup incomplete (failed: linear)Linear MCP needs OAuth againRun codex mcp login linear, or disable Linear if unused
Connection invalid from Ego LiteBrowser tool connection failedRestart the browser tool or use a normal API/terminal request
127.0.0.1:9222 ... connection refusedChrome CDP is not listeningSkip browser automation or start Chrome with the required CDP setup
Operation not permitted for localhostCodex sandbox blocked local networkingUse an allowed network mode or do not use the local browser bridge
401 invalid_api_key from glm5.appGLM5 key was not supplied or is invalidCheck GLM5_API_KEY in the same shell that starts Codex
402 from glm5.appAccount credits are insufficientAdd credits or use an account with API-eligible balance
404 from glm5.appWrong endpoint/model or an old deploymentUse /api/v1/responses and glm-5.3-flash

Cursor

Cursor is configured in its settings interface, not through a project config file. In Cursor Settings > Models:

  1. Enable Use OpenAI API Key and paste your sk-glm5-... key.
  2. Enable Override OpenAI Base URL (when using key).
  3. Set the Base URL to https://glm5.app/api/v1.
  4. Add or select a model ID returned by GET /models, such as glm-5.3 or glm-5.3-flash.
  5. Select that model for a supported chat request.

Cursor Tab is separate

Cursor's Tab autocomplete continues to use Cursor's built-in model. A GLM 5 API key applies only to Cursor's supported custom chat/model requests; it does not replace Tab autocomplete.

If the installed Cursor build or account does not offer the OpenAI Base URL override, it cannot directly use this endpoint. Use OpenCode, Continue, or an SDK instead.

Claude Code

Claude Code uses Anthropic's Messages protocol rather than the OpenAI Chat Completions protocol exposed by GLM 5, so do not point Claude Code directly at https://glm5.app/api/v1.

To use GLM 5 from Claude Code, place an Anthropic-compatible translating gateway between Claude Code and GLM 5. The gateway must accept Anthropic Messages requests, translate them to OpenAI-compatible Chat Completions, and send them to https://glm5.app/api/v1 with your GLM 5 key. Keep both the gateway and key local/private.

If you do not need Claude Code specifically, OpenCode is the simpler direct path for the GLM 5 OpenAI-compatible API.

Continue for VS Code

VS Code needs a compatible extension; pasting a GLM5 key into GitHub Copilot or an unrelated extension does not configure GLM5. Install Continue, published by Continue, from the VS Code Extensions view. Open its sidebar, select a local configuration, and use its configuration-file control to open config.yaml. The usual local path is ~/.continue/config.yaml on macOS/Linux or %USERPROFILE%\.continue\config.yaml on Windows. Prefer opening the file from Continue so you edit the configuration that the extension actually loads.

Back up any existing configuration and merge this model into its models list; do not replace unrelated models or MCP settings. Replace the placeholder with a new, active inference key from API Keys, not a masked key, revoked key, management key, upstream-provider key, or browser login password. Keep the local configuration private and outside Git; never send the key to support.

name: GLM5 Config
version: 0.0.1
schema: v1

models:
  - name: GLM 5.3 Flash
    provider: openai
    model: glm-5.3-flash
    apiBase: https://glm5.app/api/v1
    apiKey: <YOUR_GLM5_API_KEY>
    useResponsesApi: false
    roles:
      - chat
      - edit
      - apply

useResponsesApi: false explicitly selects Chat Completions for this setup. The Base URL ends at /api/v1, not /chat/completions. Use the public model ID returned by GET /models, not the internal upstream name z-ai/glm-5.3-flash.

Check the connection in order

  1. Set GLM5_API_KEY locally and run the model-list check below. It must return a model list, not an authentication error. Do not print the environment variable.
  2. Save the YAML, select the local configuration and GLM 5.3 Flash in Continue, and start in Chat mode. A VS Code terminal export alone does not necessarily supply credentials to an extension started earlier; the apiKey setting above is separate from the terminal environment.
  3. Send a short prompt such as Reply with OK only. Confirm a completed reply and a matching request in Activity, with its model and status. Model discovery alone does not test inference or available API credits.
  4. Next test an edit on a disposable file and review the diff before applying it. For Agent mode, explicitly add capabilities: [tool_use] to this model if Continue does not detect tool support. Agent/tool calls need a separate test; a successful chat does not prove every agent workflow works.

macOS/Linux terminal check:

curl --fail-with-body https://glm5.app/api/v1/models \
  -H "Authorization: Bearer $GLM5_API_KEY"

Windows PowerShell check (after setting the key privately in this terminal):

Invoke-RestMethod -Uri 'https://glm5.app/api/v1/models' `
  -Headers @{ Authorization = "Bearer $env:GLM5_API_KEY" }

Troubleshooting

SymptomNext check
401 invalid_api_keyCopy a full active GLM5 inference key, not the masked dashboard display. A revoked key must be replaced. Confirm the selected local configuration.
402Check API-eligible credits, not only total account credits. A web subscription/login is not an API credential.
404Check /api/v1 and the public model ID from /models; do not append a second /v1 or an endpoint path to apiBase.
No GLM5 request appears in ActivityCheck configuration loading, selected model, proxy and extension errors. This is a clue, not proof that the service received nothing: authentication failures can occur before request persistence.
Model-list works, but chat failsRead the inference error and request ID; discovery does not exercise model generation, credit settlement or streaming.
YAML errorUse spaces rather than tabs and keep one top-level models list.
Long document failsStart a fresh chat and add a small file first. Reduce history or split the document if the model rejects its context. Continue's client context budget is separate from the upstream model window; increasing it does not increase the model's capacity.

Do not disable TLS verification to work around a proxy or certificate problem. For support, provide the extension/version, OS, public model ID, error text and request ID if available. Redact keys and private document contents.

Configuration fields are documented in the Continue reference and OpenAI-compatible provider guide.

OpenAI SDK

Use the standard OpenAI client with the GLM 5 base URL:

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.GLM5_API_KEY,
  baseURL: 'https://glm5.app/api/v1',
});

const response = await client.chat.completions.create({
  model: 'glm-5.3-flash',
  messages: [{ role: 'user', content: 'Review this function for edge cases.' }],
  max_completion_tokens: 800,
});

console.log(response.choices[0]?.message?.content);

Common setup failures

SymptomCheck first
401 invalid_api_keyConfirm the key is a GLM 5 sk-glm5-... key and the base URL includes /api/v1.
404 model_not_foundCall GET /models and use one of the returned IDs.
402 payment_required or insufficient creditsCheck Billing and Limits; free trial and welcome credits are not API-eligible.
cURL works but the IDE failsConfirm the IDE did not keep its default provider endpoint and that it supports a custom OpenAI-compatible base URL.
Cursor Tab does not use GLM 5Expected: Tab autocomplete is a Cursor-built-in capability.

For the supported request fields, see Chat Completions. Do not rely on client-specific fields that are not documented there.

On this page