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:
| Platform | Profile 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:
| Message | Meaning | Action |
|---|---|---|
MCP startup incomplete (failed: linear) | Linear MCP needs OAuth again | Run codex mcp login linear, or disable Linear if unused |
Connection invalid from Ego Lite | Browser tool connection failed | Restart the browser tool or use a normal API/terminal request |
127.0.0.1:9222 ... connection refused | Chrome CDP is not listening | Skip browser automation or start Chrome with the required CDP setup |
Operation not permitted for localhost | Codex sandbox blocked local networking | Use an allowed network mode or do not use the local browser bridge |
401 invalid_api_key from glm5.app | GLM5 key was not supplied or is invalid | Check GLM5_API_KEY in the same shell that starts Codex |
402 from glm5.app | Account credits are insufficient | Add credits or use an account with API-eligible balance |
404 from glm5.app | Wrong endpoint/model or an old deployment | Use /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:
- Enable Use OpenAI API Key and paste your
sk-glm5-...key. - Enable Override OpenAI Base URL (when using key).
- Set the Base URL to
https://glm5.app/api/v1. - Add or select a model ID returned by
GET /models, such asglm-5.3orglm-5.3-flash. - 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
Continue is a VS Code extension with an explicit OpenAI-compatible provider
configuration. Add this to its config.yaml, replacing the key placeholder:
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>
roles:
- chat
- edit
- apply
Use a model ID returned by GET /models. After saving, begin with one short
chat request before using the client for edits or longer agent workflows.
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
| Symptom | Check first |
|---|---|
401 invalid_api_key | Confirm the key is a GLM 5 sk-glm5-... key and the base URL includes /api/v1. |
404 model_not_found | Call GET /models and use one of the returned IDs. |
402 payment_required or insufficient credits | Check Billing and Limits; free trial and welcome credits are not API-eligible. |
| cURL works but the IDE fails | Confirm 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 5 | Expected: 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.